blacklight 5.0.0.pre2 → 5.0.0.pre3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +2 -1
  3. data/VERSION +1 -1
  4. data/app/assets/stylesheets/blacklight/_catalog.css.scss +14 -4
  5. data/app/assets/stylesheets/blacklight/_header.css.scss +2 -0
  6. data/app/helpers/blacklight/blacklight_helper_behavior.rb +56 -14
  7. data/app/helpers/blacklight/catalog_helper_behavior.rb +0 -9
  8. data/app/helpers/blacklight/facets_helper_behavior.rb +25 -1
  9. data/app/views/_user_util_links.html.erb +1 -1
  10. data/app/views/catalog/_constraints.html.erb +6 -5
  11. data/app/views/catalog/_facet_layout.html.erb +2 -2
  12. data/app/views/catalog/_index_header_default.html.erb +2 -0
  13. data/app/views/catalog/_previous_next_doc.html.erb +1 -1
  14. data/app/views/catalog/_sort_and_per_page.html.erb +1 -0
  15. data/app/views/catalog/_view_type_group.html.erb +13 -0
  16. data/config/locales/blacklight.en.yml +3 -18
  17. data/config/locales/blacklight.fr.yml +4 -18
  18. data/lib/blacklight/configuration.rb +2 -1
  19. data/lib/blacklight/configuration/facet_field.rb +4 -0
  20. data/lib/blacklight/engine.rb +1 -26
  21. data/lib/blacklight/rails/routes.rb +1 -1
  22. data/lib/blacklight/routes.rb +21 -13
  23. data/lib/blacklight/solr_helper.rb +2 -1
  24. data/spec/helpers/blacklight_helper_spec.rb +90 -2
  25. data/spec/helpers/facets_helper_spec.rb +53 -1
  26. data/spec/lib/blacklight/solr_helper_spec.rb +35 -0
  27. data/spec/routing/routes_spec.rb +20 -0
  28. data/spec/views/catalog/_constraints.html.erb_spec.rb +33 -0
  29. data/spec/views/catalog/_facet_layout.html.erb_spec.rb +42 -0
  30. data/spec/views/catalog/_facets.html.erb_spec.rb +6 -2
  31. data/spec/views/catalog/_index_header_default.html.erb_spec.rb +22 -0
  32. data/spec/views/catalog/_sort_and_per_page.html.erb_spec.rb +25 -0
  33. data/spec/views/catalog/_view_type_group.html.erb_spec.rb +37 -0
  34. metadata +15 -5
  35. data/app/controllers/feedback_controller.rb +0 -38
  36. data/app/views/feedback/complete.html.erb +0 -5
  37. data/app/views/feedback/show.html.erb +0 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7f3074193519ca823f3af1b5db3d88b3cd42ce0
4
- data.tar.gz: 478b01d0e5292996ed40da54ce6fe5a7e1258f60
3
+ metadata.gz: 4d8794852e683729a57437dab41c12a7f163e935
4
+ data.tar.gz: 0475c260c2845e478307195be84b6c967e426469
5
5
  SHA512:
6
- metadata.gz: 4502e598ed76de63d1a36ecffdb2f19b1b5e8c93f6a56ec7fbfb077b30cb56fdf56859368c401c2003bc45bd272d88b3542c2a320b368828e93d490a6cddc1f7
7
- data.tar.gz: 7f77de71e7536ebf916dc24a46152b43cd458f1a9d77c1127f9e38720ba85c09f6ad00b8568fdbcb5ae20f8638f36f77aa586c4ad93795313371d8c4d46c289f
6
+ metadata.gz: 31df124b777472aa9a7f1c04cf66dce546dc61f53d5f7cc6d8f5b7ebd62d122405aa886f504c778a73a9f3976efbb207ff5f840a6ac56acbeb87499c469ab737
7
+ data.tar.gz: 0d3674651658046314cceed8ccecc82084aa4144eb9198f78bf74f0e3044d97e46436ee921e837edb10845946c51736f6b845f0992a00673c5705122e3eaa78a
data/LICENSE CHANGED
@@ -1,5 +1,6 @@
1
1
  ##########################################################################
2
- # Copyright 2008 Rector and Visitors of the University of Virginia
2
+ # Copyright 2008-2014 Rector and Visitors of the University of Virginia, The Board of Trustees of the Leland Stanford Junior University, Johns Hopkins Universities, and Data Curation Experts
3
+ # Additional copyright may be held by others, as reflected in the commit log
3
4
  #
4
5
  # Licensed under the Apache License, Version 2.0 (the "License");
5
6
  # you may not use this file except in compliance with the License.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.0.0.pre2
1
+ 5.0.0.pre3
@@ -38,10 +38,6 @@
38
38
  }
39
39
  }
40
40
 
41
- .catalog_startOverLink {
42
- @extend .pull-right;
43
- }
44
-
45
41
  .constraints-container {
46
42
  @extend .well;
47
43
  line-height: 2.5;
@@ -81,6 +77,7 @@ span.constraints-label {
81
77
  margin-top: $padding-base-vertical;
82
78
  padding-top: $padding-base-vertical;
83
79
  border-bottom:1px dotted $table-border-color;
80
+ @extend .clearfix;
84
81
  }
85
82
  }
86
83
 
@@ -131,6 +128,10 @@ span.constraints-label {
131
128
  {
132
129
  dd {
133
130
  margin-bottom: $padding-base-vertical;
131
+
132
+ &:after {
133
+ clear: none;
134
+ }
134
135
  }
135
136
  }
136
137
 
@@ -185,4 +186,13 @@ label.toggle_bookmark
185
186
  .document-thumbnail {
186
187
  float: right;
187
188
  padding-left: 20px;
189
+ margin-bottom: $line-height-computed;
190
+ }
191
+
192
+ .view-type {
193
+ display: inline-block;
194
+
195
+ .caption {
196
+ @extend .sr-only;
197
+ }
188
198
  }
@@ -17,6 +17,8 @@
17
17
  }
18
18
 
19
19
  #search-navbar {
