blacklight_allmaps 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +201 -0
  3. data/README.md +109 -0
  4. data/Rakefile +98 -0
  5. data/app/assets/config/blacklight_allmaps_manifest.js +2 -0
  6. data/app/assets/images/blacklight/allmaps/allmaps-logo.svg +39 -0
  7. data/app/assets/images/blacklight/allmaps/blacklight-logo.png +0 -0
  8. data/app/assets/images/blacklight/allmaps/geoblacklight-logo.png +0 -0
  9. data/app/assets/images/blacklight/allmaps/logo.svg +39 -0
  10. data/app/assets/stylesheets/blacklight_allmaps/application.css +15 -0
  11. data/app/controllers/blacklight/allmaps/application_controller.rb +6 -0
  12. data/app/helpers/blacklight/allmaps/application_helper.rb +17 -0
  13. data/app/javascripts/map_controller.js +39 -0
  14. data/app/jobs/blacklight/allmaps/application_job.rb +6 -0
  15. data/app/jobs/blacklight/allmaps/store_sidecar_annotation.rb +39 -0
  16. data/app/mailers/blacklight/allmaps/application_mailer.rb +8 -0
  17. data/app/models/blacklight/allmaps/application_record.rb +7 -0
  18. data/app/models/blacklight/allmaps/sidecar.rb +23 -0
  19. data/app/models/concerns/blacklight/allmaps/solr_document.rb +14 -0
  20. data/app/views/allmaps/show/_blacklight.html.erb +213 -0
  21. data/app/views/allmaps/show/_geoblacklight.html.erb +47 -0
  22. data/app/views/allmaps/sidebar/_allmaps.html.erb +55 -0
  23. data/app/views/catalog/_show_default_viewer_container.html.erb +52 -0
  24. data/app/views/catalog/_show_main_content.html.erb +58 -0
  25. data/app/views/catalog/_show_sidebar.html.erb +5 -0
  26. data/app/views/catalog/_show_sidebar_blacklight.html.erb +10 -0
  27. data/app/views/catalog/_show_sidebar_geoblacklight.html.erb +20 -0
  28. data/config/routes.rb +2 -0
  29. data/db/migrate/20240307155110_create_solr_document_sidecars.rb +15 -0
  30. data/lib/blacklight/allmaps/engine.rb +6 -0
  31. data/lib/blacklight/allmaps/rake_task.rb +7 -0
  32. data/lib/blacklight/allmaps/tasks/index.rake +77 -0
  33. data/lib/blacklight/allmaps/tasks/sidecars.rake +50 -0
  34. data/lib/blacklight/allmaps/version.rb +5 -0
  35. data/lib/blacklight/allmaps.rb +7 -0
  36. data/lib/generators/blacklight/allmaps/config_generator.rb +54 -0
  37. data/lib/generators/blacklight/allmaps/install_generator.rb +27 -0
  38. data/lib/generators/blacklight/allmaps/models_generator.rb +46 -0
  39. data/lib/generators/blacklight/allmaps/templates/manifest.js +5 -0
  40. metadata +229 -0
