blacklight 4.9.0 → 5.0.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (260) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -1
  3. data/.travis.yml +22 -12
  4. data/Gemfile +3 -40
  5. data/LICENSE +1 -2
  6. data/README.md +1 -2
  7. data/Rakefile +0 -4
  8. data/VERSION +1 -1
  9. data/app/assets/images/blacklight/logo.png +0 -0
  10. data/app/assets/javascripts/blacklight/ajax_modal.js +190 -0
  11. data/app/assets/javascripts/blacklight/blacklight.js +7 -17
  12. data/app/assets/javascripts/blacklight/checkbox_submit.js +1 -1
  13. data/app/assets/stylesheets/blacklight/{_blacklight_base.scss → _blacklight_base.css.scss} +0 -21
  14. data/app/assets/stylesheets/blacklight/_bookmark.css.scss +4 -0
  15. data/app/assets/stylesheets/blacklight/_catalog.css.scss +192 -0
  16. data/app/assets/stylesheets/blacklight/_facets.css.scss +141 -0
  17. data/app/assets/stylesheets/blacklight/{_group.scss → _group.css.scss} +1 -1
  18. data/app/assets/stylesheets/blacklight/_header.css.scss +44 -0
  19. data/app/assets/stylesheets/blacklight/_layout.css.scss +5 -0
  20. data/app/assets/stylesheets/blacklight/{_modal.scss → _modal.css.scss} +7 -7
  21. data/app/assets/stylesheets/blacklight/_search_history.css.scss +20 -0
  22. data/app/assets/stylesheets/blacklight/{blacklight.scss → blacklight.css.scss} +0 -0
  23. data/app/assets/stylesheets/blacklight/blacklight_defaults.css.scss +14 -0
  24. data/app/controllers/bookmarks_controller.rb +0 -4
  25. data/app/controllers/feedback_controller.rb +0 -4
  26. data/app/helpers/blacklight/blacklight_helper_behavior.rb +45 -155
  27. data/app/helpers/blacklight/catalog_helper_behavior.rb +8 -41
  28. data/app/helpers/blacklight/facets_helper_behavior.rb +20 -43
  29. data/app/helpers/blacklight/hash_as_hidden_fields_helper_behavior.rb +2 -9
  30. data/app/helpers/blacklight/render_constraints_helper_behavior.rb +9 -14
  31. data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +6 -6
  32. data/app/views/_flash_msg.html.erb +9 -2
  33. data/app/views/_user_util_links.html.erb +29 -15
  34. data/app/views/bookmarks/_tools.html.erb +4 -7
  35. data/app/views/bookmarks/index.html.erb +3 -2
  36. data/app/views/catalog/_citation.html.erb +1 -1
  37. data/app/views/catalog/_constraints.html.erb +1 -1
  38. data/app/views/catalog/_constraints_element.html.erb +12 -8
  39. data/app/views/catalog/_did_you_mean.html.erb +2 -2
  40. data/app/views/catalog/_document_header.html.erb +3 -3
  41. data/app/views/catalog/_email_form.html.erb +10 -10
  42. data/app/views/catalog/_facet_layout.html.erb +11 -3
  43. data/app/views/catalog/_facet_limit.html.erb +7 -7
  44. data/app/views/catalog/_facet_pagination.html.erb +8 -7
  45. data/app/views/catalog/_facet_pivot.html.erb +3 -1
  46. data/app/views/catalog/_facets.html.erb +12 -9
  47. data/app/views/catalog/_paginate_compact.html.erb +1 -7
  48. data/app/views/catalog/_per_page_widget.html.erb +5 -8
  49. data/app/views/catalog/_previous_next_doc.html.erb +11 -9
  50. data/app/views/catalog/_refworks_form.html.erb +3 -4
  51. data/app/views/catalog/_results_pagination.html.erb +1 -1
  52. data/app/views/catalog/_search_form.html.erb +16 -14
  53. data/app/views/catalog/_show_sidebar.html.erb +7 -9
  54. data/app/views/catalog/_show_tools.html.erb +13 -7
  55. data/app/views/catalog/_sms_form.html.erb +8 -8
  56. data/app/views/catalog/_sort_and_per_page.html.erb +4 -6
  57. data/app/views/catalog/_sort_widget.html.erb +5 -6
  58. data/app/views/catalog/email.html.erb +1 -1
  59. data/app/views/catalog/facet.html.erb +2 -8
  60. data/app/views/catalog/index.html.erb +11 -6
  61. data/app/views/catalog/show.html.erb +5 -5
  62. data/app/views/catalog/sms.html.erb +1 -1
  63. data/app/views/catalog/sms_sent.html.erb +1 -1
  64. data/app/views/feedback/complete.html.erb +2 -2
  65. data/app/views/feedback/show.html.erb +1 -1
  66. data/app/views/kaminari/blacklight/_paginator.html.erb +1 -1
  67. data/app/views/kaminari/blacklight_compact/_paginator.html.erb +25 -5
  68. data/app/views/layouts/blacklight.html.erb +23 -23
  69. data/app/views/saved_searches/index.html.erb +2 -2
  70. data/app/views/search_history/index.html.erb +5 -7
  71. data/app/views/shared/_header_navbar.html.erb +23 -23
  72. data/blacklight.gemspec +10 -13
  73. data/config/locales/blacklight.en.yml +1 -12
  74. data/config/locales/blacklight.fr.yml +1 -12
  75. data/gemfiles/rails3.gemfile +21 -0
  76. data/gemfiles/rails4.gemfile +20 -0
  77. data/lib/blacklight.rb +0 -8
  78. data/lib/blacklight/base.rb +0 -2
  79. data/lib/blacklight/catalog.rb +6 -32
  80. data/lib/blacklight/catalog/search_context.rb +8 -48
  81. data/lib/blacklight/configurable.rb +2 -1
  82. data/lib/blacklight/configuration.rb +1 -2
  83. data/lib/blacklight/configuration/facet_field.rb +0 -2
  84. data/lib/blacklight/engine.rb +3 -3
  85. data/lib/blacklight/legacy_controller_methods.rb +1 -64
  86. data/lib/blacklight/rails/routes.rb +17 -0
  87. data/lib/blacklight/routes.rb +46 -40
  88. data/lib/blacklight/solr.rb +1 -0
  89. data/lib/blacklight/solr/document.rb +21 -42
  90. data/lib/blacklight/solr/facet_paginator.rb +30 -54
  91. data/lib/blacklight/solr/request.rb +45 -0
  92. data/lib/blacklight/solr_helper.rb +16 -53
  93. data/lib/blacklight/solr_response.rb +0 -6
  94. data/lib/blacklight/user.rb +2 -7
  95. data/lib/blacklight/utils.rb +1 -9
  96. data/lib/generators/blacklight/assets_generator.rb +0 -14
  97. data/lib/generators/blacklight/blacklight_generator.rb +17 -14
  98. data/lib/generators/blacklight/templates/blacklight.css.scss +3 -0
  99. data/lib/generators/blacklight/templates/catalog_controller.rb +4 -1
  100. data/lib/railties/blacklight.rake +3 -1
  101. data/solr/sample_solr_documents.yml +641 -0
  102. data/spec/controllers/application_controller_spec.rb +5 -21
  103. data/spec/controllers/bookmarks_controller_spec.rb +11 -11
  104. data/spec/controllers/catalog_controller_spec.rb +122 -119
  105. data/spec/controllers/search_history_controller_spec.rb +8 -8
  106. data/spec/features/alternate_controller_spec.rb +5 -5
  107. data/spec/features/facets_spec.rb +9 -0
  108. data/spec/features/record_view_spec.rb +1 -1
  109. data/spec/features/search_filters_spec.rb +97 -41
  110. data/spec/features/search_results_spec.rb +14 -17
  111. data/spec/features/search_sort_spec.rb +1 -1
  112. data/spec/helpers/blacklight_helper_spec.rb +170 -285
  113. data/spec/helpers/catalog_helper_spec.rb +57 -96
  114. data/spec/helpers/facets_helper_spec.rb +130 -152
  115. data/spec/helpers/hash_as_hidden_fields_spec.rb +9 -15
  116. data/spec/helpers/render_constraints_helper_spec.rb +5 -5
  117. data/spec/helpers/search_history_constraints_helper_spec.rb +21 -21
  118. data/spec/lib/blacklight/routes_spec.rb +25 -0
  119. data/spec/lib/blacklight/solr/request_spec.rb +37 -0
  120. data/spec/lib/blacklight/solr_response/group_response_spec.rb +2 -2
  121. data/spec/lib/blacklight_configurable_spec.rb +16 -16
  122. data/spec/lib/blacklight_configuration_spec.rb +132 -132
  123. data/spec/lib/blacklight_email_spec.rb +4 -4
  124. data/spec/lib/blacklight_sms_spec.rb +4 -4
  125. data/spec/lib/blacklight_solr_document_dublin_core_spec.rb +6 -6
  126. data/spec/lib/blacklight_solr_document_more_like_this_spec.rb +4 -4
  127. data/spec/lib/blacklight_solr_document_spec.rb +36 -36
  128. data/spec/lib/blacklight_solr_response_spec.rb +43 -48
  129. data/spec/lib/blacklight_spec.rb +6 -14
  130. data/spec/lib/blacklight_user_spec.rb +5 -9
  131. data/spec/lib/facet_paginator_spec.rb +59 -51
  132. data/spec/lib/search_fields_spec.rb +13 -13
  133. data/spec/lib/solr_helper_spec.rb +258 -304
  134. data/spec/lib/tasks/blacklight_task_spec.rb +1 -1
  135. data/spec/lib/utils_spec.rb +16 -46
  136. data/spec/models/bookmark_spec.rb +6 -7
  137. data/spec/models/record_mailer_spec.rb +16 -16
  138. data/spec/models/search_spec.rb +8 -8
  139. data/spec/models/solr_document_spec.rb +6 -77
  140. data/spec/routing/catalog_routing_spec.rb +16 -10
  141. data/spec/spec_helper.rb +7 -7
  142. data/spec/support/assert_difference.rb +2 -2
  143. data/spec/support/features.rb +0 -11
  144. data/spec/support/features/session_helpers.rb +3 -3
  145. data/spec/support/include_text.rb +2 -2
  146. data/spec/test_app_templates/Gemfile.extra +10 -2
  147. data/spec/test_app_templates/lib/generators/test_app_generator.rb +12 -18
  148. data/spec/views/catalog/_constraints_element.html.erb_spec.rb +13 -13
  149. data/spec/views/catalog/_document.html.erb_spec.rb +1 -1
  150. data/spec/views/catalog/_document_list.html.erb_spec.rb +1 -1
  151. data/spec/views/catalog/_facets.html.erb_spec.rb +13 -14
  152. data/spec/views/catalog/_index_default.erb_spec.rb +21 -21
  153. data/spec/views/catalog/_search_header.erb_spec.rb +1 -1
  154. data/spec/views/catalog/_show_default.erb_spec.rb +21 -21
  155. data/spec/views/catalog/_show_sidebar.erb_spec.rb +7 -7
  156. data/spec/views/catalog/_thumbnail_default.erb_spec.rb +3 -3
  157. data/spec/views/catalog/index.atom.builder_spec.rb +29 -29
  158. data/spec/views/catalog/index.html.erb_spec.rb +6 -7
  159. data/tasks/blacklight.rake +8 -2
  160. metadata +84 -180
  161. data/app/assets/javascripts/blacklight/css_dropdowns.js +0 -10
  162. data/app/assets/javascripts/blacklight/facet_expand_contract.js +0 -41
  163. data/app/assets/javascripts/blacklight/lightbox_dialog.js +0 -70
  164. data/app/assets/javascripts/blacklight/select_submit.js +0 -27
  165. data/app/assets/javascripts/blacklight/zebra_stripe.js +0 -13
  166. data/app/assets/javascripts/improved-modal/bootstrap-modal.js +0 -355
  167. data/app/assets/javascripts/improved-modal/bootstrap-modalmanager.js +0 -370
  168. data/app/assets/stylesheets/blacklight/_bookmark.scss +0 -33
  169. data/app/assets/stylesheets/blacklight/_catalog.scss +0 -255
  170. data/app/assets/stylesheets/blacklight/_dropdown.scss +0 -57
  171. data/app/assets/stylesheets/blacklight/_facets.scss +0 -197
  172. data/app/assets/stylesheets/blacklight/_footer.scss +0 -0
  173. data/app/assets/stylesheets/blacklight/_header.scss +0 -53
  174. data/app/assets/stylesheets/blacklight/_layout.scss +0 -10
  175. data/app/assets/stylesheets/blacklight/_mixins.scss +0 -0
  176. data/app/assets/stylesheets/blacklight/_print.scss +0 -0
  177. data/app/assets/stylesheets/blacklight/_responsive.scss +0 -3
  178. data/app/assets/stylesheets/blacklight/_search_history.scss +0 -42
  179. data/app/assets/stylesheets/blacklight/blacklight_defaults.scss +0 -49
  180. data/app/assets/stylesheets/blacklight/responsive_partials/_catalog.scss +0 -5
  181. data/app/assets/stylesheets/blacklight/responsive_partials/_facets.scss +0 -37
  182. data/app/assets/stylesheets/blacklight/responsive_partials/_header.scss +0 -30
  183. data/app/assets/stylesheets/improved-modal/bootstrap-modal.css +0 -217
  184. data/app/helpers/blacklight/html_head_helper_behavior.rb +0 -118
  185. data/app/helpers/html_head_helper.rb +0 -3
  186. data/app/views/catalog/_bookmark_form.html.erb +0 -7
  187. data/app/views/catalog/_marc_view.html.erb +0 -32
  188. data/app/views/catalog/librarian_view.html.erb +0 -10
  189. data/config/routes.rb +0 -17
  190. data/doc/Atom-Responses.md +0 -90
  191. data/doc/Blacklight-3.0-Release-Notes-And-Upgrade-Guide.md +0 -107
  192. data/doc/Blacklight-3.2-Release-Notes-and-Upgrade-Guide.md +0 -191
  193. data/doc/Blacklight-3.3-release-notes-and-upgrade-guide.md +0 -37
  194. data/doc/Blacklight-3.4-release-notes-and-upgrade-guide.md +0 -27
  195. data/doc/Blacklight-3.5-release-notes-and-upgrade-guide.md +0 -44
  196. data/doc/Blacklight-3.6-release-notes-and-upgrade-guide.md +0 -25
  197. data/doc/Blacklight-3.7-release-notes-and-upgrade-guide.md +0 -80
  198. data/doc/Blacklight-3.8-release-notes-and-upgrade-guide.md +0 -11
  199. data/doc/Blacklight-4.0-release-notes-and-upgrade-guide.md +0 -135
  200. data/doc/Blacklight-4.1-release-notes-and-upgrade-guide.md +0 -17
  201. data/doc/Blacklight-4.2-release-notes-and-upgrade-guide.md +0 -25
  202. data/doc/Blacklight-4.3-release-notes-and-upgrade-guide.md +0 -21
  203. data/doc/Blacklight-4.4-release-notes-and-upgrade-guide.md +0 -41
  204. data/doc/Blacklight-Add-ons.md +0 -28
  205. data/doc/Blacklight-configuration.md +0 -411
  206. data/doc/Blacklight-on-Heroku.md +0 -135
  207. data/doc/Code4Lib-2014.md +0 -48
  208. data/doc/Community-principles.md +0 -44
  209. data/doc/Configuring-and-Customizing-Blacklight.md +0 -271
  210. data/doc/Configuring-rails-routes.md +0 -13
  211. data/doc/Contributing-to-Blacklight.md +0 -25
  212. data/doc/Examples.md +0 -94
  213. data/doc/Extending-or-Modifying-Blacklight-Search-Behavior.md +0 -141
  214. data/doc/FAQs.md +0 -1
  215. data/doc/Home.md +0 -80
  216. data/doc/How-to-release-a-version.md +0 -29
  217. data/doc/Indexing-your-data-into-solr.md +0 -32
  218. data/doc/Integration-with-Rails-Footnotes.md +0 -20
  219. data/doc/Internationalization.md +0 -32
  220. data/doc/JSON-API.md +0 -17
  221. data/doc/Pagination.md +0 -51
  222. data/doc/Providing-your-own-view-templates.md +0 -109
  223. data/doc/Quickstart.md +0 -115
  224. data/doc/README_SOLR.md +0 -245
  225. data/doc/Release-Notes-And-Upgrade-Guides.md +0 -20
  226. data/doc/Roadmap.md +0 -43
  227. data/doc/Sunspot-for-indexing.md +0 -46
  228. data/doc/Theming.md +0 -64
  229. data/doc/User-Authentication.md +0 -60
  230. data/doc/testing.md +0 -57
  231. data/lib/SolrMarc.jar +0 -0
  232. data/lib/blacklight/mash.rb +0 -19
  233. data/lib/blacklight/solr/document/marc.rb +0 -71
  234. data/lib/blacklight/solr/document/marc_export.rb +0 -590
  235. data/lib/generators/blacklight/marc_generator.rb +0 -66
  236. data/lib/generators/blacklight/templates/blacklight.scss +0 -4
  237. data/lib/generators/blacklight/templates/config/SolrMarc/config-test.properties +0 -37
  238. data/lib/generators/blacklight/templates/config/SolrMarc/config.properties +0 -37
  239. data/lib/generators/blacklight/templates/config/SolrMarc/index.properties +0 -97
  240. data/lib/generators/blacklight/templates/config/SolrMarc/index_scripts/dewey.bsh +0 -47
  241. data/lib/generators/blacklight/templates/config/SolrMarc/index_scripts/format.bsh +0 -126
  242. data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/README_MAPS +0 -1
  243. data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/callnumber_map.properties +0 -407
  244. data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/composition_era_map.properties +0 -56
  245. data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/country_map.properties +0 -379
  246. data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/format_map.properties +0 -50
  247. data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/instrument_map.properties +0 -101
  248. data/lib/generators/blacklight/templates/config/SolrMarc/translation_maps/language_map.properties +0 -490
  249. data/lib/railties/solr_marc.rake +0 -162
  250. data/spec/data/test_data.utf8.mrc +0 -1
  251. data/spec/features/librarian_view_spec.rb +0 -13
  252. data/spec/helpers/html_head_helper_spec.rb +0 -164
  253. data/spec/lib/blacklight_solr_document_marc_spec.rb +0 -89
  254. data/spec/lib/marc_export_spec.rb +0 -746
  255. data/spec/lib/tasks/solr_marc_task_spec.rb +0 -60
  256. data/spec/requests/alternate_controller_spec.rb +0 -16
  257. data/spec/routing/routes_spec.rb +0 -20
  258. data/spec/views/catalog/_constraints.html.erb_spec.rb +0 -33
  259. data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +0 -49
  260. data/test_support/data/test_data.utf8.mrc +0 -1