20
+ z-index: 1;
21
+
20
22
  .search-query-form {
21
23
  @extend .col-md-8;
22
24
  padding-left: 0;
@@ -101,7 +101,8 @@ module Blacklight::BlacklightHelperBehavior
101
101
 
102
102
  def should_render_index_field? document, solr_field
103
103
  document.has?(solr_field.field) ||
104
- (document.has_highlight_field? solr_field.field if solr_field.highlight)
104
+ (document.has_highlight_field? solr_field.field if solr_field.highlight) ||
105
+ solr_field.accessor
105
106
  end
106
107
 
107
108
  def spell_check_max
@@ -281,17 +282,44 @@ module Blacklight::BlacklightHelperBehavior
281
282
  end
282
283
 
283
284
  ##
284
- # Get the value of a document's field after applying any value lookups, e.g.:
285
+ # Get the value for a document's field, and prepare to render it.
286
+ # - highlight_field
287
+ # - accessor
288
+ # - solr field
289
+ #
290
+ # Rendering:
285
291
  # - helper_method
286
292
  # - link_to_search
287
- # - highlight
288
293
  # TODO : maybe this should be merged with render_field_value, and the ugly signature
289
294
  # simplified by pushing some of this logic into the "model"
290
295
  def get_field_values document, field, field_config, options = {}
296
+ # valuyes
297
+ value = case
298
+ when (field_config and field_config.highlight)
299
+ # retrieve the document value from the highlighting response
300
+ document.highlight_field(field_config.field).map { |x| x.html_safe } if document.has_highlight_field? field_config.field
301
+ when (field_config and field_config.accessor)
302
+ # implicit method call
303
+ if field_config.accessor === true
304
+ document.send(field)
305
+ # arity-1 method call (include the field name in the call)
306
+ elsif !field_config.accessor.is_a?(Array) && document.method(field_config.accessor).arity != 0
307
+ document.send(field_config.accessor, field)
308
+ # chained method calls
309
+ else
310
+ Array(field_config.accessor).inject(document) do |result, method|
311
+ result.send(method)
312
+ end
313
+ end
314
+ else
315
+ # regular solr
316
+ document.get(field, :sep => nil) if field
317
+ end
291
318
 
319
+ # rendering
292
320
  case
293
321
  when (field_config and field_config.helper_method)
294
- send(field_config.helper_method, options.merge(:document => document, :field => field))
322
+ send(field_config.helper_method, options.merge(:document => document, :field => field, :value => value))
295
323
  when (field_config and field_config.link_to_search)
296
324
  link_field = if field_config.link_to_search === true
297
325
  field_config.field
@@ -299,19 +327,18 @@ module Blacklight::BlacklightHelperBehavior
299
327
  field_config.link_to_search
300
328
  end
301
329
 
302
- Array(document.get(field, :sep => nil)).map do |v|
330
+ Array(value).map do |v|
303
331
  link_to render_field_value(v, field_config), search_action_url(add_facet_params(link_field, v, {}))
304
332
  end if field
305
- when (field_config and field_config.highlight)
306
- document.highlight_field(field_config.field).map { |x| x.html_safe } if document.has_highlight_field? field_config.field
307
333
  else
308
- document.get(field, :sep => nil) if field
309
- end
334
+ value
335
+ end
310
336
  end
311
337
 
312
338
  def should_render_show_field? document, solr_field
313
339
  document.has?(solr_field.field) ||
314
- (document.has_highlight_field? solr_field.field if solr_field.highlight)
340
+ (document.has_highlight_field? solr_field.field if solr_field.highlight) ||
341
+ solr_field.accessor
315
342
  end
316
343
 
317
344
  def render_field_value value=nil, field_config=nil
@@ -328,14 +355,18 @@ module Blacklight::BlacklightHelperBehavior
328
355
  ', '
329
356
  end
330
357
 
331
- def document_index_view_type
332
- if blacklight_config.document_index_view_types.include? params[:view]
333
- params[:view]
358
+ def document_index_view_type query_params=params
359
+ if blacklight_config.document_index_view_types.include? query_params[:view]
360
+ query_params[:view]
334
361
  else
335
- blacklight_config.document_index_view_types.first
362
+ default_document_index_view_type
336
363
  end
337
364
  end
338
365
 
366
+ def default_document_index_view_type
367
+ blacklight_config.document_index_view_types.first
368
+ end
369
+
339
370
  def render_document_index documents = nil, locals = {}
340
371
  documents ||= @document_list
341
372
  render_document_index_with_view(document_index_view_type, documents)
@@ -430,6 +461,17 @@ module Blacklight::BlacklightHelperBehavior
430
461
  link_to(query, link_url)
431
462
  end
432
463
 
464
+ ##
465
+ # Get the path to the search action with any parameters (e.g. view type)
466
+ # that should be persisted across search sessions.
467
+ def start_over_path query_params = params
468
+ h = { }
469
+ current_index_view_type = document_index_view_type(query_params)
470
+ h[:view] = current_index_view_type unless current_index_view_type == default_document_index_view_type
471
+
472
+ search_action_url(h)
473
+ end
474
+
433
475
  def render_document_index_label doc, opts
434
476
  label = nil
435
477
  label ||= doc.get(opts[:label], :sep => nil) if opts[:label].instance_of? Symbol
@@ -1,15 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Blacklight::CatalogHelperBehavior
3
3
 
4
- # Equivalent to kaminari "paginate", but takes an RSolr::Response as first argument.
5
- # Will convert it to something kaminari can deal with (using #paginate_params), and
6
- # then call kaminari paginate with that. Other arguments (options and block) same as
7
- # kaminari paginate, passed on through.
8
- # will output HTML pagination controls.
9
- def paginate_rsolr_response(response, options = {}, &block)
10
- paginate response, options, &block
11
- end
12
-
13
4
  # Override the Kaminari page_entries_info helper with our own, blacklight-aware
14
5
  # implementation
15
6
  #
@@ -42,10 +42,34 @@ module Blacklight::FacetsHelperBehavior
42
42
  # @param [Blacklight::SolrResponse::Facets::FacetField] display_facet
43
43
  def should_render_facet? display_facet
44
44
  # display when show is nil or true
45
- display = facet_configuration_for_field(display_facet.name).show != false
45
+ facet_config = facet_configuration_for_field(display_facet.name)
46
+
47
+ display = case facet_config.show
48
+ when Symbol
49
+ arity = method(facet_config.show).arity
50
+
51
+ if arity == 0
52
+ send(facet_config.show)
53
+ else
54
+ send(facet_config.show, display_facet)
55
+ end
56
+ when Proc
57
+ facet_config.show.call self, facet_config, display_facet
58
+ else
59
+ facet_config.show
60
+ end
61
+
46
62
  return display && display_facet.items.present?
47
63
  end
48
64
 
65
+ ##
66
+ # if the facet is 'active', don't collapse
67
+ # if the facet is configured to collapse (the default), collapse
68
+ # if the facet is configured not to collapse, don't collapse
69
+ def should_collapse_facet? facet_field
70
+ !facet_field_in_params?(facet_field.field) && facet_field.collapse
71
+ end
72
+
49
73
  # the name of the partial to use to render a facet field. Can be over-ridden for custom
50
74
  # display on a per-facet basis.
51
75
  def facet_partial_name(display_facet = nil)
@@ -23,7 +23,7 @@
23
23
  </li>
24
24
  <% unless current_user.to_s.blank? -%>
25
25
  <li>
26
- [<%= link_to current_user, edit_user_registration_path %>]
26
+ <%= link_to current_user, edit_user_registration_path %>
27
27
  </li>
28
28
  <% end %>
29
29
  <% else %>
@@ -1,9 +1,10 @@
1
1
  <% if query_has_constraints? %>
2
- <div id="appliedParams" class="constraints-container">
3
- <span class="constraints-label"><%= t('blacklight.search.filters.title') %></span>
4
-
5
- <%=link_to t('blacklight.search.start_over'), url_for(:action=>'index'), :class => "catalog_startOverLink", :id=>"startOverLink" %>
6
- <%= render_constraints(params) %>
7
2
 
3
+ <div id="appliedParams" class="clearfix constraints-container">
4
+ <div class="pull-right">
5
+ <%=link_to t('blacklight.search.start_over'), start_over_path, :class => "catalog_startOverLink btn btn-sm btn-text", :id=>"startOverLink" %>
6
+ </div>
7
+ <span class="constraints-label"><%= t('blacklight.search.filters.title') %></span>
8
+ <%= render_constraints(params) %>
8
9
  </div>
9
10
  <% end %>
@@ -1,10 +1,10 @@
1
1
  <div class="panel panel-default facet_limit blacklight-<%= facet_field.field.parameterize %> <%= 'facet_limit-active' if facet_field_in_params?(facet_field.field) %>">
2
- <div class="<%= "collapsed" unless facet_field_in_params?(facet_field.field) %> collapse-toggle panel-heading" data-toggle="collapse" data-target="#facet-<%= facet_field.label.parameterize %>">
2
+ <div class="<%= "collapsed" if should_collapse_facet?(facet_field) %> collapse-toggle panel-heading" data-toggle="collapse" data-target="#facet-<%= facet_field.label.parameterize %>">
3
3
  <h5 class="panel-title">
4
4
  <%= link_to facet_field.label, "#", :"data-no-turbolink" => true %>
5
5
  </h5>
6
6
  </div>
7
- <div id="facet-<%= facet_field.label.parameterize %>" class="panel-collapse <%= facet_field_in_params?(facet_field.field) ? 'in' : 'collapse' %>">
7
+ <div id="facet-<%= facet_field.label.parameterize %>" class="panel-collapse facet-content <%= should_collapse_facet?(facet_field) ? 'collapse' : 'in' %>">
8
8
  <div class="panel-body">
9
9
  <%= yield %>
10
10
  </div>
@@ -8,7 +8,9 @@
8
8
  -%>
9
9
  <h5 class="index_title col-sm-9 col-lg-10">
10
10
  <% counter = document_counter_with_offset(document_counter) %>
11
+ <span class="document-counter">
11
12
  <%= t('blacklight.search.documents.counter', :counter => counter) if counter %>
13
+ </span>
12
14
  <%= link_to_document document, :label=>document_show_link_field(document), :counter => counter %>
13
15
  </h5>
14
16
 
@@ -12,7 +12,7 @@
12
12
  <div class="pull-right search-widgets">
13
13
  <%= link_back_to_catalog :class => 'btn' %>
14
14
 
15
- <%=link_to "#{t('blacklight.search.start_over')}", catalog_index_path, :id=>"startOverLink", :class => 'btn' %>
15
+ <%=link_to "#{t('blacklight.search.start_over')}", start_over_path(current_search_session.try(:query_params) || {}), :id=>"startOverLink", :class => 'btn' %>
16
16
  </div>
17
17
  </div>
18
18
  <% end %>
@@ -3,5 +3,6 @@
3
3
  <div class="search-widgets pull-right">
4
4
  <%= render :partial => 'sort_widget' %>
5
5
  <%= render :partial => 'per_page_widget' %>
6
+ <%= render :partial => 'view_type_group' %>
6
7
  </div>
7
8
  </div>
@@ -0,0 +1,13 @@
1
+ <% if blacklight_config.document_index_view_types.length > 1 -%>
2
+ <div class="view-type">
3
+ <span class="sr-only"><%= t('blacklight.search.view_title') %></span>
4
+ <div class="view-type-group btn-group">
5
+ <% blacklight_config.document_index_view_types.each do |view| %>
6
+ <%= link_to url_for(params.merge(:view => view)), :title => t("blacklight.search.view_title.#{view}", default: t("blacklight.search.view.#{view}", default: "")), :class => "btn btn-default view-type-#{ view.parameterize } #{"active" if document_index_view_type == view}" do %>
7
+ <span class="glyphicon glyphicon-<%= view.parameterize %> view-icon-<%= view.parameterize %>"></span>
8
+ <span class="caption"><%= t("blacklight.search.view.#{view}") %></span>
9
+ <% end %>
10
+ <% end %>
11
+ </div>
12
+ </div>
13
+ <% end -%>
@@ -1,12 +1,4 @@
1
1
  en:
2
- active_record:
3
- models:
4
- feedback: 'Feedback'
5
- attributes:
6
- feedback:
7
- name: 'Your Name'
8
- email: 'Your Email'
9
- message: 'Your Message'
10
2
  views:
11
3
  pagination:
12
4
  first: '&laquo; First'
@@ -56,16 +48,6 @@ en:
56
48
  list_title: 'Your Bookmarks'
57
49
  delete: 'Remove'
58
50
 
59
- feedback:
60
- valid_name: 'A valid name is required'
61
- valid_email: 'A valid email address is required'
62
- need_message: 'A message is required'
63
- submit: 'Send!'
64
- errors:
65
- title: 'Please fix the following form errors:'
66
- complete:
67
- title: 'Thank-you for your feedback'
68
-
69
51
  saved_searches:
70
52
  add:
71
53
  success: 'Successfully saved your search.'
@@ -225,6 +207,9 @@ en:
225
207
  use_fewer_keywords: "Use fewer keywords to start, then refine your search using the links on the left."
226
208
  search_fields: "you searched by %{search_fields}"
227
209
  search_everything: "try searching everything"
210
+ view_title: "View results as: "
211
+ view:
212
+ list: "List"
228
213
 
229
214
  entry_name:
230
215
  default: 'entry'
@@ -1,12 +1,4 @@
1
1
  fr:
2
- active_record:
3
- models:
4
- feedback: 'Vos réactions'
5
- attributes:
6
- feedback:
7
- name: 'Votre nom'
8
- email: 'Votre courriel'
9
- message: 'Votre message'
10
2
  views:
11
3
  pagination:
12
4
  first: '&laquo; Première'
@@ -56,16 +48,6 @@ fr:
56
48
  list_title: 'Vos favoris'
57
49
  delete: 'Supprimer'
58
50
 
59
- feedback:
60
- valid_name: 'Vous devez saisir votre nom.'
61
- valid_email: 'Vous devez saisir votre courriel.'
62
- need_message: 'Vous devez saisir un message.'
63
- submit: 'Envoyer'
64
- errors:
65
- title: 'Veuillez corriger les erreurs suivantes :'
66
- complete:
67
- title: 'Merci pour vos remarques.'
68
-
69
51
  folder:
70
52
  title: 'Panier'
71
53
  add:
@@ -241,6 +223,10 @@ fr:
241
223
  use_fewer_keywords: "Utilisez moins de mots-clés pour commencer, puis affiner votre recherche."
242
224
  search_fields: "vous avez cherché par %{search_fields}"
243
225
  search_everything: "essayez de rechercher tout"
226
+ view_title: "Affichage: "
227
+ view:
228
+ list: "Liste"
229
+
244
230
 
245
231
  entry_name:
246
232
  default: 'résultat'
@@ -25,7 +25,8 @@ module Blacklight
25
25
  :search_history_window => Blacklight::Catalog::SearchHistoryWindow,
26
26
  :document_index_view_types => ['list'],
27
27
  :add_facet_fields_to_solr_request => false,
28
- :add_field_configuration_to_solr_request => false
28
+ :add_field_configuration_to_solr_request => false,
29
+ :http_method => :get
29
30
  }
