Skip to content

Commit

Permalink
Fix bugs / Add specs
Browse files Browse the repository at this point in the history
  • Loading branch information
JoonasAapro committed Dec 2, 2024
1 parent ca90847 commit 4501d38
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 224 deletions.
71 changes: 36 additions & 35 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/mainio/decidim-module-locations.git
revision: a27f1a5c49fc0975b6c3c9e4c322850dc61ac722
revision: f327b48d32afa8eb16e52d6d17c7668f0da1c770
branch: release/0.27-stable
specs:
decidim-locations (0.27.0)
Expand Down Expand Up @@ -104,7 +104,7 @@ GEM
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
ast (2.4.2)
axe-core-api (4.10.1)
axe-core-api (4.10.2)
dumb_delegator
ostruct
virtus
Expand Down Expand Up @@ -150,15 +150,15 @@ GEM
marcel (~> 1.0.0)
mini_mime (>= 0.1.3)
ssrf_filter (~> 1.0)
cells (4.1.7)
declarative-builder (< 0.2.0)
cells (4.1.8)
declarative-builder (~> 0.2.0)
declarative-option (< 0.2.0)
tilt (>= 1.4, < 3)
uber (< 0.2.0)
cells-erb (0.1.0)
cells (~> 4.0)
erbse (>= 0.1.1)
cells-rails (0.1.5)
cells-rails (0.1.6)
actionpack (>= 5.0)
cells (>= 4.1.6, < 5.0.0)
charlock_holmes (0.7.9)
Expand All @@ -174,7 +174,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.12.2)
commonmarker (0.23.10)
commonmarker (0.23.11)
concurrent-ruby (1.3.4)
crack (1.0.0)
bigdecimal
Expand All @@ -183,7 +183,7 @@ GEM
css_parser (1.19.1)
addressable
csv (3.3.0)
date (3.3.4)
date (3.4.0)
date_validator (0.12.0)
activemodel (>= 3)
activesupport (>= 3)
Expand Down Expand Up @@ -353,8 +353,8 @@ GEM
devise_invitable (~> 2.0, >= 2.0.9)
decidim-verifications (0.27.9)
decidim-core (= 0.27.9)
declarative-builder (0.1.0)
declarative-option (< 0.2.0)
declarative-builder (0.2.0)
trailblazer-option (~> 0.1.0)
declarative-option (0.1.0)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
Expand All @@ -375,7 +375,7 @@ GEM
nokogiri (>= 1.13.2, < 1.17.0)
rubyzip (~> 2.3.0)
docile (1.4.1)
doorkeeper (5.7.1)
doorkeeper (5.8.0)
railties (>= 5)
doorkeeper-i18n (4.0.1)
dumb_delegator (1.0.0)
Expand All @@ -391,7 +391,7 @@ GEM
temple
erubi (1.13.0)
escape_utils (1.3.0)
excon (1.0.0)
excon (1.2.2)
execjs (2.10.0)
extended-markdown-filter (0.7.0)
html-pipeline (~> 2.9)
Expand All @@ -402,12 +402,12 @@ GEM
railties (>= 3.0.0)
faker (2.19.0)
i18n (>= 1.6, < 2)
faraday (2.12.0)
faraday-net_http (>= 2.0, < 3.4)
faraday (2.12.1)
faraday-net_http (>= 2.0, < 3.5)
json
logger
faraday-net_http (3.3.0)
net-http
faraday-net_http (3.4.0)
net-http (>= 0.5.0)
ffi (1.17.0)
file_validators (3.0.0)
activemodel (>= 3.2)
Expand Down Expand Up @@ -440,7 +440,7 @@ GEM
graphql (~> 1.12)
html-pipeline (~> 2.9)
sass (~> 3.4)
hashdiff (1.1.1)
hashdiff (1.1.2)
hashie (5.0.0)
highline (3.1.1)
reline
Expand Down Expand Up @@ -473,7 +473,7 @@ GEM
invisible_captcha (0.13.0)
rails (>= 3.2.0)
io-console (0.7.2)
json (2.7.4)
json (2.8.2)
jwt (2.9.3)
base64
kaminari (1.2.2)
Expand All @@ -488,8 +488,8 @@ GEM
activerecord
kaminari-core (= 1.2.2)
kaminari-core (1.2.2)
kramdown (2.4.0)
rexml
kramdown (2.5.1)
rexml (>= 3.3.9)
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
launchy (2.5.2)
Expand Down Expand Up @@ -525,20 +525,20 @@ GEM
mime-types (3.6.0)
logger
mime-types-data (~> 3.2015)
mime-types-data (3.2024.1001)
mime-types-data (3.2024.1105)
mini_magick (4.13.2)
mini_mime (1.1.5)
minitest (5.25.1)
minitest (5.25.2)
mixlib-cli (2.1.8)
mixlib-config (3.0.27)
tomlrb
mixlib-shellout (3.3.3)
mixlib-shellout (3.3.4)
chef-utils
msgpack (1.7.3)
msgpack (1.7.5)
multi_xml (0.6.0)
net-http (0.4.1)
net-http (0.5.0)
uri
net-imap (0.4.17)
net-imap (0.4.18)
date
net-protocol
net-pop (0.1.2)
Expand Down Expand Up @@ -588,14 +588,14 @@ GEM
omniauth-oauth (~> 1.1)
rack
orm_adapter (0.5.0)
ostruct (0.6.0)
ostruct (0.6.1)
paper_trail (12.3.0)
activerecord (>= 5.2)
request_store (~> 1.1)
parallel (1.26.3)
parallel_tests (3.13.0)
parallel
parser (3.3.5.0)
parser (3.3.6.0)
ast (~> 2.4.1)
racc
pg (1.1.4)
Expand Down Expand Up @@ -672,7 +672,7 @@ GEM
redcarpet (3.6.0)
redis (4.8.1)
regexp_parser (2.9.2)
reline (0.5.10)
reline (0.5.12)
io-console (~> 0.5)
request_store (1.5.1)
rack (>= 1.4)
Expand All @@ -687,9 +687,9 @@ GEM
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-cells (0.3.9)
rspec-cells (0.3.10)
cells (>= 4.0.0, < 6.0.0)
rspec-rails (>= 3.0.0, < 6.2.0)
rspec-rails (>= 3.0.0)
rspec-core (3.13.2)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.1)
Expand Down Expand Up @@ -723,7 +723,7 @@ GEM
rubocop-ast (>= 1.17.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.32.3)
rubocop-ast (1.36.2)
parser (>= 3.3.1.0)
rubocop-faker (1.2.0)
faker (>= 2.12.0)
Expand Down Expand Up @@ -754,7 +754,7 @@ GEM
childprocess (>= 0.5, < 5.0)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2)
semantic_range (3.0.0)
semantic_range (3.1.0)
seven_zip_ruby (1.3.0)
simplecov (0.21.2)
docile (~> 1.1)
Expand All @@ -778,22 +778,23 @@ GEM
actionpack (>= 6.1)
activesupport (>= 6.1)
sprockets (>= 3.0.0)
ssrf_filter (1.1.2)
ssrf_filter (1.2.0)
temple (0.10.3)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
thor (1.3.2)
thread_safe (0.3.6)
tilt (2.4.0)
timeout (0.4.1)
timeout (0.4.2)
tomlrb (2.0.3)
trailblazer-option (0.1.2)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
uber (0.1.0)
uglifier (4.2.1)
execjs (>= 0.3.0, < 3)
unicode-display_width (2.6.0)
uri (0.13.1)
uri (1.0.2)
valid_email2 (2.3.1)
activemodel (>= 3.2)
mail (~> 2.5)
Expand Down
41 changes: 14 additions & 27 deletions decidim-module-forms_locations/app/packs/src/decidim/forms/forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,34 +75,21 @@ $(() => {
});
}

