Skip to content
This repository has been archived by the owner on Dec 6, 2018. It is now read-only.

Commit

Permalink
Merge pull request #5 from ualbertalib/master
Browse files Browse the repository at this point in the history
Modify brief record title to use Wayback URL. Closes #3
  • Loading branch information
redlibrarian committed Jun 7, 2016
2 parents 1206c8f + 6a814e3 commit 0319fd5
Show file tree
Hide file tree
Showing 62 changed files with 1,029 additions and 324 deletions.
22 changes: 22 additions & 0 deletions app/views/catalog/_bookmark_control.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<% if current_or_guest_user %>
<%-
# Note these two forms are pretty similar but for different :methods, classes, and labels.
# but it was simpler to leave them seperate instead of DRYing them, got confusing trying that.
# the data-doc-id attribute is used by our JS that converts to a checkbox/label.
-%>
<% unless bookmarked? document %>
<%= form_tag( bookmark_path( document ), :method => :put, :class => "bookmark_toggle", "data-doc-id" => document.id, :'data-present' => t('blacklight.search.bookmarks.present'), :'data-absent' => t('blacklight.search.bookmarks.absent'), :'data-inprogress' => t('blacklight.search.bookmarks.inprogress')) do %>
<%= submit_tag(t('blacklight.bookmarks.add.button'), :id => "bookmark_toggle_#{document.id.to_s.parameterize}", :class => "bookmark_add") %>
<% end %>
<% else %>
<%= form_tag( bookmark_path( document ), :method => :delete, :class => "bookmark_toggle", "data-doc-id" => document.id, :'data-present' => t('blacklight.search.bookmarks.present'), :'data-absent' => t('blacklight.search.bookmarks.absent'), :'data-inprogress' => t('blacklight.search.bookmarks.inprogress')) do %>
<%= submit_tag(t('blacklight.bookmarks.remove.button'), :id => "bookmark_toggle_#{document.id.to_s.parameterize}", :class => "bookmark_remove") %>
<% end %>
<% end %>
<% else %>
&nbsp;
<% end %>
21 changes: 21 additions & 0 deletions app/views/catalog/_citation.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<% @documents.each do |document| %>

<h3 class="modal-title"><%= document_heading(document) %></h3>

<% if document.respond_to?(:export_as_mla_citation_txt) %>
<h4><%= t('blacklight.citation.mla') %></h4>
<%= document.send(:export_as_mla_citation_txt).html_safe %><br/><br/>
<% end %>
<% if document.respond_to?(:export_as_apa_citation_txt) %>
<h4><%= t('blacklight.citation.apa') %></h4>
<%= document.send(:export_as_apa_citation_txt).html_safe %><br/><br/>
<% end %>
<%- if document.respond_to?(:export_as_chicago_citation_txt) -%>
<h4><%= t('blacklight.citation.chicago') %></h4>
<%= document.send(:export_as_chicago_citation_txt).html_safe %>
<%- end -%>
<% end %>
10 changes: 10 additions & 0 deletions app/views/catalog/_constraints.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<% if query_has_constraints? %>

<div id="appliedParams" class="clearfix constraints-container">
<div class="pull-right">
<%=link_to t('blacklight.search.start_over'), start_over_path, :class => "catalog_startOverLink btn btn-sm btn-text", :id=>"startOverLink" %>
</div>
<span class="constraints-label"><%= t('blacklight.search.filters.title') %></span>
<%= render_constraints(params) %>
</div>
<% end %>
33 changes: 33 additions & 0 deletions app/views/catalog/_constraints_element.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<% # local params:
# label
# value
# options =>
# :remove => url for a remove constraint link
# :classes => array of classes to add to container span
options ||= {}
%>

