blacklight 3.8.2 → 4.0.0.pre6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (206) hide show
  1. data/Gemfile +1 -0
  2. data/README.md +1 -1
  3. data/VERSION +1 -1
  4. data/app/assets/javascripts/blacklight/blacklight.js +12 -1
  5. data/app/assets/javascripts/blacklight/bootstrap_dropdowns.js +3 -0
  6. data/app/assets/javascripts/blacklight/checkbox_submit.js +12 -5
  7. data/app/assets/javascripts/blacklight/core.js +0 -1
  8. data/app/assets/javascripts/blacklight/css_dropdowns.js +10 -0
  9. data/app/assets/javascripts/blacklight/facet_expand_contract.js +5 -5
  10. data/app/assets/javascripts/blacklight/lightbox_dialog.js +68 -13
  11. data/app/assets/javascripts/blacklight/select_submit.js +19 -10
  12. data/app/assets/javascripts/improved-modal/bootstrap-modal.js +282 -0
  13. data/app/assets/javascripts/improved-modal/bootstrap-modalmanager.js +353 -0
  14. data/app/assets/stylesheets/blacklight/_blacklight_base.css.scss +16 -5
  15. data/app/assets/stylesheets/blacklight/_bookmark.css.scss +24 -6
  16. data/app/assets/stylesheets/blacklight/_catalog.css.scss +115 -141
  17. data/app/assets/stylesheets/blacklight/_dropdown.css.scss +57 -0
  18. data/app/assets/stylesheets/blacklight/_facets.css.scss +127 -58
  19. data/app/assets/stylesheets/blacklight/_footer.css.scss +20 -0
  20. data/app/assets/stylesheets/blacklight/_header.css.scss +90 -21
  21. data/app/assets/stylesheets/blacklight/_layout.css.scss +10 -9
  22. data/app/assets/stylesheets/blacklight/_modal.css.scss +23 -0
  23. data/app/assets/stylesheets/blacklight/_print.css.scss +0 -7
  24. data/app/assets/stylesheets/blacklight/_responsive.css.scss +3 -0
  25. data/app/assets/stylesheets/blacklight/_search_history.css.scss +2 -4
  26. data/app/assets/stylesheets/blacklight/blacklight.css.scss +0 -1
  27. data/app/assets/stylesheets/blacklight/blacklight_defaults.css.scss +9 -2
  28. data/app/assets/stylesheets/blacklight/responsive_partials/_catalog.css.scss +5 -0
  29. data/app/assets/stylesheets/blacklight/responsive_partials/_facets.css.scss +37 -0
  30. data/app/assets/stylesheets/blacklight/responsive_partials/_header.css.scss +30 -0
  31. data/app/assets/stylesheets/improved-modal/bootstrap-modal.css +199 -0
  32. data/app/controllers/bookmarks_controller.rb +16 -10
  33. data/app/helpers/blacklight/blacklight_helper_behavior.rb +124 -61
  34. data/app/helpers/blacklight/catalog_helper_behavior.rb +5 -3
  35. data/app/helpers/blacklight/facets_helper_behavior.rb +9 -9
  36. data/app/views/_flash_msg.html.erb +9 -4
  37. data/app/views/_user_util_links.html.erb +23 -17
  38. data/app/views/bookmarks/_tools.html.erb +7 -7
  39. data/app/views/bookmarks/index.html.erb +5 -13
  40. data/app/views/catalog/_bookmark_control.html.erb +2 -4
  41. data/app/views/catalog/_bookmark_form.html.erb +1 -1
  42. data/app/views/catalog/_citation.html.erb +21 -20
  43. data/app/views/catalog/_constraints.html.erb +8 -6
  44. data/app/views/catalog/_document_header.html.erb +6 -7
  45. data/app/views/catalog/_document_list.html.erb +1 -7
  46. data/app/views/catalog/_email_form.html.erb +42 -16
  47. data/app/views/catalog/_facet_layout.html.erb +1 -1
  48. data/app/views/catalog/_facet_limit.html.erb +1 -1
  49. data/app/views/catalog/_facet_pagination.html.erb +11 -14
  50. data/app/views/catalog/_facets.html.erb +16 -2
  51. data/app/views/catalog/_home.html.erb +2 -2
  52. data/app/views/catalog/_home_text.html.erb +5 -2
  53. data/app/views/catalog/_index_default.html.erb +2 -2
  54. data/app/views/catalog/_marc_view.html.erb +0 -1
  55. data/app/views/catalog/_paginate_compact.html.erb +5 -0
  56. data/app/views/catalog/_per_page_widget.html.erb +13 -7
  57. data/app/views/catalog/_previous_next_doc.html.erb +14 -4
  58. data/app/views/catalog/_refworks_form.html.erb +2 -2
  59. data/app/views/catalog/_results_pagination.html.erb +4 -1
  60. data/app/views/catalog/_search_form.html.erb +19 -13
  61. data/app/views/catalog/_show_default.html.erb +2 -2
  62. data/app/views/catalog/_show_more_like_this.html.erb +3 -0
  63. data/app/views/catalog/_show_sidebar.html.erb +14 -1
  64. data/app/views/catalog/_show_tools.html.erb +18 -18
  65. data/app/views/catalog/_sms_form.html.erb +35 -10
  66. data/app/views/catalog/_sort_and_per_page.html.erb +5 -3
  67. data/app/views/catalog/_sort_widget.html.erb +12 -6
  68. data/app/views/catalog/citation.html.erb +1 -1
  69. data/app/views/catalog/citation.js.erb +7 -0
  70. data/app/views/catalog/email.html.erb +5 -0
  71. data/app/views/catalog/facet.html.erb +28 -21
  72. data/app/views/catalog/index.html.erb +26 -26
  73. data/app/views/catalog/librarian_view.html.erb +7 -0
  74. data/app/views/catalog/show.html.erb +35 -29
  75. data/app/views/catalog/sms.html.erb +5 -0
  76. data/app/views/kaminari/blacklight/_first_page.html.erb +2 -2
  77. data/app/views/kaminari/blacklight/_gap.html.erb +4 -1
  78. data/app/views/kaminari/blacklight/_last_page.html.erb +2 -2
  79. data/app/views/kaminari/blacklight/_next_page.html.erb +3 -3
  80. data/app/views/kaminari/blacklight/_page.html.erb +4 -3
  81. data/app/views/kaminari/blacklight/_paginator.html.erb +5 -5
  82. data/app/views/kaminari/blacklight/_prev_page.html.erb +3 -3
  83. data/app/views/kaminari/blacklight_compact/_next_page.html.erb +9 -0
  84. data/app/views/kaminari/blacklight_compact/_paginator.html.erb +15 -0
  85. data/app/views/kaminari/blacklight_compact/_prev_page.html.erb +9 -0
  86. data/app/views/layouts/blacklight.html.erb +47 -27
  87. data/app/views/saved_searches/index.html.erb +2 -2
  88. data/app/views/search_history/index.html.erb +12 -7
  89. data/app/views/shared/_footer.html.erb +0 -0
  90. data/app/views/shared/_header_navbar.html.erb +25 -0
  91. data/blacklight.gemspec +2 -5
  92. data/config/locales/blacklight.en.yml +23 -15
  93. data/lib/blacklight.rb +2 -2
  94. data/lib/blacklight/catalog.rb +36 -14
  95. data/lib/blacklight/configuration.rb +10 -2
  96. data/lib/blacklight/mash.rb +151 -0
  97. data/lib/blacklight/solr/document.rb +73 -11
  98. data/lib/blacklight/solr/document/extensions.rb +0 -8
  99. data/lib/blacklight/solr/document/marc_export.rb +7 -2
  100. data/lib/blacklight/solr/document/more_like_this.rb +5 -0
  101. data/lib/blacklight/solr_helper.rb +43 -18
  102. data/lib/blacklight/solr_response.rb +60 -0
  103. data/lib/blacklight/solr_response/facets.rb +58 -0
  104. data/lib/blacklight/solr_response/more_like_this.rb +14 -0
  105. data/lib/blacklight/solr_response/spelling.rb +92 -0
  106. data/lib/generators/blacklight/assets_generator.rb +1 -14
  107. data/lib/generators/blacklight/blacklight_generator.rb +22 -21
  108. data/lib/generators/blacklight/jetty_generator.rb +1 -35
  109. data/{test_support → lib/generators/blacklight/templates}/alternate_controller.rb +0 -0
  110. data/lib/generators/blacklight/templates/blacklight.css.scss +4 -0
  111. data/lib/generators/blacklight/templates/config/SolrMarc/config-test.properties +2 -2
  112. data/lib/generators/blacklight/templates/config/jetty.yml +6 -0
  113. data/lib/generators/blacklight/test_support_generator.rb +35 -0
  114. data/lib/railties/all_tests.rake +5 -23
  115. data/lib/railties/blacklight_cucumber.rake +2 -11
  116. data/lib/railties/blacklight_rspec.rake +2 -12
  117. data/test_support/bin/run-tests.sh +1 -1
  118. data/test_support/bin/setup-test-app.sh +123 -0
  119. data/test_support/bin/test.sh +21 -21
  120. data/test_support/features/bookmarks.feature +9 -3
  121. data/test_support/features/saved_searches.feature +3 -3
  122. data/test_support/features/search.feature +3 -3
  123. data/test_support/features/search_filters.feature +24 -26
  124. data/test_support/features/search_history.feature +9 -10
  125. data/test_support/features/search_sort.feature +4 -6
  126. data/test_support/features/step_definitions/general_steps.rb +0 -4
  127. data/test_support/features/step_definitions/search_result_steps.rb +2 -1
  128. data/test_support/features/step_definitions/search_steps.rb +32 -2
  129. data/test_support/spec/controllers/application_controller_spec.rb +8 -0
  130. data/test_support/spec/controllers/catalog_controller_spec.rb +3 -18
  131. data/test_support/spec/helpers/blacklight_helper_spec.rb +116 -20
  132. data/test_support/spec/helpers/catalog_helper_spec.rb +14 -6
  133. data/test_support/spec/helpers/facets_helper_spec.rb +1 -1
  134. data/test_support/spec/lib/blacklight_solr_document_more_like_this_spec.rb +18 -0
  135. data/test_support/spec/lib/blacklight_solr_document_spec.rb +54 -1
  136. data/test_support/spec/lib/blacklight_solr_response_spec.rb +153 -0
  137. data/test_support/spec/lib/facet_paginator_spec.rb +1 -1
  138. data/test_support/spec/lib/marc_export_spec.rb +14 -6
  139. data/test_support/spec/lib/solr_helper_spec.rb +22 -6
  140. data/test_support/spec/models/solr_docment_spec.rb +1 -4
  141. data/test_support/spec/{features → requests}/alternate_controller_spec.rb +3 -2
  142. data/test_support/spec/views/catalog/_facets.html.erb_spec.rb +20 -4
  143. data/test_support/spec/views/catalog/_show_sidebar.erb_spec.rb +25 -0
  144. metadata +53 -131
  145. data/app/assets/javascripts/blacklight/more_facets.js +0 -16
  146. data/app/assets/javascripts/jquery-1.4.2.min.js +0 -154
  147. data/app/assets/javascripts/jquery-ui-1.8.1.custom.min.js +0 -756
  148. data/app/assets/javascripts/jquery.uiExt.ajaxyDialog.js +0 -180
  149. data/app/assets/stylesheets/blacklight/_formatting.css.scss +0 -164
  150. data/app/assets/stylesheets/blacklight/grids/_susy_grid.css.scss +0 -72
  151. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-anim_basic_16x16.gif +0 -0
  152. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  153. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  154. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
  155. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  156. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  157. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  158. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_gloss-wave_35_558fd0_500x100.png +0 -0
  159. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  160. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  161. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
  162. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
  163. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-icons_2e4f81_256x240.png +0 -0
  164. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
  165. data/app/assets/stylesheets/jquery/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
  166. data/app/assets/stylesheets/jquery/ui-lightness/jquery-ui-1.8.1.custom.css +0 -486
  167. data/app/models/solr_document.rb +0 -5
  168. data/app/views/catalog/email.erb +0 -1
  169. data/app/views/catalog/sms.erb +0 -1
  170. data/doc/Atom-Responses.md +0 -90
  171. data/doc/Blacklight-3.2-Release-Notes-and-Upgrade-Guide.md +0 -191
  172. data/doc/Blacklight-3.3-release-notes-and-upgrade-guide.md +0 -37
  173. data/doc/Blacklight-3.4-release-notes-and-upgrade-guide.md +0 -27
  174. data/doc/Blacklight-3.5-release-notes-and-upgrade-guide.md +0 -44
  175. data/doc/Blacklight-3.6-release-notes-and-upgrade-guide.md +0 -25
  176. data/doc/Blacklight-3.7-release-notes-and-upgrade-guide.md +0 -78
  177. data/doc/Blacklight-3.8-release-notes-and-upgrade-guide.md +0 -11
  178. data/doc/Blacklight-Add-ons.md +0 -28
  179. data/doc/Blacklight-configuration.md +0 -301
  180. data/doc/Blacklight-on-Heroku.md +0 -135
  181. data/doc/Community-principles.md +0 -44
  182. data/doc/Configuring-and-Customizing-Blacklight.md +0 -271
  183. data/doc/Contributing-to-Blacklight.md +0 -25
  184. data/doc/Examples.md +0 -62
  185. data/doc/Extending-or-Modifying-Blacklight-Search-Behavior.md +0 -141
  186. data/doc/Home.md +0 -77
  187. data/doc/How-to-release-a-version.md +0 -37
  188. data/doc/Indexing-your-data-into-solr.md +0 -5
  189. data/doc/Integration-with-Rails-Footnotes.md +0 -20
  190. data/doc/Pagination.md +0 -38
  191. data/doc/Providing-your-own-view-templates.md +0 -109
  192. data/doc/Quickstart.md +0 -116
  193. data/doc/README.md +0 -77
  194. data/doc/README_SOLR.md +0 -245
  195. data/doc/Release-Notes-And-Upgrade-Guides.md +0 -14
  196. data/doc/Sunspot-for-indexing.md +0 -46
  197. data/doc/User-Authentication.md +0 -60
  198. data/doc/testing.md +0 -115
  199. data/lib/generators/blacklight/solr_conf_generator.rb +0 -26
  200. data/lib/generators/blacklight/templates/assets/standard.css.scss +0 -59
  201. data/lib/generators/blacklight/templates/config/blacklight_config.rb +0 -3
  202. data/lib/generators/blacklight/templates/config/compass.rb +0 -2
  203. data/lib/generators/blacklight/templates/solr_conf/schema.xml +0 -689
  204. data/lib/generators/blacklight/templates/solr_conf/solrconfig.xml +0 -1846
  205. data/lib/solrmarc.log.1 +0 -849
  206. data/test_support/spec/controllers/bookmarks_controller_spec.rb +0 -48