const callback = (mutationsList) => {
mutationsList.forEach((mutation) => {
if (mutation.type === "attributes") {
const classList = Array.from(mutation.target.classList);
if (!classList.includes("hide")) {
mutation.target.querySelectorAll("[data-decidim-map]").forEach((map) => {
const mapData = JSON.parse(map.getAttribute("data-decidim-map"));
$(document).on("attributechange", ".questionnaire-step", (event) => {
const target = event.target;

const mapCtrl = $(map).data("map-controller");
mapCtrl.map.invalidateSize();
if (!target.classList.contains("hide")) {
target.querySelectorAll("[data-decidim-map]").forEach((map) => {
const mapData = JSON.parse(map.getAttribute("data-decidim-map"));

if (mapData.type === "locations") {
mapCtrl.start();
mapCtrl.refreshMarkers();
}
})
}
}
})
};
const mapCtrl = $(map).data("map-controller");

const observer = new MutationObserver(callback)

const config = { attributes: true }

if ($(".questionnaire-step")) {
$(".questionnaire-step").each((idx, el) => {
observer.observe(el, config);
})
}
mapCtrl.map.invalidateSize();
if (mapData.type === "locations") {
mapCtrl.start();
mapCtrl.refreshMarkers();
}
});
}
});
})
Loading

0 comments on commit 4501d38

Please sign in to comment.