arclight 0.3.0 → 1.6.2

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 (240) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc +11 -4
  3. data/.github/workflows/ruby.yml +51 -0
  4. data/.gitignore +1 -0
  5. data/.rspec +0 -1
  6. data/.rubocop.yml +498 -21
  7. data/.rubocop_todo.yml +69 -86
  8. data/.solr_wrapper +2 -1
  9. data/CONTRIBUTING.md +5 -5
  10. data/CONTRIBUTORS.md +1 -1
  11. data/Gemfile +15 -10
  12. data/README.md +22 -17
  13. data/app/assets/images/blacklight/bookmark.svg +1 -1
  14. data/app/assets/images/blacklight/collection.svg +1 -1
  15. data/app/assets/images/blacklight/compact.svg +1 -1
  16. data/app/assets/images/blacklight/container.svg +1 -1
  17. data/app/assets/images/blacklight/ead.svg +1 -1
  18. data/app/assets/images/blacklight/file.svg +1 -1
  19. data/app/assets/images/blacklight/folder.svg +1 -1
  20. data/app/assets/images/blacklight/list.svg +1 -1
  21. data/app/assets/images/blacklight/online.svg +1 -1
  22. data/app/assets/images/blacklight/pdf.svg +1 -1
  23. data/app/assets/images/blacklight/repository.svg +1 -1
  24. data/app/assets/javascripts/arclight/arclight.js +4 -8
  25. data/app/assets/javascripts/arclight/oembed_controller.js +58 -0
  26. data/app/assets/javascripts/arclight/truncate_controller.js +27 -0
  27. data/app/assets/stylesheets/arclight/application.scss +3 -5
  28. data/app/assets/stylesheets/arclight/build.scss +4 -0
  29. data/app/assets/stylesheets/arclight/modules/hierarchy_and_online_contents.scss +108 -130
  30. data/app/assets/stylesheets/arclight/modules/icons.scss +20 -0
  31. data/app/assets/stylesheets/arclight/modules/layout.scss +129 -100
  32. data/app/assets/stylesheets/arclight/modules/mastheads.scss +23 -96
  33. data/app/assets/stylesheets/arclight/modules/repositories.scss +2 -2
  34. data/app/assets/stylesheets/arclight/modules/repository_card.scss +4 -48
  35. data/app/assets/stylesheets/arclight/modules/search_form.scss +9 -0
  36. data/app/assets/stylesheets/arclight/modules/search_results.scss +95 -45
  37. data/app/assets/stylesheets/arclight/modules/show_collection.scss +5 -32
  38. data/app/assets/stylesheets/arclight/modules/truncator.scss +58 -0
  39. data/app/assets/stylesheets/arclight/variables.scss +7 -4
  40. data/app/components/arclight/access_component.html.erb +14 -0
  41. data/app/components/arclight/access_component.rb +25 -0
  42. data/app/components/arclight/bookmark_component.html.erb +25 -0
  43. data/app/components/arclight/bookmark_component.rb +9 -0
  44. data/app/components/arclight/breadcrumb_component.rb +50 -0
  45. data/app/components/arclight/breadcrumbs_hierarchy_component.html.erb +34 -0
  46. data/app/components/arclight/breadcrumbs_hierarchy_component.rb +25 -0
  47. data/app/components/arclight/collection_context_component.html.erb +12 -0
  48. data/app/components/arclight/collection_context_component.rb +27 -0
  49. data/app/components/arclight/collection_info_component.html.erb +28 -0
  50. data/app/components/arclight/collection_info_component.rb +26 -0
  51. data/app/components/arclight/collection_sidebar_component.html.erb +15 -0
  52. data/app/components/arclight/collection_sidebar_component.rb +39 -0
  53. data/app/{views/catalog/_search_results_repository.html.erb → components/arclight/constraints_component.html.erb} +2 -1
  54. data/app/components/arclight/constraints_component.rb +17 -0
  55. data/app/components/arclight/document_collection_context_component.html.erb +29 -0
  56. data/app/components/arclight/document_collection_context_component.rb +28 -0
  57. data/app/components/arclight/document_collection_hierarchy_component.html.erb +50 -0
  58. data/app/components/arclight/document_collection_hierarchy_component.rb +62 -0
  59. data/app/components/arclight/document_component.html.erb +39 -0
  60. data/app/components/arclight/document_component.rb +49 -0
  61. data/app/components/arclight/document_components_hierarchy_component.html.erb +20 -0
  62. data/app/components/arclight/document_components_hierarchy_component.rb +34 -0
  63. data/app/components/arclight/document_download_component.html.erb +24 -0
  64. data/app/components/arclight/document_download_component.rb +71 -0
  65. data/app/components/arclight/embed_component.html.erb +10 -0
  66. data/app/components/arclight/embed_component.rb +43 -0
  67. data/app/components/arclight/expand_hierarchy_button_component.html.erb +5 -0
  68. data/app/components/arclight/expand_hierarchy_button_component.rb +16 -0
  69. data/app/components/arclight/group_component.html.erb +34 -0
  70. data/app/components/arclight/group_component.rb +23 -0
  71. data/app/components/arclight/header_component.html.erb +5 -0
  72. data/app/components/arclight/header_component.rb +10 -0
  73. data/app/components/arclight/index_metadata_field_component.html.erb +16 -0
  74. data/app/components/arclight/index_metadata_field_component.rb +20 -0
  75. data/app/components/arclight/masthead_component.html.erb +17 -0
  76. data/app/components/arclight/masthead_component.rb +10 -0
  77. data/app/components/arclight/metadata_section_component.html.erb +13 -0
  78. data/app/components/arclight/metadata_section_component.rb +22 -0
  79. data/app/components/arclight/oembed_viewer_component.html.erb +5 -0
  80. data/app/components/arclight/oembed_viewer_component.rb +16 -0
  81. data/app/components/arclight/online_content_filter_component.html.erb +15 -0
  82. data/app/components/arclight/online_content_filter_component.rb +17 -0
  83. data/app/components/arclight/online_status_indicator_component.rb +19 -0
  84. data/app/components/arclight/repository_breadcrumb_component.html.erb +10 -0
  85. data/app/components/arclight/repository_breadcrumb_component.rb +17 -0
  86. data/app/components/arclight/repository_location_component.html.erb +20 -0
  87. data/app/components/arclight/repository_location_component.rb +10 -0
  88. data/app/components/arclight/search_bar_component.html.erb +27 -0
  89. data/app/components/arclight/search_bar_component.rb +32 -0
  90. data/app/components/arclight/search_result_breadcrumbs_component.html.erb +6 -0
  91. data/app/components/arclight/search_result_breadcrumbs_component.rb +37 -0
  92. data/app/components/arclight/search_result_component.html.erb +20 -0
  93. data/app/components/arclight/search_result_component.rb +18 -0
  94. data/app/components/arclight/search_result_title_component.html.erb +15 -0
  95. data/app/components/arclight/search_result_title_component.rb +15 -0
  96. data/app/components/arclight/sidebar_component.html.erb +9 -0
  97. data/app/components/arclight/sidebar_component.rb +19 -0
  98. data/app/components/arclight/upper_metadata_layout_component.rb +10 -0
  99. data/app/components/blacklight/icons/bookmark_component.rb +12 -0
  100. data/app/components/blacklight/icons/collection_component.rb +14 -0
  101. data/app/components/blacklight/icons/compact_component.rb +12 -0
  102. data/app/components/blacklight/icons/container_component.rb +14 -0
  103. data/app/components/blacklight/icons/ead_component.rb +12 -0
  104. data/app/components/blacklight/icons/file_component.rb +14 -0
  105. data/app/components/blacklight/icons/folder_component.rb +12 -0
  106. data/app/components/blacklight/icons/online_component.rb +15 -0
  107. data/app/components/blacklight/icons/pdf_component.rb +12 -0
  108. data/app/components/blacklight/icons/repository_component.rb +12 -0
  109. data/app/controllers/arclight/repositories_controller.rb +4 -4
  110. data/app/{controllers/concerns → helpers}/arclight/ead_format_helpers.rb +91 -7
  111. data/app/helpers/arclight/field_config_helpers.rb +26 -0
  112. data/app/helpers/arclight_helper.rb +24 -251
  113. data/app/models/arclight/document_downloads.rb +12 -15
  114. data/app/models/arclight/parent.rb +6 -8
  115. data/app/models/arclight/parents.rb +7 -4
  116. data/app/models/arclight/requests/aeon_external_request.rb +1 -1
  117. data/app/models/arclight/requests/aeon_web_ead.rb +8 -3
  118. data/app/models/arclight/requests/google_form.rb +8 -3
  119. data/app/models/concerns/arclight/catalog.rb +25 -15
  120. data/app/models/concerns/arclight/search_behavior.rb +12 -26
  121. data/app/models/concerns/arclight/solr_document.rb +80 -73
  122. data/app/presenters/arclight/show_presenter.rb +34 -7
  123. data/app/views/arclight/_requests.html.erb +2 -2
  124. data/app/views/arclight/repositories/_repository.html.erb +21 -40
  125. data/app/views/arclight/repositories/index.html.erb +3 -1
  126. data/app/views/arclight/repositories/show.html.erb +4 -6
  127. data/app/views/arclight/requests/_aeon_external_request_endpoint.html.erb +4 -5
  128. data/app/views/arclight/requests/_aeon_web_ead.html.erb +3 -4
  129. data/app/views/arclight/requests/_google_form.html.erb +4 -6
  130. data/app/views/catalog/_document_list.html.erb +8 -0
  131. data/app/views/catalog/_group.html.erb +2 -19
  132. data/app/views/catalog/_group_toggle.html.erb +1 -1
  133. data/app/views/catalog/_search_results_header.html.erb +3 -0
  134. data/app/views/catalog/hierarchy.html.erb +19 -0
  135. data/app/views/catalog/index.html.erb +16 -7
  136. data/app/views/shared/_breadcrumbs.html.erb +2 -14
  137. data/app/views/shared/_main_menu_links.html.erb +1 -1
  138. data/arclight.gemspec +17 -15
  139. data/config/breadcrumbs.rb +24 -0
  140. data/config/i18n-tasks.yml +9 -8
  141. data/config/importmap.rb +3 -0
  142. data/config/locales/arclight.en.yml +31 -30
  143. data/config/routes.rb +1 -1
  144. data/docker-compose.yml +16 -0
  145. data/lib/arclight/digital_object.rb +2 -1
  146. data/lib/arclight/engine.rb +18 -37
  147. data/lib/arclight/exceptions.rb +1 -0
  148. data/lib/arclight/hash_absolute_xpath.rb +2 -1
  149. data/lib/arclight/normalized_date.rb +5 -10
  150. data/lib/arclight/normalized_id.rb +6 -2
  151. data/lib/arclight/normalized_title.rb +2 -0
  152. data/lib/arclight/repository.rb +46 -57
  153. data/lib/arclight/routes/hierarchy.rb +19 -0
  154. data/lib/arclight/routes.rb +8 -0
  155. data/lib/arclight/traject/ead2_component_config.rb +335 -0
  156. data/lib/arclight/traject/ead2_config.rb +120 -298
  157. data/lib/arclight/version.rb +1 -1
  158. data/lib/arclight/year_range.rb +4 -3
  159. data/lib/arclight.rb +6 -1
  160. data/lib/generators/arclight/install_generator.rb +97 -11
  161. data/lib/generators/arclight/templates/arclight.scss +6 -3
  162. data/lib/generators/arclight/templates/catalog_controller.rb +193 -163
  163. data/lib/generators/arclight/templates/config/locales/arclight.en.yml +61 -0
  164. data/lib/generators/arclight/templates/config/repositories.yml +22 -29
  165. data/lib/tasks/index.rake +14 -17
  166. data/package.json +13 -14
  167. data/solr/conf/schema.xml +49 -39
  168. data/solr/conf/solrconfig.xml +78 -58
  169. data/tasks/arclight.rake +17 -9
  170. data/template.rb +6 -7
  171. metadata +159 -127
  172. data/.babelrc +0 -3
  173. data/.travis.yml +0 -28
  174. data/app/assets/javascripts/arclight/collection_navigation.js +0 -100
  175. data/app/assets/javascripts/arclight/collection_scrollspy.js +0 -6
  176. data/app/assets/javascripts/arclight/context_navigation.js +0 -374
  177. data/app/assets/javascripts/arclight/oembed_viewer.js +0 -46
  178. data/app/assets/javascripts/arclight/truncator.js.erb +0 -29
  179. data/app/assets/stylesheets/arclight/bootstrap_overrides.scss +0 -26
  180. data/app/assets/stylesheets/arclight/modules/context_navigation.scss +0 -75
  181. data/app/controllers/concerns/arclight/field_config_helpers.rb +0 -102
  182. data/app/factories/blacklight_field_configuration_factory.rb +0 -30
  183. data/app/views/arclight/repositories/_in_person_repository.html.erb +0 -19
  184. data/app/views/arclight/repositories/_repository_contact.html.erb +0 -9
  185. data/app/views/arclight/viewers/_oembed.html.erb +0 -8
  186. data/app/views/catalog/_access_contents.html.erb +0 -15
  187. data/app/views/catalog/_arclight_abstract_or_scope.html.erb +0 -5
  188. data/app/views/catalog/_arclight_bookmark_control.html.erb +0 -38
  189. data/app/views/catalog/_arclight_document_header_icon.html.erb +0 -1
  190. data/app/views/catalog/_arclight_document_index_header.html.erb +0 -13
  191. data/app/views/catalog/_arclight_document_index_header_hierarchy_default.html.erb +0 -0
  192. data/app/views/catalog/_arclight_document_index_header_online_contents_default.html.erb +0 -0
  193. data/app/views/catalog/_arclight_index_compact_default.html.erb +0 -22
  194. data/app/views/catalog/_arclight_index_default.html.erb +0 -45
  195. data/app/views/catalog/_arclight_index_group_document_compact_default.html.erb +0 -19
  196. data/app/views/catalog/_arclight_index_group_document_default.html.erb +0 -18
  197. data/app/views/catalog/_arclight_online_content_indicator.html.erb +0 -3
  198. data/app/views/catalog/_arclight_rangelimit.html.erb +0 -24
  199. data/app/views/catalog/_arclight_viewer_default.html.erb +0 -1
  200. data/app/views/catalog/_collection_contents.html.erb +0 -4
  201. data/app/views/catalog/_collection_context.html.erb +0 -15
  202. data/app/views/catalog/_collection_context_nav.html.erb +0 -12
  203. data/app/views/catalog/_collection_online_contents.html.erb +0 -17
  204. data/app/views/catalog/_component_context.html.erb +0 -5
  205. data/app/views/catalog/_containers.html.erb +0 -3
  206. data/app/views/catalog/_context_card.html.erb +0 -27
  207. data/app/views/catalog/_context_sidebar.html.erb +0 -8
  208. data/app/views/catalog/_custom_metadata.html.erb +0 -16
  209. data/app/views/catalog/_document_downloads.html.erb +0 -14
  210. data/app/views/catalog/_group_header_compact_default.html.erb +0 -15
  211. data/app/views/catalog/_group_header_default.html.erb +0 -20
  212. data/app/views/catalog/_home.html.erb +0 -1
  213. data/app/views/catalog/_index_breadcrumb_default.html.erb +0 -6
  214. data/app/views/catalog/_index_collection_context_default.html.erb +0 -53
  215. data/app/views/catalog/_index_default.html.erb +0 -17
  216. data/app/views/catalog/_index_header.html.erb +0 -7
  217. data/app/views/catalog/_index_header_online_contents_default.html.erb +0 -1
  218. data/app/views/catalog/_index_online_contents_default.html.erb +0 -6
  219. data/app/views/catalog/_online_content_label.html.erb +0 -5
  220. data/app/views/catalog/_search_form.html.erb +0 -34
  221. data/app/views/catalog/_search_results.html.erb +0 -28
  222. data/app/views/catalog/_show_actions_box_default.html.erb +0 -27
  223. data/app/views/catalog/_show_breadcrumbs_default.html.erb +0 -6
  224. data/app/views/catalog/_show_collection.html.erb +0 -66
  225. data/app/views/catalog/_show_default.html.erb +0 -70
  226. data/app/views/catalog/_show_upper_metadata_collection.html.erb +0 -1
  227. data/app/views/catalog/_show_upper_metadata_default.html.erb +0 -14
  228. data/app/views/catalog/_sort_and_per_page.html.erb +0 -8
  229. data/app/views/catalog/_within_collection_dropdown.html.erb +0 -26
  230. data/app/views/layouts/catalog_result.html.erb +0 -7
  231. data/app/views/shared/_context_sidebar.html.erb +0 -8
  232. data/app/views/shared/_header_navbar.html.erb +0 -61
  233. data/app/views/shared/_show_breadcrumbs.html.erb +0 -27
  234. data/lib/arclight/viewer.rb +0 -45
  235. data/lib/arclight/viewers/oembed.rb +0 -57
  236. data/lib/generators/arclight/templates/arclight.js +0 -2
  237. data/solr/conf/scripts.conf +0 -24
  238. data/vendor/assets/javascripts/responsiveTruncator.js +0 -69
  239. data/vendor/assets/javascripts/stickyfill.js +0 -480
  240. /data/app/assets/images/{blacklight → arclight}/logo.png +0 -0
