blacklight-spotlight 0.7.2 → 0.8.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.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spotlight/blocks/resources_block.js +10 -9
  3. data/app/assets/javascripts/spotlight/blocks/uploaded_items_block.js +129 -0
  4. data/app/assets/javascripts/spotlight/sir-trevor/locales.js +7 -2
  5. data/app/assets/stylesheets/spotlight/_exhibits_index.scss +97 -0
  6. data/app/assets/stylesheets/spotlight/_sir-trevor_overrides.scss +10 -1
  7. data/app/assets/stylesheets/spotlight/_spotlight.scss +2 -0
  8. data/app/assets/stylesheets/spotlight/_uploaded_items_block.scss +7 -0
  9. data/app/assets/stylesheets/spotlight/_variables.scss +11 -4
  10. data/app/controllers/spotlight/exhibits_controller.rb +17 -2
  11. data/app/helpers/spotlight/main_app_helpers.rb +1 -1
  12. data/app/helpers/spotlight/navbar_helper.rb +1 -1
  13. data/app/models/concerns/spotlight/exhibit_documents.rb +36 -0
  14. data/app/models/concerns/spotlight/sitemap.rb +89 -0
  15. data/app/models/sir_trevor_rails/blocks/browse_block.rb +3 -1
  16. data/app/models/sir_trevor_rails/blocks/featured_pages_block.rb +3 -1
  17. data/app/models/sir_trevor_rails/blocks/uploaded_items_block.rb +14 -0
  18. data/app/models/spotlight/contact.rb +4 -0
  19. data/app/models/spotlight/exhibit.rb +4 -16
  20. data/app/serializers/spotlight/exhibit_export_serializer.rb +10 -4
  21. data/app/serializers/spotlight/featured_image_representer.rb +25 -0
  22. data/app/serializers/spotlight/page_representer.rb +3 -1
  23. data/app/views/layouts/spotlight/home.html.erb +1 -0
  24. data/app/views/layouts/spotlight/spotlight.html.erb +6 -17
  25. data/app/views/shared/_exhibit_masthead.html.erb +1 -1
  26. data/app/views/shared/_exhibit_masthead_and_navbar.html.erb +9 -0
  27. data/app/views/shared/_flash_messages.html.erb +7 -0
  28. data/app/views/shared/_header_navbar.html.erb +0 -10
  29. data/app/views/shared/_home_sidebar.html.erb +1 -0
  30. data/app/views/shared/_modal.html.erb +6 -0
  31. data/app/views/spotlight/exhibits/_exhibit_card.html.erb +30 -0
  32. data/app/views/spotlight/exhibits/_initial_resources_form.html.erb +0 -0
  33. data/app/views/spotlight/exhibits/_missing_exhibits.html.erb +17 -0
  34. data/app/views/spotlight/exhibits/_new_exhibit_form.html.erb +14 -0
  35. data/app/views/spotlight/exhibits/index.html.erb +17 -0
  36. data/app/views/spotlight/exhibits/new.html.erb +1 -1
  37. data/app/views/spotlight/search_configurations/_default_per_page.html.erb +1 -1
  38. data/app/views/spotlight/search_configurations/_document_index_view_types.html.erb +1 -1
  39. data/app/views/spotlight/search_configurations/_search_fields.html.erb +7 -8
  40. data/app/views/spotlight/sir_trevor/blocks/_uploaded_items_block.html.erb +22 -0
  41. data/config/locales/spotlight.en.yml +20 -3
  42. data/config/routes.rb +2 -2
  43. data/db/migrate/20140128155151_create_exhibits.rb +0 -2
  44. data/db/migrate/20150116161616_add_published_to_exhibit.rb +1 -1
  45. data/db/migrate/20151117153210_change_spotlight_exhibit_published_default.rb +5 -0
  46. data/lib/generators/spotlight/install_generator.rb +12 -3
  47. data/lib/generators/spotlight/templates/config/sitemap.rb +11 -0
  48. data/lib/spotlight/engine.rb +0 -1
  49. data/lib/spotlight/version.rb +1 -1
  50. data/spec/controllers/spotlight/exhibits_controller_spec.rb +27 -0
  51. data/spec/controllers/spotlight/searches_controller_spec.rb +1 -1
  52. data/spec/factories/exhibits.rb +1 -4
  53. data/spec/factories/featured_images.rb +9 -0
  54. data/spec/factories/pages.rb +2 -2
  55. data/spec/factories/searches.rb +2 -5
  56. data/spec/features/about_page_spec.rb +1 -1
  57. data/spec/features/add_custom_field_metadata_spec.rb +1 -1
  58. data/spec/features/add_item_bookmarklet_spec.rb +1 -1
  59. data/spec/features/browse_category_admin_spec.rb +1 -1
  60. data/spec/features/catalog_spec.rb +1 -1
  61. data/spec/features/confirm_email_spec.rb +1 -1
  62. data/spec/features/create_exhibit_spec.rb +0 -10
  63. data/spec/features/create_page_spec.rb +1 -1
  64. data/spec/features/dashboard_spec.rb +1 -1
  65. data/spec/features/edit_search_fields_spec.rb +1 -1
  66. data/spec/features/exhibits/add_tags_spec.rb +1 -1
  67. data/spec/features/exhibits/administration_spec.rb +1 -1
  68. data/spec/features/exhibits/custom_metadata_fields_spec.rb +1 -1
  69. data/spec/features/exhibits/edit_metadata_fields_spec.rb +1 -1
  70. data/spec/features/exhibits_index_spec.rb +26 -0
  71. data/spec/features/feature_page_spec.rb +1 -1
  72. data/spec/features/home_page_spec.rb +1 -1
  73. data/spec/features/import_exhibit_spec.rb +1 -1
  74. data/spec/features/item_admin_spec.rb +1 -1
  75. data/spec/features/javascript/about_page_admin_spec.rb +1 -1
  76. data/spec/features/javascript/block_controls_spec.rb +1 -1
  77. data/spec/features/javascript/blocks/featured_browse_categories_block_spec.rb +1 -1
  78. data/spec/features/javascript/blocks/featured_pages_block_spec.rb +34 -7
  79. data/spec/features/javascript/blocks/search_result_block_spec.rb +1 -1
  80. data/spec/features/javascript/blocks/solr_documents_block_spec.rb +1 -1
  81. data/spec/features/javascript/blocks/uploaded_items_block_spec.rb +63 -0
  82. data/spec/features/javascript/edit_in_place_spec.rb +1 -1
  83. data/spec/features/javascript/feature_page_admin_spec.rb +1 -1
  84. data/spec/features/javascript/home_page_edit_spec.rb +1 -1
  85. data/spec/features/javascript/metadata_admin_spec.rb +1 -1
  86. data/spec/features/javascript/multi_image_select_spec.rb +1 -1
  87. data/spec/features/javascript/preview_block_spec.rb +1 -1
  88. data/spec/features/javascript/rule_block_spec.rb +1 -1
  89. data/spec/features/javascript/search_config_admin_spec.rb +2 -2
  90. data/spec/features/javascript/search_context_spec.rb +1 -1
  91. data/spec/features/main_navigation_spec.rb +1 -1
  92. data/spec/features/metadata_admin_spec.rb +1 -1
  93. data/spec/features/multiple_exhibits_spec.rb +3 -3
  94. data/spec/features/report_a_problem_spec.rb +1 -1
  95. data/spec/features/site_masthead_spec.rb +1 -1
  96. data/spec/features/slideshow_spec.rb +1 -1
  97. data/spec/features/tags_admin_spec.rb +1 -1
  98. data/spec/features/upload_non_repository_item_spec.rb +1 -1
  99. data/spec/features/user_admin_spec.rb +1 -1
  100. data/spec/helpers/spotlight/navbar_helper_spec.rb +2 -2
  101. data/spec/models/spotlight/contact_spec.rb +8 -0
  102. data/spec/models/spotlight/exhibit_spec.rb +29 -42
  103. data/spec/models/spotlight/sitemap_spec.rb +112 -0
  104. data/spec/serializers/spotlight/exhibit_export_serializer_spec.rb +81 -4
  105. data/spec/views/shared/_exhibit_masthead_and_navbar.html.erb_spec.rb +36 -0
  106. data/spec/views/shared/_header_navbar.html.erb_spec.rb +3 -25
  107. data/spec/views/spotlight/exhibits/index.html.erb_spec.rb +52 -0
  108. metadata +48 -6
  109. data/app/controllers/spotlight/default_controller.rb +0 -11
  110. data/lib/spotlight/rails/routes.rb +0 -11
  111. data/spec/lib/spotlight/routes_spec.rb +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 31319372e35468cdf48c2e5537ce4bfefac6f13a
