blacklight 3.4.2 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +4 -0
- data/VERSION +1 -1
- data/app/assets/javascripts/blacklight/blacklight.js +15 -474
- data/app/assets/javascripts/blacklight/bookmark_toggle.js +21 -0
- data/app/assets/javascripts/blacklight/checkbox_submit.js +126 -0
- data/app/assets/javascripts/blacklight/core.js +2 -0
- data/app/assets/javascripts/blacklight/facet_expand_contract.js +40 -0
- data/app/assets/javascripts/blacklight/folder_toggle.js +24 -0
- data/app/assets/javascripts/blacklight/lightbox_dialog.js +15 -0
- data/app/assets/javascripts/blacklight/more_facets.js +15 -0
- data/app/assets/javascripts/blacklight/search_context.js +26 -0
- data/app/assets/javascripts/blacklight/select_submit.js +18 -0
- data/app/assets/javascripts/blacklight/zebra_stripe.js +13 -0
- data/app/assets/javascripts/jquery.uiExt.ajaxyDialog.js +180 -0
- data/app/controllers/bookmarks_controller.rb +9 -9
- data/app/controllers/feedback_controller.rb +3 -3
- data/app/controllers/folder_controller.rb +3 -3
- data/app/controllers/saved_searches_controller.rb +7 -7
- data/app/controllers/search_history_controller.rb +2 -2
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +6 -10
- data/app/helpers/blacklight/catalog_helper_behavior.rb +8 -11
- data/app/helpers/blacklight/facets_helper_behavior.rb +2 -2
- data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +2 -2
- data/app/models/bookmark.rb +5 -0
- data/app/models/record_mailer.rb +5 -11
- data/app/views/_user_util_links.html.erb +6 -6
- data/app/views/bookmarks/index.html.erb +8 -8
- data/app/views/catalog/_bookmark_control.html.erb +2 -2
- data/app/views/catalog/_bookmark_form.html.erb +3 -3
- data/app/views/catalog/_citation.html.erb +3 -3
- data/app/views/catalog/_constraints.html.erb +1 -1
- data/app/views/catalog/_constraints_element.html.erb +2 -2
- data/app/views/catalog/_did_you_mean.html.erb +2 -7
- data/app/views/catalog/_document.html.erb +1 -1
- data/app/views/catalog/_email_form.html.erb +4 -4
- data/app/views/catalog/_facet_limit.html.erb +1 -1
- data/app/views/catalog/_facet_pagination.html.erb +7 -7
- data/app/views/catalog/_facets.html.erb +1 -1
- data/app/views/catalog/_folder_control.html.erb +1 -1
- data/app/views/catalog/_home_text.html.erb +1 -1
- data/app/views/catalog/_marc_view.html.erb +2 -2
- data/app/views/catalog/_refworks_form.html.erb +2 -2
- data/app/views/catalog/_results_pagination.html.erb +1 -1
- data/app/views/catalog/_search_form.html.erb +5 -5
- data/app/views/catalog/_show_tools.html.erb +6 -6
- data/app/views/catalog/_sms_form.html.erb +5 -5
- data/app/views/catalog/_sort_and_per_page.html.erb +6 -9
- data/app/views/catalog/index.atom.builder +3 -3
- data/app/views/catalog/index.html.erb +2 -2
- data/app/views/catalog/index.rss.builder +3 -3
- data/app/views/catalog/show.html.erb +2 -2
- data/app/views/feedback/complete.html.erb +2 -2
- data/app/views/feedback/show.html.erb +5 -5
- data/app/views/folder/_tools.html.erb +4 -4
- data/app/views/folder/index.html.erb +1 -1
- data/app/views/layouts/blacklight.html.erb +1 -1
- data/app/views/record_mailer/email_record.text.erb +2 -2
- data/app/views/record_mailer/sms_record.text.erb +1 -1
- data/app/views/saved_searches/index.html.erb +6 -6
- data/app/views/search_history/index.html.erb +6 -6
- data/config/locales/blacklight.en.yml +227 -0
- data/lib/blacklight.rb +0 -2
- data/lib/blacklight/catalog.rb +11 -13
- data/lib/blacklight/configurable.rb +0 -3
- data/lib/blacklight/configuration.rb +0 -42
- data/lib/blacklight/configuration/fields.rb +2 -0
- data/lib/blacklight/routes.rb +14 -2
- data/lib/blacklight/search_fields.rb +1 -1
- data/lib/blacklight/solr/document/email.rb +6 -6
- data/lib/blacklight/solr/document/sms.rb +4 -4
- data/lib/blacklight/solr_helper.rb +1 -3
- data/lib/generators/blacklight/blacklight_generator.rb +3 -0
- data/lib/railties/blacklight_cucumber.rake +12 -3
- data/lib/railties/blacklight_rspec.rake +9 -2
- data/test_support/alternate_controller.rb +4 -0
- data/test_support/bin/test.sh +13 -1
- data/test_support/features/bookmarks.feature +1 -1
- data/test_support/features/librarian_view.feature +2 -1
- data/test_support/features/record_view.feature +1 -0
- data/test_support/features/search.feature +1 -0
- data/test_support/features/step_definitions/general_steps.rb +4 -0
- data/test_support/features/support/env.rb +12 -1
- data/test_support/features/support/paths.rb +2 -1
- data/test_support/spec/helpers/blacklight_helper_spec.rb +8 -2
- data/test_support/spec/helpers/search_history_constraints_helper_spec.rb +6 -18
- data/test_support/spec/lib/search_fields_spec.rb +18 -25
- data/test_support/spec/models/record_mailer_spec.rb +5 -4
- data/test_support/spec/requests/alternate_controller_spec.rb +15 -0
- data/test_support/spec/spec_helper.rb +12 -0
- data/test_support/spec/views/catalog/_index_default.erb_spec.rb +6 -17
- data/test_support/spec/views/catalog/_show_default.erb_spec.rb +7 -17
- metadata +19 -8
- data/config/locales/kaminari.yml +0 -10
- data/lib/blacklight/global_configurable.rb +0 -46
- data/test_support/spec/lib/global_configurable_spec.rb +0 -98
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
<% @documents.each do |document| %>
|
|
2
2
|
<%= document.to_sms_text %>
|
|
3
|
-
|
|
3
|
+
<%= t('blacklight.sms.text.url', :url => polymorphic_path(document, {:only_path => false}.merge(@url_gen_params)) ) %>
|
|
4
4
|
<% end %>
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
<h1
|
|
1
|
+
<h1><%= t('blacklight.saved_searches.title') %></h1>
|
|
2
2
|
|
|
3
3
|
<%- if current_user.blank? -%>
|
|
4
4
|
|
|
5
|
-
<h2
|
|
5
|
+
<h2><%= t('blacklight.saved_searches.need_login') %></h2>
|
|
6
6
|
|
|
7
7
|
<%- elsif @searches.blank? -%>
|
|
8
8
|
|
|
9
|
-
<h2
|
|
9
|
+
<h2><%= t('blacklight.saved_searches.no_searches') %></h2>
|
|
10
10
|
|
|
11
11
|
<%- else -%>
|
|
12
12
|
<p>
|
|
13
|
-
<%= link_to
|
|
13
|
+
<%= link_to t('blacklight.saved_searches.clear.action_title'), clear_saved_searches_path, :method => :delete, :confirm => t('blacklight.saved_searches.clear.action_confirm') %>
|
|
14
14
|
</p>
|
|
15
15
|
|
|
16
|
-
<h2
|
|
16
|
+
<h2><%= t('blacklight.saved_searches.list_title') %></h2>
|
|
17
17
|
<table class="zebra">
|
|
18
18
|
<%- @searches.each do |search| -%>
|
|
19
19
|
<tr>
|
|
20
20
|
<td><%= link_to_previous_search(search.query_params) %></td>
|
|
21
|
-
<td><%= button_to
|
|
21
|
+
<td><%= button_to t('blacklight.saved_searches.delete'), forget_search_path(search.id) %></td>
|
|
22
22
|
</tr>
|
|
23
23
|
<%- end -%>
|
|
24
24
|
</table>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
<h1
|
|
1
|
+
<h1><%=t('blacklight.search_history.title')%></h1>
|
|
2
2
|
<%- if @searches.blank? -%>
|
|
3
|
-
<h2
|
|
3
|
+
<h2><%=t('blacklight.search_history.no_history')%></h2>
|
|
4
4
|
<%- else -%>
|
|
5
5
|
<p>
|
|
6
|
-
|
|
6
|
+
<%= link_to t('blacklight.search_history.clear.action_title'), clear_search_history_path, :method => :delete, :data => { :confirm => t('blacklight.search_history.clear.action_confirm') } %>
|
|
7
7
|
</p>
|
|
8
|
-
<h2
|
|
8
|
+
<h2><%=t('blacklight.search_history.recent')%></h2>
|
|
9
9
|
<table class="zebra search_history">
|
|
10
10
|
<%- @searches.each_with_index do |search,index| -%>
|
|
11
11
|
<%= content_tag :tr, :id => "document_#{index + 1}" do %>
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
<%- if has_user_authentication_provider? -%>
|
|
14
14
|
<td class="actions">
|
|
15
15
|
<%- if current_user && search.saved? -%>
|
|
16
|
-
<%= button_to
|
|
16
|
+
<%= button_to t('blacklight.search_history.forget'), forget_search_path(search.id) %>
|
|
17
17
|
<%- else -%>
|
|
18
|
-
<%= button_to
|
|
18
|
+
<%= button_to t('blacklight.search_history.save'), save_search_path(search.id), :method => :put %>
|
|
19
19
|
<%- end -%>
|
|
20
20
|
</td>
|
|
21
21
|
<%- end -%>
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
en:
|
|
2
|
+
active_record:
|
|
3
|
+
models:
|
|
4
|
+
feedback: 'Feedback'
|
|
5
|
+
attributes:
|
|
6
|
+
feedback:
|
|
7
|
+
name: 'Your Name'
|
|
8
|
+
email: 'Your Email'
|
|
9
|
+
message: 'Your Message'
|
|
10
|
+
views:
|
|
11
|
+
pagination:
|
|
12
|
+
first: '« First'
|
|
13
|
+
last: 'Last »'
|
|
14
|
+
previous: '« Previous'
|
|
15
|
+
next: 'Next »'
|
|
16
|
+
truncate: '…'
|
|
17
|
+
|
|
18
|
+
blacklight:
|
|
19
|
+
application_name: 'Blacklight'
|
|
20
|
+
|
|
21
|
+
header_links:
|
|
22
|
+
login: 'Login'
|
|
23
|
+
logout: 'Log Out'
|
|
24
|
+
bookmarks: 'Your Bookmarks'
|
|
25
|
+
saved_searches: 'Saved Searches'
|
|
26
|
+
selected_items: 'Selected Items'
|
|
27
|
+
search_history: 'Search History'
|
|
28
|
+
|
|
29
|
+
welcome: 'Welcome!'
|
|
30
|
+
and: 'and'
|
|
31
|
+
or: 'or'
|
|
32
|
+
|
|
33
|
+
bookmarks:
|
|
34
|
+
collection:
|
|
35
|
+
add:
|
|
36
|
+
button: 'Add to Bookmarks'
|
|
37
|
+
title: 'Bookmarks'
|
|
38
|
+
no_bookmarks: 'You have no bookmarks'
|
|
39
|
+
add:
|
|
40
|
+
button: 'Bookmark'
|
|
41
|
+
success:
|
|
42
|
+
one: 'Successfully added bookmark.'
|
|
43
|
+
other: 'Successfully added bookmarks.'
|
|
44
|
+
failure: 'Sorry, there was a problem saving the bookmarks.'
|
|
45
|
+
remove:
|
|
46
|
+
button: 'Remove bookmark'
|
|
47
|
+
success: 'Successfully removed bookmark.'
|
|
48
|
+
failure: 'Sorry, there was a problem removing the bookmarks.'
|
|
49
|
+
action_confirm: 'Remove this bookmark?'
|
|
50
|
+
clear:
|
|
51
|
+
action_title: 'Clear Bookmarks'
|
|
52
|
+
action_confirm: 'Clear your bookmarks?'
|
|
53
|
+
success: 'Cleared your bookmarks.'
|
|
54
|
+
failure: 'Sorry, there was a problem clearing your bookmarks.'
|
|
55
|
+
need_login: 'Please log in to manage and view your bookmarks.'
|
|
56
|
+
list_title: 'Your Bookmarks'
|
|
57
|
+
delete: 'Remove'
|
|
58
|
+
|
|
59
|
+
feedback:
|
|
60
|
+
valid_name: 'A valid name is required'
|
|
61
|
+
valid_email: 'A valid email address is required'
|
|
62
|
+
need_message: 'A message is required'
|
|
63
|
+
submit: 'Send!'
|
|
64
|
+
errors:
|
|
65
|
+
title: 'Please fix the following form errors:'
|
|
66
|
+
complete:
|
|
67
|
+
title: 'Thank-you for your feedback'
|
|
68
|
+
|
|
69
|
+
folder:
|
|
70
|
+
title: 'Selected Items'
|
|
71
|
+
add:
|
|
72
|
+
success: '%{title} successfully added to selected items'
|
|
73
|
+
remove:
|
|
74
|
+
success: '%{title} successfully removed from selected items'
|
|
75
|
+
clear:
|
|
76
|
+
success: 'Selected items cleared.'
|
|
77
|
+
|
|
78
|
+
saved_searches:
|
|
79
|
+
add:
|
|
80
|
+
success: 'Successfully saved your search.'
|
|
81
|
+
failure: 'There was a problem saving your search.'
|
|
82
|
+
remove:
|
|
83
|
+
success: 'Successfully removed that saved search.'
|
|
84
|
+
failure: 'There was a problem removing your search.'
|
|
85
|
+
clear:
|
|
86
|
+
action_title: 'Clear Saved Searches'
|
|
87
|
+
action_confirm: 'Clear your saved searches?'
|
|
88
|
+
success: 'Cleared your saved searches.'
|
|
89
|
+
failure: 'There was a problem clearing your searches.'
|
|
90
|
+
title: 'Saved Searches'
|
|
91
|
+
need_login: 'Please log in to manage and view your saved searches.'
|
|
92
|
+
no_searches: 'You have no saved searches'
|
|
93
|
+
list_title: 'Your saved searches'
|
|
94
|
+
delete: 'delete'
|
|
95
|
+
|
|
96
|
+
search_history:
|
|
97
|
+
clear:
|
|
98
|
+
action_title: 'Clear Search History'
|
|
99
|
+
action_confirm: 'Clear your search history?'
|
|
100
|
+
success: 'Cleared your search history.'
|
|
101
|
+
failure: 'There was a problem clearing your search history.'
|
|
102
|
+
title: 'Search History'
|
|
103
|
+
no_history: 'You have no search history'
|
|
104
|
+
recent: 'Your recent searches'
|
|
105
|
+
forget: 'forget'
|
|
106
|
+
save: 'save'
|
|
107
|
+
|
|
108
|
+
tools:
|
|
109
|
+
cite: 'Cite'
|
|
110
|
+
endnote: 'Export to EndNote'
|
|
111
|
+
refworks: 'Export to Refworks'
|
|
112
|
+
email: 'Email'
|
|
113
|
+
sms: 'SMS This'
|
|
114
|
+
librarian_view: 'Librarian View'
|
|
115
|
+
clear: 'Clear'
|
|
116
|
+
|
|
117
|
+
citation:
|
|
118
|
+
mla: 'MLA'
|
|
119
|
+
apa: 'APA'
|
|
120
|
+
chicago: 'Chicago'
|
|
121
|
+
|
|
122
|
+
email:
|
|
123
|
+
form:
|
|
124
|
+
title: 'Email This'
|
|
125
|
+
to: 'Email:'
|
|
126
|
+
message: 'Message:'
|
|
127
|
+
submit: 'Send'
|
|
128
|
+
text:
|
|
129
|
+
title: 'Title: %{value}'
|
|
130
|
+
author: 'Author: %{value}'
|
|
131
|
+
format: 'Format: %{value}'
|
|
132
|
+
language: 'Language: %{value}'
|
|
133
|
+
subject:
|
|
134
|
+
one: 'Item Record: %{title}'
|
|
135
|
+
other: 'Item records'
|
|
136
|
+
url: 'URL: %{url}'
|
|
137
|
+
message: 'Message: %{message}'
|
|
138
|
+
|
|
139
|
+
errors:
|
|
140
|
+
to:
|
|
141
|
+
invalid: 'You must enter a valid email address'
|
|
142
|
+
blank: 'You must enter a recipient in order to send this message'
|
|
143
|
+
sms:
|
|
144
|
+
form:
|
|
145
|
+
title: 'SMS This'
|
|
146
|
+
to: 'Phone Number:'
|
|
147
|
+
carrier: 'Carrier'
|
|
148
|
+
carrier_prompt: 'Please select your carrier'
|
|
149
|
+
submit: 'Send'
|
|
150
|
+
text:
|
|
151
|
+
title: '%{value}'
|
|
152
|
+
author: ' by %{value}'
|
|
153
|
+
url: 'Link: %{url}'
|
|
154
|
+
errors:
|
|
155
|
+
to:
|
|
156
|
+
invalid: 'You must enter a valid 10 digit phone number'
|
|
157
|
+
blank: "You must enter a recipient's phone number in order to send this message"
|
|
158
|
+
carrier:
|
|
159
|
+
blank: 'You must select a carrier'
|
|
160
|
+
|
|
161
|
+
back_to_search: 'Back to Search'
|
|
162
|
+
|
|
163
|
+
search:
|
|
164
|
+
title: '%{application_name} Search Results'
|
|
165
|
+
search_results: 'Search Results'
|
|
166
|
+
errors:
|
|
167
|
+
request_error: "Sorry, I don't understand your search."
|
|
168
|
+
invalid_solr_id: "Sorry, you have requested a record that doesn't exist."
|
|
169
|
+
per_page:
|
|
170
|
+
label: 'Show %{select} per page'
|
|
171
|
+
title: 'Number of results to display per page'
|
|
172
|
+
submit: 'update'
|
|
173
|
+
sort:
|
|
174
|
+
label: 'Sort by %{select}'
|
|
175
|
+
submit: 'sort results'
|
|
176
|
+
form:
|
|
177
|
+
search_field:
|
|
178
|
+
label: 'in'
|
|
179
|
+
title: 'Targeted search options'
|
|
180
|
+
q: 'Search '
|
|
181
|
+
submit: 'search'
|
|
182
|
+
pagination:
|
|
183
|
+
title: 'Results navigation'
|
|
184
|
+
pagination_info:
|
|
185
|
+
no_items_found: 'No %{entry_name} found'
|
|
186
|
+
single_item_found: 'Displaying <b>1</b> %{entry_name}'
|
|
187
|
+
pages:
|
|
188
|
+
one: 'Displaying <b>all %{total_num}</b> %{entry_name}'
|
|
189
|
+
other: 'Displaying %{entry_name} <b>%{start_num} - %{end_num}</b> of <b>%{total_num}</b>'
|
|
190
|
+
entry_pagination_info:
|
|
191
|
+
one: 'Showing the only item from your search.'
|
|
192
|
+
other: 'Showing item <b>%{current} of %{total}</b> from your search.'
|
|
193
|
+
documents:
|
|
194
|
+
counter: '%{counter}. '
|
|
195
|
+
folder:
|
|
196
|
+
select: 'Select'
|
|
197
|
+
unselect: 'Unselect'
|
|
198
|
+
facets:
|
|
199
|
+
title: 'Limit your search'
|
|
200
|
+
sort:
|
|
201
|
+
count: 'Numerical Sort'
|
|
202
|
+
index: 'A-Z Sort'
|
|
203
|
+
count: '(%{number})'
|
|
204
|
+
more: 'more »'
|
|
205
|
+
selected:
|
|
206
|
+
remove: '[remove]'
|
|
207
|
+
filters:
|
|
208
|
+
title: 'You searched for:'
|
|
209
|
+
label: '%{label}:'
|
|
210
|
+
remove:
|
|
211
|
+
value: 'Remove constraint %{value}'
|
|
212
|
+
label_value: 'Remove constraint %{label}: %{value}'
|
|
213
|
+
librarian_view:
|
|
214
|
+
title: 'Librarian View'
|
|
215
|
+
leader: 'LEADER %{leader}'
|
|
216
|
+
start_over: 'start over'
|
|
217
|
+
show:
|
|
218
|
+
title: '%{document_title} - %{application_name}'
|
|
219
|
+
rss_feed: 'RSS for results'
|
|
220
|
+
atom_feed: 'Atom for results'
|
|
221
|
+
fields:
|
|
222
|
+
default: 'Keyword'
|
|
223
|
+
|
|
224
|
+
entry_name:
|
|
225
|
+
default: 'entry'
|
|
226
|
+
|
|
227
|
+
did_you_mean: 'Did you mean to type: %{options}?'
|
data/lib/blacklight.rb
CHANGED
|
@@ -7,7 +7,6 @@ module Blacklight
|
|
|
7
7
|
|
|
8
8
|
autoload :Configurable, 'blacklight/configurable'
|
|
9
9
|
autoload :Configuration, 'blacklight/configuration'
|
|
10
|
-
autoload :GlobalConfigurable, 'blacklight/global_configurable'
|
|
11
10
|
autoload :SearchFields, 'blacklight/search_fields'
|
|
12
11
|
|
|
13
12
|
autoload :Solr, 'blacklight/solr'
|
|
@@ -26,7 +25,6 @@ module Blacklight
|
|
|
26
25
|
|
|
27
26
|
autoload :OpenStructWithHashAccess, 'blacklight/utils'
|
|
28
27
|
|
|
29
|
-
extend GlobalConfigurable
|
|
30
28
|
extend SearchFields
|
|
31
29
|
|
|
32
30
|
require 'blacklight/version'
|
data/lib/blacklight/catalog.rb
CHANGED
|
@@ -28,8 +28,8 @@ module Blacklight::Catalog
|
|
|
28
28
|
# get search results from the solr index
|
|
29
29
|
def index
|
|
30
30
|
|
|
31
|
-
extra_head_content << view_context.auto_discovery_link_tag(:rss, url_for(params.merge(:format => 'rss')), :title =>
|
|
32
|
-
extra_head_content << view_context.auto_discovery_link_tag(:atom, url_for(params.merge(:format => 'atom')), :title =>
|
|
31
|
+
extra_head_content << view_context.auto_discovery_link_tag(:rss, url_for(params.merge(:format => 'rss')), :title => t('blacklight.search.rss_feed') )
|
|
32
|
+
extra_head_content << view_context.auto_discovery_link_tag(:atom, url_for(params.merge(:format => 'atom')), :title => t('blacklight.search.atom_feed') )
|
|
33
33
|
|
|
34
34
|
(@response, @document_list) = get_search_results
|
|
35
35
|
@filters = params[:f] || []
|
|
@@ -100,18 +100,17 @@ module Blacklight::Catalog
|
|
|
100
100
|
@response, @documents = get_solr_response_for_field_values(SolrDocument.unique_key,params[:id])
|
|
101
101
|
if request.post?
|
|
102
102
|
if params[:to]
|
|
103
|
-
from = request.host # host w/o port for From address (from address cannot have port#)
|
|
104
103
|
url_gen_params = {:host => request.host_with_port, :protocol => request.protocol}
|
|
105
104
|
|
|
106
105
|
if params[:to].match(/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/)
|
|
107
|
-
email = RecordMailer.email_record(@documents, {:to => params[:to], :message => params[:message]},
|
|
106
|
+
email = RecordMailer.email_record(@documents, {:to => params[:to], :message => params[:message]}, url_gen_params)
|
|
108
107
|
else
|
|
109
|
-
flash[:error] =
|
|
108
|
+
flash[:error] = I18n.t('blacklight.email.errors.to.invalid', :to => params[:to])
|
|
110
109
|
end
|
|
111
110
|
email.deliver unless flash[:error]
|
|
112
111
|
redirect_to :back
|
|
113
112
|
else
|
|
114
|
-
flash[:error] =
|
|
113
|
+
flash[:error] = I18n.t('blacklight.email.errors.to.blank')
|
|
115
114
|
end
|
|
116
115
|
end
|
|
117
116
|
end
|
|
@@ -120,24 +119,23 @@ module Blacklight::Catalog
|
|
|
120
119
|
def sms
|
|
121
120
|
@response, @documents = get_solr_response_for_field_values(SolrDocument.unique_key,params[:id])
|
|
122
121
|
if request.post?
|
|
123
|
-
from = request.host # host w/o port for From address (from address cannot have port#)
|
|
124
122
|
url_gen_params = {:host => request.host_with_port, :protocol => request.protocol}
|
|
125
123
|
|
|
126
124
|
if params[:to]
|
|
127
125
|
phone_num = params[:to].gsub(/[^\d]/, '')
|
|
128
126
|
unless params[:carrier].blank?
|
|
129
127
|
if phone_num.length != 10
|
|
130
|
-
flash[:error] =
|
|
128
|
+
flash[:error] = I18n.t('blacklight.sms.errors.to.invalid', :to => params[:to])
|
|
131
129
|
else
|
|
132
|
-
email = RecordMailer.sms_record(@documents, {:to => phone_num, :carrier => params[:carrier]},
|
|
130
|
+
email = RecordMailer.sms_record(@documents, {:to => phone_num, :carrier => params[:carrier]}, url_gen_params)
|
|
133
131
|
end
|
|
134
132
|
email.deliver unless flash[:error]
|
|
135
133
|
redirect_to :back
|
|
136
134
|
else
|
|
137
|
-
flash[:error] =
|
|
135
|
+
flash[:error] = I18n.t('blacklight.sms.errors.carrier.blank')
|
|
138
136
|
end
|
|
139
137
|
else
|
|
140
|
-
flash[:error] =
|
|
138
|
+
flash[:error] = I18n.t('blacklight.sms.errors.to.blank')
|
|
141
139
|
end
|
|
142
140
|
|
|
143
141
|
end
|
|
@@ -251,7 +249,7 @@ module Blacklight::Catalog
|
|
|
251
249
|
if Rails.env == "development"
|
|
252
250
|
raise exception # Rails own code will catch and give usual Rails error page with stack trace
|
|
253
251
|
else
|
|
254
|
-
flash_notice =
|
|
252
|
+
flash_notice = I18n.t('blacklight.search.errors.request_error')
|
|
255
253
|
# Set the notice flag if the flash[:notice] is already set to the error that we are setting.
|
|
256
254
|
# This is intended to stop the redirect loop error
|
|
257
255
|
notice = flash[:notice] if flash[:notice] == flash_notice
|
|
@@ -270,7 +268,7 @@ module Blacklight::Catalog
|
|
|
270
268
|
if Rails.env == "development"
|
|
271
269
|
render # will give us the stack trace
|
|
272
270
|
else
|
|
273
|
-
flash[:notice] =
|
|
271
|
+
flash[:notice] = I18n.t('blacklight.search.errors.invalid_solr_id')
|
|
274
272
|
params.delete(:id)
|
|
275
273
|
index
|
|
276
274
|
render "index", :status => 404
|
|
@@ -50,10 +50,7 @@ module Blacklight::Configurable
|
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
def self.default_configuration
|
|
53
|
-
@default_configuration ||= Blacklight::Configuration.from_legacy_configuration(Blacklight.config) if Blacklight.respond_to?(:config) and not Blacklight.config.empty?
|
|
54
53
|
@default_configuration ||= Blacklight::Configuration.new
|
|
55
|
-
|
|
56
|
-
@default_configuration
|
|
57
54
|
end
|
|
58
55
|
|
|
59
56
|
def self.default_configuration= config
|
|
@@ -83,47 +83,5 @@ module Blacklight
|
|
|
83
83
|
yield self if block_given?
|
|
84
84
|
self
|
|
85
85
|
end
|
|
86
|
-
|
|
87
|
-
##
|
|
88
|
-
# Helper method for loading a legacy blacklight configuration into the new style Blacklight::Configuration
|
|
89
|
-
def self.from_legacy_configuration config
|
|
90
|
-
config = Marshal.load(Marshal.dump(config))
|
|
91
|
-
|
|
92
|
-
Blacklight::Configuration.new do |blacklight_config|
|
|
93
|
-
# SolrHelper#default_solr_parameters needs to iterate over the keys, so this can't be a Struct
|
|
94
|
-
blacklight_config.default_solr_params = config[:default_solr_params]
|
|
95
|
-
|
|
96
|
-
config[:facet][:field_names].each do |x|
|
|
97
|
-
blacklight_config.add_facet_field x, :limit => config[:facet][:limits][x], :label => config[:facet][:labels][x]
|
|
98
|
-
end if config[:facet] and config[:facet][:field_names]
|
|
99
|
-
|
|
100
|
-
config[:index_fields][:field_names].each do |x|
|
|
101
|
-
blacklight_config.add_index_field x, :label => config[:index_fields][:labels][x]
|
|
102
|
-
end if config[:index_fields]
|
|
103
|
-
|
|
104
|
-
config[:show_fields][:field_names].each do |x|
|
|
105
|
-
blacklight_config.add_show_field x, :label => config[:show_fields][:labels][x]
|
|
106
|
-
end if config[:show_fields]
|
|
107
|
-
|
|
108
|
-
config[:search_fields].each do |x|
|
|
109
|
-
unless x.is_a? Hash
|
|
110
|
-
x = { :label => x[0], :key => x[1], :qt => x[1]}
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
x[:label] ||= x.delete(:display_label)
|
|
114
|
-
|
|
115
|
-
blacklight_config.add_search_field x[:key], x
|
|
116
|
-
end if config[:search_fields]
|
|
117
|
-
|
|
118
|
-
config[:sort_fields].each do |field|
|
|
119
|
-
label, sort = field
|
|
120
|
-
blacklight_config.add_sort_field sort, :label => label
|
|
121
|
-
end if config[:sort_fields]
|
|
122
|
-
|
|
123
|
-
config.reject { |key, value| [:default_solr_params, :facet, :index_fields, :show_fields, :search_fields, :sort_fields].include? key }.each do |key,value|
|
|
124
|
-
blacklight_config.send("#{key}=", (Blacklight::OpenStructWithHashAccess.new(value) if value.is_a? Hash) || value)
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
end
|
|
128
86
|
end
|
|
129
87
|
end
|