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
@@ -0,0 +1,23 @@
1
+ .modal-header {
2
+ h1 {
3
+ font-size: 24px; line-height: 40px;
4
+ }
5
+ }
6
+
7
+ #ajax-modal {
8
+ #email_form {
9
+ width: auto;
10
+ }
11
+
12
+ .facet_pagination.top {
13
+ display: none;
14
+ }
15
+
16
+ button.close {
17
+ display: block;
18
+ }
19
+ }
20
+
21
+ button.close {
22
+ display: none;
23
+ }
@@ -33,13 +33,6 @@
33
33
  top:0;
34
34
  }
35
35
 
36
- * html #search
37
- {
38
- left:1em;
39
- position:absolute;
40
- top:-4em;
41
- }
42
-
43
36
  body
44
37
  {
45
38
  background:none;
@@ -0,0 +1,3 @@
1
+ @import "blacklight/responsive_partials/_catalog";
2
+ @import "blacklight/responsive_partials/_facets";
3
+ @import "blacklight/responsive_partials/_header";
@@ -1,7 +1,3 @@
1
-
2
-
3
-
4
-
5
1
  /* Search History */
6
2
  .search_history
7
3
  {
@@ -42,3 +38,5 @@
42
38
  }
43
39
  }
44
40
 
41
+
42
+
@@ -1,4 +1,3 @@
1
1
  /* This is the default blacklight theme. */
2
2
 
3
- @import 'blacklight/grids/susy_grid';
4
3
  @import 'blacklight/blacklight_base';
@@ -4,11 +4,18 @@
4
4
 
5
5
  $background_image: 'blacklight/bg.png' !default;
6
6
  $logo_image: 'blacklight/logo.png' !default;
7
+ $header_background_border: 'blacklight/border.png' !default;
8
+
9
+ $navbar_background_color: #000000 !default;
7
10
 
8
11
  /* Various elements of search customization share these colors */
9
12
 
10
- $search_ui_border_color: #AAAAAA !default;
11
- $search_ui_bg_color: #F0F0F0 !default;
13
+ $well_bg_color: #F5F5F5 !default;
14
+
15
+ $search_ui_border_color: #FFFFFF !default;
16
+ $search_ui_bg_color: #FFFFFF !default;
17
+
18
+ $main_container_bg_color: #FFFFFF !default;
12
19
 
13
20
  /* separates documents, facets */
14
21
  $dotted_border_color: #CCC !default;