30
31
  end
31
32
  end
@@ -7,6 +7,10 @@ module Blacklight
7
7
  self.tag = "#{self.field}_single"
8
8
  self.ex = "#{self.field}_single"
9
9
  end
10
+
11
+ self.collapse = true if self.collapse.nil?
12
+ self.show = true if self.show.nil?
13
+
10
14
  super
11
15
  end
12
16
  end
@@ -1,5 +1,3 @@
1
- # -*- encoding : utf-8 -*-
2
-
3
1
  module Blacklight
4
2
  class Engine < Rails::Engine
5
3
 
@@ -11,29 +9,6 @@ module Blacklight
11
9
  initializer 'blacklight.helpers' do |app|
12
10
  ActionView::Base.send :include, BlacklightHelper
13
11
  end
14
-
15
- # Expose Jquery-ui image assets so they are precompiled
16
- # to root path so jquery-ui css compiled into asset pipeline
17
- # can find them.
18
- # http://bibwild.wordpress.com/2011/12/08/jquery-ui-css-and-images-and-rails-asset-pipeline/
19
- #
20
- # Sorry, we end up prepending jquery-ui asset path before ALL paths, even
21
- # application, no easy way to insert em before the gem paths but after
22
- # the app paths.
23
- #
24
- # You may want to disable this if you want to supply your own theme, just set
25
- # Blacklight::Engine.config.jquery_ui_images = false
26
- # in config/appliction.rb or other pre-initializer control point.
27
- config.before_configuration do
28
- config.jquery_ui_images = true
29
- end
30
- initializer "blacklight.jquery_ui_images",
31
- :group => :all,
32
- :after => :append_assets_path do
33
- if config.jquery_ui_images
34
- Rails.application.config.assets.paths.unshift self.class.root.join("app", "assets", "stylesheets", "jquery", "ui-lightness").to_s
35
- end
36
- end
37
12
 
