arclight 0.5.0 → 1.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (218) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc +11 -4
  3. data/.github/workflows/ruby.yml +24 -11
  4. data/.rspec +0 -1
  5. data/.rubocop.yml +286 -2
  6. data/.rubocop_todo.yml +18 -195
  7. data/CONTRIBUTING.md +5 -5
  8. data/Gemfile +12 -12
  9. data/README.md +18 -12
  10. data/app/assets/javascripts/arclight/arclight.js +4 -8
  11. data/app/assets/javascripts/arclight/oembed_controller.js +64 -0
  12. data/app/assets/javascripts/arclight/truncate_controller.js +27 -0
  13. data/app/assets/stylesheets/arclight/application.scss +1 -5
  14. data/app/assets/stylesheets/arclight/modules/hierarchy_and_online_contents.scss +104 -130
  15. data/app/assets/stylesheets/arclight/modules/icons.scss +14 -3
  16. data/app/assets/stylesheets/arclight/modules/layout.scss +120 -100
  17. data/app/assets/stylesheets/arclight/modules/mastheads.scss +15 -57
  18. data/app/assets/stylesheets/arclight/modules/repositories.scss +2 -2
  19. data/app/assets/stylesheets/arclight/modules/repository_card.scss +4 -48
  20. data/app/assets/stylesheets/arclight/modules/search_results.scss +86 -35
  21. data/app/assets/stylesheets/arclight/modules/show_collection.scss +5 -32
  22. data/app/assets/stylesheets/arclight/modules/truncator.scss +56 -0
  23. data/app/assets/stylesheets/arclight/variables.scss +7 -4
  24. data/app/components/arclight/access_component.html.erb +14 -0
  25. data/app/components/arclight/access_component.rb +25 -0
  26. data/app/components/arclight/bookmark_component.html.erb +25 -0
  27. data/app/components/arclight/bookmark_component.rb +9 -0
  28. data/app/components/arclight/breadcrumb_component.rb +40 -0
  29. data/app/components/arclight/breadcrumbs_hierarchy_component.html.erb +34 -0
  30. data/app/components/arclight/breadcrumbs_hierarchy_component.rb +25 -0
  31. data/app/components/arclight/collection_context_component.html.erb +12 -0
  32. data/app/components/arclight/collection_context_component.rb +27 -0
  33. data/app/components/arclight/collection_info_component.html.erb +28 -0
  34. data/app/components/arclight/collection_info_component.rb +26 -0
  35. data/app/components/arclight/collection_sidebar_component.html.erb +15 -0
  36. data/app/components/arclight/collection_sidebar_component.rb +41 -0
  37. data/app/{views/catalog/_search_results_repository.html.erb → components/arclight/constraints_component.html.erb} +2 -1
  38. data/app/components/arclight/constraints_component.rb +17 -0
  39. data/app/components/arclight/document_collection_context_component.html.erb +29 -0
  40. data/app/components/arclight/document_collection_context_component.rb +28 -0
  41. data/app/components/arclight/document_collection_hierarchy_component.html.erb +46 -0
  42. data/app/components/arclight/document_collection_hierarchy_component.rb +62 -0
  43. data/app/components/arclight/document_component.html.erb +39 -0
  44. data/app/components/arclight/document_component.rb +49 -0
  45. data/app/components/arclight/document_components_hierarchy_component.html.erb +32 -0
  46. data/app/components/arclight/document_components_hierarchy_component.rb +28 -0
  47. data/app/components/arclight/document_download_component.html.erb +24 -0
  48. data/app/components/arclight/document_download_component.rb +71 -0
  49. data/app/components/arclight/embed_component.html.erb +10 -0
  50. data/app/components/arclight/embed_component.rb +43 -0
  51. data/app/components/arclight/group_component.html.erb +30 -0
  52. data/app/components/arclight/group_component.rb +23 -0
  53. data/app/components/arclight/header_component.html.erb +5 -0
  54. data/app/components/arclight/header_component.rb +10 -0
  55. data/app/components/arclight/index_metadata_field_component.html.erb +17 -0
  56. data/app/components/arclight/index_metadata_field_component.rb +20 -0
  57. data/app/components/arclight/masthead_component.html.erb +15 -0
  58. data/app/components/arclight/masthead_component.rb +10 -0
  59. data/app/components/arclight/metadata_section_component.html.erb +13 -0
  60. data/app/components/arclight/metadata_section_component.rb +22 -0
  61. data/app/components/arclight/oembed_viewer_component.html.erb +5 -0
  62. data/app/components/arclight/oembed_viewer_component.rb +16 -0
  63. data/app/components/arclight/online_content_filter_component.html.erb +15 -0
  64. data/app/components/arclight/online_content_filter_component.rb +19 -0
  65. data/app/components/arclight/online_status_indicator_component.rb +19 -0
  66. data/app/components/arclight/repository_breadcrumb_component.html.erb +10 -0
  67. data/app/components/arclight/repository_breadcrumb_component.rb +17 -0
  68. data/app/components/arclight/repository_location_component.html.erb +20 -0
  69. data/app/components/arclight/repository_location_component.rb +10 -0
  70. data/app/components/arclight/search_bar_component.html.erb +25 -0
  71. data/app/components/arclight/search_bar_component.rb +32 -0
  72. data/app/components/arclight/search_result_breadcrumbs_component.html.erb +3 -0
  73. data/app/components/arclight/search_result_breadcrumbs_component.rb +37 -0
  74. data/app/components/arclight/search_result_component.html.erb +20 -0
  75. data/app/components/arclight/search_result_component.rb +18 -0
  76. data/app/components/arclight/search_result_title_component.html.erb +13 -0
  77. data/app/components/arclight/search_result_title_component.rb +15 -0
  78. data/app/components/arclight/sidebar_component.html.erb +9 -0
  79. data/app/components/arclight/sidebar_component.rb +19 -0
  80. data/app/components/arclight/upper_metadata_layout_component.rb +10 -0
  81. data/app/components/blacklight/icons/bookmark_component.rb +12 -0
  82. data/app/components/blacklight/icons/collection_component.rb +14 -0
  83. data/app/components/blacklight/icons/compact_component.rb +12 -0
  84. data/app/components/blacklight/icons/container_component.rb +14 -0
  85. data/app/components/blacklight/icons/ead_component.rb +12 -0
  86. data/app/components/blacklight/icons/file_component.rb +14 -0
  87. data/app/components/blacklight/icons/folder_component.rb +12 -0
  88. data/app/components/blacklight/icons/online_component.rb +15 -0
  89. data/app/components/blacklight/icons/pdf_component.rb +12 -0
  90. data/app/components/blacklight/icons/repository_component.rb +12 -0
  91. data/app/controllers/arclight/repositories_controller.rb +4 -4
  92. data/app/{controllers/concerns → helpers}/arclight/ead_format_helpers.rb +4 -7
  93. data/app/helpers/arclight/field_config_helpers.rb +26 -0
  94. data/app/helpers/arclight_helper.rb +15 -253
  95. data/app/models/arclight/document_downloads.rb +12 -15
  96. data/app/models/arclight/parent.rb +5 -0
  97. data/app/models/arclight/parents.rb +2 -1
  98. data/app/models/arclight/requests/aeon_external_request.rb +1 -1
  99. data/app/models/arclight/requests/aeon_web_ead.rb +8 -3
  100. data/app/models/arclight/requests/google_form.rb +8 -3
  101. data/app/models/concerns/arclight/catalog.rb +25 -15
  102. data/app/models/concerns/arclight/search_behavior.rb +12 -26
  103. data/app/models/concerns/arclight/solr_document.rb +70 -73
  104. data/app/presenters/arclight/show_presenter.rb +34 -7
  105. data/app/views/arclight/_requests.html.erb +2 -2
  106. data/app/views/arclight/repositories/_repository.html.erb +21 -40
  107. data/app/views/arclight/repositories/index.html.erb +3 -1
  108. data/app/views/arclight/repositories/show.html.erb +4 -6
  109. data/app/views/arclight/requests/_aeon_external_request_endpoint.html.erb +4 -5
  110. data/app/views/arclight/requests/_aeon_web_ead.html.erb +2 -3
  111. data/app/views/arclight/requests/_google_form.html.erb +4 -6
  112. data/app/views/catalog/_group.html.erb +1 -18
  113. data/app/views/catalog/_group_toggle.html.erb +1 -1
  114. data/app/views/catalog/_search_results_header.html.erb +3 -0
  115. data/app/views/catalog/hierarchy.html.erb +19 -0
  116. data/app/views/catalog/index.html.erb +16 -7
  117. data/app/views/shared/_breadcrumbs.html.erb +2 -14
  118. data/app/views/shared/_main_menu_links.html.erb +1 -1
  119. data/arclight.gemspec +7 -6
  120. data/config/breadcrumbs.rb +24 -0
  121. data/config/i18n-tasks.yml +9 -8
  122. data/config/importmap.rb +3 -0
  123. data/config/locales/arclight.en.yml +31 -30
  124. data/config/routes.rb +1 -1
  125. data/docker-compose.yml +16 -0
  126. data/lib/arclight/digital_object.rb +2 -1
  127. data/lib/arclight/engine.rb +18 -31
  128. data/lib/arclight/exceptions.rb +1 -0
  129. data/lib/arclight/hash_absolute_xpath.rb +2 -1
  130. data/lib/arclight/normalized_id.rb +2 -0
  131. data/lib/arclight/normalized_title.rb +2 -0
  132. data/lib/arclight/repository.rb +43 -54
  133. data/lib/arclight/routes/hierarchy.rb +19 -0
  134. data/lib/arclight/routes.rb +8 -0
  135. data/lib/arclight/traject/ead2_component_config.rb +292 -0
  136. data/lib/arclight/traject/ead2_config.rb +66 -287
  137. data/lib/arclight/version.rb +1 -1
  138. data/lib/arclight/year_range.rb +4 -3
  139. data/lib/arclight.rb +6 -1
  140. data/lib/generators/arclight/install_generator.rb +57 -21
  141. data/lib/generators/arclight/templates/arclight.scss +5 -3
  142. data/lib/generators/arclight/templates/catalog_controller.rb +150 -169
  143. data/lib/generators/arclight/templates/config/locales/arclight.en.yml +53 -0
  144. data/lib/generators/arclight/templates/config/repositories.yml +20 -27
  145. data/lib/tasks/index.rake +14 -17
  146. data/package.json +11 -13
  147. data/solr/conf/schema.xml +40 -36
  148. data/solr/conf/solrconfig.xml +33 -31
  149. data/tasks/arclight.rake +8 -7
  150. data/template.rb +0 -1
  151. metadata +113 -106
  152. data/.babelrc +0 -3
  153. data/app/assets/javascripts/arclight/collection_navigation.js +0 -100
  154. data/app/assets/javascripts/arclight/collection_scrollspy.js +0 -6
  155. data/app/assets/javascripts/arclight/context_navigation.js +0 -351
  156. data/app/assets/javascripts/arclight/oembed_viewer.js +0 -46
  157. data/app/assets/javascripts/arclight/truncator.js.erb +0 -29
  158. data/app/assets/stylesheets/arclight/bootstrap_overrides.scss +0 -26
  159. data/app/assets/stylesheets/arclight/modules/context_navigation.scss +0 -75
  160. data/app/controllers/concerns/arclight/field_config_helpers.rb +0 -102
  161. data/app/factories/blacklight_field_configuration_factory.rb +0 -30
  162. data/app/views/arclight/repositories/_in_person_repository.html.erb +0 -19
  163. data/app/views/arclight/repositories/_repository_contact.html.erb +0 -9
  164. data/app/views/arclight/viewers/_oembed.html.erb +0 -8
  165. data/app/views/catalog/_access_contents.html.erb +0 -15
  166. data/app/views/catalog/_arclight_abstract_or_scope.html.erb +0 -5
  167. data/app/views/catalog/_arclight_bookmark_control.html.erb +0 -38
  168. data/app/views/catalog/_arclight_document_header_icon.html.erb +0 -1
  169. data/app/views/catalog/_arclight_document_index_header.html.erb +0 -13
  170. data/app/views/catalog/_arclight_document_index_header_hierarchy_default.html.erb +0 -0
  171. data/app/views/catalog/_arclight_document_index_header_online_contents_default.html.erb +0 -0
  172. data/app/views/catalog/_arclight_index_compact_default.html.erb +0 -22
  173. data/app/views/catalog/_arclight_index_default.html.erb +0 -45
  174. data/app/views/catalog/_arclight_index_group_document_compact_default.html.erb +0 -19
  175. data/app/views/catalog/_arclight_index_group_document_default.html.erb +0 -18
  176. data/app/views/catalog/_arclight_online_content_indicator.html.erb +0 -3
  177. data/app/views/catalog/_arclight_rangelimit.html.erb +0 -24
  178. data/app/views/catalog/_arclight_viewer_default.html.erb +0 -1
  179. data/app/views/catalog/_collection_contents.html.erb +0 -4
  180. data/app/views/catalog/_collection_context.html.erb +0 -15
  181. data/app/views/catalog/_collection_context_nav.html.erb +0 -12
  182. data/app/views/catalog/_collection_online_contents.html.erb +0 -17
  183. data/app/views/catalog/_component_context.html.erb +0 -5
  184. data/app/views/catalog/_containers.html.erb +0 -3
  185. data/app/views/catalog/_context_card.html.erb +0 -27
  186. data/app/views/catalog/_context_sidebar.html.erb +0 -8
  187. data/app/views/catalog/_custom_metadata.html.erb +0 -16
  188. data/app/views/catalog/_document_downloads.html.erb +0 -14
  189. data/app/views/catalog/_group_header_compact_default.html.erb +0 -15
  190. data/app/views/catalog/_group_header_default.html.erb +0 -20
  191. data/app/views/catalog/_home.html.erb +0 -1
  192. data/app/views/catalog/_index_breadcrumb_default.html.erb +0 -6
  193. data/app/views/catalog/_index_collection_context_default.html.erb +0 -53
  194. data/app/views/catalog/_index_default.html.erb +0 -17
  195. data/app/views/catalog/_index_header.html.erb +0 -7
  196. data/app/views/catalog/_index_header_online_contents_default.html.erb +0 -1
  197. data/app/views/catalog/_index_online_contents_default.html.erb +0 -6
  198. data/app/views/catalog/_online_content_label.html.erb +0 -5
  199. data/app/views/catalog/_search_form.html.erb +0 -38
  200. data/app/views/catalog/_search_results.html.erb +0 -28
  201. data/app/views/catalog/_show_actions_box_default.html.erb +0 -27
  202. data/app/views/catalog/_show_breadcrumbs_default.html.erb +0 -6
  203. data/app/views/catalog/_show_collection.html.erb +0 -66
  204. data/app/views/catalog/_show_default.html.erb +0 -70
  205. data/app/views/catalog/_show_upper_metadata_collection.html.erb +0 -1
  206. data/app/views/catalog/_show_upper_metadata_default.html.erb +0 -14
  207. data/app/views/catalog/_sort_and_per_page.html.erb +0 -8
  208. data/app/views/catalog/_within_collection_dropdown.html.erb +0 -26
  209. data/app/views/layouts/catalog_result.html.erb +0 -7
  210. data/app/views/shared/_context_sidebar.html.erb +0 -8
  211. data/app/views/shared/_header_navbar.html.erb +0 -61
  212. data/app/views/shared/_show_breadcrumbs.html.erb +0 -27
  213. data/lib/arclight/viewer.rb +0 -45
  214. data/lib/arclight/viewers/oembed.rb +0 -57
  215. data/solr/conf/scripts.conf +0 -24
  216. data/vendor/assets/javascripts/responsiveTruncator.js +0 -69
  217. data/vendor/assets/javascripts/stickyfill.js +0 -480
  218. /data/app/assets/images/{blacklight → arclight}/logo.png +0 -0
