geoblacklight_admin 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (346) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +18 -0
  3. data/.gitignore +75 -0
  4. data/.standard.yml +4 -0
  5. data/Gemfile +59 -0
  6. data/LICENSE +21 -0
  7. data/README.md +84 -0
  8. data/Rakefile +72 -0
  9. data/app/assets/images/.keep +0 -0
  10. data/app/assets/images/aerial_photo.jpg +0 -0
  11. data/app/assets/images/archive-solid.svg +1 -0
  12. data/app/assets/images/bookmark-regular.svg +1 -0
  13. data/app/assets/images/bookmark-solid.svg +1 -0
  14. data/app/assets/images/btaa-logo.jpg +0 -0
  15. data/app/assets/images/cloud-download-alt-solid.svg +1 -0
  16. data/app/assets/images/file-import-solid.svg +1 -0
  17. data/app/assets/images/trash-alt-solid.svg +1 -0
  18. data/app/assets/javascripts/geoblacklight_admin/chosen.js +4 -0
  19. data/app/assets/javascripts/geoblacklight_admin/date_range_picker.js +173 -0
  20. data/app/assets/javascripts/geoblacklight_admin/datepicker.js +22 -0
  21. data/app/assets/javascripts/geoblacklight_admin/elements.js +38 -0
  22. data/app/assets/javascripts/geoblacklight_admin/exports.js +3 -0
  23. data/app/assets/javascripts/geoblacklight_admin/fields.js +11 -0
  24. data/app/assets/javascripts/geoblacklight_admin/geoblacklight_admin.js +2 -0
  25. data/app/assets/javascripts/geoblacklight_admin/inputmask.js +4 -0
  26. data/app/assets/javascripts/geoblacklight_admin/locale.js +5 -0
  27. data/app/assets/javascripts/geoblacklight_admin/sortable.js +2544 -0
  28. data/app/assets/javascripts/geoblacklight_admin/tooltips.js +3 -0
  29. data/app/assets/javascripts/geoblacklight_admin/truncate.js +4 -0
  30. data/app/assets/javascripts/geoblacklight_admin.js +40 -0
  31. data/app/assets/stylesheets/geoblacklight_admin/_core.scss +47 -0
  32. data/app/assets/stylesheets/geoblacklight_admin/modules/_autocomplete.scss +32 -0
  33. data/app/assets/stylesheets/geoblacklight_admin/modules/_blazer.scss +3 -0
  34. data/app/assets/stylesheets/geoblacklight_admin/modules/_code.scss +3 -0
  35. data/app/assets/stylesheets/geoblacklight_admin/modules/_datepicker.scss +477 -0
  36. data/app/assets/stylesheets/geoblacklight_admin/modules/_elements.scss +3 -0
  37. data/app/assets/stylesheets/geoblacklight_admin/modules/_forms.scss +28 -0
  38. data/app/assets/stylesheets/geoblacklight_admin/modules/_icons.scss +15 -0
  39. data/app/assets/stylesheets/geoblacklight_admin/modules/_nav.scss +9 -0
  40. data/app/assets/stylesheets/geoblacklight_admin/modules/_tables.scss +4 -0
  41. data/app/assets/stylesheets/geoblacklight_admin/modules/_toasts.scss +7 -0
  42. data/app/assets/stylesheets/geoblacklight_admin/modules/_visibility.scss +3 -0
  43. data/app/assets/stylesheets/geoblacklight_admin/settings/_variables.scss +1 -0
  44. data/app/channels/export_channel.rb +12 -0
  45. data/app/controllers/admin/admin_controller.rb +16 -0
  46. data/app/controllers/admin/advanced_search_controller.rb +365 -0
  47. data/app/controllers/admin/api_controller.rb +386 -0
  48. data/app/controllers/admin/bookmarks_controller.rb +68 -0
  49. data/app/controllers/admin/bulk_actions_controller.rb +94 -0
  50. data/app/controllers/admin/concerns/.keep +0 -0
  51. data/app/controllers/admin/concerns/upload_util.rb +8 -0
  52. data/app/controllers/admin/document_accesses_controller.rb +125 -0
  53. data/app/controllers/admin/document_assets_controller.rb +198 -0
  54. data/app/controllers/admin/document_downloads_controller.rb +127 -0
  55. data/app/controllers/admin/documents_controller.rb +219 -0
  56. data/app/controllers/admin/elements_controller.rb +81 -0
  57. data/app/controllers/admin/form_elements_controller.rb +81 -0
  58. data/app/controllers/admin/ids_controller.rb +379 -0
  59. data/app/controllers/admin/import_documents_controller.rb +18 -0
  60. data/app/controllers/admin/imports_controller.rb +105 -0
  61. data/app/controllers/admin/mappings_controller.rb +95 -0
  62. data/app/controllers/admin/notifications_controller.rb +51 -0
  63. data/app/controllers/admin/search_controller.rb +10 -0
  64. data/app/controllers/admin/users_controller.rb +10 -0
  65. data/app/helpers/bulk_actions_helper.rb +9 -0
  66. data/app/helpers/document_helper.rb +60 -0
  67. data/app/helpers/form_input_helper.rb +73 -0
  68. data/app/helpers/geoblacklight_admin_helper.rb +118 -0
  69. data/app/helpers/import_documents_helper.rb +5 -0
  70. data/app/helpers/mappings_helper.rb +27 -0
  71. data/app/indexers/document_indexer.rb +34 -0
  72. data/app/jobs/bulk_action_revert_document_job.rb +49 -0
  73. data/app/jobs/bulk_action_revert_job.rb +25 -0
  74. data/app/jobs/bulk_action_run_document_job.rb +42 -0
  75. data/app/jobs/bulk_action_run_job.rb +27 -0
  76. data/app/jobs/export_job.rb +72 -0
  77. data/app/jobs/export_json_job.rb +120 -0
  78. data/app/jobs/import_document_job.rb +25 -0
  79. data/app/jobs/import_run_job.rb +33 -0
  80. data/app/models/active_storage_attachment.rb +5 -0
  81. data/app/models/active_storage_blob.rb +5 -0
  82. data/app/models/api_search_builder.rb +12 -0
  83. data/app/models/application_record.rb +6 -0
  84. data/app/models/blacklight_api.rb +93 -0
  85. data/app/models/blacklight_api_facets.rb +15 -0
  86. data/app/models/blacklight_api_ids.rb +103 -0
  87. data/app/models/bookmark.rb +17 -0
  88. data/app/models/bulk_action.rb +88 -0
  89. data/app/models/bulk_action_document.rb +22 -0
  90. data/app/models/bulk_action_document_state_machine.rb +16 -0
  91. data/app/models/bulk_action_document_transition.rb +19 -0
  92. data/app/models/bulk_action_state_machine.rb +16 -0
  93. data/app/models/bulk_action_transition.rb +26 -0
  94. data/app/models/concerns/.keep +0 -0
  95. data/app/models/document/bbox_validator.rb +70 -0
  96. data/app/models/document/controlled_lists.rb +104 -0
  97. data/app/models/document/date_range_validator.rb +63 -0
  98. data/app/models/document/geom_validator.rb +117 -0
  99. data/app/models/document/reference.rb +107 -0
  100. data/app/models/document.rb +264 -0
  101. data/app/models/document_access.rb +35 -0
  102. data/app/models/document_download.rb +35 -0
  103. data/app/models/document_state_machine.rb +14 -0
  104. data/app/models/document_transition.rb +26 -0
  105. data/app/models/element.rb +90 -0
  106. data/app/models/form_control.rb +2 -0
  107. data/app/models/form_element.rb +19 -0
  108. data/app/models/form_feature.rb +2 -0
  109. data/app/models/form_group.rb +2 -0
  110. data/app/models/form_header.rb +2 -0
  111. data/app/models/geoblacklight_admin/field_mappings_btaa_aardvark.rb +379 -0
  112. data/app/models/geoblacklight_admin/field_mappings_gblv1.rb +344 -0
  113. data/app/models/geoblacklight_admin/iso_language_codes.rb +515 -0
  114. data/app/models/geoblacklight_admin/schema.rb +194 -0
  115. data/app/models/geoblacklight_admin.rb +3 -0
  116. data/app/models/import/csv_duplicates_validator.rb +36 -0
  117. data/app/models/import/csv_header_validator.rb +24 -0
  118. data/app/models/import.rb +186 -0
  119. data/app/models/import_btaa.rb +91 -0
  120. data/app/models/import_btaa_aardvark.rb +109 -0
  121. data/app/models/import_document.rb +34 -0
  122. data/app/models/import_document_state_machine.rb +12 -0
  123. data/app/models/import_document_transition.rb +19 -0
  124. data/app/models/import_gblv1.rb +92 -0
  125. data/app/models/import_state_machine.rb +16 -0
  126. data/app/models/import_transition.rb +26 -0
  127. data/app/models/mapping.rb +10 -0
  128. data/app/models/notification.rb +9 -0
  129. data/app/models/user.rb +26 -0
  130. data/app/notifications/export_notification.rb +30 -0
  131. data/app/services/export_csv_document_access_links_service.rb +47 -0
  132. data/app/services/export_csv_document_downloads_service.rb +47 -0
  133. data/app/services/export_csv_service.rb +44 -0
  134. data/app/services/export_json_service.rb +35 -0
  135. data/app/services/zip_file_generator.rb +56 -0
  136. data/app/views/admin/advanced_search/facets.json.jbuilder +80 -0
  137. data/app/views/admin/advanced_search/index.json.jbuilder +90 -0
  138. data/app/views/admin/api/_field.json.jbuilder +10 -0
  139. data/app/views/admin/api/fetch.json.jbuilder +86 -0
  140. data/app/views/admin/api/index.json.jbuilder +90 -0
  141. data/app/views/admin/bookmarks/_bookmark.json.jbuilder +4 -0
  142. data/app/views/admin/bookmarks/create.js.erb +7 -0
  143. data/app/views/admin/bookmarks/destroy.js.erb +7 -0
  144. data/app/views/admin/bookmarks/index.html.erb +21 -0
  145. data/app/views/admin/bookmarks/index.json.jbuilder +3 -0
  146. data/app/views/admin/bulk_actions/_bulk_action.json.jbuilder +4 -0
  147. data/app/views/admin/bulk_actions/_form.html.erb +17 -0
  148. data/app/views/admin/bulk_actions/edit.html.erb +6 -0
  149. data/app/views/admin/bulk_actions/index.html.erb +54 -0
  150. data/app/views/admin/bulk_actions/index.json.jbuilder +3 -0
  151. data/app/views/admin/bulk_actions/new.html.erb +5 -0
  152. data/app/views/admin/bulk_actions/show.html.erb +100 -0
  153. data/app/views/admin/bulk_actions/show.json.jbuilder +3 -0
  154. data/app/views/admin/devise/confirmations/new.html.erb +16 -0
  155. data/app/views/admin/devise/invitations/edit.html.erb +15 -0
  156. data/app/views/admin/devise/invitations/new.html.erb +15 -0
  157. data/app/views/admin/devise/mailer/invitation_instructions.html.erb +11 -0
  158. data/app/views/admin/devise/mailer/invitation_instructions.text.erb +11 -0
  159. data/app/views/admin/devise/passwords/edit.html.erb +26 -0
  160. data/app/views/admin/devise/passwords/new.html.erb +16 -0
  161. data/app/views/admin/devise/registrations/edit.html.erb +35 -0
  162. data/app/views/admin/devise/registrations/new.html.erb +30 -0
  163. data/app/views/admin/devise/sessions/new.html.erb +28 -0
  164. data/app/views/admin/devise/shared/_links.html.erb +27 -0
  165. data/app/views/admin/devise/unlocks/new.html.erb +16 -0
  166. data/app/views/admin/document_accesses/_document_access.json.jbuilder +4 -0
  167. data/app/views/admin/document_accesses/_form.html.erb +17 -0
  168. data/app/views/admin/document_accesses/destroy_all.html.erb +70 -0
  169. data/app/views/admin/document_accesses/edit.html.erb +5 -0
  170. data/app/views/admin/document_accesses/import.html.erb +70 -0
  171. data/app/views/admin/document_accesses/index.html.erb +74 -0
  172. data/app/views/admin/document_accesses/index.json.jbuilder +3 -0
  173. data/app/views/admin/document_accesses/new.html.erb +6 -0
  174. data/app/views/admin/document_accesses/show.html.erb +19 -0
  175. data/app/views/admin/document_accesses/show.json.jbuilder +3 -0
  176. data/app/views/admin/document_assets/display_attach_form.html.erb +44 -0
  177. data/app/views/admin/document_assets/index.html.erb +65 -0
  178. data/app/views/admin/document_downloads/_document_download.json.jbuilder +4 -0
  179. data/app/views/admin/document_downloads/_form.html.erb +15 -0
  180. data/app/views/admin/document_downloads/destroy_all.html.erb +70 -0
  181. data/app/views/admin/document_downloads/edit.html.erb +6 -0
  182. data/app/views/admin/document_downloads/import.html.erb +74 -0
  183. data/app/views/admin/document_downloads/index.html.erb +70 -0
  184. data/app/views/admin/document_downloads/index.json.jbuilder +3 -0
  185. data/app/views/admin/document_downloads/new.html.erb +5 -0
  186. data/app/views/admin/document_downloads/show.html.erb +24 -0
  187. data/app/views/admin/document_downloads/show.json.jbuilder +3 -0
  188. data/app/views/admin/documents/_document.html.erb +29 -0
  189. data/app/views/admin/documents/_document_bookmark.html.erb +17 -0
  190. data/app/views/admin/documents/_document_fields.html.erb +24 -0
  191. data/app/views/admin/documents/_form.html.erb +49 -0
  192. data/app/views/admin/documents/_form_control.html.erb +86 -0
  193. data/app/views/admin/documents/_form_group.html.erb +1 -0
  194. data/app/views/admin/documents/_form_header.html.erb +1 -0
  195. data/app/views/admin/documents/_form_nav.html.erb +21 -0
  196. data/app/views/admin/documents/_json_aardvark.jbuilder +47 -0
  197. data/app/views/admin/documents/_json_btaa_aardvark.jbuilder +16 -0
  198. data/app/views/admin/documents/_json_gbl_v1.jbuilder +32 -0
  199. data/app/views/admin/documents/_result_facets.html.erb +35 -0
  200. data/app/views/admin/documents/_result_pagination.html.erb +21 -0
  201. data/app/views/admin/documents/_result_selected_options.html.erb +54 -0
  202. data/app/views/admin/documents/_result_selection_options.html.erb +10 -0
  203. data/app/views/admin/documents/_result_toggle.html.erb +13 -0
  204. data/app/views/admin/documents/edit.html.erb +7 -0
  205. data/app/views/admin/documents/features/_assets.html.erb +3 -0
  206. data/app/views/admin/documents/features/_institutional_access_links.html.erb +3 -0
  207. data/app/views/admin/documents/features/_multiple_download_links.html.erb +27 -0
  208. data/app/views/admin/documents/fetch.json_aardvark.jbuilder +9 -0
  209. data/app/views/admin/documents/fetch.json_btaa_aardvark.jbuilder +9 -0
  210. data/app/views/admin/documents/fetch.json_gbl_v1.jbuilder +9 -0
  211. data/app/views/admin/documents/index.html.erb +49 -0
  212. data/app/views/admin/documents/index.json_aardvark.jbuilder +9 -0
  213. data/app/views/admin/documents/index.json_btaa_aardvark.jbuilder +9 -0
  214. data/app/views/admin/documents/index.json_gbl_v1.jbuilder +9 -0
  215. data/app/views/admin/documents/show.json_aardvark.jbuilder +3 -0
  216. data/app/views/admin/documents/show.json_btaa_aardvark.jbuilder +3 -0
  217. data/app/views/admin/documents/show.json_gbl_v1.jbuilder +3 -0
  218. data/app/views/admin/documents/versions.html.erb +110 -0
  219. data/app/views/admin/elements/_element.json.jbuilder +2 -0
  220. data/app/views/admin/elements/_form.html.erb +45 -0
  221. data/app/views/admin/elements/edit.html.erb +6 -0
  222. data/app/views/admin/elements/index.html.erb +68 -0
  223. data/app/views/admin/elements/index.json.jbuilder +1 -0
  224. data/app/views/admin/elements/new.html.erb +5 -0
  225. data/app/views/admin/elements/show.html.erb +121 -0
  226. data/app/views/admin/elements/show.json.jbuilder +1 -0
  227. data/app/views/admin/form_elements/_form.html.erb +46 -0
  228. data/app/views/admin/form_elements/_form_element.json.jbuilder +2 -0
  229. data/app/views/admin/form_elements/edit.html.erb +6 -0
  230. data/app/views/admin/form_elements/index.html.erb +49 -0
  231. data/app/views/admin/form_elements/index.json.jbuilder +1 -0
  232. data/app/views/admin/form_elements/new.html.erb +5 -0
  233. data/app/views/admin/form_elements/show.html.erb +19 -0
  234. data/app/views/admin/form_elements/show.json.jbuilder +1 -0
  235. data/app/views/admin/ids/fetch.json.jbuilder +86 -0
  236. data/app/views/admin/ids/index.json.jbuilder +41 -0
  237. data/app/views/admin/import_documents/show.html.haml +20 -0
  238. data/app/views/admin/imports/_form.html.erb +27 -0
  239. data/app/views/admin/imports/_import.json.jbuilder +4 -0
  240. data/app/views/admin/imports/_show_failed_tab.html.erb +37 -0
  241. data/app/views/admin/imports/_show_success_tab.html.erb +31 -0
  242. data/app/views/admin/imports/edit.html.erb +8 -0
  243. data/app/views/admin/imports/index.html.erb +56 -0
  244. data/app/views/admin/imports/index.json.jbuilder +3 -0
  245. data/app/views/admin/imports/new.html.erb +7 -0
  246. data/app/views/admin/imports/show.html.erb +123 -0
  247. data/app/views/admin/imports/show.json.jbuilder +3 -0
  248. data/app/views/admin/layouts/application.html.erb +30 -0
  249. data/app/views/admin/layouts/blazer/application.html.erb +23 -0
  250. data/app/views/admin/layouts/mailer.html.erb +13 -0
  251. data/app/views/admin/layouts/mailer.text.erb +1 -0
  252. data/app/views/admin/mappings/_form.html.erb +17 -0
  253. data/app/views/admin/mappings/_mapping.json.jbuilder +4 -0
  254. data/app/views/admin/mappings/edit.html.erb +6 -0
  255. data/app/views/admin/mappings/index.html.erb +37 -0
  256. data/app/views/admin/mappings/index.json.jbuilder +3 -0
  257. data/app/views/admin/mappings/new.html.erb +5 -0
  258. data/app/views/admin/mappings/show.html.erb +27 -0
  259. data/app/views/admin/mappings/show.json.jbuilder +3 -0
  260. data/app/views/admin/notifications/_notification.html.haml +31 -0
  261. data/app/views/admin/notifications/index.html.erb +54 -0
  262. data/app/views/admin/notifications/update.js.erb +7 -0
  263. data/app/views/admin/search/index.html.erb +38 -0
  264. data/app/views/admin/shared/_flash_messages.html.erb +5 -0
  265. data/app/views/admin/shared/_footer.html.erb +56 -0
  266. data/app/views/admin/shared/_js_behaviors.html.erb +147 -0
  267. data/app/views/admin/shared/_navbar.html.erb +78 -0
  268. data/app/views/admin/shared/_navbar_blazer.html.erb +42 -0
  269. data/app/views/admin/shared/_schema_timestamp.html.erb +16 -0
  270. data/app/views/admin/shared/_toast.html.erb +13 -0
  271. data/app/views/admin/users/index.html.erb +21 -0
  272. data/config/authorities/formats.yml +25 -0
  273. data/config/authorities/languages.yml +50 -0
  274. data/config/authorities/resource_type.yml +82 -0
  275. data/config/blazer.yml +79 -0
  276. data/config/gbl_v1_schema.json +118 -0
  277. data/config/geomg_aardvark_schema.json +211 -0
  278. data/config/geomg_schema.json +123 -0
  279. data/config/locales/devise.en.yml +65 -0
  280. data/config/locales/devise_invitable.en.yml +31 -0
  281. data/config/locales/documents.en.yml +189 -0
  282. data/config/locales/en.yml +51 -0
  283. data/config/locales/geoblacklight.en.yml +178 -0
  284. data/config/locales/simple_form.en.yml +31 -0
  285. data/config/routes.rb +162 -0
  286. data/db/migrate/20230316183001_add_geoblacklight_admin.rb +399 -0
  287. data/db/seeds.rb +26 -0
  288. data/db/seeds_elements.csv +56 -0
  289. data/db/seeds_elements.numbers +0 -0
  290. data/db/seeds_form_elements.csv +71 -0
  291. data/db/seeds_form_elements.numbers +0 -0
  292. data/db/structure.sql +816 -0
  293. data/geoblacklight_admin.gemspec +67 -0
  294. data/lib/generators/geoblacklight_admin/config_generator.rb +336 -0
  295. data/lib/generators/geoblacklight_admin/example_docs_generator.rb +18 -0
  296. data/lib/generators/geoblacklight_admin/helpers_generator.rb +18 -0
  297. data/lib/generators/geoblacklight_admin/install_generator.rb +60 -0
  298. data/lib/generators/geoblacklight_admin/jobs_generator.rb +21 -0
  299. data/lib/generators/geoblacklight_admin/models_generator.rb +23 -0
  300. data/lib/generators/geoblacklight_admin/templates/.env.development.example +28 -0
  301. data/lib/generators/geoblacklight_admin/templates/.solr_wrapper.yml +7 -0
  302. data/lib/generators/geoblacklight_admin/templates/_user_util_links.html.erb +30 -0
  303. data/lib/generators/geoblacklight_admin/templates/config/database.yml +18 -0
  304. data/lib/generators/geoblacklight_admin/templates/config/geomg_aardvark_schema.json +211 -0
  305. data/lib/generators/geoblacklight_admin/templates/config/initializers/geoblacklight_admin.rb +25 -0
  306. data/lib/generators/geoblacklight_admin/templates/config/initializers/kithe.rb +31 -0
  307. data/lib/generators/geoblacklight_admin/templates/config/initializers/pagy.rb +158 -0
  308. data/lib/generators/geoblacklight_admin/templates/config/initializers/statesman.rb +7 -0
  309. data/lib/generators/geoblacklight_admin/templates/javascript/channels/consumer.js +6 -0
  310. data/lib/generators/geoblacklight_admin/templates/javascript/channels/export_channel.js +30 -0
  311. data/lib/generators/geoblacklight_admin/templates/javascript/channels/index.js +5 -0
  312. data/lib/generators/geoblacklight_admin/templates/javascript/controllers/application_controller.js +17 -0
  313. data/lib/generators/geoblacklight_admin/templates/javascript/controllers/document_controller.js +26 -0
  314. data/lib/generators/geoblacklight_admin/templates/javascript/controllers/index.js +10 -0
  315. data/lib/generators/geoblacklight_admin/templates/javascript/controllers/results_controller.js +310 -0
  316. data/lib/generators/geoblacklight_admin/templates/javascript/packs/application.js +23 -0
  317. data/lib/generators/geoblacklight_admin/templates/javascript/src/js/admin/qa_autocomplete.js +1134 -0
  318. data/lib/generators/geoblacklight_admin/templates/package.json +32 -0
  319. data/lib/generators/geoblacklight_admin/templates/solr/README-geoblacklight-solr-development.txt +3 -0
  320. data/lib/generators/geoblacklight_admin/templates/solr/conf/_rest_managed.json +3 -0
  321. data/lib/generators/geoblacklight_admin/templates/solr/conf/admin-extra.html +31 -0
  322. data/lib/generators/geoblacklight_admin/templates/solr/conf/core.properties +5 -0
  323. data/lib/generators/geoblacklight_admin/templates/solr/conf/elevate.xml +36 -0
  324. data/lib/generators/geoblacklight_admin/templates/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
  325. data/lib/generators/geoblacklight_admin/templates/solr/conf/protwords.txt +21 -0
  326. data/lib/generators/geoblacklight_admin/templates/solr/conf/schema.xml +229 -0
  327. data/lib/generators/geoblacklight_admin/templates/solr/conf/scripts.conf +24 -0
  328. data/lib/generators/geoblacklight_admin/templates/solr/conf/solrconfig.xml +266 -0
  329. data/lib/generators/geoblacklight_admin/templates/solr/conf/spellings.txt +2 -0
  330. data/lib/generators/geoblacklight_admin/templates/solr/conf/stopwords.txt +58 -0
  331. data/lib/generators/geoblacklight_admin/templates/solr/conf/stopwords_en.txt +58 -0
  332. data/lib/generators/geoblacklight_admin/templates/solr/conf/synonyms.txt +43 -0
  333. data/lib/generators/geoblacklight_admin/templates/solr/conf/xslt/example.xsl +132 -0
  334. data/lib/generators/geoblacklight_admin/templates/solr/conf/xslt/example_atom.xsl +67 -0
  335. data/lib/generators/geoblacklight_admin/templates/solr/conf/xslt/example_rss.xsl +66 -0
  336. data/lib/generators/geoblacklight_admin/templates/solr/conf/xslt/luke.xsl +337 -0
  337. data/lib/generators/geoblacklight_admin/templates/solr/snapshots/.keep +0 -0
  338. data/lib/generators/geoblacklight_admin/views_generator.rb +19 -0
  339. data/lib/geoblacklight_admin/engine.rb +20 -0
  340. data/lib/geoblacklight_admin/version.rb +5 -0
  341. data/lib/geoblacklight_admin.rb +7 -0
  342. data/lib/tasks/.keep +0 -0
  343. data/lib/tasks/geoblacklight_admin.rake +209 -0
  344. data/spec/test_app_templates/lib/generators/test_app_generator.rb +35 -0
  345. data/template.rb +16 -0
  346. metadata +1037 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d9c753d49a11dda454f74746f46edbcbc094ab8ed65e5a6ea4a3addd1850efa9