38
13
  # This makes our rake tasks visible.
39
14
  rake_tasks do
@@ -45,4 +20,4 @@ module Blacklight
45
20
  end
46
21
 
47
22
  end
48
- end
23
+ end
@@ -3,7 +3,7 @@ module ActionDispatch::Routing
3
3
  # example
4
4
  # blacklight_for :catalog
5
5
  # blacklight_for :catalog, :dashboard
6
- # blacklight_for :catalog, except: [ :saved_searches, :feedback ]
6
+ # blacklight_for :catalog, except: [ :saved_searches ]
7
7
  # blacklight_for :catalog, only: [ :saved_searches, :solr_document ]
8
8
  # blacklight_for :catalog, constraints: {id: /[0-9]+/ }
9
9
  def blacklight_for(*resources)
@@ -6,6 +6,26 @@ module Blacklight
6
6
 
7
7
  attr_reader :resources
8
8
 
9
+ # adds as class and instance level accessors, default_route_sets
10
+ # returns an array of symbols for method names that define routes.
11
+ # Order is important:. (e.g. /catalog/email precedes /catalog/:id)
12
+ #
13
+ # Add-ons that want to add routes into default routing might
14
+ # monkey-patch Blacklight::Routes, say:
15
+ #
16
+ # module MyWidget::Routes
17
+ # extend ActiveSupport::Concern
18
+ # included do |klass|
19
+ # klass.default_route_sets += [:widget_routing]
20
+ # end
21
+ # def widget_routing(primary_resource)
22
+ # get "#{primary_resource}/widget", "#{primary_resource}#widget"
23
+ # end
24
+ # end
25
+ # Blacklight::Routes.send(:include, MyWidget::Routes)
26
+ class_attribute :default_route_sets
27
+ self.default_route_sets = [:bookmarks, :search_history, :saved_searches, :export, :solr_document]
28
+
9
29
  def initialize(router, options)
10
30
  @router = router
11
31
  @options = options
@@ -35,10 +55,7 @@ module Blacklight
35
55
  (@options[:only] || default_route_sets) - (@options[:except] || [])
36
56
  end
37
57
 
38
- def default_route_sets
39
- # Order is important here. (e.g. /catalog/email precedes /catalog/:id)
40
- [:bookmarks, :search_history, :saved_searches, :export, :solr_document, :feedback]
41
- end
58
+
42
59
 
43
60
  module RouteSets
44
61
  def bookmarks(_)
@@ -101,15 +118,6 @@ module Blacklight
101
118
  resources primary_resource, args
102
119
  end
103
120
  end
104
-
105
-
106
- # Feedback
107
- def feedback(_)
108
- add_routes do |options|
109
- get "feedback", :to => "feedback#show"
110
- get "feedback/complete", :to => "feedback#complete"
111
- end
112
- end
113
121
  end
114
122
  include RouteSets
115
123
  end
@@ -391,7 +391,8 @@ module Blacklight::SolrHelper
391
391
  path = blacklight_config.solr_path
392
392
 
393
393
  # delete these parameters, otherwise rsolr will pass them through.
394
- res = blacklight_solr.send_and_receive(path, params: solr_params.to_hash)
394
+ key = blacklight_config.http_method == :post ? :data : :params
395
+ res = blacklight_solr.send_and_receive(path, {key=>solr_params.to_hash, method:blacklight_config.http_method})
395
396
 
396
397
  solr_response = Blacklight::SolrResponse.new(force_to_utf8(res), solr_params)
397
398
 
@@ -327,6 +327,26 @@ describe BlacklightHelper do
327
327
  params[:view] = 'not_in_list'
328
328
  expect(document_index_view_type).to eq 'list'
329
329
  end
330
+
331
+ it "should pluck values from supplied params" do
332
+ blacklight_config.stub(:document_index_view_types) { ['list', 'asdf'] }
333
+ params[:view] = 'asdf'
334
+ expect(document_index_view_type(:view => 'list')).to eq 'list'
335
+ end
336
+ end
337
+
338
+ describe "start_over_path" do
339
+ it 'should be the catalog path with the current view type' do
340
+ blacklight_config.stub(:document_index_view_types) { ['list', 'abc'] }
341
+ helper.stub(:blacklight_config => blacklight_config)
342
+ expect(helper.start_over_path(:view => 'abc')).to eq catalog_index_url(:view => 'abc')
343
+ end
344
+
345
+ it 'should not include the current view type if it is the default' do
346
+ blacklight_config.stub(:document_index_view_types) { ['list', 'abc'] }
347
+ helper.stub(:blacklight_config => blacklight_config)
348
+ expect(helper.start_over_path(:view => 'list')).to eq catalog_index_url
349
+ end
330
350
  end