@@ -0,0 +1,5 @@
1
+ @media (max-width: 767px) {
2
+ #documents .documentFunctions {
3
+ margin-top: 0;
4
+ }
5
+ }
@@ -0,0 +1,37 @@
1
+ @media (max-width: 767px) {
2
+ #facets .btn-navbar {
3
+ display: block;
4
+ }
5
+ .facets-collapse {
6
+ clear: both;
7
+
8
+ &.in {
9
+
10
+ }
11
+
12
+ &, &.collapse {
13
+ overflow: hidden;
14
+ height: 0;
15
+ }
16
+
17
+ &.collapse.in {
18
+ height: auto !important;
19
+ }
20
+ }
21
+
22
+ .no-js .facets-collapse, .no-js .facets-collapse.collapse {
23
+ height: auto !important;
24
+ overflow: visible !important;
25
+ }
26
+ }
27
+
28
+ @media (min-width: 768px) {
29
+ .facets-collapse.collapse {
30
+ height: auto !important;
31
+ overflow: visible !important;
32
+ }
33
+
34
+ .facet-collapse-toggle {
35
+ display: none;
36
+ }
37
+ }
@@ -0,0 +1,30 @@
1
+ @media (max-width: 979px) {
2
+ body {
3
+ padding-top: 0;
4
+ }
5
+
6
+ }
7
+ @media (max-width: 979px) {
8
+ .submit-search-text {
9
+ display: none;
10
+ }
11
+
12
+
13
+ .navbar .brand {
14
+ width: 120px;
15
+ }
16
+
17
+ #search_field {
18
+ width: 50px;
19
+ }
20
+ }
21
+
22
+ @media (max-width: 480px) {
23
+ #search_field {
24
+ display: none;
25
+ }
26
+
27
+ .navbar .brand {
28
+ width: 35px;
29
+ }
30
+ }
@@ -0,0 +1,199 @@
1
+ /*!
2
+ * Bootstrap Modal
3
+ *
4
+ * Copyright Jordan Schroter
5
+ * Licensed under the Apache License v2.0
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ *
8
+ */
9
+
10
+ .modal-open.has-modal-container {
11
+ position: relative; /* safari */
12
+ overflow: hidden;
13
+ }
14
+
15
+
16
+ /* add a scroll bar to stop page from jerking around */
17
+ .modal-open.page-overflow .page-container,
18
+ .modal-open.page-overflow .page-container .navbar-fixed-top,
19
+ .modal-open.page-overflow .page-container .navbar-fixed-bottom,
20
+ .modal-open.page-overflow .modal-container {
21
+ overflow-y: scroll;
22
+ }
23
+
24
+ @media (max-width: 979px) {
25
+ .modal-open.page-overflow .page-container .navbar-fixed-top,
26
+ .modal-open.page-overflow .page-container .navbar-fixed-bottom {
27
+ overflow-y: visible;
28
+ }
29
+ }
30
+
31
+ .modal-container {
32
+ display: none;
33
+ position: fixed;
34
+ top: 0;
35
+ bottom: 0;
36
+ left: 0;
37
+ right: 0;
38
+ overflow: auto;
39
+ z-index: 9999;
40
+ }
41
+
42
+ .modal-open > .modal-container {
43
+ display: block;
44
+ }
45
+
46
+ .modal {
47
+ outline: none;
48
+ position: absolute;
49
+ margin-top: 0;
50
+ top: 50%;
51
+ overflow: visible; /* allow content to popup out (i.e tooltips) */
52
+ }
53
+
54
+ .modal.fade {
55
+ top: -100%;
56
+ -webkit-transition: opacity 0.3s linear, top 0.3s ease-out, bottom 0.3s ease-out, margin-top 0.3s ease-out;
57
+ -moz-transition: opacity 0.3s linear, top 0.3s ease-out, bottom 0.3s ease-out, margin-top 0.3s ease-out;
58
+ -o-transition: opacity 0.3s linear, top 0.3s ease-out, bottom 0.3s ease-out, margin-top 0.3s ease-out;
59
+ transition: opacity 0.3s linear, top 0.3s ease-out, bottom 0.3s ease-out, margin-top 0.3s ease-out;
60
+ }
61
+
62
+ .modal.fade.in {
63
+ top: 50%;
64
+ }
65
+
66
+ .modal-body {
67
+ max-height: none;
68
+ overflow: visible;
69
+ }
70
+
71
+ .modal.modal-absolute {
72
+ position: absolute;
73
+ z-index: 950;
74
+ }
75
+
76
+ .modal .loading-mask {
77
+ position: absolute;
78
+ top: 0;
79
+ bottom: 0;
80
+ left: 0;
81
+ right: 0;
82
+ background: #fff;
83
+ border-radius: 6px;
84
+ }
85
+
86
+ .modal-spinner {
87
+ position: absolute;
88
+ top: 50%;
89
+ left: 50%;
90
+ }
91
+
92
+ .modal-backdrop.modal-absolute{
93
+ position: absolute;
94
+ z-index: 940;
95
+ }
96
+
97
+ .modal-backdrop,
98
+ .modal-backdrop.fade.in{
99
+ opacity: 0.7;
100
+ filter: alpha(opacity=70);
101
+ background: #fff;
102
+ }
103
+
104
+ .modal.container {
105
+ width: 940px;
106
+ margin-left: -470px;
107
+ }
108
+
109
+ /* Modal Overflow */
110
+
111
+ .modal-overflow.modal {
112
+ top: 1%;
113
+ /*bottom: 1%;*/
114
+ }
115
+
116
+ .modal-overflow.modal.fade {
117
+ top: -100%;
118
+ }
119
+
120
+ .modal-overflow.modal.fade.in {
121
+ top: 1%;
122
+ /*bottom: 1%;*/
123
+ }
124
+
125
+ .modal-overflow .modal-body {
126
+ overflow: auto;
127
+ -webkit-overflow-scrolling: touch;
128
+ }
129
+
130
+ /*.modal-overflow .modal-body {
131
+ position: absolute;
132
+ top: 0;
133
+ bottom: 0;
134
+ right: 0;
135
+ left: 0;
136
+ margin-top: 48px; // header height
137
+ margin-bottom: 60px; // footer height
138
+ overflow: auto;
139
+ }
140
+
141
+
142
+ .modal-overflow .modal-footer {
143
+ position: absolute;
144
+ bottom: 0;
145
+ right: 0;
146
+ left: 0;
147
+ }*/
148
+
149
+ /* Responsive */
150
+
151
+ @media (min-width: 1200px) {
152
+ .modal.container {
153
+ width: 1170px;
154
+ margin-left: -585px;
155
+ }
156
+ }
157
+
158
+ @media (max-width: 979px) {
159
+ .modal,
160
+ .modal.container,
161
+ .modal.modal-overflow {
162
+ top: 1%;
163
+ right: 1%;
164
+ left: 1%;
165
+ bottom: auto;
166
+ width: auto !important;
167
+ height: auto !important;
168
+ margin: 0 !important;
169
+ padding: 0 !important;
170
+ }
171
+
172
+ .modal.fade.in,
173
+ .modal.container.fade.in,
174
+ .modal.modal-overflow.fade.in {
175
+ top: 1%;
176
+ bottom: auto;
177
+ }
178
+
179
+ .modal-body,
180
+ .modal-overflow .modal-body {
181
+ position: static;
182
+ margin: 0;
183
+ height: auto !important;
184
+ max-height: none !important;
185
+ overflow: visible !important;
186
+ }
187
+
188
+ .modal-footer,
189
+ .modal-overflow .modal-footer {
190
+ position: static;
191
+ }
192
+ }
193
+
194
+ .loading-spinner {
195
+ position: absolute;
196
+ top: 50%;
197
+ left: 50%;
198
+ margin: -12px 0 0 -12px;
199
+ }
@@ -2,11 +2,20 @@
2
2
  # note that while this is mostly restful routing, the #update and #destroy actions
