-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating modals and fixing facet features #428
- Loading branch information
Showing
23 changed files
with
132 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
app/views/collections/_button_for_creating_empty_collection.html.erb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
<% if @response.response[:numFound] <= spell_check_max and @response.spelling.words.size > 0 %> | ||
<% if should_show_spellcheck_suggestions? @response %> | ||
<div id="spell"> | ||
<h4 class="suggest"><i>Did you mean to type | ||
<% @response.spelling.words.each_with_index do |word,index| -%> | ||
<% if index > 0 -%>, or <% end -%> | ||
<%= link_to_query(word) -%> | ||
<% end -%> | ||
?</i></h4> | ||
<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 %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<% # container for all documents in index view -%> | ||
<div id="documents" class="clear"> | ||
<div id="documents"> | ||
<%= render partial: 'my/_index_partials/default_group', locals: {docs: @response.docs.map { |x| SolrDocument.new(x) }, facet_value: nil} %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
<li class="expandable_new grey"> | ||
<% id = facet_field.label.gsub(" ","_")+"_db" %> | ||
|
||
<a class="accordion-toggle grey" data-toggle="collapse" data-parent="#facet_group" data-target="#collapse_<%= id%>"> | ||
<%= facet_field.label %> <i class="glyphicon glyphicon-chevron-right grey"></i> | ||
</a> | ||
|
||
<div id="collapse_<%= id%>" class="accordion-body collapse"> | ||
<div class="panel panel-default facet_limit blacklight-<%= facet_field.field.parameterize %> <%= 'facet_limit-active' if facet_field_in_params?(facet_field.field) %>"> | ||
<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"> | ||
<%= link_to facet_field_label(facet_field.field), "#", :"data-no-turbolink" => true %> | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
mjgiarlo
Member
|
||
</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> | ||
</li> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
<% paginator = Blacklight::Solr::FacetPaginator.new(display_facet.items, | ||
limit: facet_limit_for(solr_field)) %> | ||
<ul class="slide-list"> | ||
<ul class="facet-values list-unstyled"> | ||
<% paginator = facet_paginator(facet_field, display_facet) %> | ||
<% paginator.items.each do |item| -%> | ||
<li> | ||
<% if facet_in_params?( solr_field, item.value ) %> | ||
<%= render_selected_facet_value(solr_field, item) %> | ||
<% else %> | ||
<%= render_facet_value(solr_field, item) %> | ||
<li> | ||
<% if facet_in_params?(solr_field, item.value) %> | ||
<%= render_selected_facet_value(solr_field, item) %> | ||
<% else %> | ||
<%= render_facet_value(solr_field, item) %> | ||
<% end -%> | ||
</li> | ||
<% end %> | ||
<% if(paginator.has_next?) %> | ||
<li class="more_facets_link"><%= link_to 'more ' + facet_field.label.pluralize + '»', sufia.url_for(params.merge(id: solr_field, action: "facet", path_only: true)), class: "more_facets_link" %></li> | ||
<% end %> | ||
</ul> <!-- /slide-list --> | ||
|
||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,22 @@ | ||
<!-- This was copied from https://github.com/projectblacklight/blacklight/blob/master/app/views/catalog/_facet_pagination.html.erb | ||
It implements the facets in the same manner as blacklight does for the main catalog for the individual's dashbord | ||
--> | ||
<div class="prev_next_links btn-group pull-left"> | ||
<%= link_to_previous_page @pagination, raw(t('views.pagination.previous')), route_set: sufia, params: params, param_name: Blacklight::Solr::FacetPaginator.request_keys[:page], class: 'btn' do %> | ||
<span class="disabled btn"><%= raw(t('views.pagination.previous')) %></span> | ||
<%= link_to_previous_page @pagination, raw(t('views.pagination.previous')), route_set: sufia, params: params, param_name: Blacklight::Solr::FacetPaginator.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')), route_set: sufia, params: params, param_name: Blacklight::Solr::FacetPaginator.request_keys[:page], class: 'btn' do %> | ||
|
||
<span class="disabled btn"><%= raw(t('views.pagination.next')) %></span> | ||
<%= link_to_next_page @pagination, raw(t('views.pagination.next')), route_set: sufia, params: params, param_name: Blacklight::Solr::FacetPaginator.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"><%= t('blacklight.search.facets.sort.index') %></span><%= link_to_unless(@pagination.sort == 'count', t('blacklight.search.facets.sort.count'), | ||
Sufia::Engine.routes.url_for(@pagination.params_for_resort_url('count', params).symbolize_keys.merge(only_path: true)), | ||
class: "sort_change numeric btn") %> | ||
<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'), | ||
Sufia::Engine.routes.url_for(@pagination.params_for_resort_url('count', params).symbolize_keys.merge(only_path: true)), | ||
class: "sort_change numeric btn btn-default", | ||
data: {ajax_modal: "preserve"}) %> | ||
<% elsif @pagination.sort == 'count' -%> | ||
<%= link_to(t('blacklight.search.facets.sort.index'), | ||
Sufia::Engine.routes.url_for(@pagination.params_for_resort_url('index', params).symbolize_keys.merge(only_path: true)), | ||
class: "sort_change az btn") %><span class="active numeric btn"><%= t('blacklight.search.facets.sort.count') %></span> | ||
<% end -%> | ||
<%= link_to(t('blacklight.search.facets.sort.index'), Sufia::Engine.routes.url_for(@pagination.params_for_resort_url('index', params).symbolize_keys.merge(only_path: true)), | ||
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,22 @@ | ||
<% # main container for facets/limits menu -%> | ||
<div> | ||
<%= render partial: 'collections/button_for_creating_empty_collection', locals: {label: 'Create Collection'} %> | ||
<div class="row"> </div> | ||
<h2>Browse By</h2> | ||
<ul class="nav nav-list" id="facets"> | ||
<%= render_facet_partials %> | ||
</ul> | ||
<% 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> | ||
<%= t('blacklight.search.facets.title') %> | ||
</h4> | ||
</div> | ||
<div id="facet-panel-collapse" class="collapse panel-group"> | ||
<%= render_facet_partials %> | ||
</div> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
<% if @response.total_pages > 1 %> | ||
<div class="pager"> | ||
<%= paginate @response, outer_window: 2, theme: 'blacklight', route_set: sufia %> | ||
<div class="clearfix"></div> | ||
</div><!-- /pager --> | ||
<div class="row record-padding"> | ||
<div class="col-md-9"> | ||
<div class="pagination"> | ||
<%= paginate @response, outer_window: 2, theme: 'blacklight', route_set: sufia %> | ||
</div> | ||
</div> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require 'spec_helper' | ||
|
||
# Note: this is a direct copy of the corresponding test in Blacklight | ||
# with changes for "views/my" instead of "views/catalog" | ||
|
||
describe "my/facet.html.erb" do | ||
let(:display_facet) { double } | ||
let(:blacklight_config) { Blacklight::Configuration.new } | ||
before do | ||
blacklight_config.add_facet_field "xyz", label: "Facet title" | ||
view.stub(:blacklight_config).and_return(blacklight_config) | ||
allow(view).to receive(:blacklight_config).and_return(blacklight_config) | ||
stub_template "my/_facet_pagination.html.erb" => "pagination" | ||
assign :facet, blacklight_config.facet_fields["xyz"] | ||
assign :display_facet, display_facet | ||
end | ||
|
||
it "should have the facet title" do | ||
allow(view).to receive(:render_facet_limit) | ||
render | ||
expect(rendered).to have_selector "h3", text: "Facet title" | ||
end | ||
|
||
it "should render facet pagination" do | ||
allow(view).to receive(:render_facet_limit) | ||
render | ||
expect(rendered).to have_content "pagination" | ||
end | ||
|
||
it "should render the facet limit" do | ||
expect(view).to receive(:render_facet_limit).with(display_facet, layout: false) | ||
render | ||
end | ||
end |
Oops, something went wrong.
@mjgiarlo I think this one has to stay, though.