331
351
 
332
352
  describe "render_document_index" do
@@ -519,6 +539,9 @@ describe BlacklightHelper do
519
539
  config.add_index_field 'link_to_search_true', :link_to_search => true
520
540
  config.add_index_field 'link_to_search_named', :link_to_search => :some_field
521
541
  config.add_index_field 'highlight', :highlight => true
542
+ config.add_index_field 'solr_doc_accessor', :accessor => true
543
+ config.add_index_field 'explicit_accessor', :accessor => :solr_doc_accessor
544
+ config.add_index_field 'explicit_accessor_with_arg', :accessor => :solr_doc_accessor_with_arg
522
545
  end
523
546
  helper.stub(:blacklight_config).and_return(@config)
524
547
  end
@@ -532,7 +555,7 @@ describe BlacklightHelper do
532
555
 
533
556
  it "should check for a helper method to call" do
534
557
  doc = double()
535
- doc.should_not_receive(:get).with('asdf', :sep => nil)
558
+ doc.should_receive(:get).with('asdf', :sep => nil)
536
559
  helper.stub(:render_asdf_index_field).and_return('custom asdf value')
537
560
  value = helper.render_index_field_value :document => doc, :field => 'asdf'
538
561
  expect(value).to eq 'custom asdf value'
@@ -582,6 +605,25 @@ describe BlacklightHelper do
582
605
  value = helper.render_index_field_value :document => doc, :field => 'mnbv'
583
606
  expect(value).to eq 'document mnbv value'
584
607
  end
608
+
609
+ it "should call an accessor on the solr document" do
610
+ doc = double(:solr_doc_accessor => "123")
611
+ value = helper.render_index_field_value :document => doc, :field => 'solr_doc_accessor'
612
+ expect(value).to eq "123"
613
+ end
614
+
615
+ it "should call an explicit accessor on the solr document" do
616
+ doc = double(:solr_doc_accessor => "123")
617
+ value = helper.render_index_field_value :document => doc, :field => 'explicit_accessor'
618
+ expect(value).to eq "123"
619
+ end
620
+
621
+ it "should call an implicit accessor on the solr document" do
622
+ doc = double()
623
+ expect(doc).to receive(:solr_doc_accessor_with_arg).with('explicit_accessor_with_arg').and_return("123")
624
+ value = helper.render_index_field_value :document => doc, :field => 'explicit_accessor_with_arg'
625
+ expect(value).to eq "123"
626
+ end
585
627
  end
586
628
 
587
629
 
@@ -593,7 +635,12 @@ describe BlacklightHelper do
593
635
  config.add_show_field 'link_to_search_true', :link_to_search => true
594
636
  config.add_show_field 'link_to_search_named', :link_to_search => :some_field
595
637
  config.add_show_field 'highlight', :highlight => true
638
+ config.add_show_field 'solr_doc_accessor', :accessor => true
639
+ config.add_show_field 'explicit_accessor', :accessor => :solr_doc_accessor
640
+ config.add_show_field 'explicit_array_accessor', :accessor => [:solr_doc_accessor, :some_method]
641
+ config.add_show_field 'explicit_accessor_with_arg', :accessor => :solr_doc_accessor_with_arg
596
642
  end
643
+
597
644
  helper.stub(:blacklight_config).and_return(@config)
598
645
  end
599
646
 
@@ -607,7 +654,7 @@ describe BlacklightHelper do
607
654
 
608
655
  it "should check for a helper method to call" do
609
656
  doc = double()
610
- doc.should_not_receive(:get).with('asdf', :sep => nil)
657
+ doc.should_receive(:get).with('asdf', :sep => nil)
611
658
  helper.stub(:render_asdf_document_show_field).and_return('custom asdf value')
612
659
  value = helper.render_document_show_field_value :document => doc, :field => 'asdf'
613
660
  expect(value).to eq 'custom asdf value'
@@ -658,6 +705,31 @@ describe BlacklightHelper do
658
705
  value = helper.render_document_show_field_value :document => doc, :field => 'mnbv'
659
706
  expect(value).to eq 'document mnbv value'
660
707
  end
708
+
709
+ it "should call an accessor on the solr document" do
710
+ doc = double(:solr_doc_accessor => "123")
711
+ value = helper.render_document_show_field_value :document => doc, :field => 'solr_doc_accessor'
712
+ expect(value).to eq "123"
713
+ end
714
+
715
+ it "should call an explicit accessor on the solr document" do
716
+ doc = double(:solr_doc_accessor => "123")
717
+ value = helper.render_document_show_field_value :document => doc, :field => 'explicit_accessor'
718
+ expect(value).to eq "123"
719
+ end
720
+
721
+ it "should call an explicit array-style accessor on the solr document" do
722
+ doc = double(:solr_doc_accessor => double(:some_method => "123"))
723
+ value = helper.render_document_show_field_value :document => doc, :field => 'explicit_array_accessor'
724
+ expect(value).to eq "123"
725
+ end
726
+
727
+ it "should call an accessor on the solr document with the field as an argument" do
728
+ doc = double()
729
+ expect(doc).to receive(:solr_doc_accessor_with_arg).with('explicit_accessor_with_arg').and_return("123")
730
+ value = helper.render_document_show_field_value :document => doc, :field => 'explicit_accessor_with_arg'
731
+ expect(value).to eq "123"
732
+ end
661
733
  end
662
734
 
663
735
  describe "#should_render_index_field?" do
@@ -675,6 +747,14 @@ describe BlacklightHelper do
675
747
  field_config = double(:field => 'asdf', :highlight => true)
676
748
  helper.should_render_index_field?(doc, field_config).should == true
677
749
  end
750
+
751
+ it "should if the field has a model accessor" do
752
+ doc = double()
753
+ doc.stub(:has?).with('asdf').and_return(false)
754
+ doc.stub(:has_highlight_field?).with('asdf').and_return(false)
755
+ field_config = double(:field => 'asdf', :highlight => true, :accessor => true)
756
+ helper.should_render_index_field?(doc, field_config).should == true
757
+ end
678
758
  end
679
759
 
680
760
 
@@ -693,6 +773,14 @@ describe BlacklightHelper do
693
773
  field_config = double(:field => 'asdf', :highlight => true)
694
774
  expect(helper.should_render_show_field?(doc, field_config)).to be_true
695
775
  end
776
+
777
+ it "should if the field has a model accessor" do
778
+ doc = double()
779
+ doc.stub(:has?).with('asdf').and_return(false)
780
+ doc.stub(:has_highlight_field?).with('asdf').and_return(false)
781
+ field_config = double(:field => 'asdf', :highlight => true, :accessor => true)
782
+ helper.should_render_show_field?(doc, field_config).should == true
783
+ end
696
784
  end