3
3
  # take the Solr document ID as the :id, NOT the id of the actual Bookmark action.
4
4
  class BookmarksController < CatalogController
5
+
6
+ ##
7
+ # Give Bookmarks access to the CatalogController configuration
5
8
  include Blacklight::Configurable
6
9
  include Blacklight::SolrHelper
7
10
 
8
11
  copy_blacklight_config_from(CatalogController)
9
-
12
+
13
+ # Blacklight uses #search_action_url to figure out the right URL for
14
+ # the global search box
15
+ def search_action_url
16
+ catalog_index_url
17
+ end
18
+ helper_method :search_action_url
10
19
 
11
20
  before_filter :verify_user
12
21
 
@@ -14,7 +23,7 @@ class BookmarksController < CatalogController
14
23
  @bookmarks = current_or_guest_user.bookmarks
15
24
  bookmark_ids = @bookmarks.collect { |b| b.document_id.to_s }
16
25
 
17
- @response, @document_list = get_solr_response_for_field_values("id", bookmark_ids)
26
+ @response, @document_list = get_solr_response_for_field_values(SolrDocument.unique_key, bookmark_ids)
18
27
  end
19
28
 
20
29
  def update
@@ -30,14 +39,11 @@ class BookmarksController < CatalogController
30
39
  # bookmark[title] and bookmark[document_id], but in that case #update