@@ -1,374 +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
- collapse() {
15
- this.el.find('li.al-collection-context').addClass('collapsed');
16
- }
17
-
18
- render() {
19
- return this.el.html();
20
- }
21
- }
22
-
23
- /**
24
- * Models the "Expand"/"Collapse" button, and provides an onClick event handler
25
- * for the jQuery element
26
- * @class
27
- */
28
- class ExpandButton {
29
- /**
30
- * This retrieves the <li> elements which are hidden/rendered in response to
31
- * clicking the <button> element
32
- * @param {jQuery} $li - the <button> element
33
- * @return {jQuery} - a jQuery object containing the targeted <li>
34
- */
35
- findSiblings() {
36
- const $siblings = this.$el.parent().children('li');
37
- return $siblings.slice(0, -1);
38
- }
39
-
40
- /**
41
- * This adds a "collapsed" class to all of the <li> children, as well as
42
- * updates the text for the <button> element
43
- * @param {Event} event - the event propagated in response to clicking on the
44
- * <button> element
45
- */
46
- handleClick() {
47
- const $targeted = this.findSiblings();
48
-
49
- $targeted.toggleClass('collapsed');
50
- this.$el.toggleClass('collapsed');
51
-
52
- const containerText = this.$el.hasClass('collapsed') ? this.collapseText : this.expandText;
53
- this.$el.text(containerText);
54
- }
55
-
56
- /**
57
- * @constructor
58
- */
59
- constructor(data) {
60
- this.collapseText = data.collapse;
61
- this.expandText = data.expand;
62
-
63
- this.$el = $(`<button class="my-3 btn btn-secondary btn-sm">${this.expandText}</button>`);
64
- this.handleClick = this.handleClick.bind(this);
65
- this.$el.click(this.handleClick);
66
- }
67
- }
68
-
69
- /**
70
- * Modeling <button> Elements which hide or retrieve <li> elements for sibling
71
- * documents nested within the <li> elements of the <ul> tree
72
- * @class
73
- */
74
- class NestedExpandButton extends ExpandButton {
75
- /**
76
- * This retrieves the <li> elements which are hidden/rendered in response to
77
- * clicking the <button> element
78
- * @param {jQuery} $li - the <button> element
79
- * @return {jQuery} - a jQuery object containing the targeted <li>
80
- */
81
- findSiblings() {
82
- const highlighted = this.$el.siblings('.al-hierarchy-highlight');
83
- const $siblings = highlighted.prevAll('.al-collection-context');
84
- return $siblings.slice(0, -1);
85
- }
86
- }
87
-
88
- /**
89
- * Models the placeholder display elements for content loading from AJAX
90
- * requests
91
- * @class
92
- */
93
- class Placeholder {
94
- /*
95
- * Builds the element set which contains the placeholder markup
96
- * classes
97
- */
98
- /* eslint-disable class-methods-use-this */
99
- buildElement() {
100
- const elementMarkup = '<div class="al-hierarchy-placeholder">' +
101
- '<h3 class="col-md-9"></h3>' +
102
- '<p class="col-md-6"></p>' +
103
- '<p class="col-md-12"></p>' +
104
- '<p class="col-md-3"></p>' +
105
- '</div>';
106
- const markup = Array(3).join(elementMarkup);
107
-
108
- return $(markup);
109
- }
110
- /* eslint-enable class-methods-use-this */
111
-
112
- /*
113
- * @constructor
114
- */
115
- constructor() {
116
- this.$el = this.buildElement();
117
- }
118
- }
119
-
120
- class ContextNavigation {
121
- constructor(el, originalParents = null, originalDocument = null) {
122
- this.el = $(el);
123
- this.data = this.el.data();
124
- this.parentLi = this.el.parent();
125
- this.eadid = this.data.arclight.eadid;
126
- this.originalParents = originalParents || this.data.arclight.originalParents;
127
- this.originalDocument = originalDocument || this.data.arclight.originalDocument;
128
- this.ul = $('<ul class="al-context-nav-parent"></ul>');
129
- }
130
-
131
- // Gets the targetId to select, based off of parents and current level
132
- get targetId() {
133
- return `${this.eadid}${this.originalParents[this.data.arclight.level]}`;
134
- }
135
-
136
- get requestParent() {
137
- if (this.originalParents && this.originalParents[this.data.arclight.level - 1]) {
138
- return this.originalParents[this.data.arclight.level - 1];
139
- }
140
- return this.data.arclight.originalDocument.replace(this.eadid, '');
141
- }
142
-
143
- getData() {
144
- const that = this;
145
- // Add a placeholder so flashes of text are not as significant
146
- const placeholder = new Placeholder();
147
- this.el.after(placeholder.$el);
148
- $.ajax({
149
- url: this.data.arclight.path,
150
- data: {
151
- 'f[component_level_isim][]': this.data.arclight.level,
152
- 'f[has_online_content_ssim][]': this.data.arclight.access,
153
- 'f[collection_sim][]': this.data.arclight.name,
154
- 'f[parent_ssi][]': this.requestParent,
155
- search_field: this.data.arclight.search_field,
156
- original_parents: this.data.arclight.originalParents,
157
- original_document: this.originalDocument,
158
- view: 'collection_context'
159
- }
160
- }).done((response) => that.updateView(response));
161
- }
162
-
163
- /**
164
- * Constructs a <ul> container element with an ElementButton instance appended
165
- * within it
166
- * @returns {jQuery}
167
- */
168
- buildExpandList() {
169
- const $ul = $('<ul></ul>');
170
- $ul.addClass('pl-0');
171
- $ul.addClass('prev-siblings');
172
- const button = new ExpandButton(this.data);
173
- $ul.append(button.$el);
174
- return $ul;
175
- }
176
-
177
- /**
178
- * Highlights the <li> element for the current Document and appends <li> the
179
- * sibling documents for a given Document element
180
- * @param {NavigationDocument[]} newDocs - the NavigationDocument objects for
181
- * each resulting Solr Document
182
- * @param {number} originalDocumentIndex
183
- */
184
- updateSiblings(newDocs, originalDocumentIndex) {
185
- newDocs[originalDocumentIndex].setAsHighlighted();
186
-
187
- // Hide all but the first previous sibling
188
- const prevSiblingDocs = newDocs.slice(0, originalDocumentIndex);
189
- let nextSiblingDocs = [];
190
-
191
- if (prevSiblingDocs.length > 1 && originalDocumentIndex > 0) {
192
- const hiddenPrevSiblingDocs = prevSiblingDocs.slice(0, -1);
193
- hiddenPrevSiblingDocs.forEach(siblingDoc => {
194
- siblingDoc.collapse();
195
- });
196
-
197
- const prevSiblingList = this.buildExpandList();
198
- const renderedPrevSiblingItems = prevSiblingDocs.map(doc => doc.render()).join('');
199
-
200
- prevSiblingList.append(renderedPrevSiblingItems);
201
- this.ul.append(prevSiblingList);
202
-
203
- nextSiblingDocs = newDocs.slice(originalDocumentIndex);
204
- } else {
205
- nextSiblingDocs = newDocs;
206
- }
207
-
208
- const renderedNextSiblingItems = nextSiblingDocs.map(newDoc => newDoc.render()).join('');
209
-
210
- // Insert the rendered sibling documents before the <li> elements
211
- this.ul.append(renderedNextSiblingItems);
212
- this.el.html(this.ul);
213
- }
214
-
215
- /**
216
- * Inserts <li> elements for parents (e. g. components or collections) for the
217
- * current Document and appends <li> for each of these
218
- * @param {NavigationDocument[]} newDocs - the NavigationDocument objects for
219
- * each resulting Solr Document
220
- */
221
- updateParents(newDocs) {
222
- const that = this;
223
- // Case where this is a parent list and needs to be filed correctly
224
- //
225
- // Otherwise, retrieve the parent...
226
- let newDocIndex = newDocs.findIndex(doc => doc.id === this.targetId);
227
-
228
- if (newDocIndex === -1) {
229
- const renderedDocs = newDocs.map(newDoc => newDoc.render()).join('');
230
- this.ul.append(renderedDocs);
231
- this.el.html(this.ul);
232
- return;
233
- }
234
- // Update the docs before the item
235
- // Retrieves the documents up to and including the "new document"
236
- const beforeDocs = newDocs.slice(0, newDocIndex);
237
- let prevParentList = null;
238
- let renderedBeforeDocs;
239
- if (beforeDocs.length > 1) {
240
- beforeDocs.forEach(function (parentDoc) {
241
- parentDoc.collapse();
242
- });
243
- renderedBeforeDocs = beforeDocs.map(newDoc => newDoc.render()).join('');
244
- prevParentList = this.buildExpandList();
245
- prevParentList.append(renderedBeforeDocs);
246
- } else {
247
- renderedBeforeDocs = beforeDocs.map(newDoc => newDoc.render()).join('');
248
- }
249
-
250
- // Silly but works for now
251
- this.ul.append(prevParentList || renderedBeforeDocs);
252
-
253
- let itemDoc = newDocs.slice(newDocIndex, newDocIndex + 1);
254
- let renderedItemDoc = itemDoc.map(doc => doc.render()).join('');
255
-
256
- // Update the item
257
- const $itemDoc = $(renderedItemDoc);
258
- this.ul.append($itemDoc);
259
-
260
- // Update the docs after the item
261
- const afterDocs = newDocs.slice(newDocIndex + 1, newDocs.length);
262
- const renderedAfterDocs = afterDocs.map(newDoc => newDoc.render()).join('');
263
-
264
- // Insert the documents after the current
265
- this.ul.append(renderedAfterDocs);
266
- this.el.html(this.ul);
267
-
268
- // Initialize additional things
269
- $itemDoc.find('.context-navigator').each(function (i, e) {
270
- const contextNavigation = new ContextNavigation(
271
- e, that.originalParents, that.originalDocument
272
- );
273
- contextNavigation.getData();
274
- });
275
- }
276
-
277
-
278
- /**
279
- * Update the ancestors for <li> elements
280
- * @param {jQuery} $li - the <li> element for the current, highlighted
281
- * Document in the <ul> context list of collections, components, and
282
- * containers
283
- */
284
- /* eslint-disable class-methods-use-this */
285
- updateListSiblings($li) {
286
- const prevSiblings = $li.prevAll('.al-collection-context');
287
- if (prevSiblings.length > 1) {
288
- const hiddenNextSiblings = prevSiblings.slice(0, -1);
289
- hiddenNextSiblings.toggleClass('collapsed');
290
-
291
- const button = new NestedExpandButton();
292
-
293
- const lastHiddenNextSibling = hiddenNextSiblings[hiddenNextSiblings.length - 1];
294
- button.$el.insertAfter(lastHiddenNextSibling);
295
- }
296
- }
297
- /* eslint-enable class-methods-use-this */
298
-
299
- /**
300
- * This updates the elements in the View DOM using an AJAX response containing
301
- * the HTML of a server-rendered View template.
302
- * It is this which is primarily used to populate the <ul> element with
303
- * children for the navigation context, containing <li> elements for
304
- * collections, components, and containers.
305
- * @param {string} response - the AJAX response body
306
- */
307
- updateView(response) {
308
- const that = this;
309
- var resp = $.parseHTML(response);
310
- var $doc = $(resp);
311
- var newDocs = $doc.find('#documents')
312
- .find('article')
313
- .toArray().map(el => new NavigationDocument(el));
314
-
315
- // See if the original document is located in the returned documents
316
- const originalDocumentIndex = newDocs
317
- .findIndex(doc => doc.id === that.originalDocument);
318
- that.parentLi.find('.al-hierarchy-placeholder').remove();
319
-
320
- // If the original document in the results, update it. If not update with a
321
- // more complex procedure
322
- if (originalDocumentIndex !== -1) {
323
- this.updateSiblings(newDocs, originalDocumentIndex);
324
- } else {
325
- this.updateParents(
326
- newDocs,
327
- that.data.arclight.originalParents,
328
- that.data.arclight.parent,
329
- that.parentLi
330
- );
331
- }
332
- this.el.parent().data('resolved', true);
333
- this.addListenersForPlusMinus();
334
- this.enablebuttons();
335
- Blacklight.doBookmarkToggleBehavior();
336
- this.el.trigger('navigation.contains.elements');
337
- }
338
-
339
- // eslint-disable-next-line class-methods-use-this
340
- enablebuttons() {
341
- var toEnable = $('[data-hierarchy-enable-me]');
342
- var srOnly = $('h2[data-sr-enable-me]');
343
- toEnable.removeClass('disabled');
344
- toEnable.text(srOnly.data('hasContents'));
345
- srOnly.text(srOnly.data('hasContents'));
346
- }
347
-
348
- addListenersForPlusMinus() {
349
- const that = this;
350
- this.ul.find('.al-toggle-view-children').on('click', (e) => {
351
- e.preventDefault();
352
- const targetArea = $($(e.target).attr('href'));
353
- if (!targetArea.data().resolved) {
354
- targetArea.find('.context-navigator').each((i, ee) => {
355
- const contextNavigation = new ContextNavigation(
356
- ee, that.originalParents, that.originalDocument
357
- );
358
- contextNavigation.getData();
359
- });
360
- }
361
- });
362
- }
363
- }
364
-
365
- /**
366
- * Integrate the behavior into the DOM using the Blacklight#onLoad callback
367
- *
368
- */
369
- Blacklight.onLoad(function () {
370
- $('.context-navigator').each(function (i, e) {
371
- const contextNavigation = new ContextNavigation(e);
372
- contextNavigation.getData();
373
- });
374
- });
@@ -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].try(: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>