697
785
 
698
786
 
@@ -33,11 +33,16 @@ describe FacetsHelper do
33
33
  before do
34
34
  @config = Blacklight::Configuration.new do |config|
35
35
  config.add_facet_field 'basic_field'
36
- config.add_facet_field 'no_show', :show=>false
36
+ config.add_facet_field 'no_show', :show => false
37
+ config.add_facet_field 'helper_show', :show => :my_helper
38
+ config.add_facet_field 'helper_with_an_arg_show', :show => :my_helper_with_an_arg
39
+ config.add_facet_field 'lambda_show', :show => lambda { |context, config, field| true }
40
+ config.add_facet_field 'lambda_no_show', :show => lambda { |context, config, field| false }
37
41
  end
38
42
 
39
43
  helper.stub(:blacklight_config => @config)
40
44
  end
45
+
41
46
  it "should render facets with items" do
42
47
  a = double(:items => [1,2], :name=>'basic_field')
43
48
  expect(helper.should_render_facet?(a)).to be_true
@@ -51,6 +56,53 @@ describe FacetsHelper do
51
56
  a = double(:items => [1,2], :name=>'no_show')
52
57
  expect(helper.should_render_facet?(a)).to be_false
53
58
  end
59
+
60
+ it "should call a helper to determine if it should render a field" do
61
+ helper.stub(:my_helper => true)
62
+ a = double(:items => [1,2], :name=>'helper_show')
63
+ expect(helper.should_render_facet?(a)).to be_true
64
+ end
65
+
66
+ it "should call a helper to determine if it should render a field" do
67
+ a = double(:items => [1,2], :name=>'helper_with_an_arg_show')
68
+ helper.should_receive(:my_helper_with_an_arg).with(a).and_return(true)
69
+ expect(helper.should_render_facet?(a)).to be_true
70
+ end
71
+
72
+
73
+ it "should evaluate a Proc to determine if it should render a field" do
74
+ a = double(:items => [1,2], :name=>'lambda_show')
75
+ expect(helper.should_render_facet?(a)).to be_true
76
+
77
+ a = double(:items => [1,2], :name=>'lambda_no_show')
78
+ expect(helper.should_render_facet?(a)).to be_false
79
+ end
80
+ end
81
+
82
+ describe "should_collapse_facet?" do
83
+ before do
84
+ @config = Blacklight::Configuration.new do |config|
85
+ config.add_facet_field 'basic_field'
86
+ config.add_facet_field 'no_collapse', collapse: false
87
+ end
88
+
89
+ helper.stub(blacklight_config: @config)
90
+ end
91
+
92
+ it "should be collapsed by default" do
93
+ expect(helper.should_collapse_facet?(@config.facet_fields['basic_field'])).to be_true
94
+ end
95
+
96
+ it "should not be collapsed if the configuration says so" do
97
+ expect(helper.should_collapse_facet?(@config.facet_fields['no_collapse'])).to be_false
98
+ end
99
+
100
+ it "should not be collapsed if it is in the params" do
101
+ params[:f] = { basic_field: [1], no_collapse: [2] }.with_indifferent_access
102
+ expect(helper.should_collapse_facet?(@config.facet_fields['basic_field'])).to be_false
103
+ expect(helper.should_collapse_facet?(@config.facet_fields['no_collapse'])).to be_false
104
+ end
105
+
54
106
  end
55
107
 
56
108
  describe "facet_by_field_name" do
@@ -1146,5 +1146,40 @@ describe 'Blacklight::SolrHelper' do
1146
1146
  end
1147
1147
  end
1148
1148
 
1149
+ describe "http_method configuration" do
1150
+ describe "using default" do
1151
+ let (:blacklight_config) {Blacklight::Configuration.new}
1152
+
1153
+ it "defaults to get" do
1154
+ expect(blacklight_config.http_method).to eq :get
1155
+ Blacklight.solr.should_receive(:send_and_receive) do |path, params|
1156
+ expect(path).to eq 'select'
1157
+ expect(params[:method]).to eq :get
1158
+ expect(params[:params]).to include(:q)
1159
+ end.and_return({'response'=>{'docs'=>[]}})
1160
+ get_search_results(:q => @all_docs_query)
1161
+ end
1162
+ end
1163
+
1164
+ describe "setting to post" do
1165
+ let (:blacklight_config) {config = Blacklight::Configuration.new; config.http_method=:post; config}
1166
+
1167
+ it "keep value set to post" do
1168
+ expect(blacklight_config.http_method).to eq :post
1169
+ Blacklight.solr.should_receive(:send_and_receive) do |path, params|
1170
+ expect(path).to eq 'select'
1171
+ expect(params[:method]).to eq :post
1172
+ expect(params[:data]).to include(:q)
1173
+ end.and_return({'response'=>{'docs'=>[]}})
1174
+ get_search_results(:q => @all_docs_query)
1175
+ end
1176
+
1177
+ it "should send a post request to solr", :integration => true do
1178
+ response, docs = get_search_results(:q => @all_docs_query)
1179
+ expect(docs.length).to be >= 1
1180
+ end
1181
+ end
1182
+ end
1183
+
1149
1184
  end