@@ -1,15 +1,10 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Blacklight::CatalogHelperBehavior
3
3
 
4
- extend Deprecation
5
- self.deprecation_horizon = 'Blacklight 5.x'
6
-
7
4
  # Pass in an RSolr::Response (or duck-typed similar) object,
8
5
  # it translates to a Kaminari-paginatable
9
6
  # object, with the keys Kaminari views expect.
10
7
  def paginate_params(response)
11
- Deprecation.warn Blacklight::CatalogHelperBehavior, "#paginate_params is deprecated; the original response object is Kaminari-compatible"
12
-
13
8
  response
14
9
  end
15
10
 
@@ -19,51 +14,25 @@ module Blacklight::CatalogHelperBehavior
19
14
  # kaminari paginate, passed on through.
20
15
  # will output HTML pagination controls.
21
16
  def paginate_rsolr_response(response, options = {}, &block)
22
- Deprecation.warn Blacklight::CatalogHelperBehavior, "#paginate_rsolr_response is deprecated; the original response object is Kaminari-compatible"
23
17
  paginate response, options, &block
24
18
  end
25
19
 
26
20
  #
27
21
  # shortcut for built-in Rails helper, "number_with_delimiter"
28
22
  #
29
- def format_num(num)
30
- Deprecation.warn Blacklight::CatalogHelperBehavior, "#format_num is deprecated; use e.g. #number_with_delimiter directly"
31
- number_with_delimiter(num)
32
- end
33
-
34
- #
35
- # Pass in an RSolr::Response. Displays the "showing X through Y of N" message.
36
- def render_pagination_info(response, options = {})
37
- Deprecation.silence(Blacklight::CatalogHelperBehavior) do
38
- entry_name = options[:entry_name] || t('blacklight.entry_name.default')
39
-
40
- end_num = if render_grouped_response?
41
- number_with_delimiter(response.start + response.groups.length)
42
- else
43
- number_with_delimiter(response.start + response.docs.length)
44
- end
45
-
46
- case response.total_count
47
- when 0; t('blacklight.search.pagination_info.no_items_found', :entry_name => entry_name.pluralize ).html_safe
48
- when 1; t('blacklight.search.pagination_info.single_item_found', :entry_name => entry_name).html_safe
49
- else; t('blacklight.search.pagination_info.pages', :entry_name => entry_name.pluralize, :current_page => response.current_page, :num_pages => response.total_pages, :start_num => format_num(response.start + 1) , :end_num => end_num, :total_num => response.total_count, :count => response.total_pages).html_safe
50
- end
51
- end
52
- end
53
- deprecation_deprecate :render_pagination_info
23
+ def format_num(num); number_with_delimiter(num) end
54
24
 
