blacklight-spotlight 0.23.0 → 0.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/spotlight/_nestable.scss +10 -23
  3. data/app/controllers/concerns/spotlight/controller.rb +12 -0
  4. data/app/controllers/spotlight/browse_controller.rb +7 -1
  5. data/app/controllers/spotlight/catalog_controller.rb +2 -2
  6. data/app/controllers/spotlight/concerns/user_invitable.rb +10 -2
  7. data/app/controllers/spotlight/contact_forms_controller.rb +1 -1
  8. data/app/controllers/spotlight/lock_controller.rb +1 -1
  9. data/app/controllers/spotlight/pages_controller.rb +1 -1
  10. data/app/controllers/spotlight/resources/csv_upload_controller.rb +2 -2
  11. data/app/controllers/spotlight/roles_controller.rb +1 -1
  12. data/app/controllers/spotlight/searches_controller.rb +8 -3
  13. data/app/controllers/spotlight/solr_controller.rb +26 -7
  14. data/app/controllers/spotlight/versions_controller.rb +1 -1
  15. data/app/helpers/spotlight/application_helper.rb +0 -4
  16. data/app/helpers/spotlight/pages_helper.rb +9 -1
  17. data/app/models/concerns/spotlight/resources/open_graph.rb +11 -1
  18. data/app/models/concerns/spotlight/user.rb +1 -1
  19. data/app/models/spotlight/resources/json_upload.rb +8 -0
  20. data/app/views/spotlight/featured_images/_form.html.erb +5 -1
  21. data/app/views/spotlight/featured_images/_upload_form.html.erb +5 -1
  22. data/app/views/spotlight/resources/json_upload/_form.html.erb +15 -0
  23. data/config/locales/spotlight.en.yml +5 -0
  24. data/lib/generators/spotlight/install_generator.rb +2 -0
  25. data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +58 -0
  26. data/lib/spotlight/engine.rb +6 -1
  27. data/lib/spotlight/version.rb +1 -1
  28. data/spec/controllers/spotlight/about_pages_controller_spec.rb +33 -22
  29. data/spec/controllers/spotlight/admin_users_controller_spec.rb +9 -9
  30. data/spec/controllers/spotlight/appearances_controller_spec.rb +11 -8
  31. data/spec/controllers/spotlight/attachments_controller_spec.rb +2 -2
  32. data/spec/controllers/spotlight/browse_controller_spec.rb +5 -5
  33. data/spec/controllers/spotlight/catalog_controller_spec.rb +31 -31
  34. data/spec/controllers/spotlight/confirmations_controller_spec.rb +1 -1
  35. data/spec/controllers/spotlight/contact_forms_controller_spec.rb +4 -4
  36. data/spec/controllers/spotlight/contacts_controller_spec.rb +8 -8
  37. data/spec/controllers/spotlight/custom_fields_controller_spec.rb +5 -5
  38. data/spec/controllers/spotlight/dashboards_controller_spec.rb +5 -5
  39. data/spec/controllers/spotlight/exhibits_controller_spec.rb +26 -20
  40. data/spec/controllers/spotlight/feature_pages_controller_spec.rb +18 -18
  41. data/spec/controllers/spotlight/filters_controller_spec.rb +6 -6
  42. data/spec/controllers/spotlight/home_pages_controller_spec.rb +9 -9
  43. data/spec/controllers/spotlight/metadata_configurations_controller_spec.rb +15 -12
  44. data/spec/controllers/spotlight/resources/csv_upload_controller_spec.rb +5 -5
  45. data/spec/controllers/spotlight/resources/upload_controller_spec.rb +4 -4
  46. data/spec/controllers/spotlight/resources_controller_spec.rb +8 -8
  47. data/spec/controllers/spotlight/roles_controller_spec.rb +47 -29
  48. data/spec/controllers/spotlight/search_configurations_controller_spec.rb +35 -23
  49. data/spec/controllers/spotlight/searches_controller_spec.rb +33 -22
  50. data/spec/controllers/spotlight/sites_controller_spec.rb +2 -2
  51. data/spec/controllers/spotlight/solr_controller_spec.rb +29 -17
  52. data/spec/controllers/spotlight/tags_controller_spec.rb +4 -4
  53. data/spec/controllers/spotlight/versions_controller_spec.rb +3 -3
  54. data/spec/controllers/spotlight/view_configurations_controller_spec.rb +2 -2
  55. data/spec/features/add_items_spec.rb +23 -2
  56. data/spec/fixtures/json-upload-fixture.json +3 -0
  57. data/spec/spec_helper.rb +2 -0
  58. data/spec/support/backport_test_helpers.rb +45 -0
  59. metadata +9 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d51b05fb4abe823ca225314173cd629c12a963ec