1150
1185
 
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Blacklight::Routes" do
4
+ describe "default_route_sets" do
5
+ around do |example|
6
+ @original = Blacklight::Routes.default_route_sets.dup.freeze
7
+
8
+ example.run
9
+
10
+ Blacklight::Routes.default_route_sets = @original
11
+ end
12
+
13
+ it "is settable" do
14
+ Blacklight::Routes.default_route_sets += [:foo]
15
+
16
+ # Order DOES matter.
17
+ expect(Blacklight::Routes.default_route_sets).to eq(@original + [:foo])
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+
3
+ describe "catalog/constraints" do
4
+ let :blacklight_config do
5
+ Blacklight::Configuration.new :document_index_view_types => ['list', 'xyz']
6
+ end
7
+
8
+ it "should render nothing if no constraints are set" do
9
+ view.stub(query_has_constraints?: false)
10
+ render partial: "catalog/constraints"
11
+ expect(rendered).to be_empty
12
+ end
13
+
14
+ it "should render a start over link" do
15
+ view.should_receive(:search_action_url).with({}).and_return('http://xyz')
16
+ view.stub(query_has_constraints?: true)
17
+ view.stub(:blacklight_config).and_return(blacklight_config)
18
+ render partial: "catalog/constraints"
19
+ expect(rendered).to have_selector("#startOverLink")
20
+ expect(rendered).to have_link("Start Over", :href => 'http://xyz')
21
+ end
22
+
23
+ it "should render a start over link with the current view type" do
24
+ view.should_receive(:search_action_url).with(view: 'xyz').and_return('http://xyz?view=xyz')
25
+ view.stub(query_has_constraints?: true)
26
+ params[:view] = 'xyz'
27
+ view.stub(:blacklight_config).and_return(blacklight_config)
28
+ render partial: "catalog/constraints"
29
+ expect(rendered).to have_selector("#startOverLink")
30
+ expect(rendered).to have_link("Start Over", :href => 'http://xyz?view=xyz')
31
+ end
32
+
33
+ end
@@ -0,0 +1,42 @@
1
+ require 'spec_helper'
2
+
3
+ describe "catalog/facet_layout" do
4
+
5
+ let :blacklight_config do
6
+ Blacklight::Configuration.new
7
+ end
8
+
9
+ let :facet_field do
10
+ Blacklight::Configuration::FacetField.new(field: 'some_field').normalize!
11
+ end
12
+
13
+ before do
14
+ view.stub(blacklight_config: blacklight_config)
15
+ end
16
+
17
+ it "should have a facet-specific class" do
18
+ render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
19
+ expect(rendered).to have_selector '.blacklight-some_field'
20
+ end
21
+
22
+ it "should have a title with a link for a11y" do
23
+ render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
24
+ expect(rendered).to have_selector 'h5 a', text: 'Some Field'
25
+ end
26
+
27
+ it "should be collapsable" do
28
+ render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
29
+ expect(rendered).to have_selector '.panel-heading.collapsed'
30
+ expect(rendered).to have_selector '.collapse .panel-body'
31
+ end
32
+
33
+ it "should be configured to be open by default" do
34
+ facet_field.stub(collapse: false)
35
+ render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
36
+ expect(rendered).to_not have_selector '.panel-heading.collapsed'
37
+ expect(rendered).to have_selector '.in .panel-body'
38
+
39
+ end
40
+
41
+
42
+ end
@@ -47,8 +47,12 @@ describe "catalog/_facets" do
47
47
 
48
48
  it "should list values" do
49
49
  render
50
- expect(rendered).to have_selector('a.facet_select')
51
- expect(rendered).to have_selector('.facet-count')
50
+
51
+ # The .facet-content class is used by blacklight_range_limit js, and
52
+ # should be applied to the .panel-collapse div that contains the collapsible
53
+ # facet content. Please make sure it remains if possible.
54
+ expect(rendered).to have_selector('.facet-content a.facet_select')
55
+ expect(rendered).to have_selector('.facet-content .facet-count')
52
56
  end
53
57
 
54
58
  end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe "catalog/_index_header_default" do
4
+ let :document do
5
+ SolrDocument.new :id => 'xyz', :format => 'a'
6
+ end
7
+
8
+ let :blacklight_config do
9
+ Blacklight::Configuration.new
10
+ end
11
+
12
+ it "should render the document header" do
13
+ assign :response, double(:params => {})
14
+ view.stub(:current_search_session).and_return nil
15
+ view.stub(:render_grouped_response?).and_return false
16
+ view.stub(:blacklight_config).and_return(blacklight_config)
17
+ view.stub(:render_bookmarks_control?).and_return false
18
+ render :partial => "catalog/index_header_default", :locals => {:document => document, :document_counter => 1}
19
+ expect(rendered).to have_selector('.document-counter', text: "2")
20
+ end
21
+
22
+ end
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe "catalog/_sort_and_per_page" do
4
+
5
+ let :blacklight_config do
6
+ Blacklight::Configuration.new
7
+ end
8
+
9
+ before do
10
+ view.stub(blacklight_config: blacklight_config)
11
+ end
12
+
13
+ it "should render the pagination, sort, per page and view type controls" do
14
+ stub_template "catalog/_paginate_compact.html.erb" => "paginate_compact"
15
+ stub_template "catalog/_sort_widget.html.erb" => "sort_widget"
16
+ stub_template "catalog/_per_page_widget.html.erb" => "per_page_widget"
17
+ stub_template "catalog/_view_type_group.html.erb" => "view_type_group"
18
+ render
19
+ expect(rendered).to match /paginate_compact/
20
+ expect(rendered).to match /sort_widget/
21
+ expect(rendered).to match /per_page_widget/
22
+ expect(rendered).to match /view_type_group/
23
+ end
24
+
25
+ end
@@ -0,0 +1,37 @@
1
+ require 'spec_helper'
2
+
3
+ describe "catalog/_view_type_group" do
4
+
5
+ let :blacklight_config do
6
+ Blacklight::Configuration.new
7
+ end
8
+
9
+ before do
10
+ view.stub(blacklight_config: blacklight_config)
11
+ end
12
+
13
+ it "should not display the group when there's only one option" do
14
+ blacklight_config.stub document_index_view_types: ['a']
15
+ render partial: 'catalog/view_type_group'
16
+ expect(rendered).to be_empty
17
+ end
18
+
19
+ it "should display the group" do
20
+ blacklight_config.stub document_index_view_types: ['a', 'b', 'c']
21
+ render partial: 'catalog/view_type_group'
22
+ expect(rendered).to have_selector('.btn-group.view-type-group')
23
+ expect(rendered).to have_selector('.view-type-a', :text => 'A')
24
+ expect(rendered).to have_selector('.view-type-b', :text => 'B')
25
+ expect(rendered).to have_selector('.view-type-c', :text => 'C')
26
+ end
27
+
28
+
29
+ it "should set the current view to 'active'" do
30
+ blacklight_config.stub document_index_view_types: ['a', 'b']
31
+ render partial: 'catalog/view_type_group'
32
+ expect(rendered).to have_selector('.active', :text => 'A')
33
+ expect(rendered).to_not have_selector('.active', :text => 'B')
34
+ expect(rendered).to have_selector('.btn', :text => 'B')
35
+ end
36
+
37
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0.pre2
4
+ version: 5.0.0.pre3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rochkind
@@ -17,7 +17,7 @@ authors:
17
17
  autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
- date: 2014-01-16 00:00:00.000000000 Z
20
+ date: 2014-01-30 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails
@@ -242,7 +242,6 @@ files:
242
242
  - app/assets/stylesheets/blacklight/blacklight_defaults.css.scss
243
243
  - app/controllers/bookmarks_controller.rb
244
244
  - app/controllers/catalog_controller.rb
245
- - app/controllers/feedback_controller.rb
246
245
  - app/controllers/saved_searches_controller.rb
247
246
  - app/controllers/search_history_controller.rb
248
247
  - app/helpers/blacklight/blacklight_helper_behavior.rb
@@ -300,6 +299,7 @@ files:
300
299
  - app/views/catalog/_sort_and_per_page.html.erb
301
300
  - app/views/catalog/_sort_widget.html.erb
302
301
  - app/views/catalog/_thumbnail_default.html.erb
302
+ - app/views/catalog/_view_type_group.html.erb
303
303
  - app/views/catalog/_zero_results.html.erb
304
304
  - app/views/catalog/citation.html.erb
305
305
  - app/views/catalog/citation.js.erb