55
25
  # Override the Kaminari page_entries_info helper with our own, blacklight-aware
56
26
  # implementation
57
27
  #
58
28
  # Pass in an RSolr::Response. Displays the "showing X through Y of N" message.
59
-
60
29
  def page_entries_info(collection, options = {})
61
30
  entry_name = if options[:entry_name]
62
31
  options[:entry_name]
63
32
  elsif collection.respond_to? :model # DataMapper
64
- collection.model.model_name.human.downcase
33
+ collection.model.model_name.humanize.downcase
65
34
  elsif collection.respond_to? :model_name and !collection.model_name.nil? # AR, Blacklight::PaginationMethods
66
- collection.model_name.human.downcase
35
+ collection.model_name.humanize.downcase
67
36
  elsif collection.is_a?(::Kaminari::PaginatableArray)
68
37
  'entry'
69
38
  else
@@ -80,19 +49,18 @@ module Blacklight::CatalogHelperBehavior
80
49
  end
81
50
 
82
51
  end_num = if collection.offset_value + end_num <= collection.total_count
83
- collection.offset_value + end_num
52
+ format_num(collection.offset_value + end_num)
84
53
  else
85
- collection.total_count
54
+ format_num(collection.total_count)
86
55
  end
87
56
 
88
57
  case collection.total_count