<span class="btn-group appliedFilter constraint <%= options[:classes].join(" ") if options[:classes] %>">
<span class="constraint-value btn btn-sm btn-default btn-disabled">
<% unless label.blank? %>
<span class="filterName"><%= label %></span>
<% end %>
<% unless value.blank? %>
<%= content_tag :span, value, class: 'filterValue', title: value %>
<% end %>
</span>
<% unless options[:remove].blank? %>
<% accessible_remove_label = content_tag :span, class: 'sr-only' do
if label.blank?
t('blacklight.search.filters.remove.value', value: value)
else
t('blacklight.search.filters.remove.label_value', label: label, value: value)
end
end
%>
<%= link_to(content_tag(:span, '', class: 'glyphicon glyphicon-remove') + accessible_remove_label,
options[:remove], class: 'btn btn-default btn-sm remove dropdown-toggle'
) %>
<%- end -%>
</span>
5 changes: 5 additions & 0 deletions app/views/catalog/_did_you_mean.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<% if should_show_spellcheck_suggestions? @response %>
<div id="spell">
<h4 class="suggest"><em><%= t('blacklight.did_you_mean', :options => safe_join(@response.spelling.words.map { |word| link_to_query(word) }, " #{t('blacklight.or')} ")).html_safe %></em></h4>
</div>
<% end %>
4 changes: 4 additions & 0 deletions app/views/catalog/_document.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<% # container for a single doc -%>
<div class="document <%= render_document_class document %>" itemscope itemtype="<%= document.itemtype %>">
<%= render_document_partials document, blacklight_config.view_config(document_index_view_type).partials, :document_counter => document_counter %>
</div>
4 changes: 4 additions & 0 deletions app/views/catalog/_document_action.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<%= link_to document_action_label(document_action_config.key, document_action_config),
document_action_path(document_action_config, (local_assigns.has_key?(:url_opts) ? url_opts : {}).merge(({id: document} if document) || {})),
id: document_action_config.fetch(:id, "#{document_action_config.key}Link"),
data: {}.merge(({ajax_modal: "trigger"} if document_action_config.modal != false) || {}) %>
56 changes: 56 additions & 0 deletions app/views/catalog/_document_default.atom.builder
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
xml.entry do


xml.title document.to_semantic_values[:title][0] || presenter(document).render_document_index_label(document_show_link_field(document))

# updated is required, for now we'll just set it to now, sorry
xml.updated Time.now.strftime("%Y-%m-%dT%H:%M:%SZ")

xml.link "rel" => "alternate", "type" => "text/html", "href" => polymorphic_url(url_for_document(document))
# add other doc-specific formats, atom only lets us have one per
# content type, so the first one in the list wins.
xml << render_link_rel_alternates(document, :unique => true)

xml.id polymorphic_url(url_for_document(document))


if document.to_semantic_values.key? :author
xml.author { xml.name(document.to_semantic_values[:author].first) }
end

with_format("html") do
xml.summary "type" => "html" do
xml.text! render_document_partial(document,
:index,
:document_counter => document_counter)
end
end

#If they asked for a format, give it to them.
if (params["content_format"] &&
document.export_formats[params["content_format"].to_sym])

type = document.export_formats[params["content_format"].to_sym][:content_type]

xml.content :type => type do |content_element|
data = document.export_as(params["content_format"])