31
40
  # is simpler.
32
41
  def create
33
- @bookmarks = params[:bookmarks] || []
34
-
35
- if params[:bookmark]
36
- params[:bookmark][:document_id] ||= params[:id]
37
- @bookmarks << params[:bookmark] if params[:bookmark]
38
- end
39
-
40
- current_or_guest_user.save! unless current_or_guest_user.persisted?
42
+ if params[:bookmarks]
43
+ @bookmarks = params[:bookmarks]
44
+ else
45
+ @bookmarks = [{ :document_id => params[:id] }]
46
+ end
41
47
 
42
48
  success = @bookmarks.all? do |bookmark|
43
49
  current_or_guest_user.bookmarks.create(bookmark) unless current_or_guest_user.existing_bookmark_for(bookmark[:document_id])
@@ -9,7 +9,7 @@ module Blacklight::BlacklightHelperBehavior
9
9
  include HtmlHeadHelper
10
10
  include FacetsHelper
11
11
 
12
-
12
+
13
13
  def application_name
14
14
  return Rails.application.config.application_name if Rails.application.config.respond_to? :application_name
15
15
 
@@ -17,33 +17,33 @@ module Blacklight::BlacklightHelperBehavior
17
17
  end
18
18
 
19
19
  # Provide the full, absolute url for an image
20
- def asset_url(*args)
21
- "#{request.protocol}#{request.host_with_port}#{asset_path(*args)}"
20
+ def asset_url(*args)
21
+ "#{request.protocol}#{request.host_with_port}#{asset_path(*args)}"
22
22
  end
23
23
 
24
24
  # Create <link rel="alternate"> links from a documents dynamically
25
25
  # provided export formats. Currently not used by standard BL layouts,
26
26
  # but available for your custom layouts to provide link rel alternates.
27
27
  #
28
- # Returns empty string if no links available.
28
+ # Returns empty string if no links available.
29
29
  #
30
30
  # :unique => true, will ensure only one link is output for every
31
31
  # content type, as required eg in atom. Which one 'wins' is arbitrary.
32
32
  # :exclude => array of format shortnames, formats to not include at all.
33
33
  def render_link_rel_alternates(document=@document, options = {})
34
- options = {:unique => false, :exclude => []}.merge(options)
35
-
36
- return nil if document.nil?
34
+ options = {:unique => false, :exclude => []}.merge(options)
35
+
36
+ return nil if document.nil?
37
37
 
38
38
  seen = Set.new
39
-
39
+
40
40
  html = ""
41
41
  document.export_formats.each_pair do |format, spec|
42
42
  unless( options[:exclude].include?(format) ||
43
43
  (options[:unique] && seen.include?(spec[:content_type]))
44
44
  )
45
45
  html << tag(:link, {:rel=>"alternate", :title=>format, :type => spec[:content_type], :href=> polymorphic_url(document, :format => format)}) << "\n"
46
-
46
+
47
47
  seen.add(spec[:content_type]) if options[:unique]
48
48
  end
49
49
  end
@@ -57,45 +57,60 @@ module Blacklight::BlacklightHelperBehavior
57
57
  def render_body_class
58
58
  extra_body_classes.join " "
59
59
  end
60
-
60
+
61
61
  # collection of items to be rendered in the @sidebar
62
62
  def sidebar_items
63
63
  @sidebar_items ||= []
64
64
  end
65
65
 
66
+ # collection of items to be rendered in the @topbar
67
+ def topbar_items
68
+ @topbar_items ||= []
69
+ end
70
+
71
+ def render_search_bar
72
+ render :partial=>'catalog/search_form'
73
+ end
74
+
75
+ def search_action_url
76
+ catalog_index_url
77
+ end
78
+
66
79
  def extra_body_classes
