Skip to content

Commit 17a3b05

Browse files
authored
Merge pull request #526 from wri/develop
Release
2 parents e0194e6 + 03eb642 commit 17a3b05

File tree

13 files changed

+192
-76
lines changed

13 files changed

+192
-76
lines changed

Gemfile.lock

Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ GEM
100100
rails-html-sanitizer (~> 1.6)
101101
active_material (2.1.4)
102102
active_skin (0.0.13)
103-
activeadmin (3.2.5)
103+
activeadmin (3.3.0)
104104
arbre (~> 1.2, >= 1.2.1)
105105
csv
106106
formtastic (>= 3.1)
@@ -317,20 +317,21 @@ GEM
317317
activerecord (>= 7.0, < 8.1)
318318
activesupport (>= 7.0, < 8.1)
319319
request_store (~> 1.0)
320-
google-cloud-core (1.7.1)
320+
google-cloud-core (1.8.0)
321321
google-cloud-env (>= 1.0, < 3.a)
322322
google-cloud-errors (~> 1.0)
323-
google-cloud-env (2.2.1)
323+
google-cloud-env (2.2.2)
324+
base64 (~> 0.2)
324325
faraday (>= 1.0, < 3.a)
325-
google-cloud-errors (1.4.0)
326+
google-cloud-errors (1.5.0)
326327
google-cloud-location (0.10.0)
327328
gapic-common (>= 0.25.0, < 2.a)
328329
google-cloud-errors (~> 1.0)
329330
google-cloud-translate (3.7.0)
330331
google-cloud-core (~> 1.6)
331332
google-cloud-translate-v2 (>= 0.0, < 2.a)
332333
google-cloud-translate-v3 (>= 0.11, < 2.a)
333-
google-cloud-translate-v2 (1.0.1)
334+
google-cloud-translate-v2 (1.1.0)
334335
faraday (>= 1.0, < 3.a)
335336
google-cloud-core (~> 1.6)
336337
googleapis-common-protos (>= 1.3.10, < 2.a)
@@ -346,10 +347,10 @@ GEM
346347
google-cloud-errors (~> 1.0)
347348
grpc-google-iam-v1 (~> 1.1)
348349
google-logging-utils (0.1.0)
349-
google-protobuf (4.29.3)
350+
google-protobuf (4.30.1)
350351
bigdecimal
351352
rake (>= 13)
352-
google-protobuf (4.29.3-x86_64-linux)
353+
google-protobuf (4.30.1-x86_64-linux)
353354
bigdecimal
354355
rake (>= 13)
355356
googleapis-common-protos (1.6.0)
@@ -358,7 +359,7 @@ GEM
358359
grpc (~> 1.41)
359360
googleapis-common-protos-types (1.18.0)
360361
google-protobuf (>= 3.18, < 5.a)
361-
googleauth (1.13.1)
362+
googleauth (1.14.0)
362363
faraday (>= 1.0, < 3.a)
363364
google-cloud-env (~> 2.2)
364365
google-logging-utils (~> 0.1)
@@ -368,10 +369,10 @@ GEM
368369
signet (>= 0.16, < 2.a)
369370
groupdate (6.5.1)
370371
activesupport (>= 7)
371-
grpc (1.70.1)
372+
grpc (1.71.0)
372373
google-protobuf (>= 3.25, < 5.0)
373374
googleapis-common-protos-types (~> 1.0)
374-
grpc (1.70.1-x86_64-linux)
375+
grpc (1.71.0-x86_64-linux)
375376
google-protobuf (>= 3.25, < 5.0)
376377
googleapis-common-protos-types (~> 1.0)
377378
grpc-google-iam-v1 (1.9.0)
@@ -413,7 +414,7 @@ GEM
413414
rails-dom-testing (>= 1, < 3)
414415
railties (>= 4.2.0)
415416
thor (>= 0.14, < 2.0)
416-
json (2.10.1)
417+
json (2.10.2)
417418
jsonapi-resources (0.9.12)
418419
activerecord (>= 4.1)
419420
concurrent-ruby
@@ -445,7 +446,7 @@ GEM
445446
railties (>= 6.1)
446447
rexml
447448
lint_roller (1.1.0)
448-
llhttp-ffi (0.5.0)
449+
llhttp-ffi (0.5.1)
449450
ffi-compiler (~> 1.0)
450451
rake (~> 13.0)
451452
logger (1.6.6)
@@ -462,13 +463,13 @@ GEM
462463
mime-types (3.6.0)
463464
logger
464465
mime-types-data (~> 3.2015)
465-
mime-types-data (3.2025.0220)
466-
mini_magick (5.1.2)
466+
mime-types-data (3.2025.0304)
467+
mini_magick (5.2.0)
467468
benchmark
468469
logger
469470
mini_mime (1.1.5)
470471
mini_portile2 (2.8.8)
471-
minitest (5.25.4)
472+
minitest (5.25.5)
472473
mjml-rails (4.14.1)
473474
msgpack (1.8.0)
474475
multi_json (1.15.0)
@@ -490,12 +491,12 @@ GEM
490491
net-protocol
491492
net-ssh (7.3.0)
492493
nio4r (2.7.4)
493-
nokogiri (1.18.3)
494+
nokogiri (1.18.4)
494495
mini_portile2 (~> 2.8.2)
495496
racc (~> 1.4)
496-
nokogiri (1.18.3-x86_64-linux-gnu)
497+
nokogiri (1.18.4-x86_64-linux-gnu)
497498
racc (~> 1.4)
498-
oj (3.16.9)
499+
oj (3.16.10)
499500
bigdecimal (>= 3.0)
500501
ostruct (>= 0.2)
501502
oj_mimic_json (1.0.1)
@@ -507,7 +508,7 @@ GEM
507508
activerecord (>= 6.1)
508509
request_store (~> 1.4)
509510
parallel (1.26.3)
510-
parallel_tests (4.9.1)
511+
parallel_tests (5.1.0)
511512
parallel
512513
paranoia (3.0.1)
513514
activerecord (>= 6, < 8.1)
@@ -527,7 +528,7 @@ GEM
527528
puma (6.6.0)
528529
nio4r (~> 2.0)
529530
racc (1.8.1)
530-
rack (3.0.12)
531+
rack (3.0.14)
531532
rack-cors (2.0.2)
532533
rack (>= 2.0.0)
533534
rack-mini-profiler (2.3.4)
@@ -581,7 +582,7 @@ GEM
581582
i18n
582583
rdoc (6.12.0)
583584
psych (>= 4.0.0)
584-
redcarpet (3.6.0)
585+
redcarpet (3.6.1)
585586
redis (5.4.0)
586587
redis-client (>= 0.22.0)
587588
redis-actionpack (5.5.0)
@@ -591,7 +592,7 @@ GEM
591592
redis-activesupport (5.3.0)
592593
activesupport (>= 3, < 8)
593594
redis-store (>= 1.3, < 2)
594-
redis-client (0.23.2)
595+
redis-client (0.24.0)
595596
connection_pool
596597
redis-rack (3.0.0)
597598
rack-session (>= 0.2.0)
@@ -648,26 +649,29 @@ GEM
648649
rswag-ui (2.16.0)
649650
actionpack (>= 5.2, < 8.1)
650651
railties (>= 5.2, < 8.1)
651-
rubocop (1.71.2)
652+
rubocop (1.73.2)
652653
json (~> 2.3)
653-
language_server-protocol (>= 3.17.0)
654+
language_server-protocol (~> 3.17.0.2)
655+
lint_roller (~> 1.1.0)
654656
parallel (~> 1.10)
655657
parser (>= 3.3.0.2)
656658
rainbow (>= 2.2.2, < 4.0)
657659
regexp_parser (>= 2.9.3, < 3.0)
658660
rubocop-ast (>= 1.38.0, < 2.0)
659661
ruby-progressbar (~> 1.7)
660662
unicode-display_width (>= 2.4.0, < 4.0)
661-
rubocop-ast (1.38.0)
663+
rubocop-ast (1.39.0)
662664
parser (>= 3.3.1.0)
663-
rubocop-performance (1.23.1)
664-
rubocop (>= 1.48.1, < 2.0)
665-
rubocop-ast (>= 1.31.1, < 2.0)
666-
rubocop-rails (2.29.1)
665+
rubocop-performance (1.24.0)
666+
lint_roller (~> 1.1)
667+
rubocop (>= 1.72.1, < 2.0)
668+
rubocop-ast (>= 1.38.0, < 2.0)
669+
rubocop-rails (2.30.3)
667670
activesupport (>= 4.2.0)
671+
lint_roller (~> 1.1)
668672
rack (>= 1.1)
669-
rubocop (>= 1.52.0, < 2.0)
670-
rubocop-ast (>= 1.31.1, < 2.0)
673+
rubocop (>= 1.72.1, < 2.0)
674+
rubocop-ast (>= 1.38.0, < 2.0)
671675
ruby-graphviz (1.2.5)
672676
rexml
673677
ruby-progressbar (1.13.0)
@@ -693,10 +697,10 @@ GEM
693697
sendgrid-ruby (~> 6.4)
694698
sendgrid-ruby (6.7.0)
695699
ruby_http_client (~> 3.4)
696-
sentry-rails (5.22.4)
700+
sentry-rails (5.23.0)
697701
railties (>= 5.0)
698-
sentry-ruby (~> 5.22.4)
699-
sentry-ruby (5.22.4)
702+
sentry-ruby (~> 5.23.0)
703+
sentry-ruby (5.23.0)
700704
bigdecimal
701705
concurrent-ruby (~> 1.0, >= 1.0.2)
702706
shoulda-matchers (4.0.1)
@@ -733,18 +737,18 @@ GEM
733737
net-ssh (>= 2.8.0)
734738
ostruct
735739
ssrf_filter (1.2.0)
736-
standard (1.45.0)
740+
standard (1.47.0)
737741
language_server-protocol (~> 3.17.0.2)
738742
lint_roller (~> 1.0)
739-
rubocop (~> 1.71.0)
743+
rubocop (~> 1.73.0)
740744
standard-custom (~> 1.0.0)
741-
standard-performance (~> 1.6)
745+
standard-performance (~> 1.7)
742746
standard-custom (1.0.2)
743747
lint_roller (~> 1.0)
744748
rubocop (~> 1.50)
745-
standard-performance (1.6.0)
749+
standard-performance (1.7.0)
746750
lint_roller (~> 1.1)
747-
rubocop-performance (~> 1.23.0)
751+
rubocop-performance (~> 1.24.0)
748752
stringio (3.1.5)
749753
super_diff (0.15.0)
750754
attr_extras (>= 6.2.4)
@@ -764,7 +768,7 @@ GEM
764768
unicode-emoji (~> 4.0, >= 4.0.4)
765769
unicode-emoji (4.0.4)
766770
uniform_notifier (1.16.0)
767-
uri (1.0.2)
771+
uri (1.0.3)
768772
useragent (0.16.11)
769773
warden (1.2.9)
770774
rack (>= 2.0.9)
@@ -774,7 +778,7 @@ GEM
774778
activemodel (>= 6.0.0)
775779
bindex (>= 0.4.0)
776780
railties (>= 6.0.0)
777-
webmock (3.25.0)
781+
webmock (3.25.1)
778782
addressable (>= 2.8.0)
779783
crack (>= 0.3.2)
780784
hashdiff (>= 0.4.0, < 2.0.0)