89
58
  when 0; t('blacklight.search.pagination_info.no_items_found', :entry_name => entry_name ).html_safe
90
59
  when 1; t('blacklight.search.pagination_info.single_item_found', :entry_name => entry_name).html_safe
91
- else; t('blacklight.search.pagination_info.pages', :entry_name => entry_name, :current_page => collection.current_page, :num_pages => collection.total_pages, :start_num => number_with_delimiter(collection.offset_value + 1) , :end_num => number_with_delimiter(end_num), :total_num => number_with_delimiter(collection.total_count), :count => collection.total_pages).html_safe
60
+ else; t('blacklight.search.pagination_info.pages', :entry_name => entry_name, :current_page => collection.current_page, :num_pages => collection.total_pages, :start_num => format_num(collection.offset_value + 1) , :end_num => end_num, :total_num => collection.total_count, :count => collection.total_pages).html_safe
92
61
  end
93
62
  end
94
63
 
95
-
96
64
  def document_counter_with_offset idx
97
65
  unless render_grouped_response?
98
66
  idx + 1 + @response.params[:start].to_i
@@ -105,7 +73,7 @@ module Blacklight::CatalogHelperBehavior
105
73
  # Code should call this method rather than interrogating session directly,
106
74
  # because implementation of where this data is stored/retrieved may change.