@@ -18,9 +18,9 @@ Feature: Saved Searches Page
18
18
  When I go to the saved searches page
19
19
  Then I should see "You have no saved searches"
20
20
 
21
- Scenario: Saved Searches not logged in
22
- When I go to the saved searches page
23
- Then I should see "Sign in"
21
+ # Scenario: Saved Searches not logged in
22
+ # When I go to the saved searches page
23
+ # Then I should see "Sign in"
24
24
 
25
25
  Scenario: Saved Searches
26
26
  Given I am logged in as "user1"
@@ -49,7 +49,7 @@ Feature: Search
49
49
  And I should see "inmul"
50
50
  And I should see select list "select#search_field" with "Title" selected
51
51
  And I should see "1."
52
- And I should see "Displaying 1 item"
52
+ And I should see "1 to 1 of 1"
53
53
 
54
54
  Scenario: Results Page Shows Vernacular (Linked 880) Fields
55
55
  Given I am on the home page
@@ -68,7 +68,7 @@ Feature: Search
68
68
  Given I am on the home page
69
69
  And I fill in "q" with "history"
70
70
  When I press "search"
71
- Then I should see select list "select#sort" with field labels "relevance, year, author, title"
71
+ Then I should see the sort dropdown with values "relevance, year, author, title"
72
72
 