4
+ data.tar.gz: db199042de538a4e2d0548db3444a86ef81b78f2d88216dfbcae1d05b53f9923
5
+ SHA512:
6
+ metadata.gz: 757f8f91ff005aeaa92a11dfa2d292b68383781cfdbd9cf9db5f54bb39aea4c25be30b81d9b493ee1383bcbb210d1239a68eab436c0d54e41078e69f14a11003
7
+ data.tar.gz: 107dbebee2ed281bd0284e2fe4e0b60c25344cc38952d6b3363703c3ffe4ae492fdcc6aac1d6da6f8b9f5caa825375e42e7c2d190da9202a5e7f835f27bb8335
data/.editorconfig ADDED
@@ -0,0 +1,18 @@
1
+ # EditorConfig is awesome: http://EditorConfig.org
2
+
3
+ # top-most EditorConfig file for the repo
4
+ root = true
5
+
6
+ # Quasi-universal defaults
7
+ [*]
8
+ end_of_line = lf
9
+ insert_final_newline = true
10
+ charset = utf-8
11
+
12
+ # Defaults that seem fairly common
13
+ indent_style = space
14
+ indent_size = 2
15
+
16
+ # file-specific overrides
17
+ [CODEOWNERS]
18
+ indent_size = 8
data/.gitignore ADDED
@@ -0,0 +1,75 @@
1
+ *.gem
2
+ .bundle/
3
+ Gemfile.lock
4
+ coverage
5
+ .internal_test_app
6
+ .ruby-version
7
+ .byebug_history
8
+
9
+ *.rbc
10
+ capybara-*.html
11
+ .rspec
12
+ /db/*.sqlite3
13
+ /db/*.sqlite3-journal
14
+ /db/*.sqlite3-[0-9]*
15
+ /public/system
16
+ /coverage/
17
+ /spec/tmp
18
+ *.orig
19
+ rerun.txt
20
+ pickle-email-*.html
21
+
22
+ # Ignore all logfiles and tempfiles.
23
+ /log/*
24
+ /tmp/*
25
+ !/log/.keep
26
+ !/tmp/.keep
27
+
28
+ # TODO Comment out this rule if you are OK with secrets being uploaded to the repo
29
+ config/initializers/secret_token.rb
30
+ config/master.key
31
+
32
+ # Only include if you have production secrets in this file, which is no longer a Rails default
33
+ # config/secrets.yml
34
+
35
+ # dotenv
36
+ # TODO Comment out this rule if environment variables can be committed
37
+ .env
38
+
39
+ ## Environment normalization:
40
+ /.bundle
41
+ /vendor/bundle
42
+
43
+ # these should all be checked in to normalize the environment:
44
+ # Gemfile.lock, .ruby-version, .ruby-gemset
45
+
46
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
47
+ .rvmrc
48
+
49
+ # if using bower-rails ignore default bower_components path bower.json files
50
+ /vendor/assets/bower_components
51
+ *.bowerrc
52
+ bower.json
53
+
54
+ # Ignore pow environment settings
55
+ .powenv
56
+
57
+ # Ignore Byebug command history file.
58
+ .byebug_history
59
+
60
+ # Ignore node_modules
61
+ node_modules/
62
+
63
+ # Ignore precompiled javascript packs
64
+ /public/packs
65
+ /public/packs-test
66
+ /public/assets
67
+
68
+ # Ignore yarn files
69
+ /yarn-error.log
70
+ yarn-debug.log*
71
+ .yarn-integrity
72
+
73
+ # Ignore uploaded files in development
74
+ /storage/*
75
+ !/storage/.keep
data/.standard.yml ADDED
@@ -0,0 +1,4 @@
1
+ format: progress
2
+ ignore:
3
+ - 'db/seeds.rb'
4
+ - 'db/migrate/**'
data/Gemfile ADDED
@@ -0,0 +1,59 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Declare your gem's dependencies in geoblacklight_admin.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
6
+
7
+ # Please see geoblacklight_admin.gemspec for dependency information.
8
+ gemspec
9
+
10
+ # Declare any dependencies that are still in development here instead of in
11
+ # your gemspec. These might include edge Rails or gems from your path or
12
+ # Git. Remember to move these dependencies to your gemspec before releasing
13
+ # your gem to rubygems.org.
14
+
15
+ group :development, :test do
16
+ end
17
+
18
+ # To use a debugger
19
+ # gem 'byebug', group: [:development, :test]
20
+
21
+ # BEGIN ENGINE_CART BLOCK
22
+ # engine_cart: 2.5.0
23
+ # engine_cart stanza: 2.5.0
24
+ # the below comes from engine_cart, a gem used to test this Rails engine gem in the context of a Rails app.
25
+ file = File.expand_path('Gemfile', ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path('.internal_test_app', File.dirname(__FILE__)))
26
+ if File.exist?(file)
27
+ begin
28
+ eval_gemfile file
29
+ rescue Bundler::GemfileError => e
30
+ Bundler.ui.warn '[EngineCart] Skipping Rails application dependencies:'
31
+ Bundler.ui.warn e.message
32
+ end
33
+ else
34
+ Bundler.ui.warn "[EngineCart] Unable to find test application dependencies in #{file}, using placeholder dependencies"
35
+ gem "blacklight", "~> 7.33"
36
+ gem "blacklight_advanced_search"
37
+ gem "geoblacklight", ">= 4.0"
38
+ gem "statesman", ">= 3.4"
39
+
40
+ if ENV['RAILS_VERSION']
41
+ if ENV['RAILS_VERSION'] == 'edge'
42
+ gem 'rails', github: 'rails/rails'
43
+ ENV['ENGINE_CART_RAILS_OPTIONS'] = '--edge --skip-turbolinks'
44
+ else
45
+ gem 'rails', ENV['RAILS_VERSION']
46
+ end
47
+
48
+ case ENV['RAILS_VERSION']
49
+ when /^6.0/
50
+ gem 'sass-rails', '>= 6'
51
+ gem 'webpacker', '~> 4.0'
52
+ when /^5.[12]/
53
+ gem 'sass-rails', '~> 5.0'
54
+ gem 'sprockets', '~> 3.7'
55
+ gem 'thor', '~> 0.20'
56
+ end
57
+ end
58
+ end
59
+ # END ENGINE_CART BLOCK
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Big Ten Academic Alliance Geospatial Information Network
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,84 @@
1
+ # geoblacklight_admin
2
+
3
+ GeoBlacklight Admin is a [GeoBlacklight](https://github.com/geoblacklight/geoblacklight) plugin, built on [Kithe](https://github.com/sciencehistory/kithe), that provides a complex web-form for editing documents and an CSV-based import/export workflow for OpenGeoMetadata's [Aardvark schema](https://opengeometadata.org/ogm-aardvark/). It's a Rubygem port of the Big Ten Academic Alliance's production workflow tool [GEOMG](https://github.com/geobtaa/geomg).
4
+
5
+ ## Warning: Pre-Alpha
6
+
7
+ > :warning: This gem is not ready for public adoption yet, but hopefully someday soon (Late Summer 2023?). Feel free to kick the tires if you are curious and know GeoBlacklight's codebase/stack well.
8
+
9
+ ## Requirements
10
+
11
+ * Blacklight v7 (not v8)
12
+ * GeoBlacklight v4 (not v3)
13
+ * Solr v8.4+
14
+ * PostgreSQL (not MySQL-based DBs)
15
+ * Redis (for Sidekiq)
16
+ * OpenGeoMetadata's Aardvark Schema
17
+
18
+ ## Install Notes
19
+
20
+ ### Terminal 1 - Drop/Create application PG database
21
+ ```bash
22
+ psql postgres
23
+ DROP DATABASE geoblacklight_development;
24
+ CREATE DATABASE geoblacklight_development;
25
+ ```
26
+
27
+ ### Terminal 2 - Bundle and run generator
28
+ ```bash
29
+ bundle install
30
+ bundle exec rake engine_cart:generate
31
+ ```
32
+
33
+ When the .internal_test_app is built, edit `geoblacklight_admin_helper.rb`, and uncomment this Pagy include. Why including Pagy here breaks the entire generator build is beyond me...
34
+
35
+ ```bash
36
+ # @TODO:
37
+ # Cannot generate app if uncommented...
38
+ # Uncomment after app is generated to fix view errors
39
+ # include ::Pagy::Frontend
40
+ ```
41
+
42
+ ### Terminal 2 - Seed and spin up server
43
+ ```bash
44
+ cd .internal_test_app
45
+ bundle exec rake db:seed
46
+ bundle exec rake gbl_admin:server
47
+ ```
48
+
49
+ You're now done generating the test app and populating the Elements / FormElements tables with the basic Aardvark controls.
50
+
51
+ ### View App in Browser
52
+
53
+ 1. Visit http://localhost:3000/admin
54
+ 2. Click on the "Sign in" link
55
+ 3. Enter email: admin@geoblacklight.org and password: 123456
56
+ 4. Click on the "GBL Admin" link
57
+ 5. Import some CSV
58
+
59
+ -----
60
+
61
+ ### TODOs - Running list of things to accomplish
62
+
63
+ * ~~SolrWrapper - Add persist option~~
64
+ * ~~BlacklightApi returns not auth'd message (not requiring auth for now (not sensitive data))~~
65
+ * ~~Facet links need /admin nesting~~
66
+ * ~~Imports#new -- undefined method `imports_path'~~
67
+ * ~~Elements#index -- undefined method `element_path'~~
68
+ * ~~Imports#new -- cannot upload files~~
69
+ * ~~Import#run -- doesn't fire~~
70
+ * ~~Documents - JS actions not working~~
71
+ * ~~GBL needs to honor publication state~~
72
+ * ~~Add GBL Admin link to nav~~
73
+ * ~~Routes - Get devise user~~
74
+ * ~~No route matches [GET] "/users/sign_out"~~
75
+ * Bookmarks need to be Admin::Bookmarks
76
+ * Remove legacy GEOMG / B1G everywhere...
77
+ * Send GBLADMIN JavaScript pack to NPM like Blacklight
78
+ * Port the GEOMG test suite
79
+ * GitHub Actions / CI integration
80
+ * Project gem dependency injection redundancy...
81
+ * Likely a lot more polish to be uncovered...
82
+
83
+
84
+
data/Rakefile ADDED
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails"
4
+ begin
5
+ require "bundler/setup"
6
+ require "bundler/gem_tasks"
7
+ rescue LoadError
8
+ puts "You must `gem install bundler` and `bundle install` to run rake tasks"
9
+ end
10
+
11
+ Bundler::GemHelper.install_tasks
12
+
13
+ require "solr_wrapper"
14
+
15
+ require "rspec/core/rake_task"
16
+ RSpec::Core::RakeTask.new(:spec)
17
+
18
+ require "rubocop/rake_task"
19
+ RuboCop::RakeTask.new(:rubocop)
20
+
21
+ require "solr_wrapper/rake_task"
22
+ require "engine_cart/rake_task"
23
+ require "geoblacklight_admin/version"
24
+
25
+ desc "Run test suite"
26
+ task ci: ["engine_cart:generate"] do
27
+ ENV["environment"] = "test"
28
+ # run the tests
29
+ Rake::Task["test"].invoke
30
+ end
31
+
32
+ namespace :geoblacklight do
33
+ namespace :internal do
34
+ task seed: ["engine_cart:generate"] do
35
+ within_test_app do
36
+ # @TODO - Seed Elements / FormElements
37
+ # system "bundle exec rake gbl_admin:seed"
38
+ system "bundle exec rake geoblacklight:downloads:mkdir"
39
+ end
40
+ end
41
+ end
42
+
43
+ desc "Run Solr and seed with sample data"
44
+ task :solr do
45
+ if File.exist? EngineCart.destination
46
+ within_test_app do
47
+ system "bundle update"
48
+ end
49
+ else
50
+ Rake::Task["engine_cart:generate"].invoke
51
+ end
52
+
53
+ SolrWrapper.wrap(port: "8983") do |solr|
54
+ solr.with_collection(name: "blacklight-core", dir: File.join(File.expand_path(".", File.dirname(__FILE__)), "solr", "conf")) do
55
+ Rake::Task["geoblacklight:internal:seed"].invoke
56
+
57
+ within_test_app do
58
+ puts "\nSolr server running: http://localhost:#{solr.port}/solr/#/blacklight-core"
59
+ puts "\n^C to stop"
60
+ puts " "
61
+ begin
62
+ sleep
63
+ rescue Interrupt
64
+ puts "Shutting down..."
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
71
+
72
+ task default: %i[rubocop ci]
File without changes
Binary file
@@ -0,0 +1 @@
1
+ <svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="archive" class="svg-inline--fa fa-archive fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M32 448c0 17.7 14.3 32 32 32h384c17.7 0 32-14.3 32-32V160H32v288zm160-212c0-6.6 5.4-12 12-12h104c6.6 0 12 5.4 12 12v8c0 6.6-5.4 12-12 12H204c-6.6 0-12-5.4-12-12v-8zM480 32H32C14.3 32 0 46.3 0 64v48c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16V64c0-17.7-14.3-32-32-32z"></path></svg>
@@ -0,0 +1 @@
1
+ <svg aria-hidden="true" focusable="false" data-prefix="far" data-icon="bookmark" class="svg-inline--fa fa-bookmark fa-w-12" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M336 0H48C21.49 0 0 21.49 0 48v464l192-112 192 112V48c0-26.51-21.49-48-48-48zm0 428.43l-144-84-144 84V54a6 6 0 0 1 6-6h276c3.314 0 6 2.683 6 5.996V428.43z"></path></svg>
@@ -0,0 +1 @@
1
+ <svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="bookmark" class="svg-inline--fa fa-bookmark fa-w-12" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M0 512V48C0 21.49 21.49 0 48 0h288c26.51 0 48 21.49 48 48v464L192 400 0 512z"></path></svg>
Binary file
@@ -0,0 +1 @@
1
+ <svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="cloud-download-alt" class="svg-inline--fa fa-cloud-download-alt fa-w-20" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path fill="currentColor" d="M537.6 226.6c4.1-10.7 6.4-22.4 6.4-34.6 0-53-43-96-96-96-19.7 0-38.1 6-53.3 16.2C367 64.2 315.3 32 256 32c-88.4 0-160 71.6-160 160 0 2.7.1 5.4.2 8.1C40.2 219.8 0 273.2 0 336c0 79.5 64.5 144 144 144h368c70.7 0 128-57.3 128-128 0-61.9-44-113.6-102.4-125.4zm-132.9 88.7L299.3 420.7c-6.2 6.2-16.4 6.2-22.6 0L171.3 315.3c-10.1-10.1-2.9-27.3 11.3-27.3H248V176c0-8.8 7.2-16 16-16h48c8.8 0 16 7.2 16 16v112h65.4c14.2 0 21.4 17.2 11.3 27.3z"></path></svg>
@@ -0,0 +1 @@
1
+ <svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="file-import" class="svg-inline--fa fa-file-import fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M16 288c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h112v-64zm489-183L407.1 7c-4.5-4.5-10.6-7-17-7H384v128h128v-6.1c0-6.3-2.5-12.4-7-16.9zm-153 31V0H152c-13.3 0-24 10.7-24 24v264h128v-65.2c0-14.3 17.3-21.4 27.4-11.3L379 308c6.6 6.7 6.6 17.4 0 24l-95.7 96.4c-10.1 10.1-27.4 3-27.4-11.3V352H128v136c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V160H376c-13.2 0-24-10.8-24-24z"></path></svg>
@@ -0,0 +1 @@
1
+ <svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="trash-alt" class="svg-inline--fa fa-trash-alt fa-w-14" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M32 464a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V128H32zm272-256a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zM432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16z"></path></svg>
@@ -0,0 +1,4 @@
1
+ // jQuery Ready
2
+ $(document).on('ready turbolinks:load', function() {
3
+ $('.chosen-select').chosen();
4
+ });
@@ -0,0 +1,173 @@
1
+ GBLADMIN.SetDateRangeInputs = function(startDate, endDate) {
2
+ // Set input start and end dates
3
+ // Try to reload
4
+ $('input#start-date').attr(
5
+ 'value',
6
+ startDate.format(I18n.t('date.formats.momentjs_datepicker')
7
+ )
8
+ );
9
+
10
+ $('input#end-date').attr(
11
+ 'value',
12
+ endDate.format(
13
+ I18n.t('date.formats.momentjs_datepicker')
14
+ )
15
+ );
16
+ }
17
+
18
+ GBLADMIN.SetCompareRangeInputs = function(startDate, endDate) {
19
+ $('input#compare-start-date').attr(
20
+ 'value',
21
+ startDate.format(
22
+ I18n.t('date.formats.momentjs_datepicker')
23
+ )
24
+ );
25
+
26
+ $('input#compare-end-date').attr(
27
+ 'value',
28
+ endDate.format(
29
+ I18n.t('date.formats.momentjs_datepicker')
30
+ )
31
+ );
32
+ }
33
+
34
+ // Use with moment.js subtract function
35
+ GBLADMIN.DateRangePeriod = function(opt) {
36
+ switch(opt){
37
+ case 'custom':
38
+ break;
39
+ case 'today':
40
+ return [0, 'days'];
41
+ case 'yesterday':
42
+ return [1, 'days'];
43
+ case 'lastweek':
44
+ return [1, 'weeks'];
45
+ case 'lastmonth':
46
+ return [1, 'months'];
47
+ case 'lastyear':
48
+ return [1, 'years'];
49
+ case 'last7days':
50
+ return [7, 'days'];
51
+ case 'last4weeks':
52
+ return [28, 'days'];
53
+ case 'last30days':
54
+ return [30, 'days'];
55
+ case 'last365days':
56
+ return [365, 'days'];
57
+ }
58
+ }
59
+
60
+ GBLADMIN.DateRangeSelect = function() {
61
+ var opt, startDate, endDate;
62
+ opt = $('#date-range').val();
63
+
64
+ switch(opt) {
65
+ case 'custom':
66
+ break;
67
+ case 'today':
68
+ startDate = moment().startOf('day');
69
+ endDate = moment().endOf('day');
70
+ break;
71
+ case 'yesterday':
72
+ startDate = moment().subtract(1, 'days').startOf('day');
73
+ endDate = moment().subtract(1, 'days').endOf('day');
74
+ break;
75
+ case 'lastweek':
76
+ startDate = moment().subtract(1, 'weeks').startOf('week');
77
+ endDate = moment().subtract(1, 'weeks').endOf('week');
78
+ break;
79
+ case 'lastmonth':
80
+ startDate = moment().subtract(1, 'months').startOf('month');
81
+ endDate = moment().subtract(1, 'months').endOf('month');
82
+ break;
83
+ case 'lastyear':
84
+ startDate = moment().subtract(1, 'years').startOf('year');
85
+ endDate = moment().subtract(1, 'years').endOf('year');
86
+ break;
87
+ case 'last7days':
88
+ startDate = moment().subtract(7, 'days').startOf('day');
89
+ endDate = moment().subtract(1, 'days').endOf('day');
90
+ break;
91
+ case 'last4weeks':
92
+ startDate = moment().subtract(28, 'days').startOf('day');
93
+ endDate = moment().subtract(1, 'days').endOf('day');
94
+ break;
95
+ case 'last30days':
96
+ startDate = moment().subtract(30, 'days').startOf('day');
97
+ endDate = moment().subtract(1, 'days').endOf('day');
98
+ break;
99
+ case 'last365days':
100
+ startDate = moment().subtract(365, 'days').startOf('day');
101
+ endDate = moment().subtract(1, 'days').endOf('day');
102
+ break;
103
+ }
104
+
105
+ GBLADMIN.SetDateRangeInputs(startDate, endDate);
106
+ }
107
+
108
+ // @TODO: need to calculate display periodicity
109
+ // - might be day, week, month, year (custom range?)
110
+ // - calc display start-date, period (select opt)
111
+ // -
112
+ GBLADMIN.CompareRangeSelect = function(event) {
113
+ var dateOpt, compareOpt, period, startDate, endDate;
114
+ dateOpt = $('#date-range').val();
115
+ compareOpt = $('#compare-options').val();
116
+ period = GBLADMIN.DateRangePeriod(dateOpt);
117
+
118
+ startDate = moment(
119
+ $('#start-date').val(),
120
+ I18n.t('date.formats.momentjs_iso')
121
+ );
122
+
123
+ endDate = moment(
124
+ $('#end-date').val(),
125
+ I18n.t('date.formats.momentjs_iso')
126
+ );
127
+
128
+ switch(compareOpt) {
129
+ case 'custom':
130
+ break;
131
+ case 'previous_period':
132
+ startDate = moment(startDate).subtract(period[0], period[1]).startOf('day');
133
+ // console.log(startDate);
134
+ endDate = moment(endDate).subtract(period[0], period[1]).endOf('day');
135
+ // console.log(endDate);
136
+ break;
137
+ case 'previous_year':
138
+ startDate = moment(startDate).subtract(1, 'years').startOf('day');
139
+ endDate = moment(endDate).subtract(1, 'years').endOf('day');
140
+ break;
141
+ }
142
+
143
+ GBLADMIN.SetCompareRangeInputs(startDate, endDate);
144
+ }
145
+
146
+ GBLADMIN.DisplayCompareDateRange = function() {
147
+ if ($('#compare').prop('checked')) {
148
+ $("#compare-range").show();
149
+ $("#compare-options").prop('disabled', false);
150
+ $("#compare-start-date").prop('disabled', false);
151
+ $("#compare-end-date").prop('disabled', false);
152
+ } else {
153
+ $("#compare-range").hide();
154
+ $("#compare-options").prop('disabled', true);
155
+ $("#compare-start-date").prop('disabled', true);
156
+ $("#compare-end-date").prop('disabled', true);
157
+ }
158
+ }
159
+
160
+ GBLADMIN.ToggleDataTable = function(elm) {
161
+ var toggle;
162
+ $('.search-facet').hide();
163
+ toggle = $(elm).data('toggle');
164
+ $('#' + toggle).show();
165
+ };
166
+
167
+ GBLADMIN.ToggleCompare = function(elm) {
168
+ if ($('#compare').prop('checked')) {
169
+ $("input[name=compare]").val("true");
170
+ } else {
171
+ $("input[name=compare]").val("false");
172
+ }
173
+ }
@@ -0,0 +1,22 @@
1
+ // jQuery Ready
2
+ $(document).on('ready turbolinks:load', function() {
3
+ // Datepickers - YYYY-MM-DD
4
+ if($("input[data-js='datepicker']").length > 0) {
5
+ $("input[data-js='datepicker']").datepicker({
6
+ language: 'en',
7
+ format: 'yyyy-mm-dd',
8
+ 'autoclose': true
9
+ });
10
+ }
11
+
12
+ // Datepickers - YYYY
13
+ if($("input[data-js='datepicker-years']").length > 0) {
14
+ $("input[data-js='datepicker-years']").datepicker({
15
+ language: 'en',
16
+ format: 'yyyy',
17
+ viewMode: "years",
18
+ minViewMode: "years",
19
+ 'autoclose': true
20
+ });
21
+ }
22
+ });
@@ -0,0 +1,38 @@
1
+ GBLADMIN.SortElements = function(elm_container, change_url) {
2
+ console.log("Behavior added: Sort elements init")
3
+ var container, sort_lists;
4
+ container = $(elm_container);
5
+
6
+ container.sortable({
7
+ cursor: "pointer",
8
+ items: "> tr",
9
+ appendTo: "parent",
10
+ helper: "original",
11
+ handle: ".handle",
12
+ axis: "y"
13
+ });
14
+
15
+ container.on('sortupdate', function() {
16
+ console.log("Sorting");
17
+ var active_id_list, element;
18
+
19
+ element = $(this);
20
+ console.log(element);
21
+
22
+ active_id_list = $.map(
23
+ $(this).find('tr'), function (e) {
24
+ return $(e).data('id');
25
+ }
26
+ );
27
+
28
+ console.log(active_id_list);
29
+ console.log(change_url);
30
+
31
+ $.post(
32
+ change_url,
33
+ {
34
+ 'id_list[]': active_id_list,
35
+ }
36
+ );
37
+ });
38
+ };
@@ -0,0 +1,3 @@
1
+ GBLADMIN.RefreshNotifications = function(count) {
2
+ $('#notification-count').html(count);
3
+ }
@@ -0,0 +1,11 @@
1
+ // Fields - JS Behaviors
2
+
3
+ // Disable Field if Persisted
4
+ GBLADMIN.DisableIfPersisted = function() {
5
+ if($('[data-persisted="true"]').length > 0) {
6
+ elms = $('[data-js="disable_if_persisted"]');
7
+ elms.each(function(i) {
8
+ $(this).prop( "disabled", true );
9
+ });
10
+ }
11
+ }
@@ -0,0 +1,2 @@
1
+ // GBLADMIN Namespace
2
+ if (!window.GBLADMIN){ GBLADMIN={}; }
@@ -0,0 +1,4 @@
1
+ // jQuery Ready
2
+ $(document).on('ready turbolinks:load', function() {
3
+ $("input[data-inputmask]").inputmask();
4
+ });
@@ -0,0 +1,5 @@
1
+ $(document).ready(function(){
2
+ // @TODO - I18n not loading correctly
3
+ // I18n.locale = $('body').data('locale');
4
+ // I18n.fallbacks = true;
5
+ });