Skip to content

Commit

Permalink
Merge pull request #1 from scientist-softserv/views_and_specs
Browse files Browse the repository at this point in the history
add view and spec overrides
  • Loading branch information
orangewolf authored Sep 22, 2023
2 parents c22487a + b77aa8f commit b19d9ed
Show file tree
Hide file tree
Showing 150 changed files with 4,573 additions and 1 deletion.
36 changes: 36 additions & 0 deletions app/views/_controls.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<%# OVERRIDE: remove nav controls & add share-work button . hyrax VERSION 2.9.1 %>

<div class="mx-auto px-5 py-5 <%= controller_name == 'homepage' ? 'homepage-search-banner-wrapper' : 'search-form-banner-wrapper container' %> ">
<% if controller_name == 'homepage' && (display_content_block? @marketing_text).present? %>
<%= displayable_content_block @marketing_text, class: 'banner-text text-center' %>
<% end %>

<%# OVERRIDE here to remove the nav links from the controls/search bar%>
<%= render partial: 'catalog/search_form' %>
<%# BEGIN placement of SHARE YOUR WORK BUTTON %>
<% if controller_name == 'homepage' && @presenter.display_share_button?%>
<div class="home-share-work text-center mt-3">
<% if signed_in? %>
<% if @presenter.create_many_work_types? %>
<%= link_to '#',
class: "btn btn-primary",
data: { behavior: 'select-work', target: '#worktypes-to-create', 'create-type' => 'single' } do %>
<i class="glyphicon glyphicon-upload" aria-hidden="true"></i> <%= t('hyrax.share_button') %>
<% end %>
<% else # simple link to the first work type %>
<%= link_to new_polymorphic_path([main_app, @presenter.first_work_type]),
class: 'btn btn-primary' do %>
<i class="glyphicon glyphicon-upload" aria-hidden="true"></i> <%= t('hyrax.share_button') %>
<% end %>
<% end %>
<% else %>
<%= link_to hyrax.my_works_path,
class: "btn btn-primary" do %>
<i class="glyphicon glyphicon-upload" aria-hidden="true"></i> <%= t('hyrax.share_button') %>
<% end %>
<% end %>
</div>
<% end %>
<%= render '/shared/select_work_type_modal', create_work_presenter: @presenter.create_work_presenter if controller_name == 'homepage' && @presenter.draw_select_work_modal?%>
<%# END placement of SHARE YOUR WORK BUTTON %>
</div>
22 changes: 22 additions & 0 deletions app/views/_masthead.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<nav id="masthead" class="navbar navbar-inverse navbar-static-top" role="navigation" aria-label="masthead">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#top-navbar-collapse" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<%= render '/logo' %>
</div>

<div class="collapse navbar-collapse" id="top-navbar-collapse">
<% if admin_host? %>
<%= render '/admin_util_links' %>
<% else %>
<%= render '/user_util_links' %>
<% end %>
</div>
</div>
</nav>
23 changes: 23 additions & 0 deletions app/views/hyrax/exam_papers/_attribute_rows.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<% DogBiscuits.config.send("#{presenter.model_name.singular}_properties").each do | prop |
# skip title, description and license
next if [:title, :description, :license].include? prop

prop = "#{prop}_label".to_sym if presenter.model_name.to_s.constantize.controlled_properties.include? prop

if DogBiscuits.config.property_mappings[prop]
if DogBiscuits.config.property_mappings[prop][:render_as]
render = DogBiscuits.config.property_mappings[prop][:render_as]
elsif DogBiscuits.config.facet_properties.include? prop
render = 'faceted'
else
render = nil
end
end %>
<%= presenter.attribute_to_html(prop,
label: I18n.t("dog_biscuits.fields.#{prop.to_s}"),
render_as: render,
html_dl: true)
%>
<% end %>
<%= presenter.attribute_to_html(:description) %>

2 changes: 2 additions & 0 deletions app/views/hyrax/exam_papers/_exam_paper.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<%# This is a search result view %>
<%= render 'catalog/document', document: exam_paper, document_counter: exam_paper_counter %>
39 changes: 39 additions & 0 deletions app/views/hyrax/homepage/_home_content.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<%# Override from hyrax 2.9.5 to add a feature flag for featured researcher %>