107
75
  def item_page_entry_info
108
- t('blacklight.search.entry_pagination_info.other', :current => number_with_delimiter(search_session['counter']), :total => number_with_delimiter(search_session['total']), :count => search_session['total'].to_i).html_safe
76
+ t('blacklight.search.entry_pagination_info.other', :current => format_num(search_session[:counter]), :total => format_num(search_session[:total]), :count => search_session[:total].to_i).html_safe
109
77
  end
110
78
 
111
79
  # Look up search field user-displayable label
@@ -179,7 +147,6 @@ module Blacklight::CatalogHelperBehavior
179
147
  end
180
148
 
181
149
  def response_has_no_search_results?
182
- Deprecation.warn(Blacklight::CatalogHelperBehavior, "#response_has_no_search_results? is deprecated; use Response#empty? to check instead")
183
- @response.empty?
150
+ @response.total == 0
184
151
  end
185
152
  end
@@ -1,27 +1,16 @@
1
1
  module Blacklight::FacetsHelperBehavior
2
2
 
3
- extend Deprecation
4
- self.deprecation_horizon = 'Blacklight 5.x'
5
-
6
-
7
3
  include Blacklight::Facet
8
4
 
9
- # used in the catalog/_facets partial
10
- def facet_field_labels
11
- # DEPRECATED
12
- Hash[*blacklight_config.facet_fields.map { |key, facet| [key, facet.label] }.flatten]
13
- end
14
-
15
-
16
5
  def has_facet_values? fields = facet_field_names, options = {}
17
6
  facets_from_request(fields).any? { |display_facet| !display_facet.items.empty? }
18
7
  end
19
8
 
20
9
  # Render a collection of facet fields
21
10
  def render_facet_partials fields = facet_field_names, options = {}
22
- facets_from_request(fields).map do |display_facet|
11
+ safe_join(facets_from_request(fields).map do |display_facet|
23
12
  render_facet_limit(display_facet, options)
24
- end.compact.join("\n").html_safe
13
+ end.compact, "\n".html_safe)
25
14
  end
26
15
 
27
16
 
@@ -34,17 +23,12 @@ module Blacklight::FacetsHelperBehavior
34
23
  # @param [Hash] options parameters to use for rendering the facet limit partial
35
24
  #
36
25
  def render_facet_limit(display_facet, options = {})
37
- if display_facet.is_a? String or display_facet.is_a? Symbol
38
- Deprecation.warn(Blacklight::FacetsHelperBehavior, "Blacklight::FacetsHelper#render_facet_limit: use #render_facet_partials to render facets by field name")
39
- return render_facet_partials([display_facet])
40
- end
41
26
  return if not should_render_facet?(display_facet)
42
27
  options = options.dup