# encode properly. See:
# http://tools.ietf.org/html/rfc4287#section-4.1.3.3
type = type.downcase
if (type.downcase =~ /\+|\/xml$/)
# xml, just put it right in
content_element << data
elsif (type.downcase =~ /text\//)
# text, escape
content_element.text! data
else
#something else, base64 encode it
content_element << Base64.encode64(data)
end
end

end


end
5 changes: 5 additions & 0 deletions app/views/catalog/_document_default.rss.builder
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
xml.item do
xml.title(presenter(document).render_document_index_label(document_show_link_field(document)) || (document.to_semantic_values[:title].first if document.to_semantic_values.key?(:title)))
xml.link(polymorphic_url(url_for_document(document)))
xml.author( document.to_semantic_values[:author].first ) if document.to_semantic_values.key? :author
end
4 changes: 4 additions & 0 deletions app/views/catalog/_document_list.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<% # container for all documents in index list view -%>
<div id="documents" class="documents-<%= document_index_view_type %>">
<%= render documents, :as => :document %>
</div>
36 changes: 36 additions & 0 deletions app/views/catalog/_email_form.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<%= form_tag url_for(:controller => controller_name, :action => "email"), :id => 'email_form', :class => "form-horizontal ajax_form", :method => :post do %>

<div class="modal-body">
<%= render :partial=>'/flash_msg' %>
<div class="form-group">
<label class="control-label col-sm-2" for="to">
<%= t('blacklight.email.form.to') %>
</label>
<div class="col-sm-10">
<%= email_field_tag :to, params[:to], class: 'form-control' %>
</div>
</div>

<div class="form-group">
<label class="control-label col-sm-2" for="message">
<%= t('blacklight.email.form.message') %>
</label>
<div class="col-sm-10">
<%= text_area_tag :message, params[:message], class: 'form-control' %>
</div>
</div>

<% @documents.each do |doc| %>
<%=hidden_field_tag "id[]", doc.id %>
<% end %>
<%- if params[:sort] -%>
<%= hidden_field_tag "sort", params[:sort] %>
<%- end -%>
<%- if params[:per_page] -%>
<%= hidden_field_tag "per_page", params[:per_page] %>
<%- end -%>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary"> <%= t('blacklight.sms.form.submit') %></button>
</div>
<% end %>
13 changes: 13 additions & 0 deletions app/views/catalog/_facet_layout.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<div class="panel panel-default facet_limit blacklight-<%= facet_field.key.parameterize %> <%= 'facet_limit-active' if facet_field_in_params?(facet_field.key) %>">
<div class="<%= "collapsed" if should_collapse_facet?(facet_field) %> collapse-toggle panel-heading" data-toggle="collapse" data-target="#<%= facet_field_id(facet_field) %>">
<h5 class="panel-title facet-field-heading">

<%= link_to facet_field_label(facet_field.key), "#", :"data-no-turbolink" => true %>
</h5>
</div>
<div id="<%= facet_field_id(facet_field) %>" class="panel-collapse facet-content <%= should_collapse_facet?(facet_field) ? 'collapse' : 'in' %>">
<div class="panel-body">
<%= yield %>
</div>
</div>
</div>
11 changes: 11 additions & 0 deletions app/views/catalog/_facet_limit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<ul class="facet-values list-unstyled">
<% paginator = facet_paginator(facet_field, display_facet) %>
<%= render_facet_limit_list paginator, field_name %>
<% unless paginator.last_page? || params[:action] == "facet" %>
<li class="more_facets_link">
<%= link_to t("more_#{field_name}_html", scope: 'blacklight.search.facets', default: :more_html, field_name: facet_field.label),
search_facet_url(id: field_name), class: "more_facets_link" %>
</li>
<% end %>
</ul>
21 changes: 21 additions & 0 deletions app/views/catalog/_facet_pagination.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<div class="prev_next_links btn-group pull-left">
<%= link_to_previous_page @pagination, raw(t('views.pagination.previous')), :params => params, :param_name => blacklight_config.facet_paginator_class.request_keys[:page], :class => 'btn btn-link', :data => {:ajax_modal => "preserve"} do %>
<span class="disabled btn btn-disabled"><%= raw(t('views.pagination.previous')) %></span>
<% end %>
<%= link_to_next_page @pagination, raw(t('views.pagination.next')), :params => params, :param_name => blacklight_config.facet_paginator_class.request_keys[:page], :class => 'btn btn-link', :data => {:ajax_modal => "preserve"} do %>

<span class="disabled btn btn-disabled"><%= raw(t('views.pagination.next')) %></span>
<% end %>

</div>

<div class="sort_options btn-group pull-right">
<% if @pagination.sort == 'index' -%>
<span class="active az btn btn-default"><%= t('blacklight.search.facets.sort.index') %></span><%= link_to_unless(@pagination.sort == 'count', t('blacklight.search.facets.sort.count'),
@pagination.params_for_resort_url('count', params), :class => "sort_change numeric btn btn-default",
:data => {:ajax_modal => "preserve"}) %>
<% elsif @pagination.sort == 'count' -%>
<%= link_to(t('blacklight.search.facets.sort.index'), @pagination.params_for_resort_url('index', params),
:class => "sort_change az btn btn-default", :data => {:ajax_modal => "preserve"}) %><span class="active numeric btn btn-default"><%= t('blacklight.search.facets.sort.count') %></span>
<% end -%>
</div>
18 changes: 18 additions & 0 deletions app/views/catalog/_facet_pivot.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<ul class="pivot-facet list-unstyled">
<% display_facet.items.each do |item| -%>
<li>
<span class="facet-values">
<% if facet_in_params?(field_name, item) %>
<%= render_selected_facet_value(field_name, item) %>
<% else %>
<%= render_facet_value(field_name, item) %>
<% end -%>
</span>

<% unless item.items.blank? %>
<%= render partial: 'facet_pivot', locals: { display_facet: item, field_name: field_name, solr_field: field_name } %>
<% end %>
</li>
<% end %>

</ul>
23 changes: 23 additions & 0 deletions app/views/catalog/_facets.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<% # main container for facets/limits menu -%>
<% if has_facet_values? %>
<div id="facets" class="facets sidenav">
<div class="top-panel-heading panel-heading">
<button type="button" class="facets-toggle" data-toggle="collapse" data-target="#facet-panel-collapse">
<span class="sr-only">Toggle facets</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<h4 class='facets-heading'>
<%= t('blacklight.search.facets.title') %>
</h4>
</div>
<div id="facet-panel-collapse" class="collapse panel-group">
<%= render_facet_partials %>
</div>
</div>
<% end %>
12 changes: 12 additions & 0 deletions app/views/catalog/_group_default.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<% # container for all groups in index view -%>
<div id="groups">
<%- @response.groups.each do |g| %>
<h3 class="group-key"><%= g.key %></h3>
<div class="grouped-documents">
<%= render_document_index g.docs %>
</div>
<%- if g.total > @response.group_limit %>
<%= link_to t('blacklight.search.group.more'), add_group_facet_params_and_redirect(g), :class => 'more-in-group' %>
<%- end %>
<%- end %>
</div>
2 changes: 2 additions & 0 deletions app/views/catalog/_home.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<% #Search form can be added here, defaulted to the navbar for Bootstrap version -%>
<%= render :partial=>'home_text' %>
49 changes: 49 additions & 0 deletions app/views/catalog/_home_text.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<div class="page-header row">
<h1 class="col-md-8 page-heading"><%= t('blacklight.welcome') %></h1>

<ul class="nav nav-pills col-md-4">
<li><a href="https://github.com/projectblacklight/blacklight/">Github</a></li>
<li><a href="https://github.com/projectblacklight/blacklight/wiki">Wiki</a></li>
<li><a href="https://github.com/projectblacklight/blacklight/releases/tag/v<%= Blacklight::VERSION %>">Release Notes</a></li>
</ul>


</div>

<div id="getting-started">
<h2 class='section-heading'>Here&rsquo;s how to get started:</h2>

<ol>
<li>To modify this text, you need to <a href="http://guides.rubyonrails.org/engines.html#improving-engine-functionality">override the Blacklight-provided view</a>.
You can copy this file, located in the blacklight gem: <br />
<%= Blacklight.root %>/app/views/catalog/_home_text.html.erb <br />
to your own application: <br />
<%= Rails.root %>/app/views/catalog/_home_text.html.erb
</li>
<li><a href="https://github.com/projectblacklight/blacklight/wiki/Indexing-your-data-into-solr">Index your own data</a> into Solr</li>
<li><a href="https://github.com/projectblacklight/blacklight/wiki#blacklight-configuration">Configure Blacklight</a> to match your data and user-experience needs</li>
<li><a href="https://github.com/projectblacklight/blacklight/wiki#support">Get in touch</a> with your comments, questions, and ideas</li>
</ol>
</div>

<%# This is the same panel shown in the Rails welcome template %>
<div id="about">
<h3 class='section-heading'><a href="/rails/info/properties">About your application&rsquo;s environment</a></h3>
<div id="about-content" class="well" style="display: none"></div>
</div>

<script>
$(function() {
$('#about a').on('click', function(e) {
e.preventDefault();

if ($('#about-content').html() == "") {
$('#about-content').load($(this).attr("href"), function() {
$('#about-content').show();
});
} else {
$('#about-content').toggle();
}
});
});
</script>
11 changes: 11 additions & 0 deletions app/views/catalog/_index_default.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<%# default partial to display solr document fields in catalog index view -%>
<dl class="document-metadata dl-horizontal dl-invert">

<% index_fields(document).each do |field_name, field| -%>
<% if should_render_index_field? document, field %>
<dt class="blacklight-<%= field_name.parameterize %>"><%= render_index_field_label document, field: field_name %></dt>
<dd class="blacklight-<%= field_name.parameterize %>"><%= render_index_field_value document, field: field_name %></dd>
<% end -%>
<% end -%>

</dl>
Loading

0 comments on commit 0319fd5

Please sign in to comment.