<div class="col-xs-12 col-sm-6">
<ul id="homeTabs" class="nav nav-pills">
<li class="active"><a href="#featured_container" data-toggle="tab" role="tab" id="featureTab"><%= t('hyrax.homepage.featured_works.tab_label') %></a></li>
<li><a href="#recently_uploaded" data-toggle="tab" role="tab" id="recentTab"><%= t('hyrax.homepage.recently_uploaded.tab_label') %></a></li>
</ul>
<div class="tab-content">
<div class="tab-pane fade in active" id="featured_container" role="tabpanel" aria-labelledby="featureTab">
<%= render 'featured_works' %>
</div>
<div class="tab-pane fade" id="recently_uploaded" role="tabpanel" aria-labelledby="recentTab">
<%= render 'recently_uploaded', recent_documents: @recent_documents %>
</div>
</div>
</div><!-- /.col-xs-6 -->

<div class="col-xs-12 col-sm-6">
<ul class="nav nav-pills" role="tablist">
<li class="active"><a aria-expanded="true" href="#tab-col2-first" role="tab" data-toggle="tab"><%= t('hyrax.homepage.admin_sets.title') %></a></li>
<%# add check for featured researcher %>
<% if @presenter.display_featured_researcher? %>
<li class=""><a aria-expanded="false" href="#tab-col2-second" role="tab" data-toggle="tab"><%= t('hyrax.homepage.featured_researcher.tab_label') %></a></li>
<% end %>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab-col2-first">
<h2 class="sr-only"><%= t('hyrax.homepage.admin_sets.title') %></h2>
<%= render 'explore_collections', collections: @presenter.collections %>
</div>
<%# add check for featured researcher %>
<% if @presenter.display_featured_researcher? %>
<div class="tab-pane" id="tab-col2-second">
<h2 class="sr-only"><%= t('hyrax.homepage.featured_researcher.title') %></h2>
<%= render 'featured_researcher' %>
</div>
<% end %>
</div>
</div>
17 changes: 17 additions & 0 deletions app/views/hyrax/homepage/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<%# OVERRIDE HYRAX VERSION 2.9.1 %>

<% provide :page_title, application_name %>

<%# OVERRIDE remove share work button and add custom partials %>

<div class="home-content">
<%= render '/adl/about_section' %>
<%# this conditional hides featured collections in non-adl tenants. fill in your tenant's name, and switch the comments on the following 2 lines to see this section in the development environment %>
<%# if current_account.name == "<YOUR TENANT NAME HERE>" %>
<% if current_account.name == "adl" %>
<%= render '/adl/featured_collections' %>
<% end %>
<%= render '/adl/featured_works' %>
</div>

<%= render '/shared/select_work_type_modal', create_work_presenter: @presenter.create_work_presenter if @presenter.draw_select_work_modal? %>
23 changes: 23 additions & 0 deletions app/views/hyrax/journal_articles/_attribute_rows.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<% DogBiscuits.config.send("#{presenter.model_name.singular}_properties").each do | prop |
# skip title, description and license
next if [:title, :description, :license, :abstract].include? prop

prop = "#{prop}_label".to_sym if presenter.model_name.to_s.constantize.controlled_properties.include? prop

if DogBiscuits.config.property_mappings[prop]
if DogBiscuits.config.property_mappings[prop][:render_as]
render = DogBiscuits.config.property_mappings[prop][:render_as]
elsif DogBiscuits.config.facet_properties.include? prop
render = 'faceted'
else
render = nil
end
end %>
<%= presenter.attribute_to_html(prop,
label: prop.to_s == 'part_of' ? 'Periodical' : I18n.t("dog_biscuits.fields.#{prop.to_s}"),
render_as: render,
html_dl: true)
%>
<% end %>
<%= presenter.attribute_to_html(:abstract) %>

26 changes: 26 additions & 0 deletions app/views/hyrax/journal_articles/_form_metadata.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<div class="base-terms">
<% f.object.primary_terms.each do |term| %>
<%= render_edit_field_partial(term, f: f) %>
<% end %>
</div>
<% if f.object.display_additional_fields? %>
<%= link_to t('hyrax.works.form.additional_fields'),
'#extended-terms',
class: 'btn btn-default additional-fields',
data: { toggle: 'collapse' },
role: "button",
'aria-expanded'=> "false",
'aria-controls'=> "extended-terms" %>
<div id="extended-terms" class='collapse'>
<%= render 'form_media', f: f %>
<% f.object.secondary_terms.each do |term| %>
<%# OVERRIDE of app/views/hyrax/base/_form_metadata.html.erb for JournalArticle
so that the "Part of" label shows "Periodical" instead %>
<% if (f.object.multiple? term) && term == :part_of %>
<%= f.input term, label: 'Periodical', as: :multi_value, input_html: { class: 'form-control' }, required: f.object.required?(term) %>
<% else %>
<%= render_edit_field_partial(term, f: f) %>
<% end %>
<% end %>
</div>
<% end %>
2 changes: 2 additions & 0 deletions app/views/hyrax/journal_articles/_journal_article.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<%# This is a search result view %>
<%= render 'catalog/document', document: journal_article, document_counter: journal_article_counter %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<% # use date picker %>