67
80
  @extra_body_classes ||= ['blacklight-' + controller.controller_name, 'blacklight-' + [controller.controller_name, controller.action_name].join('-')]
68
81
  end
69
-
70
-
82
+
71
83
  def render_document_list_partial options={}
72
84
  render :partial=>'catalog/document_list'
73
85
  end
74
-
86
+
75
87
  # Save function area for search results 'index' view, normally
76
- # renders next to title.
77
- def render_index_doc_actions(document, options={})
88
+ # renders next to title.
89
+ def render_index_doc_actions(document, options={})
90
+ wrapping_class = options.delete(:wrapping_class) || "documentFunctions"
91
+
78
92
  content = []
79
93
  content << render(:partial => 'catalog/bookmark_control', :locals => {:document=> document}.merge(options)) if has_user_authentication_provider? and current_or_guest_user
80
94
 
81
- content_tag("div", content.join("\n").html_safe, :class=>"documentFunctions")
95
+ content_tag("div", content.join("\n").html_safe, :class=> wrapping_class)
82
96
  end
83
-
97
+
84
98
  # Save function area for item detail 'show' view, normally
85
99
  # renders next to title. By default includes 'Bookmarks'
86
100
  def render_show_doc_actions(document=@document, options={})
101
+ wrapping_class = options.delete(:documentFunctions) || "documentFunctions"
87
102
  content = []
88
103
  content << render(:partial => 'catalog/bookmark_control', :locals => {:document=> document}.merge(options)) if has_user_authentication_provider? and current_or_guest_user
89
104
 
90
105
  content_tag("div", content.join("\n").html_safe, :class=>"documentFunctions")
91
106
  end
92
-
107
+
93
108
  # used in the catalog/_index_partials/_default view
94
109
  def index_fields
95
110
  blacklight_config.index_fields
96
111
  end
97
112
 
98
- def should_display_index_field? document, solr_field
113
+ def should_render_index_field? document, solr_field
99
114
  document.has?(solr_field.field) ||
100
115
  (document.has_highlight_field? solr_field.field if solr_field.highlight)
101
116
  end
@@ -109,7 +124,7 @@ module Blacklight::BlacklightHelperBehavior
109
124
  # XXX DEPRECATED
110
125
  Hash[*index_fields.map { |key, field| [key, field.label] }.flatten]
111
126
  end
112
-
127
+
113
128
  def spell_check_max
114
129
  blacklight_config.spell_max
115
130
  end
@@ -121,68 +136,80 @@ module Blacklight::BlacklightHelperBehavior
121
136
 
122
137
  def render_index_field_value args
123
138
  value = args[:value]
124
- value ||= send(blacklight_config.index_fields[args[:field]][:helper_method], args) if args[:field] and blacklight_config.index_fields[args[:field]] and blacklight_config.index_fields[args[:field]][:helper_method]
139
+
140
+ if args[:field] and blacklight_config.index_fields[args[:field]]
141
+ field_config = blacklight_config.index_fields[args[:field]]
142
+ value ||= send(blacklight_config.index_fields[args[:field]][:helper_method], args) if field_config.helper_method
143
+ value ||= args[:document].highlight_field(args[:field]) if field_config.highlight
144
+ end
145
+
125
146
  value ||= args[:document].get(args[:field], :sep => nil) if args[:document] and args[:field]
126
147
  render_field_value value
127
148
  end
128
-
149
+
129
150
  # Used in the show view for displaying the main solr document heading
130
151
  def document_heading
131
152
  @document[blacklight_config.show.heading] || @document.id
132
153
  end
133
154
  def render_document_heading
134
- content_tag(:h1, document_heading)
155
+ content_tag(:h4, document_heading, :class => "show-document-title")
135
156
  end
136
-
157
+
137
158
  # Used in the show view for setting the main html document title
138
159
  def document_show_html_title
139
160
  @document[blacklight_config.show.html_title]
140
161
  end