app/admin/components/dialog.rb

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
module Admin
2+
module Components
3+
class Header < Arbre::HTML::Tag
4+
builder_method :html5_header
5+
end
6+
7+
class Dialog < Arbre::HTML::Tag
8+
builder_method :dialog
9+
attr_accessor :inner_content
10+
11+
def build(attributes = {})
12+
title = attributes[:title]
13+
super(attributes.except(:title))
14+
html5_header do
15+
strong title if title.present?
16+
button "X", title: "Close", class: "button close-dialog-button"
17+
end
18+
@inner_content = div
19+
end
20+
21+
def add_child(child)
22+
if @inner_content
23+
@inner_content.add_child child
24+
else
25+
super
26+
end
27+
end
28+
29+
delegate :children?, to: :@inner_content
30+
end
31+
end
32+
end

app/admin/fmu.rb

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def download_shapefiles(fmus)
6969
}
7070
end
7171

72-
sidebar "Shapefiles" do
72+
sidebar "Shapefiles", only: :index do
7373
div do
7474
link_to "Download Filtered Shapefiles", download_filtered_shapefiles_admin_fmus_path(
7575
q: params[:q]&.to_unsafe_h
@@ -101,29 +101,51 @@ def download_shapefiles(fmus)
101101
end
102102

103103
show do
104-
attributes_table do
105-
row :id
106-
row :name
107-
row :forest_type
108-
row :country
109-
row :operator
110-
row :certification_fsc
111-
row :certification_pefc
112-
row :certification_olb
113-
row :certification_pafc
114-
row :certification_fsc_cw
115-
row :certification_tlv
116-
row :certification_ls
117-
if resource.geojson && resource.centroid.present?
118-
row :map do |r|
119-
render partial: "map", locals: {center: [r.centroid.x, r.centroid.y], center_marker: false, geojson: r.geojson, bbox: r.bbox}
104+
columns class: "d-flex" do
105+
column class: "flex-1" do
106+
attributes_table do
107+
row :id
108+
row :name
109+
row :forest_type
110+
row :country
111+
row :operator
112+
113+
if resource.geojson && resource.centroid.present?
114+
row :map do |r|
115+
render partial: "map", locals: {center: [r.centroid.x, r.centroid.y], center_marker: false, geojson: r.geojson, bbox: r.bbox}
116+
end
117+
end
118+
if resource.geojson
119+
row(:geojson) do
120+
dialog id: "geojson_modal", title: Fmu.human_attribute_name(:geojson) do
121+
resource.geojson
122+
end
123+
link_to t("active_admin.view"), "javascript:void(0)", onclick: "document.querySelector('#geojson_modal').showModal()"
124+
end
125+
row(:properties) do
126+
dialog id: "properties_modal", title: Fmu.human_attribute_name(:properties) do
127+
resource.properties
128+
end
129+
link_to t("active_admin.view"), "javascript:void(0)", onclick: "document.querySelector('#properties_modal').showModal()"
130+
end
131+
end
132+
row :created_at
133+
row :updated_at
134+
row :deleted_at
135+
end
136+
end
137+
138+
column max_width: "250px" do
139+
attributes_table title: t("active_admin.fmus_page.certification") do
140+
row :certification_fsc
141+
row :certification_pefc
142+
row :certification_olb
143+
row :certification_pafc
144+
row :certification_fsc_cw
145+
row :certification_tlv
146+
row :certification_ls
120147
end
121148
end
122-
row(:geojson) { |fmu| fmu.geojson.to_json }
123-
row(:properties) { |fmu| fmu.geojson&.dig("properties")&.to_json }
124-
row :created_at
125-
row :updated_at
126-
row :deleted_at
127149
end
128150
end
129151

app/assets/javascripts/active_admin.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//= require activeadmin_addons/all
33
//= require access_control
44
//= require editor
5+
//= require dialog
56
//= require users
67
//= require rod
78
//= require fmu

0 commit comments

Comments
 (0)