<% if f.object.class.multiple? key %>
<%= f.input key, as: :multi_value, input_html: { data: { provide: 'datepicker', 'date-force-parse': 'false', 'date-autoclose': 'true' } }, required: f.object.required?(key) %>
<% else %>
<%= f.input key, input_html: { value: f.object.model[key].first, data: { provide: 'datepicker', 'date-force-parse': 'false', 'date-autoclose': 'true' } }, required: f.object.required?(key) %>
<% end %>
23 changes: 23 additions & 0 deletions app/views/hyrax/published_works/_attribute_rows.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<% DogBiscuits.config.send("#{presenter.model_name.singular}_properties").each do | prop |
# skip title, description and license
next if [:title, :description, :license, :abstract].include? prop

prop = "#{prop}_label".to_sym if presenter.model_name.to_s.constantize.controlled_properties.include? prop

if DogBiscuits.config.property_mappings[prop]
if DogBiscuits.config.property_mappings[prop][:render_as]
render = DogBiscuits.config.property_mappings[prop][:render_as]
elsif DogBiscuits.config.facet_properties.include? prop
render = 'faceted'
else
render = nil
end
end %>
<%= presenter.attribute_to_html(prop,
label: I18n.t("dog_biscuits.fields.#{prop.to_s}"),
render_as: render,
html_dl: true)
%>
<% end %>
<%= presenter.attribute_to_html(:abstract) %>

2 changes: 2 additions & 0 deletions app/views/hyrax/published_works/_published_work.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<%# This is a search result view %>
<%= render 'catalog/document', document: published_work, document_counter: published_work_counter %>
22 changes: 22 additions & 0 deletions app/views/hyrax/theses/_attribute_rows.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<% DogBiscuits.config.send("#{presenter.model_name.singular}_properties").each do | prop |
# skip title, description and license
next if [:title, :description, :license, :abstract].include? prop

prop = "#{prop}_label".to_sym if presenter.model_name.to_s.constantize.controlled_properties.include? prop

if DogBiscuits.config.property_mappings[prop]
if DogBiscuits.config.property_mappings[prop][:render_as]
render = DogBiscuits.config.property_mappings[prop][:render_as]
elsif DogBiscuits.config.facet_properties.include? prop
render = 'faceted'
else
render = nil
end
end %>
<%= presenter.attribute_to_html(prop,
label: I18n.t("dog_biscuits.fields.#{prop.to_s}"),
render_as: render,
html_dl: true)
%>
<% end %>
<%= presenter.attribute_to_html(:abstract) %>
2 changes: 2 additions & 0 deletions app/views/hyrax/theses/_thesis.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<%# This is a search result view %>
<%= render 'catalog/document', document: thesis, document_counter: thesis_counter %>
7 changes: 7 additions & 0 deletions app/views/journal_articles/edit_fields/_date_created.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<% # use date picker %>

<% if f.object.class.multiple? key %>
<%= f.input key, as: :multi_value, input_html: { data: { provide: 'datepicker', 'date-force-parse': 'false', 'date-autoclose': 'true' } }, required: f.object.required?(key) %>
<% else %>
<%= f.input key, input_html: { value: f.object.model[key].first, data: { provide: 'datepicker', 'date-force-parse': 'false', 'date-autoclose': 'true' } }, required: f.object.required?(key) %>
<% end %>
6 changes: 6 additions & 0 deletions app/views/journal_articles/edit_fields/_default.html.temp.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<% # the hyrax version of this file messes singular field display %>
<% if f.object.class.multiple? key %>
<%= f.input key, as: :multi_value, input_html: { class: 'form-control' }, required: f.object.required?(key) %>
<% else %>
<%= f.input key, required: f.object.required?(key), input_html: { value: f.object.model[key].first } %>
<% end %>
14 changes: 14 additions & 0 deletions app/views/layouts/layouts/application.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<title>Adventist Digital Libraray</title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
</head>
<body>