@@ -318,8 +318,6 @@ files:
318
318
  - app/views/catalog/show.refworks.erb
319
319
  - app/views/catalog/sms.html.erb
320
320
  - app/views/catalog/sms_sent.html.erb
321
- - app/views/feedback/complete.html.erb
322
- - app/views/feedback/show.html.erb
323
321
  - app/views/kaminari/blacklight/_first_page.html.erb
324
322
  - app/views/kaminari/blacklight/_gap.html.erb
325
323
  - app/views/kaminari/blacklight/_last_page.html.erb
@@ -450,6 +448,7 @@ files:
450
448
  - spec/models/search_spec.rb
451
449
  - spec/models/solr_document_spec.rb
452
450
  - spec/routing/catalog_routing_spec.rb
451
+ - spec/routing/routes_spec.rb
453
452
  - spec/spec.opts
454
453
  - spec/spec_helper.rb
455
454
  - spec/support/features.rb
@@ -458,16 +457,21 @@ files:
458
457
  - spec/test_app_templates/Gemfile.extra
459
458
  - spec/test_app_templates/lib/generators/test_app_generator.rb
460
459
  - spec/test_app_templates/lib/tasks/blacklight_test_app.rake
460
+ - spec/views/catalog/_constraints.html.erb_spec.rb
461
461
  - spec/views/catalog/_constraints_element.html.erb_spec.rb
462
462
  - spec/views/catalog/_document.html.erb_spec.rb
463
463
  - spec/views/catalog/_document_list.html.erb_spec.rb
464
+ - spec/views/catalog/_facet_layout.html.erb_spec.rb
464
465
  - spec/views/catalog/_facets.html.erb_spec.rb
465
466
  - spec/views/catalog/_index_default.erb_spec.rb
467
+ - spec/views/catalog/_index_header_default.html.erb_spec.rb
466
468
  - spec/views/catalog/_paginate_compact.html.erb_spec.rb
467
469
  - spec/views/catalog/_search_header.erb_spec.rb
468
470
  - spec/views/catalog/_show_default.erb_spec.rb
469
471
  - spec/views/catalog/_show_sidebar.erb_spec.rb
472
+ - spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
470
473
  - spec/views/catalog/_thumbnail_default.erb_spec.rb
474
+ - spec/views/catalog/_view_type_group.html.erb_spec.rb
471
475
  - spec/views/catalog/index.atom.builder_spec.rb
472
476
  - spec/views/catalog/index.html.erb_spec.rb
473
477
  - spec/views/catalog/show.html.erb_spec.rb
@@ -546,6 +550,7 @@ test_files:
546
550
  - spec/models/search_spec.rb
547
551
  - spec/models/solr_document_spec.rb
548
552
  - spec/routing/catalog_routing_spec.rb
553
+ - spec/routing/routes_spec.rb
549
554
  - spec/spec.opts
550
555
  - spec/spec_helper.rb
551
556
  - spec/support/features.rb
@@ -554,16 +559,21 @@ test_files:
554
559
  - spec/test_app_templates/Gemfile.extra
555
560
  - spec/test_app_templates/lib/generators/test_app_generator.rb
556
561
  - spec/test_app_templates/lib/tasks/blacklight_test_app.rake
562
+ - spec/views/catalog/_constraints.html.erb_spec.rb
557
563
  - spec/views/catalog/_constraints_element.html.erb_spec.rb
558
564
  - spec/views/catalog/_document.html.erb_spec.rb
559
565
  - spec/views/catalog/_document_list.html.erb_spec.rb
566
+ - spec/views/catalog/_facet_layout.html.erb_spec.rb
560
567
  - spec/views/catalog/_facets.html.erb_spec.rb
561
568
  - spec/views/catalog/_index_default.erb_spec.rb
569
+ - spec/views/catalog/_index_header_default.html.erb_spec.rb
562
570
  - spec/views/catalog/_paginate_compact.html.erb_spec.rb
563
571
  - spec/views/catalog/_search_header.erb_spec.rb
564
572
  - spec/views/catalog/_show_default.erb_spec.rb
565
573
  - spec/views/catalog/_show_sidebar.erb_spec.rb
574
+ - spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
566
575
  - spec/views/catalog/_thumbnail_default.erb_spec.rb
576
+ - spec/views/catalog/_view_type_group.html.erb_spec.rb
567
577
  - spec/views/catalog/index.atom.builder_spec.rb
568
578
  - spec/views/catalog/index.html.erb_spec.rb
569
579
  - spec/views/catalog/show.html.erb_spec.rb
@@ -1,38 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
- class FeedbackController < ApplicationController
3
-
4
- # http://expressica.com/simple_captcha/
5
- # include SimpleCaptcha::ControllerHelpers
6
-
7
- # show the feedback form
8
- def show
9
- @errors=[]
10
- if request.post?
11
- if validate
12
- Notifier.feedback(params)
13
- redirect_to feedback_complete_path
14
- end
15
- end
16
- end
17
-
18
- protected
19
-
20
- # validates the incoming params
21
- # returns either an empty array or an array with error messages
22
- def validate
23
- unless params[:name] =~ /\w+/
24
- @errors << I18n.t('blacklight.feedback.valid_name')
25
- end
26
- unless params[:email] =~ /\w+@\w+\.\w+/
27
- @errors << I18n.t('blacklight.feedback.valid_email')
28
- end
29
- unless params[:message] =~ /\w+/
30
- @errors << I18n.t('blacklight.feedback.need_message')
31
- end
32
- #unless simple_captcha_valid?
33
- # @errors << 'Captcha did not match'
34
- #end
35
- @errors.empty?
36
- end
37
-
38
- end
@@ -1,5 +0,0 @@
1
- <div id="content" class="col-md-9">
2
- <h1><%= t('blacklight.feedback.complete.title') %></h1>
3
-
4
- <%= link_to t('blacklight.back_to_search'), catalog_index_path %>
5
- </div>
@@ -1,22 +0,0 @@
1
- <div id="content" class="col-md-9">
2
- <h1>Send Us Feedback</h1>
3
-
4
- <% unless @errors.empty? %>
5
- <strong><%= t('blacklight.feedback.errors.title') %></strong>
6
- <ul class="errors">
7
- <% @errors.each do |msg| %>
8
- <li><%= msg %></li>
9
- <% end %>
10
- </ul>
11
- <% end %>
12
-
13
- <%= form_tag do %>
14
- <fieldset>
15
- <%= label_tag t('active_record.attributes.feedback.name') %> <%= text_field_tag :name, params[:name] %>
16
- <%= label_tag t('active_record.attributes.feedback.email') %> <%= text_field_tag :email, params[:email] %>
17
- <%= label_tag t('active_record.attributes.feedback.message') %> <%= text_area_tag :message, params[:message] %>
18
-
19
- <%= label_tag '' %><%= submit_tag t('blacklight.feedback.submit') %>
20
- </fieldset>
21
- <% end %>
22
- </div>