73
73
  Scenario: Can clear a search
74
74
  When I am on the home page
@@ -79,7 +79,7 @@ Feature: Search
79
79
  And I should see "All Fields"
80
80
  And I should see "history"
81
81
  And the "q" field should contain "history"
82
- When I follow "start over"
82
+ When I follow "Start Over"
83
83
  Then I should be on "the catalog page"
84
84
  And I should see "Welcome!"
85
85
  And the "q" field should not contain "history"
@@ -6,19 +6,19 @@ Feature: Search Filters
6
6
  Scenario: Filter a blank search
7
7
  Given I am on the home page
8
8
  When I follow "Tibetan"
9
- Then I should see "Displaying all 6 items"
10
- And I should see the applied facet "Language" with the value "Tibetan (6)"
9
+ Then I should see "1 - 6 of 6"
10
+ And I should see the applied facet "Language" with the value "Tibetan 6"
11
11
  When I follow "India"
12
- Then I should see "Displaying all 2 items"
13
- And I should see the applied facet "Language" with the value "Tibetan (2)"
14
- And I should see the applied facet "Region" with the value "India (2)"
12
+ Then I should see "1 - 2 of 2"
13
+ And I should see the applied facet "Language" with the value "Tibetan 2"
14
+ And I should see the applied facet "Region" with the value "India 2"
15
15
 