4
- data.tar.gz: 8ee0d3c095e06d42de53f10f2041c929948192be
3
+ metadata.gz: a7de23e07b1ce71e1f7d3d18807940b6f9e46c14
4
+ data.tar.gz: d3dc8288bdff435529fb727f6d0353adae56f178
5
5
  SHA512:
6
- metadata.gz: 9dba2d6f177687cba357fdee4948c3af932983c4c8c2c16b8371ea8ccc6ec42778ac952083255a1d5cc891e465597736a7fa09fb58ead53f620540267892408d
7
- data.tar.gz: 28a1090a7a5aaa46f12eed7a9e11f994b7f48ca1ec2fa4bb102d7ba0c18dbc9f056f6da8b3ac0bc585c4d56b257591d8525ac313e50e171775dd72f861abb459
6
+ metadata.gz: 794b994391e7ea143e90cb42230bbf1e4cb759831ac5e397c198cdde892585c2abdc2ca09b3f8cfcc319cdadebbaf73434aecf3a7e92039f6374a4ea6f8198aa
7
+ data.tar.gz: aeef5f4b1f8622303a270752e8ce3e92c9c836c1eb9856ce99b2406d860b4e90644fc974d524dcf1493e3e392cb60654128c1d1c87d88bef51dda44d902e7de6
@@ -36,12 +36,9 @@ tr.dd-item {
36
36
 
37
37
  .dd-handle { display: block; height: 100%; margin: 5px 0; padding: 5px 10px; color: #333; text-decoration: none; font-weight: bold; border: 1px solid #ccc;
38
38
  background: #fafafa;
39
- background: -webkit-linear-gradient(to bottom, #fafafa 0%, #eee 100%);
40
- background: -moz-linear-gradient(to bottom, #fafafa 0%, #eee 100%);
41
- background: linear-gradient(to bottom, #fafafa 0%, #eee 100%);
42
- -webkit-border-radius: 3px;
43
- border-radius: 3px;
44
- box-sizing: border-box; -moz-box-sizing: border-box;
39
+ background: linear-gradient(to bottom, #fafafa 0%, #eee 100%);
40
+ border-radius: 3px;
41
+ box-sizing: border-box;
45
42
  }
46
43
  .dd-handle:hover { color: #2ea8e5; background: #fff; }
47
44
 
@@ -50,14 +47,10 @@ tr.dd-item {
50
47
  .dd-item > button[data-action="collapse"]:before { content: '-'; }
51
48
 
52
49
  .dd-placeholder,
53
- .dd-empty { margin: 5px 0; padding: 0; min-height: 30px; border: 1px dashed #b6bcbf; box-sizing: border-box; -moz-box-sizing: border-box; }
54
- .dd-empty { border: 1px dashed #bbb; min-height: 100px;
55
- background-image: -webkit-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff),
56
- -webkit-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff);
57
- background-image: -moz-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff),
58
- -moz-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff);
59
- background-image: linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff),
60
- linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff);
50
+ .dd-empty { margin: 5px 0; padding: 0; min-height: 30px; border: 1px dashed #b6bcbf; box-sizing: border-box; }
51
+ .dd-empty { border: 1px dashed #bbb; min-height: 100px;
52
+ background-image: linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff),
53
+ linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff);
61
54
  background-size: 60px 60px;
62
55
  background-position: 0 0, 30px 30px;
63
56
  }
@@ -65,7 +58,6 @@ tr.dd-item {
65
58
  .dd-dragel { position: absolute; pointer-events: none; z-index: 9999; }
66
59
  .dd-dragel > .dd-item .dd-handle { margin-top: 0; }
67
60
  .dd-dragel .dd-handle {
68
- -webkit-box-shadow: 2px 4px 6px 0 rgba(0,0,0,.1);
69
61
  box-shadow: 2px 4px 6px 0 rgba(0,0,0,.1);
70
62
  }
71
63
 
@@ -84,12 +76,9 @@ tr.dd-item {
84
76
 
85
77
  .dd3-content { display: block; margin: 5px 0; padding: 0 0 0 30px;
86
78
  background: #fafafa;
87
- background: -webkit-linear-gradient(to bottom, #fafafa 0%, #eee 100%);
88
- background: -moz-linear-gradient(to bottom, #fafafa 0%, #eee 100%);
89
79
  background: linear-gradient(to bottom, #fafafa 0%, #eee 100%);
90
- -webkit-border-radius: 3px;
91
- border-radius: 3px;
92
- box-sizing: border-box; -moz-box-sizing: border-box;
80
+ border-radius: 3px;
81
+ box-sizing: border-box;
93
82
  }
94
83
  .dd3-content.page-admin {
95
84
  position: relative;
@@ -105,9 +94,7 @@ tr.dd-item {
105
94
  white-space: nowrap; overflow: hidden;
106
95
  border: 1px solid #aaa;
107
96
  background: #ddd;
108
- background: -webkit-linear-gradient(to bottom, #ddd 0%, #bbb 100%);
109
- background: -moz-linear-gradient(to bottom, #ddd 0%, #bbb 100%);
110
- background: linear-gradient(to bottom, #ddd 0%, #bbb 100%);
97
+ background: linear-gradient(to bottom, #ddd 0%, #bbb 100%);
111
98
  border-top-right-radius: 0;
112
99
  border-bottom-right-radius: 0;
113
100
  }
@@ -8,6 +8,7 @@ module Spotlight
8
8
 
9
9
  included do
10
10
  helper_method :current_site, :current_exhibit, :current_masthead, :exhibit_masthead?, :resource_masthead?
11
+ helper_method :redirect_back # helper method backported from Rails 5
11
12
  end
12
13
 
13
14
  def current_site
@@ -85,5 +86,16 @@ module Spotlight
85
86
  options = Blacklight::Parameters.sanitize(params.to_unsafe_h.with_indifferent_access).merge(options).except(:exhibit_id, :only_path)
86
87
  spotlight.facet_exhibit_catalog_url(current_exhibit, *args, options)
87
88
  end
89
+
90
+ # Backport from Rails 5
91
+ def redirect_back(fallback_location:, **args)
92
+ if defined?(super)
93
+ super
94
+ elsif request.headers['Referer']
95
+ redirect_to request.headers['Referer'], **args
96
+ else
97
+ redirect_to fallback_location, **args
98
+ end
99
+ end
88
100
  end
89
101
  end
@@ -20,11 +20,17 @@ module Spotlight
20
20
  blacklight_config.index.document_actions = blacklight_config.browse.document_actions
21
21
 
22
22
  add_breadcrumb @search.title, exhibit_browse_path(@exhibit, @search)
23
- (@response, @document_list) = search_results(@search.query_params.with_indifferent_access.merge(params))
23
+ (@response, @document_list) = search_results(search_query)
24
24
  end
25
25
 
26
26
  protected
27
27
 
28
+ def search_query
29
+ base_query = Blacklight::SearchState.new(@search.query_params, blacklight_config)
30
+ user_query = Blacklight::SearchState.new(params, blacklight_config).to_h
31
+ base_query.params_for_search(user_query)
32
+ end
33
+
28
34
  ##
29
35
  # Browsing an exhibit should start a new search session
30
36
  def start_new_search_session?
@@ -92,7 +92,7 @@ module Spotlight
92
92
  @document.save
93
93
 
94
94
  respond_to do |format|
95
- format.html { redirect_to :back }
95
+ format.html { redirect_back(fallback_location: [spotlight, current_exhibit, @document]) }
96
96
  format.json { render json: true }
97
97
  end
98
98
  end
@@ -103,7 +103,7 @@ module Spotlight
103
103
  @document.save
104
104
 
105
105
  respond_to do |format|
106
- format.html { redirect_to :back }
106
+ format.html { redirect_back(fallback_location: [spotlight, current_exhibit, @document]) }
107
107
  format.json { render json: true }
108
108
  end
109
109
  end
@@ -10,9 +10,9 @@ module Spotlight
10
10
  role = Spotlight::Role.create(resource: exhibit_or_site, user: user, role: invite_params[:role])
11
11
  if role.save
12
12
  user.deliver_invitation # now deliver it when we have saved the role
13
- redirect_to :back, notice: t(:'helpers.submit.invite.invited')
13
+ redirect_back fallback_location: fallback_location, notice: t(:'helpers.submit.invite.invited')
14
14
  else
15
- redirect_to :back, alert: t(:'helpers.submit.role.batch_error', count: 1)
15
+ redirect_back fallback_location: fallback_location, alert: t(:'helpers.submit.role.batch_error', count: 1)
16
16
  end
17
17
  end
18
18
 
@@ -25,6 +25,14 @@ module Spotlight
25
25
  def exhibit_or_site
26
26
  current_exhibit || @site
27
27
  end
28
+
29
+ def fallback_location
30
+ if current_exhibit
31
+ spotlight.exhibit_roles_path(current_exhibit)
32
+ else
33
+ spotlight.admin_users_path
34
+ end
35
+ end
28
36
  end
29
37
  end
30
38
  end
@@ -13,7 +13,7 @@ module Spotlight
13
13
  if @contact_form.valid?
14
14
  ContactMailer.report_problem(@contact_form).deliver_now
15
15
 
16
- redirect_to :back, notice: t(:'helpers.submit.contact_form.created')
16
+ redirect_back fallback_location: spotlight.new_exhibit_contact_form_path(current_exhibit), notice: t(:'helpers.submit.contact_form.created')
17
17
  else
18
18
  render 'new'
19
19
  end
@@ -8,7 +8,7 @@ module Spotlight
8
8
  def destroy
9
9
  @lock.destroy
10
10
 
11
- render text: '', status: 204
11
+ render plain: '', status: 204
12
12
  end
13
13
  end
14
14
  end
@@ -82,7 +82,7 @@ module Spotlight
82
82
  else
83
83
  t(:'helpers.submit.page.batch_error', model: human_name)
84
84
  end
85
- redirect_to :back, notice: notice
85
+ redirect_back fallback_location: spotlight.exhibit_dashboard_path(@exhibit), notice: notice
86
86
  end
87
87
 
88
88
  protected
@@ -17,11 +17,11 @@ module Spotlight
17
17
  csv = CSV.parse(file.read, headers: true, return_headers: false, encoding: 'utf-8').map(&:to_hash)
18
18
  Spotlight::AddUploadsFromCSV.perform_later(csv, current_exhibit, current_user)
19
19
  flash[:notice] = t('spotlight.resources.upload.csv.success', file_name: file.original_filename)
20
- redirect_to :back
20
+ redirect_back(fallback_location: spotlight.exhibit_resources_path(current_exhibit))
21
21
  end
22
22
 
23
23
  def template
24
- render text: CSV.generate { |csv| csv << data_param_keys.unshift(:url) }, content_type: 'text/csv'
24
+ render plain: CSV.generate { |csv| csv << data_param_keys.unshift(:url) }, content_type: 'text/csv'
25
25
  end
26
26
 
27
27
  private
@@ -25,7 +25,7 @@ module Spotlight
25
25
  notice = any_deleted ? t(:'helpers.submit.role.destroyed') : t(:'helpers.submit.role.updated')
26
26
  redirect_to exhibit_roles_path(@exhibit), notice: notice
27
27
  else
28
- flash[:alert] = t(:'helpers.submit.role.batch_error', count: exhibit_params[:roles_attributes].size)
28
+ flash[:alert] = t(:'helpers.submit.role.batch_error', count: exhibit_params[:roles_attributes].to_unsafe_h.size)
29
29
  render action: 'index'
30
30
  end
31
31
  end
@@ -16,9 +16,10 @@ module Spotlight
16
16
  @search.query_params = query_params
17
17
 
18
18
  if @search.save
19
- redirect_to :back, notice: t(:'helpers.submit.search.created', model: @search.class.model_name.human.downcase)
19
+ redirect_back fallback_location: fallback_url,
20
+ notice: t(:'helpers.submit.search.created', model: @search.class.model_name.human.downcase)
20
21
  else
21
- redirect_to :back, alert: @search.errors.full_messages.join('<br>'.html_safe)
22
+ redirect_back fallback_location: fallback_url, alert: @search.errors.full_messages.join('<br>'.html_safe)
22
23
  end
23
24
  end
24
25
 
@@ -64,7 +65,7 @@ module Spotlight
64
65
  else
65
66
  t(:'helpers.submit.search.batch_error', model: Spotlight::Search.model_name.human.pluralize.downcase)
66
67
  end
67
- redirect_to :back, notice: notice
68
+ redirect_back fallback_location: fallback_url, notice: notice
68
69
  end
69
70
 
70
71
  def show
@@ -118,5 +119,9 @@ module Spotlight
118
119
  def blacklisted_search_session_params
119
120
  [:commit, :counter, :total, :search_id, :page, :per_page, :authenticity_token, :utf8, :action, :controller]
120
121
  end
122
+
123
+ def fallback_url
124
+ spotlight.exhibit_searches_path(current_exhibit)
125
+ end
121
126
  end
122
127
  end
@@ -6,31 +6,50 @@ module Spotlight
6
6
  # This is an example of how you could integrate external indexing
7
7
  # workflows with exhibit-specific content
8
8
  class SolrController < Spotlight::ApplicationController
9
+ include Blacklight::SearchHelper
10
+
9
11
  before_action :authenticate_user!
10
12
  before_action :validate_writable_index!
11
13
 
12
14
  load_and_authorize_resource :exhibit, class: Spotlight::Exhibit
15
+ delegate :blacklight_config, to: :current_exhibit
13
16
 
14
17
  def update
15
18
  authorize! :update_solr, @exhibit
16
19
 
17
- req = ActiveSupport::JSON.decode(request.body.read)
20
+ data = solr_documents
18
21
 
19
- docs = Array.wrap(req).map do |r|
20
- blacklight_config.document_model.new(r).to_solr.merge(@exhibit.solr_data).merge(r)
22
+ repository.connection.update params: { commitWithin: 500 }, data: data.to_json, headers: { 'Content-Type' => 'application/json' } unless data.empty?
23
+
24
+ if respond_to? :head
25
+ head :ok
26
+ else
27
+ render nothing: true
21
28
  end
29
+ end
30
+
31
+ private
22
32
 
23
- blacklight_solr.update docs
33
+ def solr_documents
34
+ req = ActiveSupport::JSON.decode(json_content)
24
35
 
25
- render nothing: true
36
+ Array.wrap(req).map do |r|
37
+ blacklight_config.document_model.new(r).to_solr.merge(@exhibit.solr_data).merge(r)
38
+ end
26
39
  end
27
40
 
28
- private
41
+ def json_content
42
+ if params[:resources_json_upload]
43
+ params[:resources_json_upload][:json].read
44
+ else
45
+ request.body.read
46
+ end
47
+ end
29
48
 
30
49
  def validate_writable_index!
31
50
  return if Spotlight::Engine.config.writable_index
32
51
 
33
- render text: 'Spotlight is unable to write to solr', status: 409
52
+ render plain: 'Spotlight is unable to write to solr', status: 409
34
53
  end
35
54
  end
36
55
  end
@@ -15,7 +15,7 @@ module Spotlight
15
15
  redirect_to [obj.exhibit, obj], flash: { html_safe: true }, notice: view_context.t(:'spotlight.versions.undo_error')
16
16
  end
17
17
  else
18
- redirect_to :back, flash: { html_safe: true }, notice: view_context.t(:'spotlight.versions.undo_error')
18
+ redirect_back fallback_location: main_app.root_url, flash: { html_safe: true }, notice: view_context.t(:'spotlight.versions.undo_error')
19
19
  end
20
20
  end
21
21
 
@@ -140,10 +140,6 @@ module Spotlight
140
140
  config.label || blacklight_config.index_fields[solr_field].try(:label) || t(".#{solr_field}")
141
141
  end
142
142
 
143
- def view_label(view)
144
- t(:"blacklight.search.view.#{view}", default: blacklight_config.view[view].title || view.to_s)
145
- end
146
-
147
143
  def available_view_fields
148
144
  current_exhibit.blacklight_configuration.default_blacklight_config.view.to_h.reject { |_k, v| v.if == false }
149
145
  end
@@ -22,7 +22,7 @@ module Spotlight
22
22
 
23
23
  def get_search_widget_search_results(block)
24
24
  if block.searches?
25
- search_results(block.query_params.with_indifferent_access.merge(params))
25
+ search_results(search_widget_search_query(block))
26
26
  else
27
27
  []
28
28
  end
@@ -50,5 +50,13 @@ module Spotlight
50
50
  def render_contact_email_address(address)
51
51
  mail_to address, address
52
52
  end
53
+
54
+ private
55
+
56
+ def search_widget_search_query(block)
57
+ base_query = Blacklight::SearchState.new(block.query_params, blacklight_config)
58
+ user_query = Blacklight::SearchState.new(params, blacklight_config).to_h
59
+ base_query.params_for_search(user_query)
60
+ end
53
61
  end
54
62
  end
@@ -20,9 +20,19 @@ module Spotlight
20
20
 
21
21
  def opengraph_properties
22
22
  Hash[opengraph.map do |k, v|
23
- ["#{k.parameterize('_')}_tesim", v]
23
+ ["#{opengraph_solr_field_name(k)}_tesim", v]
24
24
  end]
25
25
  end
26
+
27
+ private
28
+
29
+ def opengraph_solr_field_name(field)
30
+ if Rails::VERSION::MAJOR >= 5
31
+ field.parameterize(separator: '_')
32
+ else
33
+ field.parameterize('_')
34
+ end
35
+ end
26
36
  end
27
37
  end
28
38
  end
@@ -7,7 +7,7 @@ module Spotlight
7
7
  has_many :roles, class_name: 'Spotlight::Role', dependent: :destroy
8
8
  has_many :exhibits, class_name: 'Spotlight::Exhibit', through: :roles, source: 'resource', source_type: 'Spotlight::Exhibit'
9
9
 
10
- scope :with_roles, -> { where(id: Spotlight::Role.uniq.pluck(:user_id)) }
10
+ scope :with_roles, -> { where(id: Spotlight::Role.distinct.pluck(:user_id)) }
11
11
 
12
12
  before_create :add_default_roles
13
13
  end
@@ -0,0 +1,8 @@
1
+ module Spotlight
2
+ module Resources
3
+ # Raw solr document uploads
4
+ class JsonUpload < Spotlight::Resource
5
+ store :data, accessors: :json
6
+ end
7
+ end
8
+ end
@@ -1,4 +1,8 @@
1
- <% form_prefix = f.object_name.parameterize("_") %>
1
+ <% if Rails::VERSION::MAJOR >= 5 %>
2
+ <% form_prefix = f.object_name.parameterize(separator: '_') %>
3
+ <% else %>
4
+ <% form_prefix = f.object_name.parameterize('_') %>
5
+ <% end %>
2
6
  <%= field_set_tag do %>
3
7
  <%= f.check_box(:display) %>
4
8
  <% end if f.object.is_a? Spotlight::Masthead %>
@@ -1,4 +1,8 @@
1
- <% form_prefix = f.object_name.parameterize("_") %>
1
+ <% if Rails::VERSION::MAJOR >= 5 %>
2
+ <% form_prefix = f.object_name.parameterize(separator: '_') %>
3
+ <% else %>
4
+ <% form_prefix = f.object_name.parameterize('_') %>
5
+ <% end %>
2
6
  <%= field_set_tag do %>
3
7
  <%= f.check_box(:display) %>
4
8
  <% end if f.object.is_a? Spotlight::Masthead %>
@@ -0,0 +1,15 @@
1
+ <% if can? :update_solr, current_exhibit %>
2
+ <%= bootstrap_form_for([current_exhibit, @resource.becomes(Spotlight::Resources::JsonUpload)], url: spotlight.exhibit_solr_update_path(current_exhibit), layout: :horizontal, label_col: 'col-md-2', control_col: 'col-sm-6 col-md-6', html: { class: 'item-upload-form', multipart: true } ) do |f| %>
3
+ <%= f.url_field :json, type: "file", label: t('.file_label') %>
4
+ <div class="form-actions">
5
+ <div class="primary-actions">
6
+ <%= cancel_link @resource, :back, class: 'btn btn-default' %>
7
+ <%= f.submit t('.add_item'), class: 'btn btn-primary' %>
8
+ </div>
9
+ </div>
10
+ <% end %>
11
+ <% else %>
12
+ <div class="alert alert-info">
13
+ Uploading raw documents is restricted to site administrators.
14
+ </div>
15
+ <% end %>