blacklight 4.3.0 → 4.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +0 -6
- data/Gemfile +5 -0
- data/README.md +1 -1
- data/Rakefile +0 -1
- data/VERSION +1 -1
- data/app/assets/javascripts/blacklight/autofocus.js +16 -0
- data/app/assets/javascripts/blacklight/blacklight.js +1 -0
- data/app/assets/javascripts/blacklight/bookmark_toggle.js +2 -5
- data/app/assets/javascripts/blacklight/checkbox_submit.js +3 -6
- data/app/assets/javascripts/blacklight/core.js +24 -1
- data/app/assets/javascripts/blacklight/css_dropdowns.js +2 -2
- data/app/assets/javascripts/blacklight/facet_expand_contract.js +4 -3
- data/app/assets/javascripts/blacklight/lightbox_dialog.js +7 -1
- data/app/assets/javascripts/blacklight/search_context.js +1 -1
- data/app/assets/javascripts/blacklight/select_submit.js +1 -1
- data/app/assets/javascripts/blacklight/zebra_stripe.js +1 -1
- data/app/assets/stylesheets/blacklight/_blacklight_base.css.scss +1 -0
- data/app/assets/stylesheets/blacklight/_catalog.css.scss +5 -0
- data/app/assets/stylesheets/blacklight/_facets.css.scss +6 -0
- data/app/assets/stylesheets/blacklight/_group.css.scss +14 -0
- data/app/assets/stylesheets/blacklight/blacklight_defaults.css.scss +1 -0
- data/app/controllers/bookmarks_controller.rb +2 -2
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +41 -24
- data/app/helpers/blacklight/catalog_helper_behavior.rb +48 -28
- data/app/helpers/blacklight/facets_helper_behavior.rb +9 -75
- data/app/models/record_mailer.rb +1 -16
- data/app/views/bookmarks/index.html.erb +2 -0
- data/app/views/catalog/_bookmark_control.html.erb +3 -4
- data/app/views/catalog/_document.html.erb +2 -1
- data/app/views/catalog/_document_header.html.erb +6 -3
- data/app/views/catalog/_email_form.html.erb +0 -7
- data/app/views/catalog/_facet_layout.html.erb +1 -1
- data/app/views/catalog/_group_default.html.erb +12 -0
- data/app/views/catalog/_index_default.html.erb +1 -1
- data/app/views/catalog/_opensearch_response_metadata.html.erb +2 -3
- data/app/views/catalog/_paginate_compact.html.erb +2 -2
- data/app/views/catalog/_results_pagination.html.erb +2 -2
- data/app/views/catalog/_search_form.html.erb +1 -1
- data/app/views/catalog/_sms_form.html.erb +1 -21
- data/app/views/catalog/_thumbnail_default.html.erb +5 -0
- data/app/views/catalog/email_sent.html.erb +9 -0
- data/app/views/catalog/index.atom.builder +7 -8
- data/app/views/catalog/index.html.erb +6 -3
- data/app/views/catalog/librarian_view.html.erb +1 -1
- data/app/views/catalog/sms_sent.html.erb +9 -0
- data/app/views/feedback/complete.html.erb +2 -0
- data/app/views/feedback/show.html.erb +7 -5
- data/app/views/kaminari/blacklight_compact/_paginator.html.erb +1 -1
- data/app/views/layouts/blacklight.html.erb +1 -2
- data/app/views/saved_searches/index.html.erb +2 -0
- data/app/views/search_history/index.html.erb +1 -1
- data/blacklight.gemspec +1 -1
- data/config/locales/blacklight.en.yml +11 -0
- data/config/locales/blacklight.fr.yml +15 -1
- data/gemfiles/rails3.gemfile +7 -0
- data/gemfiles/rails4.gemfile +7 -0
- data/lib/blacklight.rb +1 -0
- data/lib/blacklight/catalog.rb +101 -56
- data/lib/blacklight/configuration.rb +1 -1
- data/lib/blacklight/controller.rb +7 -4
- data/lib/blacklight/facet.rb +79 -0
- data/lib/blacklight/routes.rb +0 -1
- data/lib/blacklight/solr/document.rb +4 -0
- data/lib/blacklight/solr/document/marc_export.rb +1 -1
- data/lib/blacklight/solr_helper.rb +39 -8
- data/lib/blacklight/solr_response.rb +35 -3
- data/lib/blacklight/solr_response/facets.rb +4 -0
- data/lib/blacklight/solr_response/group.rb +33 -0
- data/lib/blacklight/solr_response/group_response.rb +49 -0
- data/lib/blacklight/solr_response/pagination_methods.rb +27 -0
- data/lib/blacklight/user.rb +30 -32
- data/lib/generators/blacklight/assets_generator.rb +3 -1
- data/lib/generators/blacklight/blacklight_generator.rb +28 -125
- data/lib/generators/blacklight/marc_generator.rb +66 -0
- data/lib/generators/blacklight/models_generator.rb +113 -0
- data/lib/generators/blacklight/templates/alternate_controller.rb +9 -0
- data/lib/generators/blacklight/templates/config/solr.yml +0 -2
- data/lib/generators/blacklight/templates/solr_document.rb +1 -13
- data/lib/railties/all_tests.rake +5 -8
- data/spec/controllers/catalog_controller_spec.rb +185 -113
- data/spec/features/alternate_controller_spec.rb +34 -0
- data/spec/features/bookmarks_spec.rb +58 -0
- data/spec/features/did_you_mean_spec.rb +135 -0
- data/spec/features/librarian_view_spec.rb +13 -0
- data/spec/features/record_view_spec.rb +37 -0
- data/spec/features/saved_searches_spec.rb +47 -0
- data/spec/features/search_filters_spec.rb +137 -0
- data/spec/features/search_history_spec.rb +75 -0
- data/spec/features/search_pagination_spec.rb +91 -0
- data/spec/features/search_results_spec.rb +68 -0
- data/spec/features/search_sort_spec.rb +20 -0
- data/spec/features/search_spec.rb +108 -0
- data/spec/helpers/blacklight_helper_spec.rb +45 -2
- data/spec/helpers/catalog_helper_spec.rb +134 -1
- data/spec/helpers/facets_helper_spec.rb +8 -0
- data/spec/lib/blacklight/solr_response/group_response_spec.rb +78 -0
- data/spec/lib/blacklight/solr_response/group_spec.rb +70 -0
- data/spec/lib/blacklight_solr_response_spec.rb +11 -5
- data/spec/lib/blacklight_user_spec.rb +22 -41
- data/spec/lib/solr_helper_spec.rb +73 -1
- data/spec/models/record_mailer_spec.rb +3 -3
- data/spec/models/{solr_docment_spec.rb → solr_document_spec.rb} +1 -1
- data/spec/spec_helper.rb +0 -1
- data/spec/support/features.rb +7 -0
- data/spec/support/features/session_helpers.rb +22 -0
- data/spec/test_app_templates/Gemfile.extra +0 -4
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -6
- data/spec/test_app_templates/lib/tasks/blacklight_test_app.rake +1 -9
- data/spec/views/catalog/_facets.html.erb_spec.rb +2 -1
- data/tasks/blacklight.rake +0 -10
- metadata +49 -58
- data/features/bookmarks.feature +0 -68
- data/features/did_you_mean.feature +0 -123
- data/features/librarian_view.feature +0 -18
- data/features/record_view.feature +0 -40
- data/features/saved_searches.feature +0 -49
- data/features/search.feature +0 -83
- data/features/search_filters.feature +0 -119
- data/features/search_history.feature +0 -85
- data/features/search_pagination.feature +0 -53
- data/features/search_results.feature +0 -61
- data/features/search_sort.feature +0 -27
- data/features/step_definitions/bookmarks_steps.rb +0 -6
- data/features/step_definitions/error_steps.rb +0 -5
- data/features/step_definitions/general_steps.rb +0 -50
- data/features/step_definitions/record_view_steps.rb +0 -12
- data/features/step_definitions/saved_searches_steps.rb +0 -19
- data/features/step_definitions/search_facets_steps.rb +0 -29
- data/features/step_definitions/search_history_steps.rb +0 -9
- data/features/step_definitions/search_pagination_steps.rb +0 -29
- data/features/step_definitions/search_result_steps.rb +0 -115
- data/features/step_definitions/search_steps.rb +0 -118
- data/features/step_definitions/user_steps.rb +0 -5
- data/features/step_definitions/web_steps.rb +0 -217
- data/features/support/env.rb +0 -65
- data/features/support/paths.rb +0 -48
- data/features/support/selectors.rb +0 -40
- data/lib/railties/blacklight_cucumber.rake +0 -126
- data/lib/solrmarc.log.1 +0 -854
@@ -1,3 +1,4 @@
|
|
1
|
+
<div id="content" class="span9">
|
1
2
|
<h1>Send Us Feedback</h1>
|
2
3
|
|
3
4
|
<% unless @errors.empty? %>
|
@@ -11,10 +12,11 @@
|
|
11
12
|
|
12
13
|
<%= form_tag do %>
|
13
14
|
<fieldset>
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
<%= label_tag t('active_record.attributes.feedback.name') %> <%= text_field_tag :name, params[:name] %>
|
16
|
+
<%= label_tag t('active_record.attributes.feedback.email') %> <%= text_field_tag :email, params[:email] %>
|
17
|
+
<%= label_tag t('active_record.attributes.feedback.message') %> <%= text_area_tag :message, params[:message] %>
|
18
|
+
|
19
|
+
<%= label_tag '' %><%= submit_tag t('blacklight.feedback.submit') %>
|
19
20
|
</fieldset>
|
20
21
|
<% end %>
|
22
|
+
</div>
|
@@ -27,8 +27,7 @@
|
|
27
27
|
<![endif]-->
|
28
28
|
|
29
29
|
</head>
|
30
|
-
|
31
|
-
<body onload="<%= onload_text %>" class="<%= render_body_class %>">
|
30
|
+
<body class="<%= render_body_class %>">
|
32
31
|
<%= render :partial => 'shared/header_navbar' %>
|
33
32
|
|
34
33
|
<div id="ajax-modal" class="modal hide fade" tabindex="-1"></div>
|
data/blacklight.gemspec
CHANGED
@@ -5,7 +5,7 @@ Gem::Specification.new do |s|
|
|
5
5
|
s.name = "blacklight"
|
6
6
|
s.version = Blacklight::VERSION
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
|
-
s.authors = ["Jonathan Rochkind", "Matt Mitchell", "Chris Beer", "Jessie Keck", "Jason Ronallo", "Vernon Chapman", "Mark A. Matienzo", "Dan Funk", "Naomi Dushay"]
|
8
|
+
s.authors = ["Jonathan Rochkind", "Matt Mitchell", "Chris Beer", "Jessie Keck", "Jason Ronallo", "Vernon Chapman", "Mark A. Matienzo", "Dan Funk", "Naomi Dushay", "Justin Coyne"]
|
9
9
|
s.email = ["blacklight-development@googlegroups.com"]
|
10
10
|
s.homepage = "http://projectblacklight.org/"
|
11
11
|
s.summary = "Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr) index."
|
@@ -131,6 +131,8 @@ en:
|
|
131
131
|
url: 'URL: %{url}'
|
132
132
|
message: 'Message: %{message}'
|
133
133
|
|
134
|
+
success: "Email Sent"
|
135
|
+
|
134
136
|
errors:
|
135
137
|
to:
|
136
138
|
invalid: 'You must enter a valid email address'
|
@@ -146,12 +148,14 @@ en:
|
|
146
148
|
title: '%{value}'
|
147
149
|
author: ' by %{value}'
|
148
150
|
url: 'Link: %{url}'
|
151
|
+
success: "SMS Sent"
|
149
152
|
errors:
|
150
153
|
to:
|
151
154
|
invalid: 'You must enter a valid 10 digit phone number'
|
152
155
|
blank: "You must enter a recipient's phone number in order to send this message"
|
153
156
|
carrier:
|
154
157
|
blank: 'You must select a carrier'
|
158
|
+
invalid: "You must enter a valid carrier"
|
155
159
|
|
156
160
|
back_to_search: 'Back to Search'
|
157
161
|
back_to_bookmarks: 'Back to Bookmarks'
|
@@ -200,6 +204,8 @@ en:
|
|
200
204
|
more: 'more »'
|
201
205
|
selected:
|
202
206
|
remove: '[remove]'
|
207
|
+
group:
|
208
|
+
more: 'more »'
|
203
209
|
filters:
|
204
210
|
title: 'You searched for:'
|
205
211
|
label: '%{label}:'
|
@@ -209,6 +215,7 @@ en:
|
|
209
215
|
librarian_view:
|
210
216
|
title: 'Librarian View'
|
211
217
|
leader: 'LEADER %{leader}'
|
218
|
+
empty: 'No MARC data found.'
|
212
219
|
start_over: 'Start Over'
|
213
220
|
show:
|
214
221
|
title: '%{document_title} - %{application_name}'
|
@@ -216,6 +223,10 @@ en:
|
|
216
223
|
atom_feed: 'Atom for results'
|
217
224
|
fields:
|
218
225
|
default: 'Keyword'
|
226
|
+
bookmarks:
|
227
|
+
present: "In Bookmarks"
|
228
|
+
absent: "Bookmark"
|
229
|
+
inprogress: "Saving..."
|
219
230
|
|
220
231
|
entry_name:
|
221
232
|
default: 'entry'
|
@@ -20,7 +20,7 @@ fr:
|
|
20
20
|
next: 'Suivante »'
|
21
21
|
|
22
22
|
blacklight:
|
23
|
-
application_name: 'Blacklight
|
23
|
+
application_name: 'Blacklight'
|
24
24
|
|
25
25
|
header_links:
|
26
26
|
login: 'Mon compte'
|
@@ -141,10 +141,13 @@ fr:
|
|
141
141
|
url: 'URL : %{url}'
|
142
142
|
message: 'Message : %{message}'
|
143
143
|
|
144
|
+
success: "Message envoyé"
|
145
|
+
|
144
146
|
errors:
|
145
147
|
to:
|
146
148
|
invalid: 'Vous devez saisir une adresse correcte.'
|
147
149
|
blank: 'Vous devez saisir l''adresse de votre destinataire.'
|
150
|
+
|
148
151
|
sms:
|
149
152
|
form:
|
150
153
|
title: 'Envoyer par SMS'
|
@@ -156,12 +159,16 @@ fr:
|
|
156
159
|
title: '%{value}'
|
157
160
|
author: ' by %{value}'
|
158
161
|
url: 'Lien : %{url}'
|
162
|
+
|
163
|
+
success: "SMS envoyé"
|
164
|
+
|
159
165
|
errors:
|
160
166
|
to:
|
161
167
|
invalid: 'Vous devez saisir un numéro de téléphone à 10 chiffres.'
|
162
168
|
blank: "Vous devez saisir le numéro de téléphone de votre destinataire."
|
163
169
|
carrier:
|
164
170
|
blank: 'Vous devez choisir un opérateur.'
|
171
|
+
invalid: "Vous devez choisir le opérateur valide."
|
165
172
|
|
166
173
|
back_to_search: 'Retour aux résultats'
|
167
174
|
back_to_bookmarks: 'Retour aux favoris'
|
@@ -213,6 +220,8 @@ fr:
|
|
213
220
|
more: 'plus »'
|
214
221
|
selected:
|
215
222
|
remove: '[ X ]'
|
223
|
+
group:
|
224
|
+
more: 'plus »'
|
216
225
|
filters:
|
217
226
|
title: 'Vous avez demandé :'
|
218
227
|
label: '%{label}:'
|
@@ -222,6 +231,7 @@ fr:
|
|
222
231
|
librarian_view:
|
223
232
|
title: 'Vue UNIMARC'
|
224
233
|
leader: 'LABEL %{leader}'
|
234
|
+
empty: 'Pas MARC trouvé.'
|
225
235
|
start_over: 'Accueil'
|
226
236
|
show:
|
227
237
|
title: '%{document_title} - %{application_name}'
|
@@ -229,6 +239,10 @@ fr:
|
|
229
239
|
atom_feed: 'Atom pour les résultats'
|
230
240
|
fields:
|
231
241
|
default: 'Keyword'
|
242
|
+
bookmarks:
|
243
|
+
present: "Dans panier"
|
244
|
+
absent: "Ajouter au panier"
|
245
|
+
inprogress: "En cours"
|
232
246
|
|
233
247
|
entry_name:
|
234
248
|
default: 'résultat'
|
data/gemfiles/rails3.gemfile
CHANGED
@@ -8,6 +8,13 @@ gem 'simplecov-rcov', :platform => :mri
|
|
8
8
|
|
9
9
|
gem 'rails', "~> 3.2"
|
10
10
|
|
11
|
+
group :test do
|
12
|
+
gem 'devise'
|
13
|
+
gem "bootstrap-sass"
|
14
|
+
gem 'turbolinks'
|
15
|
+
gem "unicode", :platforms => [:mri_18, :mri_19]
|
16
|
+
end
|
17
|
+
|
11
18
|
f = File.expand_path(File.dirname(__FILE__) + '/../spec/test_app_templates/Gemfile.extra')
|
12
19
|
if File.exists?(f)
|
13
20
|
eval File.read(f), nil, f
|
data/gemfiles/rails4.gemfile
CHANGED
@@ -8,6 +8,13 @@ gem 'simplecov-rcov', :platform => :mri
|
|
8
8
|
|
9
9
|
gem 'rails', '~> 4.0.0'
|
10
10
|
|
11
|
+
group :test do
|
12
|
+
gem 'devise'
|
13
|
+
gem "bootstrap-sass"
|
14
|
+
gem 'turbolinks'
|
15
|
+
gem "unicode", :platforms => [:mri_18, :mri_19]
|
16
|
+
end
|
17
|
+
|
11
18
|
f = File.expand_path(File.dirname(__FILE__) + '/../spec/test_app_templates/Gemfile.extra')
|
12
19
|
if File.exists?(f)
|
13
20
|
eval File.read(f), nil, f
|
data/lib/blacklight.rb
CHANGED
data/lib/blacklight/catalog.rb
CHANGED
@@ -11,6 +11,7 @@ module Blacklight::Catalog
|
|
11
11
|
# own controller.
|
12
12
|
included do
|
13
13
|
helper_method :search_action_url
|
14
|
+
helper_method :sms_mappings
|
14
15
|
before_filter :search_session, :history_session
|
15
16
|
before_filter :delete_or_assign_search_session_params, :only => :index
|
16
17
|
after_filter :set_additional_search_session_values, :only=>:index
|
@@ -25,23 +26,23 @@ module Blacklight::Catalog
|
|
25
26
|
rescue_from RSolr::Error::Http, :with => :rsolr_request_error
|
26
27
|
end
|
27
28
|
|
28
|
-
def search_action_url
|
29
|
-
url_for(:action => 'index', :only_path => true)
|
30
|
-
end
|
31
|
-
|
32
29
|
# get search results from the solr index
|
33
30
|
def index
|
34
31
|
|
35
|
-
extra_head_content << view_context.auto_discovery_link_tag(:rss, url_for(params.merge(:format => 'rss')), :title => t('blacklight.search.rss_feed') )
|
36
|
-
extra_head_content << view_context.auto_discovery_link_tag(:atom, url_for(params.merge(:format => 'atom')), :title => t('blacklight.search.atom_feed') )
|
37
|
-
|
38
32
|
(@response, @document_list) = get_search_results
|
39
33
|
@filters = params[:f] || []
|
40
34
|
|
41
35
|
respond_to do |format|
|
42
|
-
format.html {
|
36
|
+
format.html {
|
37
|
+
extra_head_content << view_context.auto_discovery_link_tag(:rss, url_for(params.merge(:format => 'rss')), :title => t('blacklight.search.rss_feed') )
|
38
|
+
extra_head_content << view_context.auto_discovery_link_tag(:atom, url_for(params.merge(:format => 'atom')), :title => t('blacklight.search.atom_feed') )
|
39
|
+
save_current_search_params
|
40
|
+
}
|
43
41
|
format.rss { render :layout => false }
|
44
42
|
format.atom { render :layout => false }
|
43
|
+
|
44
|
+
|
45
|
+
format.json { render json: {response: {docs: @document_list, facets: facets_from_request, pages: pagination_info(@response)}}}
|
45
46
|
end
|
46
47
|
end
|
47
48
|
|
@@ -52,6 +53,8 @@ module Blacklight::Catalog
|
|
52
53
|
respond_to do |format|
|
53
54
|
format.html {setup_next_and_previous_documents}
|
54
55
|
|
56
|
+
format.json { render json: {response: {document: @document}}}
|
57
|
+
|
55
58
|
# Add all dynamically added (such as by document extensions)
|
56
59
|
# export formats.
|
57
60
|
@document.export_formats.each_key do | format_name |
|
@@ -75,7 +78,11 @@ module Blacklight::Catalog
|
|
75
78
|
@pagination = get_facet_pagination(params[:id], params)
|
76
79
|
|
77
80
|
respond_to do |format|
|
81
|
+
# Draw the facet selector for users who have javascript disabled:
|
78
82
|
format.html
|
83
|
+
format.json { render json: {response: {facets: @pagination }}}
|
84
|
+
|
85
|
+
# Draw the partial for the "more" facet modal window:
|
79
86
|
format.js { render :layout => false }
|
80
87
|
end
|
81
88
|
end
|
@@ -111,68 +118,51 @@ module Blacklight::Catalog
|
|
111
118
|
# Email Action (this will render the appropriate view on GET requests and process the form and send the email on POST requests)
|
112
119
|
def email
|
113
120
|
@response, @documents = get_solr_response_for_field_values(SolrDocument.unique_key,params[:id])
|
114
|
-
|
115
|
-
|
116
|
-
|
121
|
+
|
122
|
+
if request.post? and validate_email_params
|
123
|
+
url_gen_params = {:host => request.host_with_port, :protocol => request.protocol}
|
117
124
|
|
118
|
-
|
119
|
-
|
120
|
-
else
|
121
|
-
flash[:error] = I18n.t('blacklight.email.errors.to.invalid', :to => params[:to])
|
122
|
-
end
|
123
|
-
else
|
124
|
-
flash[:error] = I18n.t('blacklight.email.errors.to.blank')
|
125
|
-
end
|
125
|
+
email = RecordMailer.email_record(@documents, {:to => params[:to], :message => params[:message]}, url_gen_params)
|
126
|
+
email.deliver
|
126
127
|
|
127
|
-
|
128
|
-
email.deliver
|
129
|
-
flash[:success] = "Email sent"
|
130
|
-
redirect_to catalog_path(params['id']) unless request.xhr?
|
131
|
-
end
|
132
|
-
end
|
128
|
+
flash[:success] = I18n.t("blacklight.email.success")
|
133
129
|
|
134
|
-
unless !request.xhr? && flash[:success]
|
135
130
|
respond_to do |format|
|
136
|
-
format.
|
137
|
-
format.
|
138
|
-
end
|
131
|
+
format.html { redirect_to catalog_path(params['id']) }
|
132
|
+
format.js { render 'email_sent' }
|
133
|
+
end and return
|
134
|
+
end
|
135
|
+
|
136
|
+
respond_to do |format|
|
137
|
+
format.html
|
138
|
+
format.js { render :layout => false }
|
139
139
|
end
|
140
140
|
end
|
141
|
+
|
141
142
|
|
142
143
|
# SMS action (this will render the appropriate view on GET requests and process the form and send the email on POST requests)
|
143
144
|
def sms
|
144
145
|
@response, @documents = get_solr_response_for_field_values(SolrDocument.unique_key,params[:id])
|
145
|
-
|
146
|
+
|
147
|
+
if request.post? and validate_sms_params
|
146
148
|
url_gen_params = {:host => request.host_with_port, :protocol => request.protocol}
|
147
|
-
|
148
|
-
if params[:to]
|
149
|
-
phone_num = params[:to].gsub(/[^\d]/, '')
|
150
|
-
unless params[:carrier].blank?
|
151
|
-
if phone_num.length != 10
|
152
|
-
flash[:error] = I18n.t('blacklight.sms.errors.to.invalid', :to => params[:to])
|
153
|
-
else
|
154
|
-
email = RecordMailer.sms_record(@documents, {:to => phone_num, :carrier => params[:carrier]}, url_gen_params)
|
155
|
-
end
|
156
|
-
|
157
|
-
else
|
158
|
-
flash[:error] = I18n.t('blacklight.sms.errors.carrier.blank')
|
159
|
-
end
|
160
|
-
else
|
161
|
-
flash[:error] = I18n.t('blacklight.sms.errors.to.blank')
|
162
|
-
end
|
163
149
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
150
|
+
to = "#{params[:to].gsub(/[^\d]/, '')}@#{sms_mappings[params[:carrier]]}"
|
151
|
+
|
152
|
+
sms = RecordMailer.sms_record(@documents, { :to => to }, url_gen_params)
|
153
|
+
sms.deliver
|
154
|
+
|
155
|
+
flash[:success] = I18n.t("blacklight.sms.success")
|
156
|
+
|
157
|
+
respond_to do |format|
|
158
|
+
format.html { redirect_to catalog_path(params['id']) }
|
159
|
+
format.js { render 'sms_sent' }
|
160
|
+
end and return
|
169
161
|
end
|
170
162
|
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
format.html
|
175
|
-
end
|
163
|
+
respond_to do |format|
|
164
|
+
format.js { render :layout => false }
|
165
|
+
format.html
|
176
166
|
end
|
177
167
|
end
|
178
168
|
|
@@ -191,6 +181,11 @@ module Blacklight::Catalog
|
|
191
181
|
# non-routable methods ->
|
192
182
|
#
|
193
183
|
|
184
|
+
def search_action_url options = {}
|
185
|
+
url_for(options.merge(:action => 'index', :only_path => true))
|
186
|
+
end
|
187
|
+
|
188
|
+
|
194
189
|
# calls setup_previous_document then setup_next_document.
|
195
190
|
# used in the show action for single view pagination.
|
196
191
|
def setup_next_and_previous_documents
|
@@ -296,7 +291,57 @@ module Blacklight::Catalog
|
|
296
291
|
redirect_to root_path
|
297
292
|
end
|
298
293
|
end
|
294
|
+
|
295
|
+
# extract the pagination info from the response object
|
296
|
+
def pagination_info response
|
297
|
+
h = {}
|
298
|
+
|
299
|
+
[:current_page, :next_page, :prev_page, :total_pages,
|
300
|
+
:limit_value, :offset_value, :total_count,
|
301
|
+
:first_page?, :last_page?].each do |k|
|
302
|
+
h[k] = response.send(k)
|
303
|
+
end
|
304
|
+
|
305
|
+
h
|
306
|
+
end
|
299
307
|
|
308
|
+
def validate_sms_params
|
309
|
+
case
|
310
|
+
when params[:to].blank?
|
311
|
+
flash[:error] = I18n.t('blacklight.sms.errors.to.blank')
|
312
|
+
when params[:carrier].blank?
|
313
|
+
flash[:error] = I18n.t('blacklight.sms.errors.carrier.blank')
|
314
|
+
when params[:to].gsub(/[^\d]/, '').length != 10
|
315
|
+
flash[:error] = I18n.t('blacklight.sms.errors.to.invalid', :to => params[:to])
|
316
|
+
when !sms_mappings.values.include?(params[:carrier])
|
317
|
+
flash[:error] = I18n.t('blacklight.sms.errors.carrier.invalid')
|
318
|
+
end
|
319
|
+
|
320
|
+
flash[:error].blank?
|
321
|
+
end
|
322
|
+
|
323
|
+
def sms_mappings
|
324
|
+
{'Virgin' => 'vmobl.com',
|
325
|
+
'AT&T' => 'txt.att.net',
|
326
|
+
'Verizon' => 'vtext.com',
|
327
|
+
'Nextel' => 'messaging.nextel.com',
|
328
|
+
'Sprint' => 'messaging.sprintpcs.com',
|
329
|
+
'T Mobile' => 'tmomail.net',
|
330
|
+
'Alltel' => 'message.alltel.com',
|
331
|
+
'Cricket' => 'mms.mycricket.com'}
|
332
|
+
end
|
333
|
+
|
334
|
+
def validate_email_params
|
335
|
+
case
|
336
|
+
when params[:to].blank?
|
337
|
+
flash[:error] = I18n.t('blacklight.email.errors.to.blank')
|
338
|
+
when !params[:to].match(defined?(Devise) ? Devise.email_regexp : /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/)
|
339
|
+
flash[:error] = I18n.t('blacklight.email.errors.to.invalid', :to => params[:to])
|
340
|
+
end
|
341
|
+
|
342
|
+
flash[:error].blank?
|
343
|
+
end
|
344
|
+
|
300
345
|
# when a request for /catalog/BAD_SOLR_ID is made, this method is executed...
|
301
346
|
def invalid_solr_id_error
|
302
347
|
flash[:notice] = I18n.t('blacklight.search.errors.invalid_solr_id')
|