16
16
  Scenario: Search with no filters applied
17
17
  When I am on the home page
18
18
  And I fill in "q" with "bod"
19
19
  And I press "search"
20
20
  Then I should be on "the catalog page"
21
- And I should see "Displaying all 3 items"
21
+ And I should see "1 - 3 of 3"
22
22
  And I should not see "No Keywords"
23
23
  And I should see "You searched for:"
24
24
  And I should see "All Fields"
@@ -29,27 +29,27 @@ Feature: Search Filters
29
29
  And I fill in "q" with "history"
30
30
  And I press "search"
31
31
  Then I should be on "the catalog page"
32
- And I should see "Displaying all 9 items"
32
+ And I should see "1 - 9 of 9"
33
33
  And I should not see "No Keywords"
34
34
  And I should see "You searched for:"
35
35
  And I should see "All Fields"
36
36
  And I should see "history"
37
37
  When I follow "Tibetan"
38
- Then I should see "Displaying all 2 items"
39
- And I should see the applied facet "Language" with the value "Tibetan (2)"
38
+ Then I should see "1 - 2 of 2"
39
+ And I should see the applied facet "Language" with the value "Tibetan 2"
40
40
  And I should see "All Fields"
41
41
  And I should see "history"
42
42
  When I follow "2004"
43
- Then I should see "Displaying 1 item"
43
+ Then I should see "1 to 1 of 1"
44
44
  And I should see "You searched for:"
45
- And I should see the applied facet "Language" with the value "Tibetan (1)"
46
- And I should see the applied facet "Publication Year" with the value "2004 (1)"
45
+ And I should see the applied facet "Language" with the value "Tibetan 1"
46
+ And I should see the applied facet "Publication Year" with the value "2004 1"
47
47
 
48
48
  Scenario: Apply and remove filters
49
49
  Given I am on the home page
50
50
  When I follow "Tibetan"
51
51
  And I should see "Language"
52
- And I should see "Tibetan (6)"
52
+ And I should see "Tibetan 6"
53
53
  And I should see "[remove]"
54
54
  When I follow "remove"
55
55
  Then I should not see "You searched for:"
@@ -66,19 +66,19 @@ Feature: Search Filters
66
66
  When I follow "Tibetan"
67
67
  Then I should see "You searched for:"
68
68
  And I should see "history"
69
- And I should see the applied facet "Language" with the value "Tibetan (2)"
69
+ And I should see the applied facet "Language" with the value "Tibetan 2"
70
70
  When I follow "2004"
71
71
  And I should see "You searched for:"
72
72
  And I should see "history"
73
- And I should see the applied facet "Language" with the value "Tibetan (1)"
74
- And I should see the applied facet "Publication Year" with the value "2004 (1)"
73
+ And I should see the applied facet "Language" with the value "Tibetan 1"
74
+ And I should see the applied facet "Publication Year" with the value "2004 1"
75
75
  When I fill in "q" with "china"
76
76
  And I press "search"
77
77
  Then I should be on "the catalog page"
78
78
  And I should see "All Fields"
79
79
  And I should see "china"
80
- And I should see the applied facet "Language" with the value "Tibetan (1)"
81
- And I should see the applied facet "Publication Year" with the value "2004 (1)"
80
+ And I should see the applied facet "Language" with the value "Tibetan 1"
81
+ And I should see the applied facet "Publication Year" with the value "2004 1"
82
82
 
83
83
 
84
84
  Scenario: Sorting results should retain filters
@@ -91,13 +91,12 @@ Feature: Search Filters
91
91
  When I follow "Tibetan"
92
92
  And I should see "You searched for:"
93
93
  And I should see "history"