@@ -0,0 +1,5 @@
1
+ module Blacklight
2
+ module Allmaps
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ require "blacklight"
2
+
3
+ module Blacklight
4
+ module Allmaps
5
+ require "blacklight/allmaps/engine"
6
+ end
7
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails/generators"
4
+
5
+ module Blacklight
6
+ module Allmaps
7
+ class ConfigGenerator < Rails::Generators::Base
8
+ source_root File.expand_path("templates", __dir__)
9
+
10
+ desc <<-DESCRIPTION
11
+ This generator makes the following changes to your application:
12
+ 1. Copies config files to host config
13
+ DESCRIPTION
14
+
15
+ def asset_config_manifest
16
+ copy_file "manifest.js", "app/assets/config/manifest.js", force: true
17
+ end
18
+
19
+ def copy_rake_tasks
20
+ append_to_file "Rakefile", "require 'blacklight/allmaps/rake_task'\n"
21
+ end
22
+
23
+ def prioritize_blacklight_allmaps_views
24
+ inject_into_file "config/application.rb", "\nrequire \"blacklight/allmaps/engine\"\n", after: "require \"action_cable/engine\""
25
+ inject_into_file "config/application.rb", "\nconfig.railties_order = [Blacklight::Allmaps::Engine, :main_app, :all]\n", after: "class Application < Rails::Application\n"
26
+ end
27
+
28
+ def add_importmap_pins
29
+ append_to_file "config/importmap.rb" do
30
+ <<~CONTENT
31
+ pin "leaflet" # @1.9.4
32
+ pin '@allmaps/leaflet', to: "@allmaps--leaflet.js"
33
+ CONTENT
34
+ end
35
+ end
36
+
37
+ def set_active_job_config
38
+ inject_into_file "config/environments/development.rb", " config.active_job.queue_adapter = :inline\n", after: "Rails.application.configure do\n"
39
+ end
40
+
41
+ def add_geoblacklight
42
+ return unless ENV["LIGHT"] == "geoblacklight"
43
+ append_to_file "Gemfile", '"geoblacklight", "4.1"'
44
+ end
45
+
46
+ def include_blacklight_allmaps_solrdocument
47
+ return unless ENV["LIGHT"] == "blacklight"
48
+ inject_into_file "app/models/solr_document.rb", after: "include Blacklight::Solr::Document" do
49
+ "\n include Blacklight::Allmaps::SolrDocument"
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,27 @@
1
+ require "rails/generators"
2
+
3
+ module Blacklight
4
+ module Allmaps
5
+ class InstallGenerator < Rails::Generators::Base
6
+ source_root File.expand_path("templates", __dir__)
7
+
8
+ class_option :geoblacklight, type: :boolean, default: false, aliases: "-geo", desc: "Install with GeoBlacklight."
9
+
10
+ desc "Install BlacklightAllmaps"
11
+
12
+ def generate_config
13
+ generate "blacklight:allmaps:config"
14
+ end
15
+
16
+ def generate_models
17
+ generate "blacklight:allmaps:models"
18
+ end
19
+
20
+ def bundle_install
21
+ Bundler.with_unbundled_env do
22
+ run "bundle install"
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails/generators"
4
+ require "rails/generators/migration"
5
+
6
+ module Blacklight
7
+ module Allmaps
8
+ class ModelsGenerator < Rails::Generators::Base
9
+ include Rails::Generators::Migration
10
+
11
+ source_root File.expand_path("templates", __dir__)
12
+
13
+ desc <<-DESCRIPTION
14
+ This generator makes the following changes to your application:
15
+ 1. Preps engine migrations
16
+ 2. Adds Sidecar ActiveRecord model
17
+ DESCRIPTION
18
+
19
+ # Setup the database migrations
20
+ def copy_migrations
21
+ rake "blacklight_allmaps_engine:install:migrations"
22
+ end
23
+
24
+ def include_sidecar_allmaps_solrdocument
25
+ sidecar = <<-SIDECAR
26
+
27
+ def sidecar_allmaps
28
+ # Find or create, and set version
29
+ sidecar = Blacklight::Allmaps::Sidecar.where(
30
+ solr_document_id: id,
31
+ ).first_or_create do |sc|
32
+ sc.solr_version = self._source["_version_"]
33
+ end
34
+
35
+ sidecar.solr_version = self._source["_version_"]
36
+ sidecar.save
37
+
38
+ sidecar
39
+ end
40
+ SIDECAR
41
+
42
+ inject_into_file "app/models/solr_document.rb", sidecar, before: /^end/
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,5 @@
1
+ //= link_tree ../images
2
+ //= link 'application.css'
3
+ //= link_tree ../../javascript .js
4
+ //= link_tree ../../../vendor/javascript .js
5
+ //= link blacklight/allmaps/allmaps-logo.svg
metadata ADDED
@@ -0,0 +1,229 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: blacklight_allmaps
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Eric Larson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-03-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: blacklight
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 7.25.2
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '9'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 7.25.2
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '9'
33
+ - !ruby/object:Gem::Dependency
34
+ name: httparty
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: solr_wrapper
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rails-controller-testing
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rspec-rails
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: engine_cart
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '2.1'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '2.1'
103
+ - !ruby/object:Gem::Dependency
104
+ name: capybara
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '3'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '3'
117
+ - !ruby/object:Gem::Dependency
118
+ name: webdrivers
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ - !ruby/object:Gem::Dependency
132
+ name: standard
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: '1.34'
138
+ type: :development
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: '1.34'
145
+ - !ruby/object:Gem::Dependency
146
+ name: sqlite3
147
+ requirement: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ type: :development
153
+ prerelease: false
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
159
+ description: Description of BlacklightAllmaps
160
+ email:
161
+ - ewlarson@gmail.com
162
+ executables: []
163
+ extensions: []
164
+ extra_rdoc_files: []
165
+ files:
166
+ - LICENSE
167
+ - README.md
168
+ - Rakefile
169
+ - app/assets/config/blacklight_allmaps_manifest.js
170
+ - app/assets/images/blacklight/allmaps/allmaps-logo.svg
171
+ - app/assets/images/blacklight/allmaps/blacklight-logo.png
172
+ - app/assets/images/blacklight/allmaps/geoblacklight-logo.png
173
+ - app/assets/images/blacklight/allmaps/logo.svg
174
+ - app/assets/stylesheets/blacklight_allmaps/application.css
175
+ - app/controllers/blacklight/allmaps/application_controller.rb
176
+ - app/helpers/blacklight/allmaps/application_helper.rb
177
+ - app/javascripts/map_controller.js
178
+ - app/jobs/blacklight/allmaps/application_job.rb
179
+ - app/jobs/blacklight/allmaps/store_sidecar_annotation.rb
180
+ - app/mailers/blacklight/allmaps/application_mailer.rb
181
+ - app/models/blacklight/allmaps/application_record.rb
182
+ - app/models/blacklight/allmaps/sidecar.rb
183
+ - app/models/concerns/blacklight/allmaps/solr_document.rb
184
+ - app/views/allmaps/show/_blacklight.html.erb
185
+ - app/views/allmaps/show/_geoblacklight.html.erb
186
+ - app/views/allmaps/sidebar/_allmaps.html.erb
187
+ - app/views/catalog/_show_default_viewer_container.html.erb
188
+ - app/views/catalog/_show_main_content.html.erb
189
+ - app/views/catalog/_show_sidebar.html.erb
190
+ - app/views/catalog/_show_sidebar_blacklight.html.erb
191
+ - app/views/catalog/_show_sidebar_geoblacklight.html.erb
192
+ - config/routes.rb
193
+ - db/migrate/20240307155110_create_solr_document_sidecars.rb
194
+ - lib/blacklight/allmaps.rb
195
+ - lib/blacklight/allmaps/engine.rb
196
+ - lib/blacklight/allmaps/rake_task.rb
197
+ - lib/blacklight/allmaps/tasks/index.rake
198
+ - lib/blacklight/allmaps/tasks/sidecars.rake
199
+ - lib/blacklight/allmaps/version.rb
200
+ - lib/generators/blacklight/allmaps/config_generator.rb
201
+ - lib/generators/blacklight/allmaps/install_generator.rb
202
+ - lib/generators/blacklight/allmaps/models_generator.rb
203
+ - lib/generators/blacklight/allmaps/templates/manifest.js
204
+ homepage: https://github.com/bplmaps/blacklight-allmaps
205
+ licenses:
206
+ - Apache 2.0
207
+ metadata:
208
+ homepage_uri: https://github.com/bplmaps/blacklight-allmaps
209
+ source_code_uri: https://github.com/bplmaps/blacklight-allmaps
210
+ post_install_message:
211
+ rdoc_options: []
212
+ require_paths:
213
+ - lib
214
+ required_ruby_version: !ruby/object:Gem::Requirement
215
+ requirements:
216
+ - - ">="
217
+ - !ruby/object:Gem::Version
218
+ version: '0'
219
+ required_rubygems_version: !ruby/object:Gem::Requirement
220
+ requirements:
221
+ - - ">="
222
+ - !ruby/object:Gem::Version
223
+ version: '0'
224
+ requirements: []
225
+ rubygems_version: 3.4.21
226
+ signing_key:
227
+ specification_version: 4
228
+ summary: Blacklight Allmaps plugin
229
+ test_files: []