43
28
  options[:partial] ||= facet_partial_name(display_facet)
44
29
  options[:layout] ||= "facet_layout" unless options.has_key?(:layout)
45
30
  options[:locals] ||= {}
46
31
  options[:locals][:solr_field] ||= display_facet.name
47
- options[:locals][:solr_fname] ||= display_facet.name # DEPRECATED
48
32
  options[:locals][:facet_field] ||= facet_configuration_for_field(display_facet.name)
49
33
  options[:locals][:display_facet] ||= display_facet
50
34
 
@@ -58,23 +42,7 @@ module Blacklight::FacetsHelperBehavior
58
42
  # @param [Blacklight::SolrResponse::Facets::FacetField] display_facet
59
43
  def should_render_facet? display_facet
60
44
  # display when show is nil or true
61
- facet_config = facet_configuration_for_field(display_facet.name)
62
-
63
- display = case facet_config.show
64
- when Symbol
65
- arity = method(facet_config.show).arity
66
-
67
- if arity == 0
68
- send(facet_config.show)
69
- else
70
- send(facet_config.show, display_facet)
71
- end
72
- when Proc
73
- facet_config.show.call self, facet_config, display_facet
74
- else
75
- facet_config.show
76
- end
77
-
45
+ display = facet_configuration_for_field(display_facet.name).show != false
78
46
  return display && display_facet.items.present?
79
47
  end
80
48
 
@@ -96,23 +64,33 @@ module Blacklight::FacetsHelperBehavior
96
64
  # a link to add that to your restrictions, with count in parens.
97
65
  # first arg item is a facet value item from rsolr-ext.
98
66
  # options consist of:
99
- # :suppress_link => true # do not make it a link, used for an already selected value for instance
67
+ # :suppress_link => true # do not make it a link
68
+ # :route_set => my_engine # call link_to on engine routes.
100
69
  def render_facet_value(facet_solr_field, item, options ={})
101
- (link_to_unless(options[:suppress_link], facet_display_value(facet_solr_field, item), add_facet_params_and_redirect(facet_solr_field, item), :class=>"facet_select") + " " + render_facet_count(item.hits)).html_safe
70
+ scope = options.delete(:route_set) || self
71
+ path = scope.url_for(add_facet_params_and_redirect(facet_solr_field, item).merge(only_path: true))
72
+ content_tag(:span, :class => "facet-label") do
73
+ link_to_unless(options[:suppress_link], facet_display_value(facet_solr_field, item), path, :class=>"facet_select")
74
+ end + render_facet_count(item.hits)
102
75
  end
103
76
 
104
77
  # Standard display of a SELECTED facet value, no link, special span
105
78
  # with class, and 'remove' button.
106
79
  def render_selected_facet_value(facet_solr_field, item)
107
- #Updated class for Bootstrap Blacklight
108
- content_tag(:span, render_facet_value(facet_solr_field, item, :suppress_link => true), :class => "selected") +
109
- link_to(content_tag(:i, '', :class => "icon-remove") + content_tag(:span, '[remove]', :class => 'hide-text'), remove_facet_params(facet_solr_field, item, params), :class=>"remove")
80
+ content_tag(:span, :class => "facet-label") do
81
+ content_tag(:span, facet_display_value(facet_solr_field, item), :class => "selected") +
82
+ # remove link
83
+ link_to(content_tag(:span, '', :class => "glyphicon glyphicon-remove") + content_tag(:span, '[remove]', :class => 'sr-only'), remove_facet_params(facet_solr_field, item, params), :class=>"remove")
84
+ end + render_facet_count(item.hits, :classes => ["selected"])
110
85
  end
111
86
 
112
87
  # Renders a count value for facet limits. Can be over-ridden locally
113
88
  # to change style. And can be called by plugins to get consistent display.
114
- def render_facet_count(num)
115
- content_tag("span", t('blacklight.search.facets.count', :number => num), :class => "count")
89
+ #
90
+ # option :class takes an array of classes to add to count span.
91
+ def render_facet_count(num, options = {})
92
+ classes = (options[:classes] || []) << "facet-count"
93
+ content_tag("span", t('blacklight.search.facets.count', :number => num), :class => classes)
116
94
  end
117
95
 
118
96
  # adds the value and/or field to params[:f]
@@ -195,7 +173,6 @@ module Blacklight::FacetsHelperBehavior
195
173
  p.delete :commit
196
174
  p[:f][field] = p[:f][field] - [value]
197
175
  p[:f].delete(field) if p[:f][field].size == 0
198
- p.delete(:f) if p[:f].empty?
199
176
  p
200
177
  end
201
178
 
@@ -10,13 +10,11 @@
10
10
  # This is used to serialize a complete current query from current params
11
11
  # to form fields used for sort and change per-page
12
12
  module Blacklight::HashAsHiddenFieldsHelperBehavior
13
- extend Deprecation
14
- self.deprecation_horizon = 'blacklight 5.0'
15
13
 
16
14
  # Writes out zero or more <input type="hidden"> elements, completely
17
15
  # representing a hash passed in using Rails-style request parameters
18
16
  # for hashes nested with arrays and other hashes.
19
- def render_hash_as_hidden_fields(hash)
17
+ def hash_as_hidden_fields(hash)
20
18
 
21
19
  hidden_fields = []
22
20
  flatten_hash(hash).each do |name, value|
@@ -26,12 +24,7 @@ module Blacklight::HashAsHiddenFieldsHelperBehavior
26
24
  end