<%= yield %>

</body>
</html>
8 changes: 8 additions & 0 deletions app/views/layouts/layouts/homepage.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<%# OVERRIDE HYRAX VERSION 2.9.1 - add share your work button & change inline bootstrap styles%>
<% content_for(:navbar) do %>
<div class="image-masthead custom-masthead" style="background-image: url('<%= banner_image %>')">
<%= render '/controls' %>
</div>
<% end %>
<%= render template: 'layouts/hyrax' %>

54 changes: 54 additions & 0 deletions app/views/layouts/layouts/hyrax.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<!-- add body classes to make styling easier -->
<!DOCTYPE html>
<html lang="<%= I18n.locale.to_s %>" prefix="og:http://ogp.me/ns#">
<head>
<%= render partial: 'layouts/head_tag_content' %>
<%= content_for(:head) %>

<link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
</head>
<% content_for(:extra_body_classes, 'public-facing') unless params[:controller].match(/^proprietor/) %>

<body class="<%= body_class %>">
<div class="skip-to-content">
<%= link_to "Skip to Content", "#skip-to-content" %>
</div>
<%= render 'hyrax/homepage/announcement' if controller_name == 'homepage' %>
<%= render '/masthead' %>
<%= content_for(:navbar) %>
<%= content_for(:precontainer_content) %>
<div id="content-wrapper" class="container" role="main">
<%= render '/flash_msg' %>
<%= render_breadcrumbs builder: Hyrax::BootstrapBreadcrumbsBuilder %>
<% if content_for?(:page_header) %>
<div class="row">
<div class="col-xs-12 main-header">
<%= yield(:page_header) %>
</div>
</div>
<% end %>

<a name="skip-to-content" id="skip-to-content"></a>
<%= content_for?(:content) ? yield(:content) : yield %>

</div><!-- /#content-wrapper -->
<%= render partial: 'shared/footer' %>
<%= render 'shared/ajax_modal' %>
</body>
</html>
1 change: 1 addition & 0 deletions app/views/layouts/layouts/proprietor.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= render template: 'layouts/hyrax' %>
5 changes: 5 additions & 0 deletions app/views/records/edit_fields/_abstract.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<% if f.object.multiple? key %>
<%= f.input :abstract, as: :multi_value, input_html: { rows: '14', type: 'textarea'}, required: f.object.required?(key) %>
<% else %>
<%= f.input :abstract, as: :text, input_html: { rows: '14' }, required: f.object.required?(key) %>
<% end %>
7 changes: 7 additions & 0 deletions app/views/records/edit_fields/_date_accepted.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<% # use date picker %>

<% if f.object.class.multiple? key %>
<%= f.input key, as: :multi_value, input_html: { data: { provide: 'datepicker', 'date-force-parse': 'false', 'date-autoclose': 'true' } }, required: f.object.required?(key) %>
<% else %>
<%= f.input key, input_html: { value: f.object.model[key].first, data: { provide: 'datepicker', 'date-force-parse': 'false', 'date-autoclose': 'true' } }, required: f.object.required?(key) %>
<% end %>
7 changes: 7 additions & 0 deletions app/views/records/edit_fields/_date_available.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<% # use date picker %>

<% if f.object.class.multiple? key %>
<%= f.input key, as: :multi_value, input_html: { data: { provide: 'datepicker', 'date-force-parse': 'false', 'date-autoclose': 'true' } }, required: f.object.required?(key) %>
<% else %>
<%= f.input key, input_html: { value: f.object.model[key].first, data: { provide: 'datepicker', 'date-force-parse': 'false', 'date-autoclose': 'true' } }, required: f.object.required?(key) %>
<% end %>
7 changes: 7 additions & 0 deletions app/views/records/edit_fields/_date_collected.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<% # use date picker %>

<% if f.object.class.multiple? key %>
<%= f.input key, as: :multi_value, input_html: { data: { provide: 'datepicker', 'date-force-parse': 'false', 'date-autoclose': 'true' } }, required: f.object.required?(key) %>
<% else %>
<%= f.input key, input_html: { value: f.object.model[key].first, data: { provide: 'datepicker', 'date-force-parse': 'false', 'date-autoclose': 'true' } }, required: f.object.required?(key) %>
<% end %>
Loading

0 comments on commit b19d9ed

Please sign in to comment.