94
- And I should see the applied facet "Language" with the value "Tibetan (2)"
95
- When I select "title" from "sort"
96
- And I press "sort results"
94
+ And I should see the applied facet "Language" with the value "Tibetan 2"
95
+ When I sort by "title"
97
96
  Then I should be on "the catalog page"
98
97
  And I should see "You searched for:"
99
98
  And I should see "history"
100
- And I should see the applied facet "Language" with the value "Tibetan (2)"
99
+ And I should see the applied facet "Language" with the value "Tibetan 2"
101
100
 
102
101
 
103
102
  Scenario: Changing per page number should retain filters
@@ -111,11 +110,10 @@ Feature: Search Filters
111
110
  And I should see "You searched for:"
112
111
  And I should see "All Fields"
113
112
  And I should see "history"
114
- And I should see the applied facet "Language" with the value "Tibetan (2)"
115
- When I select "20" from "per_page"
116
- And I press "update"
113
+ And I should see the applied facet "Language" with the value "Tibetan 2"
114
+ When I show 20 per page
117
115
  Then I should be on "the catalog page"
118
116
  And I should see "You searched for:"
119
117
  And I should see "history"
120
- And I should see the applied facet "Language" with the value "Tibetan (2)"
118
+ And I should see the applied facet "Language" with the value "Tibetan 2"
121
119
 
@@ -6,9 +6,8 @@ Feature: Search History Page
6
6
 
7
7
  Scenario: Menu Link
8
8
  When I am on the home page
9
- Then I should see "Search History"
10
- When I follow "Search History"
11
- Then I should be on the search history page
9
+ Then I should see "History"
10
+ When I go to the search history page
12
11
  And I should see a stylesheet
13
12
 
14
13
  Scenario: Have No Searches
@@ -48,12 +47,12 @@ Feature: Search History Page
48
47
  And I should be on the search history page
49
48
  And I should see a "forget" button
50
49
 
51
- Scenario: Saving a Search when not logged in
52
- Given I have done a search with term "book"
53
- And I am on the search history page
54
- Then I should see a "save" button
55
- When I press "save"
56
- Then I should see "Sign in"
50
+ # Scenario: Saving a Search when not logged in
51
+ # Given I have done a search with term "book"
52
+ # And I am on the search history page
53
+ # Then I should see a "save" button
54
+ # When I press "save"
55
+ # Then I should see "Sign in"
57
56
 
58
57
  Scenario: Un-Saving a Search when logged in
59
58
  Given I am logged in as "user1"
@@ -81,6 +80,6 @@ Feature: Search History Page
81
80
  When I follow "Log Out"
82
81
  Then I should see "Login"
83
82
  And I should not see "user1"
84
- When I follow "Search History"
83
+ When I go to the search history page
85
84
  Then I should not see "book"
86
85
 
@@ -10,10 +10,9 @@ Feature: Search Sort
10
10
  Then I should see "Sort by"
11
11
  # 2009-08-25 I don't know why this isn't working ... Naomi.
12
12
  # And I should see select list "select#sort" with "relevance" selected
13
- When I select "title" from "sort"
14
- And I press "sort results"
13
+ When I sort by "title"
15
14
  Then I should see "Sort by"
16
- And I should see select list "select#sort" with "title" selected
15
+ And I should see the sort list with "title" selected
17
16
 
18
17
  Scenario: Sort on result set from fielded search
19
18
  Given I am on the home page
@@ -21,9 +20,8 @@ Feature: Search Sort
21
20
  And I select "Title" from "search_field"
22
21
  And I press "search"
23
22
  Then I should see "Sort by"
24
- When I select "title" from "sort"
25
- And I press "sort results"
23
+ When I sort by "title"
26
24
  Then I should see "Sort by"
27
25
  And I should see select list "select#search_field" with "Title" selected
28
- And I should see select list "select#sort" with "title" selected
26
+ And I should see the sort list with "title" selected
29
27
 
@@ -9,10 +9,6 @@ Then /^I should see a stylesheet/ do
9
9
  page.should have_selector("link[rel=stylesheet]")
10
10
  end
11
11
 
12
- Then /^the page title should be "([^"]*)"$/i do |title|
13
- page.should have_selector("title", :text => title)
14
- end
15
-
16
12
  Then /I should see "(.*)" (at least|at most|exactly) (.*) times?$/i do |target, comparator, expected_num|
17
13
  actual_num = page.split(target).length - 1
18
14
  case comparator
@@ -3,7 +3,8 @@
3
3
 
4
4
  When /^I fill in the search box with "(.*?)"$/ do |query|