27
25
  end
28
26
 
29
- hidden_fields.join("\n").html_safe
30
- end
31
-
32
- def hash_as_hidden_fields *args
33
- Deprecation.warn(Blacklight::HashAsHiddenFieldsHelperBehavior, "#hash_as_hidden_fields is deprecated; use #render_hash_as_hidden_fields instead")
34
- render_hash_as_hidden_fields *args
27
+ safe_join(hidden_fields, "\n".html_safe)
35
28
  end
36
29
 
37
30
  protected
@@ -14,7 +14,7 @@ module Blacklight::RenderConstraintsHelperBehavior
14
14
  # Render actual constraints, not including header or footer
15
15
  # info.
16
16
  def render_constraints(localized_params = params)
17
- (render_constraints_query(localized_params) + render_constraints_filters(localized_params)).html_safe
17
+ render_constraints_query(localized_params) + render_constraints_filters(localized_params)
18
18
  end
19
19
 
20
20
  def render_constraints_query(localized_params = params)
@@ -41,22 +41,21 @@ module Blacklight::RenderConstraintsHelperBehavior
41
41
  content = []
42
42
  localized_params[:f].each_pair do |facet,values|
43
43
  content << render_filter_element(facet, values, localized_params)
44
- end
44
+ end
45
45
 
46
- return content.flatten.join("\n").html_safe
46
+ safe_join(content.flatten, "\n".html_safe)
47
47
  end
48
48
 
49
49
  def render_filter_element(facet, values, localized_params)
50
50
  facet_config = facet_configuration_for_field(facet)
51
51
 
52
- values.map do |val|
53
-
54
- render_constraint_element( facet_field_labels[facet],
55
- facet_display_value(facet, val),
52
+ safe_join(values.map do |val|
53
+ render_constraint_element( blacklight_config.facet_fields[facet].label,
54
+ facet_display_value(facet, val),
56
55
  :remove => url_for(remove_facet_params(facet, val, localized_params)),
57
- :classes => ["filter", "filter-" + facet.parameterize]
58
- ) + "\n"
59
- end
56
+ :classes => ["filter", "filter-" + facet.parameterize]
57
+ )
58
+ end, "\n".html_safe)
60
59
  end
61
60
 
62
61
  # Render a label/value constraint on the screen. Can be called
@@ -77,10 +76,6 @@ module Blacklight::RenderConstraintsHelperBehavior
77
76
  # [:escape_value]
78
77
  # default true, HTML escape.
79
78
  def render_constraint_element(label, value, options = {})
80
- if (options[:escape_label] and !label.html_safe?) or (options.has_key?(:escape_value) and !value.html_safe?)
81
- Deprecation.warn(Blacklight::RenderConstraintsHelperBehavior, "Calling #render_constraint_element with :escape_label or :escape_value parameters is deprecated; make sure your values are #html_safe instead")
82
- end
83
-
84
79
  render(:partial => "catalog/constraints_element", :locals => {:label => label, :value => value, :options => options})
85
80
  end
86
81
 
@@ -17,25 +17,25 @@ module Blacklight::SearchHistoryConstraintsHelperBehavior
17
17
  end
18
18
 
19
19
  def render_search_to_s_q(params)
20
- return "".html_safe if params['q'].blank?
20
+ return "".html_safe if params[:q].blank?
21
21
 
22
22
  label = (default_search_field && params[:search_field] == default_search_field[:key]) ?
23
23
  nil :
24
24
  label_for_search_field(params[:search_field])
25
25
 
26
- render_search_to_s_element(label , render_filter_value(params['q']) )
26
+ render_search_to_s_element(label , render_filter_value(params[:q]) )
27
27
  end
28
28
 
29
29
  def render_search_to_s_filters(params)
30
30
  return "".html_safe unless params[:f]
31
31
 
32
- params[:f].collect do |facet_field, value_list|
32
+ safe_join(params[:f].collect do |facet_field, value_list|
33
33
  render_search_to_s_element(facet_configuration_for_field(facet_field).label,
34
- value_list.collect do |value|
34
+ safe_join(value_list.collect do |value|
35
35
  render_filter_value(value, facet_field)
36
- end.join(content_tag(:span, " #{t('blacklight.and')} ", :class =>'filterSeparator')).html_safe
36
+ end, content_tag(:span, " #{t('blacklight.and')} ", :class =>'filterSeparator'))
37
37
  )
38
- end.join(" \n ").html_safe
38
+ end, " \n ".html_safe)
39
39
  end
40
40
 
41
41
  # value can be Array, in which case elements are joined with
@@ -1,8 +1,15 @@
1
1
  <div class="flash_messages">
2
2
  <% [:success, :notice, :error, :alert].each do |type| %>
3
- <%- alert_class = type == :notice ? 'info' : type %>
3
+ <%- alert_class = case type
4
+ when :success then "alert-success"
5
+ when :notice then "alert-info"
6
+ when :alert then "alert-warning"
7
+ when :error then "alert-danger"
8
+ else "alert-#{type}"
9
+ end
10
+ -%>
4
11
  <% if flash[type] %>
5
- <div class="alert alert-<%=alert_class%>"><%= flash[type] %>
12
+ <div class="alert <%=alert_class %>"><%= flash[type] %>
6
13
  <a class="close" data-dismiss="alert" href="#">&times;</a>
7
14
  </div>
8
15
  <% end %>