4
- data.tar.gz: 95e24029e38199e97049fb7bd473b1446b8caec7
3
+ metadata.gz: 351909ac5de4d14fb42941ccf4a0f256a1e5f33a
4
+ data.tar.gz: dc6ff75445a24ca3ee49ef3776ea0b3ab6b37b62
5
5
  SHA512:
6
- metadata.gz: 85d25c21a72c38d78517c6025d4db128eda270a86d280a1e532d9902bea2d81ac38346716ec684ac8750176dbea4be744911f0a9b8736d4f68a9404c4c33f0fd
7
- data.tar.gz: 0bba96afb2b8df22de90bc36a4447bc1b15fb970b6cb8737b272f0696d5ba9e412c769ba93dead4d7859b2f4258c878fc4b3e6a6a00f3a2d3e8a5d2e0280ef69
6
+ metadata.gz: d26fcd3db00fb8981613e734e698e05d1cc416ce1e8e205bdf2f6748e7a912fcefab2008a3b432a124e363e54a2b26623edfbf6c34299cbd67f18d7b47c59504
7
+ data.tar.gz: b6abc8e74091524fcb57b34175a54541929b070ad9c44c24349e8539d6e11e7c19fe8819960b10a0dafb86c43a0eaaa1cca74b924351bdd96d3d433e16c81ef9
@@ -5,13 +5,13 @@ Spotlight.Block.Resources = (function(){
5
5
  formable: true,
6
6
  autocompleteable: true,
7
7
  show_heading: true,
8
-
8
+
9
9
  title: function() { return i18n.t("blocks:" + this.type + ":title"); },
10
10
  description: function() { return i18n.t("blocks:" + this.type + ":description"); },
11
11
 
12
12
  icon_name: "resources",
13
13
  blockGroup: function() { return i18n.t("blocks:group:items") },
14
-
14
+
15
15
  primary_field_key: "primary-caption-field",
16
16
  show_primary_field_key: "show-primary-caption",
17
17
  secondary_field_key: "secondary-caption-field",
@@ -63,11 +63,11 @@ Spotlight.Block.Resources = (function(){
63
63
  var panel = $(_.template(markup)(this));
64
64
  var context = this;
65
65
 
66
- $('.remove a', panel).on('click', function(e) {
67
- e.preventDefault();
66
+ $('.remove a', panel).on('click', function(e) {
67
+ e.preventDefault();
68
68
  $(this).closest('.field').remove();
69
69
  context.afterPanelDelete();
70
-
70
+
71
71
  });
72
72
 
73
73
  this.afterPanelRender(data, panel);
@@ -78,14 +78,15 @@ Spotlight.Block.Resources = (function(){
78
78
  afterPanelRender: function(data, panel) {
79
79
 
80
80
  },
81
-
81
+
82
82
  afterPanelDelete: function() {
83
83
 
84
84
  },
85
85
 
86
- createItemPanel: function(data) {
86
+ createItemPanel: function(data) {
87
87
  var panel = this._itemPanel(data);
88
88
  $(panel).appendTo(this.$el.find('.panels > ol'));
89
+ this.$el.find('[data-behavior="nestable"]').trigger('change');
89
90
  },
90
91
 
91
92
  item_options: function() { return ""; },
@@ -126,7 +127,7 @@ Spotlight.Block.Resources = (function(){
126
127
 
127
128
  this.$el.find('[data-input-select-target]').selectRelatedInput();
128
129
  },
129
-
130
+
130
131
  afterLoadData: function(data) {
131
132
  var context = this;
132
133
  $.each(Object.keys(data.item || {}).map(function(k) { return data.item[k]}).sort(function(a,b) { return a.weight - b.weight; }), function(index, item) {
@@ -135,4 +136,4 @@ Spotlight.Block.Resources = (function(){
135
136
  },
136
137
  });
137
138
 
138
- })();
139
+ })();
@@ -0,0 +1,129 @@
1
+ SirTrevor.Blocks.UploadedItems = (function(){
2
+ return Spotlight.Block.Resources.extend({
3
+ textable: true,
4
+ uploadable: true,
5
+ autocompleteable: false,
6
+
7
+ id_key: 'file',
8
+
9
+ type: 'uploaded_items',
10
+
11
+ icon_name: 'items',
12
+
13
+ blockGroup: 'undefined',
14
+
15
+ // Clear out the default Uploadable upload options
16
+ // since we will be using our own custom controls
17
+ upload_options: { html: '' },
18
+
19
+ fileInput: function() { return this.$el.find('input[type="file"]'); },
20
+
21
+ onBlockRender: function(){
22
+ SpotlightNestable.init(this.$el.find('[data-behavior="nestable"]'));
23
+
24
+ this.fileInput().on('change', (function(ev) {
25
+ this.onDrop(ev.currentTarget);
26
+ }).bind(this));
27
+ },
28
+
29
+ onDrop: function(transferData){
30
+ var file = transferData.files[0],
31
+ urlAPI = (typeof URL !== "undefined") ? URL : (typeof webkitURL !== "undefined") ? webkitURL : null;
32
+
33
+ // Handle one upload at a time
34
+ if (/image/.test(file.type)) {
35
+ this.loading();
36
+
37
+ this.uploader(
38
+ file,
39
+ function(data) {
40
+ this.createItemPanel(data);
41
+ this.fileInput().val('');
42
+ this.ready();
43
+ },
44
+ function(error) {
45
+ this.addMessage(i18n.t('blocks:image:upload_error'));
46
+ this.ready();
47
+ }
48
+ );
49
+ }
50
+ },
51
+
52
+ title: function() { return i18n.t('blocks:uploaded_items:title'); },
53
+ description: function() { return i18n.t('blocks:uploaded_items:description'); },
54
+
55
+ globalIndex: 0,
56
+
57
+ _itemPanel: function(data) {
58
+ var index = "file_" + this.globalIndex++;
59
+ var checked = 'checked="checked"';
60
+
61
+ if (data.display == 'false') {
62
+ checked = '';
63
+ }
64
+
65
+ var dataId = data.id || data.uid;
66
+ var dataTitle = data.title || data.name;
67
+ var dataUrl = data.url || data.file.url;
68
+
69
+ var markup = [
70
+ '<li class="field form-inline dd-item dd3-item" data-id="' + index + '" id="' + this.formId("item_" + dataId) + '">',
71
+ '<input type="hidden" name="item[' + index + '][id]" value="' + dataId + '" />',
72
+ '<input type="hidden" name="item[' + index + '][title]" value="' + dataTitle + '" />',
73
+ '<input type="hidden" name="item[' + index + '][url]" data-item-grid-thumbnail="true" value="' + dataUrl + '"/>',
74
+ '<input data-property="weight" type="hidden" name="item[' + index + '][weight]" value="' + data.weight + '" />',
75
+ '<div class="dd-handle dd3-handle"><%= i18n.t("blocks:resources:panel:drag") %></div>',
76
+ '<div class="dd3-content panel panel-default">',
77
+ '<div class="panel-heading item-grid">',
78
+ '<div class="checkbox">',
79
+ '<input name="item[' + index + '][display]" type="hidden" value="false" />',
80
+ '<input name="item[' + index + '][display]" id="'+ this.formId(this.display_checkbox + '_' + dataId) + '" type="checkbox" ' + checked + ' class="item-grid-checkbox" value="true" />',
81
+ '<label class="sr-only" for="'+ this.formId(this.display_checkbox + '_' + dataId) +'"><%= i18n.t("blocks:resources:panel:display") %></label>',
82
+ '</div>',
83
+ '<div class="pic thumbnail">',
84
+ '<img src="' + dataUrl + '" />',
85
+ '</div>',
86
+ '<div class="main">',
87
+ '<div class="title panel-title">' + dataTitle + '</div>',
88
+ '</div>',
89
+ '<div class="remove pull-right">',
90
+ '<a data-item-grid-panel-remove="true" href="#"><%= i18n.t("blocks:resources:panel:remove") %></a>',
91
+ '</div>',
92
+ '</div>',
93
+ '</div>',
94
+ '</li>'
95
+ ].join("\n");
96
+
97
+ var panel = $(_.template(markup)(this));
98
+ var context = this;
99
+
100
+ $('.remove a', panel).on('click', function(e) {
101
+ e.preventDefault();
102
+ $(this).closest('.field').remove();
103
+ context.afterPanelDelete();
104
+ });
105
+
106
+ this.afterPanelRender(data, panel);
107
+
108
+ return panel;
109
+ },
110
+
111
+ template: [
112
+ '<div class="form oembed-text-admin clearfix">',
113
+ '<div class="widget-header">',
114
+ '<%= description() %>',
115
+ '</div>',
116
+ '<div class="row">',
117
+ '<div class="form-group col-md-8">',
118
+ '<div class="panels dd nestable-item-grid" data-behavior="nestable" data-max-depth="1">',
119
+ '<ol class="dd-list">',
120
+ '</ol>',
121
+ '</div>',
122
+ '<input type="file" id="uploaded_item_url" name="file[file_0][file_data]" />',
123
+ '</div>',
124
+ '</div>',
125
+ '<%= text_area() %>',
126
+ '</div>'
127
+ ].join("\n")
128
+ });
129
+ })();
@@ -21,6 +21,11 @@ SirTrevor.Locales.en.blocks = $.extend(SirTrevor.Locales.en.blocks, {
21
21
  url: "URL",
22
22
  },
23
23
 
24
+ uploaded_items: {
25
+ title: "Uploaded Item Row",
26
+ description: "This widget displays uploaded items in a horizontal row. Optionally, you can add a heading and/or text to be displayed adjacent to the items."
27
+ },
28
+
24
29
  featured_pages: {
25
30
  title: "Feature Pages",
26
31
  description: "This widget highlights feature pages. Each highlighted item links to the corresponding feature page."
@@ -68,7 +73,7 @@ SirTrevor.Locales.en.blocks = $.extend(SirTrevor.Locales.en.blocks, {
68
73
  title: "Maximum carousel height"
69
74
  }
70
75
  },
71
-
76
+
72
77
  solr_documents_embed: {
73
78
  title: "Item Embed",
74
79
  description: "This widget embeds exhibit items on a page. Optionally, you can add a heading and/or text to be displayed adjacent to the items.",
@@ -98,4 +103,4 @@ SirTrevor.Locales.en.blocks = $.extend(SirTrevor.Locales.en.blocks, {
98
103
  undefined: "Standard widgets",
99
104
  items: "Exhibit item widgets"
100
105
  }
101
- });
106
+ });
@@ -0,0 +1,97 @@
1
+ .exhibit-card {
2
+ box-sizing: border-box;
3
+ float: left;
4
+ height: $exhibit-card-height;
5
+ margin: 0 -1 * $exhibit-card-gutter $exhibit-card-gutter $exhibit-card-gutter;
6
+ // image width + gutter + border (x2)
7
+ max-width: $exhibit-card-image-size + $exhibit-card-gutter + 2px;
8
+ padding: 0 $exhibit-card-gutter 0 0;
9
+ perspective: 1000; // for flip animation
10
+ position: relative;
11
+
12
+ .flipper {
13
+ position: relative;
14
+ transform-style: preserve-3d;
15
+ transition: 0.6s;
16
+ }
17
+
18
+ &.hover .flipper,
19
+ &:hover .flipper {
20
+ -ms-filter: "FlipH"; // autoprefixer doesn't handle this case.
21
+ filter: FlipH;
22
+ transform: rotateY(180deg);
23
+ }
24
+ }
25
+
26
+ .card-face {
27
+ backface-visibility: hidden;
28
+ background-color: $exhibit-card-bg;
29
+ border: 1px solid $exhibit-card-border;
30
+ height: $exhibit-card-height;
31
+ left: 0;
32
+ position: absolute;
33
+ top: 0;
34
+ transform-style: preserve-3d;
35
+ transition: 0.6s;
36
+ width: 100%;
37
+ }
38
+
39
+ .card-title {
40
+ @extend .h5;
41
+ @extend .text-center;
42
+
43
+ font-size: $font-size-h4;
44
+ }
45
+
46
+ .card-front {
47
+ transform: rotateY(0deg);
48
+ z-index: 2;
49
+
50
+ img {
51
+ height: $exhibit-card-image-size;
52
+ object-fit: cover;
53
+ width: $exhibit-card-image-size;
54
+ }
55
+
56
+ .card-title {
57
+ padding-top: $padding-large-vertical;
58
+ }
59
+ }
60
+
61
+ .card-back {
62
+ box-shadow: $exhibit-card-shadow;
63
+ padding: 0 $exhibit-card-gutter;
64
+ transform: rotateY(-180deg);
65
+
66
+ .card-title {
67
+ border-bottom: 1px dotted $exhibit-card-border;
68
+ line-height: $headings-line-height;
69
+ margin-bottom: $padding-base-vertical;
70
+ padding-bottom: $padding-base-vertical;
71
+ }
72
+
73
+ .subtitle {
74
+ @extend .h5;
75
+ @extend .text-center;
76
+ line-height: $headings-line-height;
77
+ }
78
+
79
+ .description {
80
+ font-size: $font-size-h6;
81
+ }
82
+
83
+ .visit-exhibit {
84
+ bottom: $exhibit-card-gutter;
85
+ position: absolute;
86
+ }
87
+ }
88
+
89
+ .center-btn {
90
+ left: 50%;
91
+ position: absolute;
92
+
93
+ .btn {
94
+ left: -50%;
95
+ position: relative;
96
+ }
97
+ }
@@ -91,6 +91,15 @@
91
91
  }
92
92
  }
93
93
 
94
+ .st-icon-uploaded_items {
95
+ @extend .icon;
96
+ background-image: image-url('spotlight/blocks/item-row.png');
97
+
98
+ &:hover {
99
+ background-image: image-url('spotlight/blocks/item-row-on.png');
100
+ }
101
+ }
102
+
94
103
  .st-icon-search_results {
95
104
  @extend .icon;
96
105
  background-image: image-url('spotlight/blocks/results.png');
@@ -196,4 +205,4 @@
196
205
 
197
206
  .st-block-positioner {
198
207
  left: -6.5em;
199
- }
208
+ }
@@ -16,6 +16,7 @@
16
16
  @import "spotlight/edit_in_place";
17
17
  @import "spotlight/featured_browse_categories_block";
18
18
  @import "spotlight/item_text_block";
19
+ @import "spotlight/uploaded_items_block";
19
20
  @import "spotlight/multi_image_selector";
20
21
  @import "spotlight/multi_up_item_grid";
21
22
  @import "spotlight/slideshow_block";
@@ -26,6 +27,7 @@
26
27
  @import "spotlight/bootstrap_overrides";
27
28
  @import "spotlight/blacklight_overrides";
28
29
  @import "spotlight/report_a_problem";
30
+ @import "spotlight/exhibits_index";
29
31
 
30
32
 
31
33
 
@@ -0,0 +1,7 @@
1
+ [data-type='uploaded_items'] {
2
+ // SirTrevor's Uploadable mixin adds a
3
+ // styled div that we need to remove
4
+ .st-block__inputs {
5
+ display: none;
6
+ }
7
+ }
@@ -1,4 +1,11 @@
1
- $footer-top-margin: 3 * $padding-small-vertical;
2
- $footer-height: 118px;
3
- $white: #FFFFFF;
4
- $black: #000000;
1
+ $footer-top-margin: 3 * $padding-small-vertical !default;
2
+ $footer-height: 118px !default;
3
+ $white: #ffffff !default;
4
+ $black: #000000 !default;
5
+
6
+ $exhibit-card-height: 350px !default;
7
+ $exhibit-card-bg: $well-bg !default;
8
+ $exhibit-card-border: $well-border !default;
9
+ $exhibit-card-gutter: $padding-large-horizontal !default;
10
+ $exhibit-card-image-size: 273px !default;
11
+ $exhibit-card-shadow: inset 2px 2px 5px -2px $exhibit-card-border !default;
@@ -2,18 +2,26 @@ module Spotlight
2
2
  ##
3
3
  # Administrative CRUD actions for an exhibit
4
4
  class ExhibitsController < Spotlight::ApplicationController
5
- before_action :authenticate_user!
5
+ before_action :authenticate_user!, except: [:index]
6
6
  include Blacklight::SearchHelper
7
7
 
8
8
  load_and_authorize_resource
9
9
 
10
+ def index
11
+ if @exhibits.one?
12
+ redirect_to @exhibits.first
13
+ else
14
+ render layout: 'spotlight/home'
15
+ end
16
+ end
17
+
10
18
  def new
11
19
  build_initial_exhibit_contact_emails
12
20
  end
13
21
 
14
22
  def process_import
15
23
  @exhibit.import(JSON.parse(import_exhibit_params.read))
16
- if @exhibit.save
24
+ if @exhibit.save && @exhibit.reindex_later
17
25
  redirect_to spotlight.exhibit_dashboard_path(@exhibit), notice: t(:'helpers.submit.exhibit.updated', model: @exhibit.class.model_name.human.downcase)
18
26
  else
19
27
  render action: :import
@@ -80,6 +88,13 @@ module Spotlight
80
88
  )
81
89
  end
82
90
 
91
+ def create_params
92
+ params.require(:exhibit).permit(
93
+ :title,
94
+ :slug
95
+ )
96
+ end
97
+
83
98
  def import_exhibit_params
84
99
  params.require(:file)
85
100
  end
@@ -4,7 +4,7 @@ module Spotlight
4
4
  module MainAppHelpers
5
5
  include Spotlight::NavbarHelper
6
6
  def cache_key_for_spotlight_exhibits
7
- Spotlight::Exhibit.maximum(:updated_at).try(:utc).try(:to_s, :number)
7
+ "#{Spotlight::Exhibit.count}/#{Spotlight::Exhibit.maximum(:updated_at).try(:utc)}"
8
8
  end
9
9
 
10
10
  def on_browse_page?
@@ -7,7 +7,7 @@ module Spotlight
7
7
  # if the exhibit is not searchable, we're not in an exhibit, or the top-level
8
8
  # exhibit masthead isn't being used (e.g. on a browse category)
9
9
  def should_render_spotlight_search_bar?
10
- exhibit_masthead? && (current_exhibit.nil? || current_exhibit.searchable?)
10
+ exhibit_masthead? && current_exhibit && current_exhibit.searchable?
11
11
  end
12
12
  end
13
13
  end