5
5
  query.gsub!(/\\"/, '"')
6
- fill_in(:q, :with => query)
6
+ # fill_in(:q, :with => query)
7
+ find('#q').set(query)
7
8
  end
8
9
 
9
10
 
@@ -9,11 +9,41 @@ Then /^I should see a selectable list with field choices$/ do
9
9
  end
10
10
 
11
11
  Then /^I should see a selectable list with per page choices$/ do
12
- page.should have_selector("select#per_page")
12
+ page.should have_selector("#per_page-dropdown")
13
+ end
14
+
15
+
16
+ When /^I show (\d+) per page$/ do |value|
17
+ page.should have_selector('#per_page-dropdown') do
18
+ click_link(value)
19
+ end
20
+ end
21
+
22
+ Then /^I should see the sort dropdown$/ do
23
+ page.should have_selector("#sort-dropdown")
24
+ end
25
+
26
+ Then /^I should see the sort dropdown with values "([^\"]*)"$/ do |values|
27
+ page.should have_selector('#sort-dropdown') do
28
+ labels = values.split(", ")
29
+ labels.each do |label|
30
+ with_tag('li', label)
31
+ end
32
+ end
33
+ end
34
+
35
+ Then /^I should see the sort list with "([^\"]*)" selected$/ do |value|
36
+ page.should have_selector('#sort-dropdown .css-dropdown a', :text => value)
37
+ end
38
+
39
+ When /^I sort by "([^\"]*)"$/ do |value|
40
+ page.should have_selector('#sort-dropdown') do
41
+ click_link(value)
42
+ end
13
43
  end
14
44
 
15
45
  Then /^I should see a "([^\"]*)" button$/ do |label|
16
- page.should have_selector("input[type='submit'][value='#{label}']")
46
+ page.should have_selector("button[type='submit'] .submit-search-text")
17
47
  end
18
48
 
19
49
  Then /^I should not see the "([^\"]*)" element$/ do |id|
@@ -15,6 +15,14 @@ describe ApplicationController do
15
15
  controller.stylesheet_links.should be_empty
16
16
  end
17
17
  end
18
+
19
+ describe "#blacklight_config" do
20
+
21
+ it "should provide a default blacklight_config everywhere" do
22
+ controller.blacklight_config.should == CatalogController.blacklight_config
23
+ end
24
+ end
25
+
18
26
  end
19
27
 
20
28
  end
@@ -300,7 +300,6 @@ describe CatalogController do
300
300
 
301
301
  describe "@document" do
302
302
  before do
303
- @mock_response = mock()
304
303
  @mock_response.stub(:docs => [{ :id => 'my_fake_doc' }])
305
304
  @mock_document = mock()
306
305
  controller.stub(:find => @mock_response,
@@ -327,12 +326,13 @@ describe CatalogController do
327
326
  end
328
327
  end
329
328
  before do
330
- @mock_response = mock()
331
- @mock_document = mock()
332
329
  @mock_response.stub(:docs => [{ :id => 'my_fake_doc' }])
333
330
  @mock_document = mock()
334
331
  controller.stub(:find => @mock_response,
335
332
  :get_single_doc_via_search => @mock_document)
333
+
334
+ controller.stub(:find => @mock_response,
335
+ :get_single_doc_via_search => @mock_document)
336
336
  end
337
337
 
338
338
  before(:each) do
@@ -438,26 +438,11 @@ describe CatalogController do
438
438
  request.should redirect_to(catalog_path(doc_id))
439
439
  end
440
440
  end
441
- describe "backwards compatbile send_record_email" do
442
- it "should redirect to the sms action when the sms style param is passed" do
443
- post :send_email_record, :style=>"sms"
444
- request.should redirect_to(sms_catalog_path)
445
- end
446
- it "should redirect to the email action when the email style param is passed" do
447
- post :send_email_record, :style=>"email"
448
- request.should redirect_to(email_catalog_path)
449
- end
450
- it "should not do anything if a bad style is sent" do
451
- post :send_email_record, :style=>"bad-style"
452
- response.status.should == 404
453
- end
454
- end
455
441
  end
456
442
 
457
443
  describe "errors" do
458
444
  it "should return status 404 for a record that doesn't exist" do
459
445
  @mock_response = mock()
460
- @mock_document = mock()
461
446
  @mock_response.stub(:docs => [])
462
447
  @mock_document = mock()
463
448
  controller.stub(:find => @mock_response,
@@ -24,7 +24,7 @@ def exportable_record
24
24
 
25
25
  <datafield tag=\"700\" ind1=\"1\" ind2=\" \">
26
26
  <subfield code=\"a\">Greer, Lowell.</subfield>
27
- </datafield>
27
+ </datafield>
28
28
 
29
29
  <datafield tag=\"700\" ind1=\"1\" ind2=\" \">
30
30
  <subfield code=\"a\">Lubin, Steven.</subfield>
@@ -68,17 +68,17 @@ describe BlacklightHelper do
68
68
  include BlacklightHelper
69
69
  include Devise::TestHelpers
70
70
  def blacklight_config
71
- @config ||= Blacklight::Configuration.new.configure do |config|
71
+ @config ||= Blacklight::Configuration.new.configure do |config|
72
72
  config.show.html_title = "title_display"
73
73
  config.show.heading = "title_display"
74
74
  config.show.display_type = 'format'
75
-
75
+
76
76
  config.index.show_link = 'title_display'
77
- config.index.record_display_type = 'format'
77
+ config.index.record_display_type = 'format'
78
78
  end
79
-
79
+
80
80
  #CatalogController.blacklight_config
81
- #@config ||= {:show => {:html_title => 'title_display', :heading => 'title_display', :display_type => 'format'}, :index => { :show_link => 'title_display', :record_display_type => 'format' } }
81
+ #@config ||= {:show => {:html_title => 'title_display', :heading => 'title_display', :display_type => 'format'}, :index => { :show_link => 'title_display', :record_display_type => 'format' } }
82
82
  end
83
83
 
84
84
  describe "#application_name", :test => true do
@@ -95,7 +95,9 @@ describe BlacklightHelper do
95
95
  describe "link_back_to_catalog" do
96
96
  before(:all) do
97
97
  @query_params = {:q => "query", :f => "facets", :per_page => "10", :page => "2", :controller=>'catalog'}
98
+ @bookmarks_query_params = { :page => "2", :controller=>'bookmarks'}
98
99
  end
100
+
99
101
  it "should build a link tag to catalog using session[:search] for query params" do
100
102
  session[:search] = @query_params
101
103
  tag = link_back_to_catalog
@@ -104,8 +106,16 @@ describe BlacklightHelper do
104
106
  tag.should =~ /per_page=10/
105
107
  tag.should =~ /page=2/
106
108
  end
109
+
110
+ it "should build a link tag to bookmarks using session[:search] for query params" do
111
+ session[:search] = @bookmarks_query_params
112
+ tag = link_back_to_catalog
113
+ tag.should =~ /Back to Bookmarks/
114
+ tag.should =~ /\/bookmarks/
115
+ tag.should =~ /page=2/
116
+ end
107
117
  end
108
-
118
+
109
119
  describe "link_to_query" do
110
120
  it "should build a link tag to catalog using query string (no other params)" do
111
121
  query = "brilliant"
@@ -143,7 +153,7 @@ describe BlacklightHelper do
143
153
  describe "for default arguments" do
144
154
  it "should default to omitting :page" do
145
155
  search_as_hidden_fields.should have_selector("input[type='hidden']", :count =>8)
146
- search_as_hidden_fields.should_not have_selector("input[name='page']")
156
+ search_as_hidden_fields.should_not have_selector("input[name='page']")
147
157
  end
148
158
  it "should not return blacklisted elements" do
149
159
  search_as_hidden_fields.should_not have_selector("input[name='action']")
@@ -153,7 +163,7 @@ describe BlacklightHelper do
153
163
  describe "for omit_keys parameter" do
154
164
  it "should not include those keys" do
155
165
  generated = search_as_hidden_fields(:omit_keys => [:per_page, :sort])
156
-
166
+
157
167
  generated.should_not have_selector("input[name=sort]")
158
168
  generated.should_not have_selector("input[name=per_page]")
159
169
 
@@ -187,7 +197,7 @@ describe BlacklightHelper do
187
197
  render_body_class.split(' ').should include('blacklight-123456-abcdef')
188
198
  end
189
199
  end
190
-
200
+
191
201
  describe "document_heading" do
192
202
 
193
203
  it "should consist of the show heading field when available" do
@@ -206,11 +216,42 @@ describe BlacklightHelper do
206
216
  it "should consist of #document_heading wrapped in a <h1>" do
207
217
  @document = SolrDocument.new('title_display' => "A Fake Document")
208
218
 
209
- render_document_heading.should have_selector("h1", :text => document_heading, :count => 1)
219
+ render_document_heading.should have_selector("h4", :text => document_heading, :count => 1)
210
220
  render_document_heading.html_safe?.should == true
211
221
  end
212
222
  end
213
223
 
224
+ describe "document_index_view_type" do
225
+ it "should default to 'list'" do
226
+ document_index_view_type.should == 'list'
227
+ end
228
+
229
+ it "should pluck values out of params" do
230
+ params[:view] = 'asdf'
231
+ document_index_view_type.should == 'asdf'
232
+ end
233
+ end
234
+
235
+ describe "render_document_index" do
236
+ it "should render the document_list" do
237
+ @document_list = ['a', 'b']
238
+ self.stub!(:document_index_view_type) { "gallery" }
239
+ self.should_receive(:render).with(hash_including(:partial => 'document_gallery'))
240
+ render_document_index
241
+ end
242
+
243
+ it "should fall back on more specific templates" do
244
+ @document_list = ['a', 'b']
245
+ self.stub!(:document_index_view_type) { "gallery" }
246
+
247
+ ex = ActionView::MissingTemplate.new [], '', '', '',''
248
+ self.should_receive(:render).with(hash_including(:partial => 'document_gallery')).and_raise(ex)
249
+ self.should_receive(:render).with(hash_including(:partial => 'catalog/document_gallery')).and_raise(ex)
250
+ self.should_receive(:render).with(hash_including(:partial => 'catalog/document_list'))
251
+ render_document_index
252
+ end
253
+ end
254
+
214
255
  describe "document_partial_name" do
215
256
  it "should default to 'default' when a format blank" do
216
257
  document_partial_name({}).should == "default"
@@ -247,7 +288,7 @@ describe BlacklightHelper do
247
288
  @document = SolrDocument.new(data)
248
289
  link_to_document(@document, { :label => "title_display" }).should have_selector("a", :text => 'title_display', :count => 1)
249
290
  end
250
-
291
+
251
292
  it "should accept and return a Proc" do
252
293
  data = {'id'=>'123456','title_display'=>['654321'] }
253
294
  @document = SolrDocument.new(data)
@@ -285,7 +326,7 @@ describe BlacklightHelper do
285
326
 
286
327
  describe "render_link_rel_alternates" do
287
328
  class MockDocumentAppHelper
288
- include Blacklight::Solr::Document
329
+ include Blacklight::Solr::Document
289
330
  end
290
331
  module MockExtension
291
332
  def self.extended(document)
@@ -318,7 +359,7 @@ describe BlacklightHelper do
318
359
  tag.attributes["rel"].value.should == "alternate"
319
360
  tag.attributes["title"].value.should == format.to_s
320
361
  tag.attributes["href"].value.should === mock_document_app_helper_url(@document, :format =>format)
321
- end
362
+ end
322
363
  end
323
364
  end
324
365
  it "respects :unique=>true" do
@@ -339,19 +380,19 @@ describe BlacklightHelper do
339
380
 
340
381
  describe "with a config" do
341
382
  before do
342
- @config = Blacklight::Configuration.new.configure do |config|
383
+ @config = Blacklight::Configuration.new.configure do |config|
343
384
  config.show.html_title = "title_display"
344
385
  config.show.heading = "title_display"
345
386
  config.show.display_type = 'format'
346
-
387
+
347
388
  config.index.show_link = 'title_display'
348
- config.index.record_display_type = 'format'
389
+ config.index.record_display_type = 'format'
349
390
  end
350
391
 
351
392
  @document = SolrDocument.new('title_display' => "A Fake Document", 'id'=>'8')
352
393
  helper.stub(:blacklight_config).and_return(@config)
353
394
  helper.stub(:has_user_authentication_provider?).and_return(true)
354
- helper.stub(:current_user).and_return(User.new)
395
+ helper.stub(:current_or_guest_user).and_return(User.new)
355
396
  end
356
397
  describe "render_index_doc_actions" do
357
398
  it "should render partials" do
@@ -372,6 +413,7 @@ describe BlacklightHelper do
372
413
  @config = Blacklight::Configuration.new.configure do |config|
373
414
  config.add_index_field 'qwer'
374
415
  config.add_index_field 'asdf', :helper_method => :render_asdf_index_field
416
+ config.add_index_field 'highlight', :highlight => true
375
417
  end
376
418
  helper.stub(:blacklight_config).and_return(@config)
377
419
  end
@@ -391,6 +433,14 @@ describe BlacklightHelper do
391
433
  value.should == 'custom asdf value'
392
434
  end
393
435
 
436
+ it "should check for a highlighted field" do
437
+ doc = mock()
438
+ doc.should_not_receive(:get)
439
+ doc.should_receive(:highlight_field).with('highlight').and_return(['<em>highlight</em>'.html_safe])
440
+ value = helper.render_index_field_value :document => doc, :field => 'highlight'
441
+ value.should == '<em>highlight</em>'
442
+ end
443
+
394
444
  it "should check the document field value" do
395
445
  doc = mock()
396
446
  doc.should_receive(:get).with('qwer', :sep => nil).and_return('document qwer value')
@@ -405,13 +455,14 @@ describe BlacklightHelper do
405
455
  value.should == 'document mnbv value'
406
456
  end
407
457
  end
408
-
458
+
409
459
 
410
460
  describe "render_document_show_field_value" do
411
461
  before do
412
462
  @config = Blacklight::Configuration.new.configure do |config|
413
463
  config.add_show_field 'qwer'
414
464
  config.add_show_field 'asdf', :helper_method => :render_asdf_document_show_field
465
+ config.add_show_field 'highlight', :highlight => true
415
466
  end
416
467
  helper.stub(:blacklight_config).and_return(@config)
417
468
  end
@@ -432,6 +483,16 @@ describe BlacklightHelper do
432
483
  value.should == 'custom asdf value'
433
484
  end
434
485
 
486
+
487
+ it "should check for a highlighted field" do
488
+ doc = mock()
489
+ doc.should_not_receive(:get)
490
+ doc.should_receive(:highlight_field).with('highlight').and_return(['<em>highlight</em>'.html_safe])
491
+ value = helper.render_document_show_field_value :document => doc, :field => 'highlight'
492
+ value.should == '<em>highlight</em>'
493
+ end
494
+
495
+
435
496
  it "should check the document field value" do
436
497
  doc = mock()
437
498
  doc.should_receive(:get).with('qwer', :sep => nil).and_return('document qwer value')
@@ -446,5 +507,40 @@ describe BlacklightHelper do
446
507
  value.should == 'document mnbv value'
447
508
  end
448
509
  end
449
-
510
+
511
+ describe "#should_render_index_field?" do
512
+ it "should if the document has the field value" do
513
+ doc = mock()
514
+ doc.stub(:has?).with('asdf').and_return(true)
515
+ field_config = mock(:field => 'asdf')
516
+ helper.should_render_index_field?(doc, field_config).should == true
517
+ end
518
+
519
+ it "should if the document has a highlight field value" do
520
+ doc = mock()
521
+ doc.stub(:has?).with('asdf').and_return(false)
522
+ doc.stub(:has_highlight_field?).with('asdf').and_return(true)
523
+ field_config = mock(:field => 'asdf', :highlight => true)
524
+ helper.should_render_index_field?(doc, field_config).should == true
525
+ end
526
+ end
527
+
528
+
529
+ describe "#should_render_show_field?" do
530
+ it "should if the document has the field value" do
531
+ doc = mock()
532
+ doc.stub(:has?).with('asdf').and_return(true)
533
+ field_config = mock(:field => 'asdf')
534
+ helper.should_render_show_field?(doc, field_config).should == true
535
+ end
536
+
537
+ it "should if the document has a highlight field value" do
538
+ doc = mock()
539
+ doc.stub(:has?).with('asdf').and_return(false)
540
+ doc.stub(:has_highlight_field?).with('asdf').and_return(true)
541
+ field_config = mock(:field => 'asdf', :highlight => true)
542
+ helper.should_render_show_field?(doc, field_config).should == true
543
+ end
544
+ end
545
+
450
546
  end