@@ -1,351 +0,0 @@
1
- class NavigationDocument {
2
- constructor(el) {
3
- this.el = $(el);
4
- }
5
-
6
- get id() {
7
- return this.el.find('[data-document-id]').data().documentId;
8
- }
9
-
10
- setAsHighlighted() {
11
- this.el.find('li.al-collection-context').addClass('al-hierarchy-highlight');
12
- }
13
-
14
- makeCollapsible() {
15
- this.el.find('li.al-collection-context').addClass('collapsible');
16
- }
17
-
18
- collapse() {
19
- this.el.find('li.al-collection-context').addClass('collapsed');
20
- }
21
-
22
- render() {
23
- return this.el.html();
24
- }
25
- }
26
-
27
- /**
28
- * Models the "Expand"/"Collapse" button, and provides an onClick event handler
29
- * for the jQuery element
30
- * @class
31
- */
32
- class ExpandButton {
33
- /**
34
- * This retrieves the <li> elements which are hidden/rendered in response to
35
- * clicking the <button> element
36
- * @param {jQuery} $li - the <button> element
37
- * @return {jQuery} - a jQuery object containing the targeted <li>
38
- */
39
- findCollapsibleSiblings() {
40
- const $siblings = this.$el.parent().children('li.collapsible');
41
- return $siblings;
42
- }
43
-
44
- /**
45
- * This adds a "collapsed" class to all of the <li> children, as well as
46
- * updates the text for the <button> element
47
- * @param {Event} event - the event propagated in response to clicking on the
48
- * <button> element
49
- */
50
- handleClick() {
51
- const $targeted = this.findCollapsibleSiblings();
52
-
53
- $targeted.toggleClass('collapsed');
54
- this.$el.toggleClass('collapsed');
55
-
56
- const containerText = this.$el.hasClass('collapsed') ? this.collapseText : this.expandText;
57
- this.$el.text(containerText);
58
- }
59
-
60
- /**
61
- * @constructor
62
- */
63
- constructor(data) {
64
- this.collapseText = data.collapse;
65
- this.expandText = data.expand;
66
-
67
- this.$el = $(`<button class="my-3 btn btn-secondary btn-sm">${this.expandText}</button>`);
68
- this.handleClick = this.handleClick.bind(this);
69
- this.$el.click(this.handleClick);
70
- }
71
- }
72
-
73
- /**
74
- * Models the placeholder display elements for content loading from AJAX
75
- * requests
76
- * @class
77
- */
78
- class Placeholder {
79
- /*
80
- * Builds the element set which contains the placeholder markup
81
- * classes
82
- */
83
- /* eslint-disable class-methods-use-this */
84
- buildElement() {
85
- const elementMarkup = '<div class="al-hierarchy-placeholder">' +
86
- '<h3 class="col-md-9"></h3>' +
87
- '<p class="col-md-6"></p>' +
88
- '<p class="col-md-12"></p>' +
89
- '<p class="col-md-3"></p>' +
90
- '</div>';
91
- const markup = Array(3).join(elementMarkup);
92
-
93
- return $(markup);
94
- }
95
- /* eslint-enable class-methods-use-this */
96
-
97
- /*
98
- * @constructor
99
- */
100
- constructor() {
101
- this.$el = this.buildElement();
102
- }
103
- }
104
-
105
- class ContextNavigation {
106
- constructor(el, originalParents = null, originalDocument = null) {
107
- this.el = $(el);
108
- this.data = this.el.data();
109
- this.parentLi = this.el.parent();
110
- this.eadid = this.data.arclight.eadid;
111
- this.originalParents = originalParents; // let originalParents stay null
112
- this.originalDocument = originalDocument || this.data.arclight.originalDocument;
113
- this.ul = $('<ul class="al-context-nav-parent"></ul>');
114
- }
115
-
116
- // Gets the targetId to select, based off of parents and current level
117
- get targetId() {
118
- if (this.originalParents && this.originalParents[this.data.arclight.level]) {
119
- return `${this.eadid}${this.originalParents[this.data.arclight.level]}`;
120
- }
121
- return this.data.arclight.originalDocument;
122
- }
123
-
124
- get requestParent() {
125
- // Cases where you're viewing a component page (use its ancestor trail)...
126
- if (this.originalParents && this.originalParents[this.data.arclight.level - 1]) {
127
- return this.originalParents[this.data.arclight.level - 1];
128
- }
129
- // Cases where there are no parents provided...
130
- // 1) when on a top-level collection page
131
- // 2) when +/- gets clicked
132
- return this.data.arclight.originalDocument.replace(this.eadid, '');
133
- }
134
-
135
- getData() {
136
- const that = this;
137
- // Add a placeholder so flashes of text are not as significant
138
- const placeholder = new Placeholder();
139
- this.el.after(placeholder.$el);
140
- $.ajax({
141
- url: this.data.arclight.path,
142
- data: {
143
- 'f[component_level_isim][]': this.data.arclight.level,
144
- 'f[has_online_content_ssim][]': this.data.arclight.access,
145
- 'f[collection_sim][]': this.data.arclight.name,
146
- 'f[parent_ssi][]': this.requestParent,
147
- search_field: this.data.arclight.search_field,
148
- original_parents: this.data.arclight.originalParents,
149
- original_document: this.originalDocument,
150
- view: 'collection_context'
151
- }
152
- }).done((response) => that.updateView(response));
153
- }
154
-
155
- /**
156
- * Constructs a <ul> container element with an ElementButton instance appended
157
- * within it
158
- * @returns {jQuery}
159
- */
160
- buildExpandList() {
161
- const $ul = $('<ul></ul>');
162
- $ul.addClass('pl-0');
163
- $ul.addClass('prev-siblings');
164
- const button = new ExpandButton(this.data);
165
- $ul.append(button.$el);
166
- return $ul;
167
- }
168
-
169
- /**
170
- * Highlights the <li> element for the current Document and appends <li> the
171
- * sibling documents for a given Document element
172
- * @param {NavigationDocument[]} newDocs - the NavigationDocument objects for
173
- * each resulting Solr Document
174
- * @param {number} originalDocumentIndex
175
- */
176
- updateSiblings(newDocs, originalDocumentIndex) {
177
- newDocs[originalDocumentIndex].setAsHighlighted();
178
-
179
- // Hide all but the first previous sibling
180
- const prevSiblingDocs = newDocs.slice(0, originalDocumentIndex);
181
- let nextSiblingDocs = [];
182
-
183
- if (prevSiblingDocs.length > 1 && originalDocumentIndex > 0) {
184
- const hiddenPrevSiblingDocs = prevSiblingDocs.slice(0, -1);
185
- hiddenPrevSiblingDocs.forEach(siblingDoc => {
186
- siblingDoc.makeCollapsible();
187
- siblingDoc.collapse();
188
- });
189
-
190
- const prevSiblingList = this.buildExpandList();
191
- const renderedPrevSiblingItems = prevSiblingDocs.map(doc => doc.render()).join('');
192
-
193
- prevSiblingList.append(renderedPrevSiblingItems);
194
- this.ul.append(prevSiblingList);
195
-
196
- nextSiblingDocs = newDocs.slice(originalDocumentIndex);
197
- } else {
198
- nextSiblingDocs = newDocs;
199
- }
200
-
201
- const renderedNextSiblingItems = nextSiblingDocs.map(newDoc => newDoc.render()).join('');
202
-
203
- // Insert the rendered sibling documents before the <li> elements
204
- this.ul.append(renderedNextSiblingItems);
205
- this.el.html(this.ul);
206
- }
207
-
208
- /**
209
- * Inserts <li> elements for parents (e. g. components or collections) for the
210
- * current Document and appends <li> for each of these
211
- * @param {NavigationDocument[]} newDocs - the NavigationDocument objects for
212
- * each resulting Solr Document
213
- */
214
- updateParents(newDocs) {
215
- const that = this;
216
- // Case where this is a parent list and needs to be filed correctly
217
- //
218
- // Otherwise, retrieve the parent...
219
- let newDocIndex = newDocs.findIndex(doc => doc.id === this.targetId);
220
-
221
- if (newDocIndex === -1) {
222
- const renderedDocs = newDocs.map(newDoc => newDoc.render()).join('');
223
- this.ul.append(renderedDocs);
224
- this.el.html(this.ul);
225
- return;
226
- }
227
- // Update the docs before the item
228
- // Retrieves the documents up to and including the "new document"
229
- const beforeDocs = newDocs.slice(0, newDocIndex);
230
- let prevParentList = null;
231
- let renderedBeforeDocs;
232
- if (beforeDocs.length > 1) {
233
- beforeDocs.forEach(function (parentDoc) {
234
- parentDoc.makeCollapsible();
235
- parentDoc.collapse();
236
- });
237
- renderedBeforeDocs = beforeDocs.map(newDoc => newDoc.render()).join('');
238
- prevParentList = this.buildExpandList();
239
- prevParentList.append(renderedBeforeDocs);
240
- } else {
241
- renderedBeforeDocs = beforeDocs.map(newDoc => newDoc.render()).join('');
242
- }
243
-
244
- // Silly but works for now
245
- this.ul.append(prevParentList || renderedBeforeDocs);
246
-
247
- let itemDoc = newDocs.slice(newDocIndex, newDocIndex + 1);
248
- let renderedItemDoc = itemDoc.map(doc => doc.render()).join('');
249
-
250
- // Update the item
251
- const $itemDoc = $(renderedItemDoc);
252
- this.ul.append($itemDoc);
253
-
254
- // Update the docs after the item
255
- const afterDocs = newDocs.slice(newDocIndex + 1, newDocs.length);
256
- const renderedAfterDocs = afterDocs.map(newDoc => newDoc.render()).join('');
257
-
258
- // Insert the documents after the current
259
- this.ul.append(renderedAfterDocs);
260
- this.el.html(this.ul);
261
-
262
- // Initialize additional things
263
- $itemDoc.find('.context-navigator').each(function (i, e) {
264
- const contextNavigation = new ContextNavigation(
265
- e, that.originalParents, that.originalDocument
266
- );
267
- contextNavigation.getData();
268
- });
269
- }
270
-
271
- /**
272
- * This updates the elements in the View DOM using an AJAX response containing
273
- * the HTML of a server-rendered View template.
274
- * It is this which is primarily used to populate the <ul> element with
275
- * children for the navigation context, containing <li> elements for
276
- * collections, components, and containers.
277
- * @param {string} response - the AJAX response body
278
- */
279
- updateView(response) {
280
- const that = this;
281
- var resp = $.parseHTML(response);
282
- var $doc = $(resp);
283
- var newDocs = $doc.find('#documents')
284
- .find('article')
285
- .toArray().map(el => new NavigationDocument(el));
286
-
287
- // See if the original document is located in the returned documents
288
- const originalDocumentIndex = newDocs
289
- .findIndex(doc => doc.id === that.originalDocument);
290
- that.parentLi.find('.al-hierarchy-placeholder').remove();
291
-
292
- // If the original document in the results, update it. If not update with a
293
- // more complex procedure
294
- if (originalDocumentIndex !== -1) {
295
- this.updateSiblings(newDocs, originalDocumentIndex);
296
- } else {
297
- this.updateParents(
298
- newDocs,
299
- that.data.arclight.originalParents,
300
- that.data.arclight.parent,
301
- that.parentLi
302
- );
303
- }
304
- this.el.parent().data('resolved', true);
305
- this.addListenersForPlusMinus();
306
- this.enablebuttons();
307
- Blacklight.doBookmarkToggleBehavior();
308
- this.el.trigger('navigation.contains.elements');
309
- }
310
-
311
- // eslint-disable-next-line class-methods-use-this
312
- enablebuttons() {
313
- var toEnable = $('[data-hierarchy-enable-me]');
314
- var srOnly = $('h2[data-sr-enable-me]');
315
- toEnable.removeClass('disabled');
316
- toEnable.text(srOnly.data('hasContents'));
317
- srOnly.text(srOnly.data('hasContents'));
318
- }
319
-
320
- addListenersForPlusMinus() {
321
- const that = this;
322
- this.ul.find('.al-toggle-view-children').on('click', (e) => {
323
- e.preventDefault();
324
- const targetArea = $($(e.currentTarget).attr('href'));
325
- if (!targetArea.data('resolved') === true) {
326
- targetArea.find('.context-navigator').each((i, ee) => {
327
- const contextNavigation = new ContextNavigation(
328
- // Send null for originalParents. We want to disregard the original
329
- // component's ancestor trail and instead use the current ID as the
330
- // parent in the query to populate the navigator.
331
- ee, null, that.originalDocument
332
- );
333
- contextNavigation.getData();
334
- });
335
- }
336
- });
337
- }
338
- }
339
-
340
- /**
341
- * Integrate the behavior into the DOM using the Blacklight#onLoad callback
342
- *
343
- */
344
- Blacklight.onLoad(function () {
345
- $('.context-navigator').each(function (i, e) {
346
- const contextNavigation = new ContextNavigation(
347
- e, $(this).data('arclight').originalParents, $(this).data('arclight').originalDocument
348
- );
349
- contextNavigation.getData();
350
- });
351
- });
@@ -1,46 +0,0 @@
1
- Blacklight.onLoad(function () {
2
- 'use strict';
3
-
4
- var onlineContentTabSelector = '[data-arclight-online-content-tab="true"]';
5
- var oEmbedViewerSelector = '[data-arclight-oembed="true"]';
6
-
7
- $(onlineContentTabSelector).on('shown.bs.tab', function () {
8
- var $viewerElements = $(oEmbedViewerSelector);
9
- if ($viewerElements.length === 0) {
10
- return;
11
- }
12
-
13
- $viewerElements.each(function (i, element) {
14
- var $el = $(element);
15
- var loadedAttr = $el.attr('loaded');
16
- var data = $el.data();
17
- var resourceUrl = data.arclightOembedUrl;
18
- if (loadedAttr && loadedAttr === 'loaded') {
19
- return;
20
- }
21
-
22
- $.ajax({
23
- url: resourceUrl,
24
- dataType: 'html'
25
- }).done(function (response) {
26
- var links = $('<div>' + response.match(/<link .*>/g).join('') + '</div>'); // Parse out link elements so image assets are not loaded
27
- var oEmbedEndPoint = links.find('link[rel="alternate"][type="application/json+oembed"]').prop('href');
28
-
29
- if (!oEmbedEndPoint || oEmbedEndPoint.length === 0) {
30
- return;
31
- }
32
-
33
- $.ajax({
34
- url: oEmbedEndPoint
35
- }).done(function (oEmbedResponse) {
36
- if (oEmbedResponse.html) {
37
- $el.hide()
38
- .html(oEmbedResponse.html)
39
- .fadeIn(500);
40
- $el.attr('loaded', 'loaded');
41
- }
42
- });
43
- });
44
- });
45
- });
46
- });
@@ -1,29 +0,0 @@
1
- Blacklight.onLoad(function () {
2
- 'use strict';
3
-
4
- // Any element on page load
5
- $('[data-arclight-truncate="true"]').each(function (i, e) {
6
- $(e).responsiveTruncate({
7
- more: "<%= I18n.t 'arclight.truncation.view_more' %>",
8
- less: "<%= I18n.t 'arclight.truncation.view_less' %>"
9
- });
10
- });
11
-
12
- // When elements get loaded from hierarchy
13
- $('.al-contents, .context-navigator').on('navigation.contains.elements', function (e) {
14
- $('a[data-toggle="tab"]').on('shown.bs.tab', function () {
15
- $('[data-arclight-truncate="true"]').each(function (_, el) {
16
- $(el).responsiveTruncate({
17
- more: "<%= I18n.t 'arclight.truncation.view_more' %>",
18
- less: "<%= I18n.t 'arclight.truncation.view_less' %>"
19
- });
20
- });
21
- });
22
- $(e.target).find('[data-arclight-truncate="true"]').each(function (_, el) {
23
- $(el).responsiveTruncate({
24
- more: "<%= I18n.t 'arclight.truncation.view_more' %>",
25
- less: "<%= I18n.t 'arclight.truncation.view_less' %>"
26
- });
27
- });
28
- });
29
- });
@@ -1,26 +0,0 @@
1
- .nav.nav-pills {
2
- margin-bottom: $spacer;
3
- }
4
-
5
- .nav.nav-tabs {
6
- margin-bottom: 0;
7
- flex-wrap: nowrap;
8
- & .nav-item .nav-link:not(.active) {
9
- background: $gray-100;
10
- border-color: $nav-tabs-border-color;
11
- }
12
- & .nav-item .nav-link {
13
- height: 100%;
14
- }
15
- & .nav-item {
16
- overflow-wrap: break-word;
17
- }
18
- }
19
-
20
- .tab-pane {
21
- border-style: solid;
22
- border-width: 0 1px 1px 1px;
23
- border-color: $nav-tabs-border-color;
24
- border-radius: 0px 0px $nav-tabs-border-radius $nav-tabs-border-radius;
25
- padding: $spacer*2;
26
- }
@@ -1,75 +0,0 @@
1
- #contents > .context-navigator,
2
- #collection-context > .context-navigator {
3
- padding-left: $spacer;
4
- }
5
-
6
- ul.al-context-nav-parent {
7
- padding-left: 0px;
8
- }
9
-
10
- li.al-collection-context {
11
- flex-grow: 1;
12
- margin-right: 0;
13
- margin-left: 0;
14
- padding-left: 15px;
15
- max-width: 100%;
16
-
17
- .al-collection-context-collapsible {
18
- width: 100%;
19
- }
20
-
21
- .blacklight-icons {
22
- padding-top: $spacer * .25;
23
- }
24
-
25
- .al-number-of-children-badge {
26
- font-size: 12px;
27
- vertical-align: middle;
28
- }
29
-
30
- .documentHeader {
31
- flex-grow: 1;
32
- margin-bottom: $spacer;
33
- width: 100%;
34
- }
35
-
36
- .document-title-heading {
37
- font-size: 1.25rem;
38
- }
39
-
40
- .col.col-no-left-padding.d-flex.flex-wrap {
41
- flex-grow: 1;
42
- }
43
- .order-2 .row {
44
- margin-left: 0;
45
- }
46
-
47
- .al-document-abstract-or-scope {
48
- max-width: 45em;
49
- }
50
-
51
- .blacklight-icons svg {
52
- fill: $gray-600;
53
- }
54
-
55
- .al-online-content-icon svg {
56
- fill: $green;
57
- }
58
- @media (max-width: 767px) {
59
- padding-left: 0;
60
- .al-document-abstract-or-scope {
61
- max-width: 25em;
62
- }
63
- }
64
- }
65
-
66
- @media (max-width: 767px) {
67
- .blacklight-catalog.blacklight-catalog-show {
68
- #context {
69
- padding: 10px;
70
- }
71
- }
72
- ul.al-context-nav-parent {
73
- padding-left: 40px;
74
- }
75
- }
@@ -1,102 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Arclight
4
- ##
5
- # A module to add configuration helpers for certain fields used by Arclight
6
- module FieldConfigHelpers
7
- extend ActiveSupport::Concern
8
- include ActionView::Helpers::OutputSafetyHelper
9
- include ActionView::Helpers::TagHelper
10
- include Arclight::EadFormatHelpers
11
-
12
- included do
13
- if respond_to?(:helper_method)
14
- helper_method :repository_config_present
15
- helper_method :request_config_present
16
- helper_method :context_access_tab_repository
17
- helper_method :access_repository_contact
18
- helper_method :before_you_visit_note_present
19
- helper_method :context_access_tab_visit_note
20
- helper_method :highlight_terms
21
- helper_method :context_sidebar_containers_request
22
- helper_method :item_requestable?
23
- helper_method :paragraph_separator
24
- helper_method :link_to_name_facet
25
- helper_method :render_html_tags
26
- end
27
- end
28
-
29
- def repository_config_present(_, document)
30
- document.repository_config.present?
31
- end
32
-
33
- def item_requestable?(_, options)
34
- document = options[:document]
35
- request_config_present('', document)
36
- end
37
-
38
- def request_config_present(var, document)
39
- repository_config_present(var, document) &&
40
- document.repository_config.request_config_present?
41
- end
42
-
43
- def context_access_tab_repository(args)
44
- document = args[:document]
45
- ApplicationController.renderer.render(
46
- 'arclight/repositories/_in_person_repository',
47
- layout: false,
48
- locals: { repository: document.repository_config }
49
- )
50
- end
51
-
52
- def access_repository_contact(args)
53
- document = args[:document]
54
- ApplicationController.renderer.render(
55
- 'arclight/repositories/_repository_contact',
56
- layout: false,
57
- locals: { repository: document.repository_config }
58
- )
59
- end
60
-
61
- def before_you_visit_note_present(_, document)
62
- document.repository_config && document.repository_config.visit_note.present?
63
- end
64
-
65
- def context_access_tab_visit_note(args)
66
- document = args[:document]
67
- document.repository_config.visit_note
68
- end
69
-
70
- def highlight_terms(args)
71
- safe_join(args[:value].map { |value| content_tag(:span, value, class: 'bg-info') })
72
- end
73
-
74
- def context_sidebar_containers_request(args)
75
- document = args[:document]
76
- presenter = Arclight::ShowPresenter.new(document, view_context)
77
- ApplicationController.renderer.render(
78
- 'arclight/requests/_google_form',
79
- layout: false,
80
- locals: {
81
- google_form: Arclight::Requests::GoogleForm.new(document, presenter, solr_document_url(document))
82
- }
83
- )
84
- end
85
-
86
- def paragraph_separator(args)
87
- safe_join(args[:value].map { |paragraph| content_tag(:p, paragraph) })
88
- end
89
-
90
- def link_to_name_facet(args)
91
- options = args[:config]&.separator_options || {}
92
- values = args[:value] || []
93
-
94
- values.map do |value|
95
- view_context.link_to(
96
- value,
97
- view_context.search_action_path(f: { names_ssim: [value] })
98
- )
99
- end.to_sentence(options).html_safe
100
- end
101
- end
102
- end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- ##
4
- # A factory to return blacklight field configurations given a field key
5
- # that represents a field group (e.g. summary_fields, access_fields, etc)
6
- class BlacklightFieldConfigurationFactory
7
- def self.for(config:, field:, field_group:)
8
- new(config: config, field: field, field_group: field_group).field_config
9
- end
10
-
11
- def initialize(config:, field:, field_group:)
12
- @config = config
13
- @field = field
14
- @field_group = field_group
15
- end
16
-
17
- def field_config
18
- return null_field unless config.respond_to?(:"#{field_group}s")
19
-
20
- config.send(:"#{field_group}s").fetch(field) { null_field }
21
- end
22
-
23
- private
24
-
25
- attr_reader :config, :field, :field_group
26
-
27
- def null_field
28
- Blacklight::Configuration::NullField.new(field)
29
- end
30
- end
@@ -1,19 +0,0 @@
1
- <div class='al-in-person-repository-name'>
2
- <% if repository.thumbnail_url %>
3
- <%= image_tag repository.thumbnail_url, alt: '', class: 'img-fluid float-left' %>
4
- <% end %>
5
- <div>
6
- <%= link_to(repository.name, arclight_engine.repository_path(repository.slug)) %>
7
- </div>
8
- </div>
9
- <div class='al-in-person-repository-location'>
10
- <address>
11
- <% %i[building address1 address2 city_state_zip_country].each do |f| %>
12
- <% if repository.send(f).present? %>
13
- <div class='al-repository-contact-<%= f %>'>
14
- <%= repository.send(f) %>
15
- </div>
16
- <% end %>
17
- <% end %>
18
- </address>
19
- </div>
@@ -1,9 +0,0 @@
1
- <div class='al-in-person-repository-contact'>
2
- <% %i[phone contact_info].each do |f| %>
3
- <% if repository.send(f).present? %>
4
- <div class='al-repository-contact-<%= f %>'>
5
- <%= repository.send(f) %>
6
- </div>
7
- <% end %>
8
- <% end %>
9
- </div>
@@ -1,8 +0,0 @@
1
- <% parents = Arclight::Parents.from_solr_document(viewer.document).as_parents %>
2
- <% viewer.resources.each do |resource| %>
3
- <%= content_tag(:div, viewer.attributes_for(resource)) do %>
4
- <div class="al-digital-object media breadcrumb-item breadcrumb-item-<%= parents.length + 6 %>">
5
- <%= link_to(resource.label, resource.href) %>
6
- </div>
7
- <% end %>
8
- <% end %>