141
-
162
+
142
163
  # Used in citation view for displaying the title
143
164
  def citation_title(document)
144
165
  document[blacklight_config.show.html_title]
145
166
  end
146
-
167
+
147
168
  # Used in the document_list partial (search view) for building a select element
148
169
  def sort_fields
149
170
  blacklight_config.sort_fields.map { |key, x| [x.label, x.key] }
150
171
  end
151
-
172
+
152
173
  # Used in the document list partial (search view) for creating a link to the document show action
153
174
  def document_show_link_field
154
175
  blacklight_config.index.show_link.to_sym
155
176
  end
156
-
177
+
157
178
  # Used in the search form partial for building a select tag
158
179
  def search_fields
159
180
  search_field_options_for_select
160
181
  end
161
-
182
+
162
183
  # used in the catalog/_show/_default partial
163
184
  def document_show_fields
164
185
  blacklight_config.show_fields
165
186
  end
166
-
187
+
167
188
  # used in the catalog/_show/_default partial
168
189
  def document_show_field_labels
169
190
  # XXX DEPRECATED
170
191
  Hash[*blacklight_config.show_fields.map { |key, field| [key, field.label] }.flatten]
171
192
  end
172
193
 
173
- def render_document_show_field_label args
194
+ def render_document_show_field_label args
174
195
  field = args[:field]
175
196
  html_escape blacklight_config.show_fields[field].label
176
197
  end
177
198
 
178
199
  def render_document_show_field_value args
179
200
  value = args[:value]
180
- value ||= send(blacklight_config.show_fields[args[:field]][:helper_method], args) if args[:field] and blacklight_config.show_fields[args[:field]] and blacklight_config.show_fields[args[:field]][:helper_method]
201
+
202
+ if args[:field] and blacklight_config.show_fields[args[:field]]
203
+ field_config = blacklight_config.show_fields[args[:field]]
204
+ value ||= send(blacklight_config.show_fields[args[:field]][:helper_method], args) if field_config.helper_method
205
+ value ||= args[:document].highlight_field(args[:field]).map { |x| x.html_safe } if field_config.highlight
206
+ end
207
+
181
208
  value ||= args[:document].get(args[:field], :sep => nil) if args[:document] and args[:field]
182
209
  render_field_value value
183
210
  end
184
211
 
185
- def should_display_show_field? document, solr_field
212
+ def should_render_show_field? document, solr_field
186
213
  document.has?(solr_field.field) ||
187
214
  (document.has_highlight_field? solr_field.field if solr_field.highlight)
188
215
  end
@@ -191,12 +218,40 @@ module Blacklight::BlacklightHelperBehavior
191
218
  value = [value] unless value.is_a? Array
192
219
  value = value.collect { |x| x.respond_to?(:force_encoding) ? x.force_encoding("UTF-8") : x}
193
220
  return value.map { |v| html_escape v }.join(field_value_separator).html_safe
194
- end
221
+ end
195
222
 
196
223
  def field_value_separator
197
224
  ', '
198
225
  end
199
-
226
+
227
+ def document_index_view_type
228
+ params.fetch(:view, 'list')
229
+ end
230
+
231
+ def render_document_index documents = nil, locals = {}
232
+ documents ||= @document_list
233
+
234
+ document_index_path_templates.each do |str|
235
+ # XXX rather than handling this logic through exceptions, maybe there's a Rails internals method
236
+ # for determining if a partial template exists..
237
+ begin
238
+ return render(:partial => (str % [document_index_view_type]), :locals => { :documents => documents })
239
+ rescue ActionView::MissingTemplate
240
+ nil
241
+ end
242
+ end
243
+
244
+ return ""
245
+ end
246
+
247
+ # a list of document partial templates to try to render for #render_document_index
248
+ def document_index_path_templates
249
+ # first, the legacy template names for backwards compatbility
250
+ # followed by the new, inheritable style
251
+ # finally, a controller-specific path for non-catalog subclasses
252
+ @document_index_path_templates ||= ["document_%s", "catalog/document_%s", "catalog/document_list"]
253
+ end
254
+
200
255
  # Return a normalized partial name that can be used to contruct view partial path
