From 2d36bb5abc66dadb8e35d630a67548ba26d9ac53 Mon Sep 17 00:00:00 2001 From: Thomas Burkhalter Date: Sun, 3 Mar 2024 01:14:28 +0100 Subject: [PATCH] Add decidim-geo --- Dockerfile | 2 +- Gemfile | 3 +- Gemfile.lock | 35 +++++++++++++++++- ...stgis_extension_to_database.decidim_geo.rb | 7 ++++ ...03000156_create_decidim_geo.decidim_geo.rb | 23 ++++++++++++ package.json | 24 ++++++------- yarn.lock | 36 +++++++++---------- 7 files changed, 97 insertions(+), 33 deletions(-) create mode 100644 db/migrate/20240303000155_add_postgis_extension_to_database.decidim_geo.rb create mode 100644 db/migrate/20240303000156_create_decidim_geo.decidim_geo.rb diff --git a/Dockerfile b/Dockerfile index c53684cb..b59c0812 100644 --- a/Dockerfile +++ b/Dockerfile @@ -87,7 +87,7 @@ RUN adduser --disabled-password --uid 1001 --gid 0 --gecos "" --shell /bin/bash ARG BUNDLE_WITHOUT='development:metrics:test' ARG BUNDLER_VERSION="2.3.22" -ARG RUN_PACKAGES="clamav clamav-daemon git graphicsmagick libicu-dev libpq5 nodejs poppler-utils" +ARG RUN_PACKAGES="clamav clamav-daemon git graphicsmagick libicu-dev libpq5 nodejs poppler-utils libgeos-dev" ARG PS1='$SENTRY_CURRENT_ENV:$PWD$ ' ENV PS1=$PS1 ARG TZ="Europe/Zurich" diff --git a/Gemfile b/Gemfile index 1161e308..c8c3256a 100644 --- a/Gemfile +++ b/Gemfile @@ -15,8 +15,9 @@ gem 'decidim-proposals', DECIDIM_VERSION gem 'decidim-conferences', DECIDIM_VERSION gem 'decidim-templates', DECIDIM_VERSION -gem 'decidim-antivirus', github: 'mainio/decidim-module-antivirus', branch: 'release/0.27-stable' +gem 'decidim-geo', github: 'octree-gva/decidim-module-geo', branch: "main" gem 'decidim-anonymous_proposals', github: 'puzzle/decidim-module-anonymous_proposals', branch: 'release/0.27-stable' +gem 'decidim-antivirus', github: 'mainio/decidim-module-antivirus', branch: 'release/0.27-stable' gem 'decidim-cleaner', github: 'puzzle/decidim-module-cleaner', branch: 'release/0.27-stable' gem 'decidim-decidim_awesome', github: 'decidim-ice/decidim-module-decidim_awesome' gem 'decidim-participatory_documents', github: 'openpoke/decidim-module-participatory-documents', tag: '0.2.2' diff --git a/Gemfile.lock b/Gemfile.lock index 36c503ee..efeffd78 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -45,6 +45,21 @@ GIT omniauth (~> 2.0) openid_connect (~> 1.2) +GIT + remote: https://github.com/octree-gva/decidim-module-geo.git + revision: 24fd33476e727d5401bc725fc69be1a4dff1561a + branch: main + specs: + decidim-geo (0.26.3) + activerecord-postgis-adapter (>= 6.0) + decidim-admin (>= 0.26) + decidim-core (>= 0.26) + deface (>= 1.8.1) + ffi-geos (~> 2.4) + rgeo (>= 3.0) + rgeo-geojson (>= 1.0) + rgeo-shapefile (>= 1.0) + GIT remote: https://github.com/openpoke/decidim-module-participatory-documents.git revision: 76957bf7bbceb3235eb912b64361ed4a4e521f8a @@ -122,6 +137,9 @@ GEM activerecord (6.1.7.6) activemodel (= 6.1.7.6) activesupport (= 6.1.7.6) + activerecord-postgis-adapter (7.1.1) + activerecord (~> 6.1) + rgeo-activerecord (~> 7.0.0) activestorage (6.1.7.6) actionpack (= 6.1.7.6) activejob (= 6.1.7.6) @@ -247,6 +265,7 @@ GEM crass (1.0.6) css_parser (1.16.0) addressable + csv (3.2.8) dalli (3.2.5) date (3.3.4) date_validator (0.12.0) @@ -255,6 +274,8 @@ GEM db-query-matchers (0.10.0) activesupport (>= 4.0, < 7) rspec (~> 3.0) + dbf (4.3.2) + csv debug_inspector (1.1.0) decidim (0.27.5) decidim-accountability (= 0.27.5) @@ -504,6 +525,8 @@ GEM faraday-net_http (3.1.0) net-http ffi (1.16.3) + ffi-geos (2.4.0) + ffi (>= 1.0.0) file_validators (3.0.0) activemodel (>= 3.2) mime-types (>= 1.0) @@ -808,6 +831,15 @@ GEM actionpack (>= 5.2) railties (>= 5.2) rexml (3.2.6) + rgeo (3.0.1) + rgeo-activerecord (7.0.1) + activerecord (>= 5.0) + rgeo (>= 1.0.0) + rgeo-geojson (2.1.1) + rgeo (>= 1.0.0) + rgeo-shapefile (3.1.0) + dbf (~> 4.0) + rgeo (>= 1.0) rouge (4.1.3) rspec (3.12.0) rspec-core (~> 3.12.0) @@ -1001,6 +1033,7 @@ DEPENDENCIES decidim-conferences (= 0.27.5) decidim-decidim_awesome! decidim-dev (= 0.27.5) + decidim-geo! decidim-participatory_documents! decidim-proposals (= 0.27.5) decidim-question_captcha! @@ -1029,4 +1062,4 @@ RUBY VERSION ruby 3.0.6p216 BUNDLED WITH - 2.5.5 + 2.5.6 diff --git a/db/migrate/20240303000155_add_postgis_extension_to_database.decidim_geo.rb b/db/migrate/20240303000155_add_postgis_extension_to_database.decidim_geo.rb new file mode 100644 index 00000000..46dd6303 --- /dev/null +++ b/db/migrate/20240303000155_add_postgis_extension_to_database.decidim_geo.rb @@ -0,0 +1,7 @@ +# This migration comes from decidim_geo (originally 20221019184712) +class AddPostgisExtensionToDatabase < ActiveRecord::Migration[6.0] + def change + raise "Postgis adapter not enabled" unless ActiveRecord::Base.connection.adapter_name == "PostGIS" + enable_extension 'postgis' + end +end diff --git a/db/migrate/20240303000156_create_decidim_geo.decidim_geo.rb b/db/migrate/20240303000156_create_decidim_geo.decidim_geo.rb new file mode 100644 index 00000000..6e26e67c --- /dev/null +++ b/db/migrate/20240303000156_create_decidim_geo.decidim_geo.rb @@ -0,0 +1,23 @@ +# This migration comes from decidim_geo (originally 20221025195520) +class CreateDecidimGeo < ActiveRecord::Migration[6.0] + def change + create_table :decidim_geo_shapefiles do |t| + t.string :title, null: false + t.string :description, null: true + t.string :shapefile, null: false + t.belongs_to :decidim_scope_types, index: true, foreign_key: true, null: true + + t.timestamps + end + + create_table :decidim_geo_shapefile_datas do |t| + t.belongs_to :decidim_geo_shapefiles, index: true, foreign_key: true + t.jsonb :data + t.multi_polygon :geom + + t.belongs_to :decidim_scopes, index: true, foreign_key: true, null: true + + t.timestamps + end + end +end diff --git a/package.json b/package.json index 5da4ede0..e27e80a0 100644 --- a/package.json +++ b/package.json @@ -7,28 +7,16 @@ "@decidim/elections": "^0.27.5", "@decidim/webpacker": "^0.27.5", "async": "2.6.4", - "codemirror": "^5.65.2", "dset": "3.1.2", "ejs": "3.1.8", - "europa": "^4.0.0", - "form-storage": "^1.3.5", - "formBuilder": "^3.8.3", - "highlight.js": "^11.5.0", - "inline-attachment": "^2.0.3", - "inscrybmde": "^1.11.6", - "jquery-ui": "1.13.2", - "jsrender": "^1.0.11", "leaflet": "^1.8.0", "leaflet-svgicon": "^0.0.2", "leaflet-tilelayer-swiss": "^2.2.1", - "leaflet.featuregroup.subgroup": "^1.0.2", "leaflet.markercluster": "^1.5.3", - "marked": "^4.0.10", "moment": "^2.29.4", "nth-check": "^2.0.1", "proj4": "^2.8.0", "proj4leaflet": "^1.0.2", - "select2": "^4.1.0-rc.0", "yargs-parser": "^5.0.1" }, "version": "0.1.0", @@ -44,10 +32,22 @@ "@decidim/dev": "^0.27.5", "@decidim/eslint-config": "^0.27.5", "@decidim/stylelint-config": "^0.27.5", + "codemirror": "^5.65.16", "eslint": "^7.32.0", "eslint-config-prettier": "^8.5.0", "eslint-config-standard": "^11.0.0", "eslint-plugin-import": "^2.26.0", + "europa": "^4.0.0", + "form-storage": "^1.3.5", + "formBuilder": "^3.19.4", + "highlight.js": "^11.9.0", + "inline-attachment": "^2.0.3", + "inscrybmde": "^1.11.6", + "jquery-ui": "^1.13.2", + "jsrender": "^1.0.13", + "leaflet.featuregroup.subgroup": "^1.0.2", + "marked": "^5.1.2", + "select2": "^4.1.0-rc.0", "stylelint": "^13.11.0" } } diff --git a/yarn.lock b/yarn.lock index 0821d1f9..ad395403 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2354,10 +2354,10 @@ codemirror-spell-checker@^1.1.2: dependencies: typo-js "*" -codemirror@^5.33.0, codemirror@^5.65.2, codemirror@^5.65.3: - version "5.65.14" - resolved "https://registry.npmjs.org/codemirror/-/codemirror-5.65.14.tgz" - integrity sha512-VSNugIBDGt0OU9gDjeVr6fNkoFQznrWEUdAApMlXQNbfE8gGO19776D6MwSqF/V/w/sDwonsQ0z7KmmI9guScg== +codemirror@^5.33.0, codemirror@^5.65.16, codemirror@^5.65.3: + version "5.65.16" + resolved "https://registry.npmjs.org/codemirror/-/codemirror-5.65.16.tgz" + integrity sha512-br21LjYmSlVL0vFCPWPfhzUCT34FM/pAdK7rRIZwa0rrtrIdotvP4Oh4GUHsu2E3IrQMCfRkL/fN3ytMNxVQvg== color-convert@^1.9.0: version "1.9.3" @@ -3417,10 +3417,10 @@ form-storage@^1.3.5: query-string "^5.0.1" query-string-es5 "^6.1.4" -formBuilder@^3.8.3: - version "3.8.3" - resolved "https://registry.npmjs.org/formBuilder/-/formBuilder-3.8.3.tgz" - integrity sha512-9Mxc/6LyWedsiEuktkxwPP+EEGkFP5xo2jTUnN37onmHgw3iX4nohc2AxaFODVVDDNAgX0X0bdHEhU7jIGogvg== +formBuilder@^3.19.4: + version "3.19.4" + resolved "https://registry.npmjs.org/formBuilder/-/formBuilder-3.19.4.tgz" + integrity sha512-pPRzBMGsvQONHI25W7C95YGLsVOOFKsxcPZagF4PULh7i5GzMuy+lbVLIiDwEmbJsQBLwv25wj2R7Wu/dC+N9Q== dependencies: jquery ">=3.4.1" jquery-ui-sortable "*" @@ -3726,10 +3726,10 @@ hasown@^2.0.0: dependencies: function-bind "^1.1.2" -highlight.js@^11.5.0: - version "11.8.0" - resolved "https://registry.npmjs.org/highlight.js/-/highlight.js-11.8.0.tgz" - integrity sha512-MedQhoqVdr0U6SSnWPzfiadUcDHfN/Wzq25AkXiQv9oiOO/sG0S7XkvpFIqWBl9Yq1UYyYOOVORs5UW2XlPyzg== +highlight.js@^11.9.0: + version "11.9.0" + resolved "https://registry.npmjs.org/highlight.js/-/highlight.js-11.9.0.tgz" + integrity sha512-fJ7cW7fQGCYAkgv4CPfwFHrfd/cLS4Hau96JuJ+ZTOWhjnhoeN1ub1tFmALm/+lW5z4WCAuAV9bm05AP0mS6Gw== hoist-non-react-statics@^3.3.2: version "3.3.2" @@ -4169,7 +4169,7 @@ jquery-ui-sortable@*: resolved "https://registry.npmjs.org/jquery-ui-sortable/-/jquery-ui-sortable-1.0.0.tgz" integrity sha512-7xAUWoEJ/jHoj48ei8CCUtiad2uM3ie3IR2b3KB0Mpmb54IbBxzVb5vtrj0zqtd0GNQDImx+BPZml9QmK2EL3w== -jquery-ui@1.13.2: +jquery-ui@^1.13.2: version "1.13.2" resolved "https://registry.npmjs.org/jquery-ui/-/jquery-ui-1.13.2.tgz" integrity sha512-wBZPnqWs5GaYJmo1Jj0k/mrSkzdQzKDwhXNtHKcBdAcKVxMM3KNYFq+iJ2i1rwiG53Z8M4mTn3Qxrm17uH1D4Q== @@ -4283,7 +4283,7 @@ jsonpointer@^5.0.0: resolved "https://registry.npmjs.org/jsonpointer/-/jsonpointer-5.0.1.tgz" integrity sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ== -jsrender@^1.0.11: +jsrender@^1.0.13: version "1.0.13" resolved "https://registry.npmjs.org/jsrender/-/jsrender-1.0.13.tgz" integrity sha512-WAHG4EBPygNZqv8b3oFDprM5Zi+v2TG5/GLk5f0TYIej+xJiGoQNRvGSbhdh25vggWJP3YfzTpAqVSNDaXwY5Q== @@ -4523,10 +4523,10 @@ marked@^0.5.1: resolved "https://registry.npmjs.org/marked/-/marked-0.5.2.tgz" integrity sha512-fdZvBa7/vSQIZCi4uuwo2N3q+7jJURpMVCcbaX0S1Mg65WZ5ilXvC67MviJAsdjqqgD+CEq4RKo5AYGgINkVAA== -marked@^4.0.10: - version "4.3.0" - resolved "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz" - integrity sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A== +marked@^5.1.2: + version "5.1.2" + resolved "https://registry.npmjs.org/marked/-/marked-5.1.2.tgz" + integrity sha512-ahRPGXJpjMjwSOlBoTMZAK7ATXkli5qCPxZ21TG44rx1KEo44bii4ekgTDQPNRQ4Kh7JMb9Ub1PVk1NxRSsorg== mathml-tag-names@^2.1.3: version "2.1.3"