@@ -1,22 +1,36 @@
1
- <% if has_user_authentication_provider? %>
2
- <div class="util-links-login">
3
- <% if current_user %>
4
- <%= link_to t('blacklight.header_links.logout'), destroy_user_session_path %> <%= "[#{ link_to current_user, edit_user_registration_path }]".html_safe unless current_user.to_s.blank? %>
5
- <% else %>
6
- <%= link_to t('blacklight.header_links.login'), new_user_session_path %>
7
- <% end %>
8
- </div>
9
-
10
- <% end %>
11
-
12
- <div class="util-links-other">
1
+ <div class="navbar-right">
2
+ <ul class="nav navbar-nav">
13
3
  <% if render_bookmarks_control? %>
4
+ <li>
14
5
  <%= link_to t('blacklight.header_links.bookmarks'), bookmarks_path %>
6
+ </li>
15
7
  <% end %>
16
8
  <% if has_user_authentication_provider? and current_user %>
17
- |
9
+ <li>
18
10
  <%= link_to t('blacklight.header_links.saved_searches'), saved_searches_path %>
11
+ </li>
19
12
  <% end %>
20
- |
13
+ <li>
21
14
  <%= link_to t('blacklight.header_links.search_history'), search_history_path %>
22
- </div>
15
+ </li>
16
+ </ul>
17
+
18
+ <% if has_user_authentication_provider? %>
19
+ <ul class="nav navbar-nav">
20
+ <% if current_user %>
21
+ <li>
22
+ <%= link_to t('blacklight.header_links.logout'), destroy_user_session_path %>
23
+ </li>
24
+ <% unless current_user.to_s.blank? -%>
25
+ <li>
26
+ [<%= link_to current_user, edit_user_registration_path %>]
27
+ </li>
28
+ <% end %>
29
+ <% else %>
30
+ <li>
31
+ <%= link_to t('blacklight.header_links.login'), new_user_session_path %>
32
+ </li>
33
+ <% end %>
34
+ </ul>
35
+ <% end %>
36
+ </div>
@@ -1,18 +1,15 @@
1
- <ul class="bookmarkTools">
1
+ <ul class="bookmarkTools nav nav-pills">
2
2
  <li class="cite">
3
- <%= link_to t('blacklight.tools.cite'), citation_catalog_path(:sort=>params[:sort], :per_page=>params[:per_page], :id => @bookmarks.collect{|doc| doc.document_id}), {:id => 'citeLink', :name => 'citation', :class => 'lightboxLink btn'} %>
3
+ <%= link_to t('blacklight.tools.cite'), citation_catalog_path(:sort=>params[:sort], :per_page=>params[:per_page], :id => @bookmarks.collect{|doc| doc.document_id}), {:id => 'citeLink', :name => 'citation', :class => 'btn btn-default', :data => {:ajax_modal => "trigger"}} %>
4
4
  </li>
5
5
  <li class="refworks">
6
6
  <%= render :partial => 'catalog/refworks_form', :locals => {:documents=>@document_list} %>
7
7
  </li>
8
8
 
9
9
  <li class="endnote">
10
- <%= link_to t('blacklight.tools.endnote'), endnote_catalog_path(:sort=>params[:sort], :per_page=>params[:per_page], :id => @bookmarks.collect {|doc| doc.document_id}, :format => 'endnote'), {:class => 'btn'}%>
10
+ <%= link_to t('blacklight.tools.endnote'), endnote_catalog_path(:sort=>params[:sort], :per_page=>params[:per_page], :id => @bookmarks.collect {|doc| doc.document_id}, :format => 'endnote'), {:class => 'btn btn-default'}%>
11
11
  </li>
12
12
  <li class="email">
13
- <%= link_to t('blacklight.tools.email'), email_catalog_path(:sort=>params[:sort], :per_page=>params[:per_page], :id => @bookmarks.collect {|doc| doc.document_id}), :class=>"lightboxLink btn", :id => "emailLink" %>
14
- </li>
15
- <li>
16
- <%= link_to t('blacklight.bookmarks.clear.action_title'), clear_bookmarks_path, :method => :delete, :data => { :confirm => t('blacklight.bookmarks.clear.action_confirm') }, :class => 'btn' %>
13
+ <%= link_to t('blacklight.tools.email'), email_catalog_path(:sort=>params[:sort], :per_page=>params[:per_page], :id => @bookmarks.collect {|doc| doc.document_id}), :class=>"btn btn-default", :id => "emailLink", :data => {:ajax_modal => "trigger"} %>
17
14
  </li>
18
15
  </ul>
@@ -1,4 +1,4 @@
1
- <div id="content" class="span12">
1
+ <div id="content" class="col-md-12">
2
2
  <h1><%= t('blacklight.bookmarks.title') %></h1>
3
3
 
4
4
  <%- if current_or_guest_user.blank? -%>
@@ -9,9 +9,10 @@
9
9
 
10
10
  <h3><%= t('blacklight.bookmarks.no_bookmarks') %></h3>
11
11
  <% else %>
12
+ <%= link_to t('blacklight.bookmarks.clear.action_title'), clear_bookmarks_path, :method => :delete, :data => { :confirm => t('blacklight.bookmarks.clear.action_confirm') }, :class => 'btn btn-danger pull-right' %>
12
13
  <%= render 'sort_and_per_page' %>
13
-
14
14
  <%= render 'tools' %>
15
+
15
16
  <%= render_document_index %>
16
17
  <%= render 'results_pagination' %>
17
18
  <% end %>