Skip to content
This repository has been archived by the owner on Jun 27, 2020. It is now read-only.

Commit

Permalink
Updated page <title>s to reflect portal context. Fixes #380
Browse files Browse the repository at this point in the history
  • Loading branch information
seanaery committed Jun 22, 2016
1 parent f14cde3 commit 2a2563e
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 16 deletions.
3 changes: 3 additions & 0 deletions app/models/portal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ def initialize(args={})

private

def configured_title
I18n.t('ddr.public.portal.%{controller_name}.title', :default => I18n.t('blacklight.application_name'))
end

def item_or_collection_documents(local_ids)
local_ids ? documents(item_or_collection_documents_search(local_ids)) : []
Expand Down
2 changes: 1 addition & 1 deletion app/models/portal/digital_collections.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def item_count
end

def title
parent_collection_document.title
parent_collection_document ? parent_collection_document.title : configured_title
end

def abstract
Expand Down
4 changes: 4 additions & 0 deletions app/views/catalog/_search_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
<%= render 'collection_matches' %>

<%= render 'sort_and_per_page' %>

<% if @portal %>
<%= content_for :page_title, t('blacklight.search.page_title.title', :constraints => render_search_to_page_title(params), :application_name => @portal.title + ' - Duke Libraries -') %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/catalog/_show_default.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
<%= render partial: 'show_license_default', locals: { document: @document } %>
</div>


<%= render partial: 'related_items', locals: {document: @document} %>

<%= content_for :page_title, t('blacklight.search.show.title', :document_title => document_show_html_title, :application_name => document.collection.title + ' - Duke Libraries').html_safe %>
9 changes: 3 additions & 6 deletions app/views/digital_collections/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
<%= render 'home_showcase' %>
<% else %>
<% unless has_search_parameters? %>
<%= render partial: 'collection_submast', locals: { document: @portal.collection } %>
<!-- <h1><%# t("ddr.public.portal.#{params[:collection] || controller_name}.title") %></h1> -->
<%= render partial: 'collection_submast', locals: { document: @portal.collection } %>
<% end %>
<% end %>
</div>
Expand All @@ -34,10 +33,8 @@
<%= render 'home' %>

<%# set the html title for collection portal page -%>
<% if @portal.collection %>
<%= content_for :page_title, t("ddr.public.portal.#{params[:collection] || controller_name}.title", :default => @portal.title) + " - Duke Libraries" %>
<% else %>
<%= content_for :page_title, t("ddr.public.portal.#{params[:collection] || controller_name}.title", :default => t("blacklight.welcome")) %>
<% if @portal %>
<%= content_for :page_title, @portal.title + " - Duke Libraries" %>
<% end %>
<% else %>
<%= render 'search_results' %>
Expand Down
15 changes: 7 additions & 8 deletions app/views/digital_collections/index_portal.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,18 @@
<div id="content" class="col-md-9 col-sm-8">
<% unless has_search_parameters? %>

<%= render partial: "home_featured_collections"%>
<%= render partial: "home_featured_collections"%>

<h3 class="feature-head">Featured Items</h3>
<%= render partial: "home_highlights" %>
<h3 class="feature-head">Featured Items</h3>
<%= render partial: "home_highlights" %>

<%= render partial: "show_blog_posts" %>
<%= render partial: "show_blog_posts" %>

<%# set the html title for collection portal page -%>
<% if @portal.collection %>
<%= content_for :page_title, t("ddr.public.portal.#{params[:collection] || controller_name}.title", :default => @portal.title) + " - Duke Libraries" %>
<% else %>
<%= content_for :page_title, t("ddr.public.portal.#{params[:collection] || controller_name}.title", :default => t("blacklight.welcome")) %>
<% if @portal %>
<%= content_for :page_title, @portal.title + " - Duke Libraries" %>
<% end %>

<% else %>
<%= render 'search_results' %>
<% end %>
Expand Down

0 comments on commit 2a2563e

Please sign in to comment.