201
256
  def document_partial_name(document)
202
257
  # .to_s is necessary otherwise the default return value is not always a string
@@ -221,8 +276,8 @@ module Blacklight::BlacklightHelperBehavior
221
276
  # XXX rather than handling this logic through exceptions, maybe there's a Rails internals method
222
277
  # for determining if a partial template exists..
223
278
  begin
224
- return render :partial => (str % [action_name, format]), :locals=>locals.merge({:document=>doc})
225
- rescue ActionView::MissingTemplate
279
+ return render :partial => (str % [action_name, format]), :locals=>locals.merge({:document=>doc})
280
+ rescue ActionView::MissingTemplate
226
281
  nil
227
282
  end
228
283
  end
@@ -232,7 +287,7 @@ module Blacklight::BlacklightHelperBehavior
232
287
 
233
288
  # a list of document partial templates to try to render for #render_document_partial
234
289
  #
235
- # (NOTE: I suspect #document_partial_name, #render_document_partial and #document_partial_path_templates
290
+ # (NOTE: I suspect #document_partial_name, #render_document_partial and #document_partial_path_templates
236
291
  # should be more succinctly refactored in the future)
237
292
  def document_partial_path_templates
238
293
  # first, the legacy template names for backwards compatbility
@@ -241,21 +296,21 @@ module Blacklight::BlacklightHelperBehavior
241
296
  @partial_path_templates ||= ["catalog/_%s_partials/%s", "catalog/_%s_partials/default", "%s_%s", "%s_default", "catalog/%s_%s", "catalog/%s_default"]
242
297
  end
243
298
 
244
-
299
+
245
300
  # Search History and Saved Searches display
246
301
  def link_to_previous_search(params)
247
302
  link_to(raw(render_search_to_s(params)), catalog_index_path(params)).html_safe
248
303
  end
249
-
304
+
250
305
  #
251
306
  # shortcut for built-in Rails helper, "number_with_delimiter"
252
307
  #
253
308
  def format_num(num); number_with_delimiter(num) end
254
-
309
+
255
310
  #
256
311
  # link based helpers ->
257
312
  #
258
-
313
+
259
314
  # create link to query (e.g. spelling suggestion)
260
315
  def link_to_query(query)
261
316
  p = params.dup
@@ -265,7 +320,7 @@ module Blacklight::BlacklightHelperBehavior
265
320
  link_url = catalog_index_path(p)
266
321
  link_to(query, link_url)
267
322
  end
268
-
323
+
269
324
  def render_document_index_label doc, opts
270
325
  label = nil
271
326
  label ||= doc.get(opts[:label], :sep => nil) if opts[:label].instance_of? Symbol
@@ -276,7 +331,7 @@ module Blacklight::BlacklightHelperBehavior
276
331
  end
277
332
 
278
333
  # link_to_document(doc, :label=>'VIEW', :counter => 3)
279
- # Use the catalog_path RESTful route to create a link to the show page for a specific item.
334
+ # Use the catalog_path RESTful route to create a link to the show page for a specific item.
280
335
  # catalog_path accepts a HashWithIndifferentAccess object. The solr query params are stored in the session,
281
336
  # so we only need the +counter+ param here. We also need to know if we are viewing to document as part of search results.
282
337
  def link_to_document(doc, opts={:label=>nil, :counter => nil, :results_view => true})
@@ -287,11 +342,17 @@ module Blacklight::BlacklightHelperBehavior
287
342
 
288
343
  # link_back_to_catalog(:label=>'Back to Search')
289
344
  # Create a link back to the index screen, keeping the user's facet, query and paging choices intact by using session.
290
- def link_back_to_catalog(opts={:label=>t('blacklight.back_to_search')})
345
+ def link_back_to_catalog(opts={:label=>nil})
291
346
  query_params = session[:search] ? session[:search].dup : {}
292
347
  query_params.delete :counter
293
348
  query_params.delete :total
294
349
  link_url = url_for(query_params)
350
+ if link_url =~ /bookmarks/
351
+ opts[:label] ||= t('blacklight.back_to_bookmarks')
352
+ end
353
+
354
+ opts[:label] ||= t('blacklight.back_to_search')
355
+
295
356
  link_to opts[:label], link_url
296
357
  end
297
358
 
@@ -312,7 +373,7 @@ module Blacklight::BlacklightHelperBehavior
312
373
  else
313
374
  my_params.delete(omit_key)
314
375
  end
315
- end
376
+ end
316
377
 
317
378
  # removing action and controller from duplicate params so that we don't get hidden fields for them.
318
379
  my_params.delete(:action)
@@ -323,7 +384,7 @@ module Blacklight::BlacklightHelperBehavior
323
384
 
324
385
  my_params
325
386
  end
326
-
387
+
327
388
  # Create form input type=hidden fields representing the entire search context,
328
389
  # for inclusion in a form meant to change some aspect of it, like
329
390
  # re-sort or change records per page. Can pass in params hash
@@ -335,29 +396,31 @@ module Blacklight::BlacklightHelperBehavior
335
396
  # hash_as_hidden_fields in hash_as_hidden_fields.rb
336
397
  return hash_as_hidden_fields(my_params)
337
398
  end
338
-
339
-
399
+
400
+
340
401
 
341
402
  def link_to_previous_document(previous_document)
342
- return if previous_document == nil
343
- link_to raw(t('views.pagination.previous')), previous_document, :class => "previous", :'data-counter' => session[:search][:counter].to_i - 1
403
+ link_to_unless previous_document.nil?, raw(t('views.pagination.previous')), previous_document, :class => "previous", :rel => 'prev', :'data-counter' => session[:search][:counter].to_i - 1 do
404
+ content_tag :span, raw(t('views.pagination.previous')), :class => 'previous'
405
+ end
344
406
  end
345
407
 
346
408
  def link_to_next_document(next_document)
347
- return if next_document == nil
348
- link_to raw(t('views.pagination.next')), next_document, :class => "next", :'data-counter' => session[:search][:counter].to_i + 1
409
+ link_to_unless next_document.nil?, raw(t('views.pagination.next')), next_document, :class => "next", :rel => 'next', :'data-counter' => session[:search][:counter].to_i + 1 do
410
+ content_tag :span, raw(t('views.pagination.next')), :class => 'next'
411
+ end
349
412
  end
350
413
 
351
414
  # Use case, you want to render an html partial from an XML (say, atom)
352
- # template. Rails API kind of lets us down, we need to hack Rails internals
415
+ # template. Rails API kind of lets us down, we need to hack Rails internals
353
416
  # a bit. code taken from:
354
- # http://stackoverflow.com/questions/339130/how-do-i-render-a-partial-of-a-different-format-in-rails
417
+ # http://stackoverflow.com/questions/339130/how-do-i-render-a-partial-of-a-different-format-in-rails (zgchurch)
355
418
  def with_format(format, &block)
356
- old_format = @template_format
357
- @template_format = format
358
- result = block.call
359
- @template_format = old_format
360
- return result
419
+ old_formats = formats
420
+ self.formats = [format]
421
+ block.call
422
+ self.formats = old_formats
423
+ nil
361
424
  end
362
425
 
363
426
  # puts together a collection of documents into one refworks export string
@@ -370,7 +433,7 @@ module Blacklight::BlacklightHelperBehavior
370
433
  end
371
434
  val
372
435
  end
373
-
436
+
374
437
  # puts together a collection of documents into one endnote export string
375
438
  def render_endnote_texts(documents)
376
439
  val = ''