decidim-navigation_maps 1.2.0 → 1.3.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.
- checksums.yaml +4 -4
- data/README.md +22 -3
- data/Rakefile +8 -0
- data/app/cells/decidim/navigation_maps/content_blocks/navigation_map/_tabs_content.erb +1 -1
- data/app/cells/decidim/navigation_maps/content_blocks/navigation_map/show.erb +2 -2
- data/app/cells/decidim/navigation_maps/content_blocks/navigation_map_cell.rb +5 -0
- data/app/cells/decidim/navigation_maps/content_blocks/navigation_map_settings_form/_form.erb +4 -4
- data/app/cells/decidim/navigation_maps/content_blocks/navigation_map_settings_form/_tabs_content.erb +0 -1
- data/app/cells/decidim/navigation_maps/content_blocks/navigation_map_settings_form/show.erb +4 -2
- data/app/cells/decidim/navigation_maps/content_blocks/navigation_map_settings_form_cell.rb +9 -0
- data/app/controllers/decidim/navigation_maps/admin/blueprints_controller.rb +1 -1
- data/app/jobs/decidim/navigation_maps/migrate_legacy_images_job.rb +32 -0
- data/app/models/decidim/navigation_maps/blueprint.rb +4 -3
- data/app/packs/entrypoints/decidim_admin_navigation_maps.js +4 -0
- data/app/packs/entrypoints/decidim_admin_navigation_maps.scss +1 -0
- data/app/packs/entrypoints/decidim_navigation_maps.js +7 -0
- data/app/packs/entrypoints/decidim_navigation_maps.scss +1 -0
- data/app/packs/src/decidim/navigation_maps/admin/map_editor.js +83 -0
- data/app/packs/src/decidim/navigation_maps/admin/navigation_maps.js +154 -0
- data/app/packs/src/decidim/navigation_maps/map_view.js +125 -0
- data/app/packs/src/decidim/navigation_maps/navigation_maps.js +43 -0
- data/app/{assets → packs}/stylesheets/decidim/navigation_maps/_variables.scss +0 -0
- data/app/{assets → packs}/stylesheets/decidim/navigation_maps/admin/navigation_maps.scss +4 -4
- data/app/{assets → packs}/stylesheets/decidim/navigation_maps/navigation_maps.scss +1 -2
- data/app/uploaders/decidim/navigation_maps/blueprint_uploader.rb +4 -12
- data/app/uploaders/decidim/navigation_maps/cw/blueprint_uploader.rb +24 -0
- data/config/assets.rb +41 -0
- data/config/locales/cs.yml +1 -1
- data/db/seeds.rb +6 -5
- data/lib/decidim/navigation_maps/admin_engine.rb +0 -4
- data/lib/decidim/navigation_maps/engine.rb +4 -4
- data/lib/decidim/navigation_maps/navigation_map_cell_helpers.rb +1 -1
- data/lib/decidim/navigation_maps/version.rb +2 -2
- data/lib/decidim/navigation_maps.rb +0 -2
- data/lib/tasks/decidim_navigation_maps_webpacker_tasks.rake +58 -0
- data/lib/tasks/navigation_maps_active_storage_migration_tasks.rake +37 -0
- metadata +31 -27
- data/app/assets/config/admin/decidim_navigation_maps_manifest.css +0 -3
- data/app/assets/config/admin/decidim_navigation_maps_manifest.js +0 -3
- data/app/assets/config/decidim_navigation_maps_manifest.css +0 -3
- data/app/assets/config/decidim_navigation_maps_manifest.js +0 -1
- data/app/assets/images/decidim/navigation_maps/icon.svg +0 -1
- data/app/assets/javascripts/decidim/navigation_maps/admin/map_editor.js +0 -88
- data/app/assets/javascripts/decidim/navigation_maps/admin/navigation_maps.js +0 -143
- data/app/assets/javascripts/decidim/navigation_maps/map_view.js +0 -123
- data/app/assets/javascripts/decidim/navigation_maps/navigation_maps.js +0 -44
@@ -0,0 +1,43 @@
|
|
1
|
+
import NavigationMapView from "src/decidim/navigation_maps/map_view.js";
|
2
|
+
import "jsviews/jsrender";
|
3
|
+
|
4
|
+
$(function() {
|
5
|
+
|
6
|
+
let $maps = $(".navigation_maps .map");
|
7
|
+
let $tabs = $("#navigation_maps-tabs");
|
8
|
+
let maps = {};
|
9
|
+
let tmpl = $.templates("#navigation_maps-popup");
|
10
|
+
|
11
|
+
$maps.each(function() {
|
12
|
+
let id = $(this).data("id");
|
13
|
+
maps[id] = new NavigationMapView(this);
|
14
|
+
maps[id].onSetLayerProperties(function(layer, props) {
|
15
|
+
if (!props.popup) {
|
16
|
+
let node = document.createElement("div");
|
17
|
+
let html = tmpl.render(props);
|
18
|
+
$(node).html(html);
|
19
|
+
|
20
|
+
layer.bindPopup(node, {
|
21
|
+
maxHeight: 400,
|
22
|
+
// autoPan: false,
|
23
|
+
maxWidth: 640,
|
24
|
+
minWidth: 200,
|
25
|
+
keepInView: true,
|
26
|
+
className: `navigation_map-info map-info-${id}-${layer._leaflet_id}`
|
27
|
+
});
|
28
|
+
}
|
29
|
+
});
|
30
|
+
maps[id].onClickArea(function(area) {
|
31
|
+
let popup = area.feature.properties && area.feature.properties.link && area.feature.properties.popup;
|
32
|
+
if (popup) {
|
33
|
+
location = area.feature.properties.link;
|
34
|
+
}
|
35
|
+
});
|
36
|
+
});
|
37
|
+
|
38
|
+
$tabs.on("change.zf.tabs", function(e, $tab, $content) {
|
39
|
+
let id = $content.find(".map").data("id");
|
40
|
+
maps[id].reload();
|
41
|
+
});
|
42
|
+
|
43
|
+
});
|
File without changes
|
@@ -2,10 +2,10 @@
|
|
2
2
|
//= require leaflet-geoman
|
3
3
|
//= require_self
|
4
4
|
|
5
|
-
@import "decidim/variables";
|
6
|
-
@import "decidim/utils/settings";
|
7
|
-
@import "decidim/utils/mixins";
|
8
|
-
@import "decidim/navigation_maps/variables";
|
5
|
+
@import "stylesheets/decidim/variables";
|
6
|
+
@import "stylesheets/decidim/utils/settings";
|
7
|
+
@import "stylesheets/decidim/utils/mixins";
|
8
|
+
@import "stylesheets/decidim/navigation_maps/variables";
|
9
9
|
|
10
10
|
.navigation_maps.admin {
|
11
11
|
.accordion-item {
|
@@ -4,18 +4,10 @@ module Decidim
|
|
4
4
|
module NavigationMaps
|
5
5
|
# This class deals with uploading images to a Blueprints.
|
6
6
|
class BlueprintUploader < Decidim::ImageUploader
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
end
|
12
|
-
|
13
|
-
def extension_white_list
|
14
|
-
%w(jpg jpeg png svg)
|
15
|
-
end
|
16
|
-
|
17
|
-
def max_image_height_or_width
|
18
|
-
8000
|
7
|
+
set_variants do
|
8
|
+
{
|
9
|
+
thumbnail: { resize_to_fit: [nil, 237] }
|
10
|
+
}
|
19
11
|
end
|
20
12
|
end
|
21
13
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module NavigationMaps
|
5
|
+
module Cw
|
6
|
+
# This class deals with uploading images to a Blueprints.
|
7
|
+
class BlueprintUploader < Decidim::Cw::ImageUploader
|
8
|
+
process :validate_size, :validate_dimensions
|
9
|
+
|
10
|
+
version :thumbnail do
|
11
|
+
process resize_to_fit: [nil, 237]
|
12
|
+
end
|
13
|
+
|
14
|
+
def extension_white_list
|
15
|
+
%w(jpg jpeg png svg)
|
16
|
+
end
|
17
|
+
|
18
|
+
def max_image_height_or_width
|
19
|
+
8000
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/config/assets.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file is located at `config/assets.rb` of your module.
|
4
|
+
|
5
|
+
# Define the base path of your module. Please note that `Rails.root` may not be
|
6
|
+
# used because we are not inside the Rails environment when this file is loaded.
|
7
|
+
base_path = File.expand_path("..", __dir__)
|
8
|
+
|
9
|
+
# Register an additional load path for webpack. All the assets within these
|
10
|
+
# directories will be available for inclusion within the Decidim assets. For
|
11
|
+
# example, if you have `app/packs/src/decidim/foo.js`, you can include that file
|
12
|
+
# in your JavaScript entrypoints (or other JavaScript files within Decidim)
|
13
|
+
# using `import "src/decidim/foo"` after you have registered the additional path
|
14
|
+
# as follows.
|
15
|
+
Decidim::Webpacker.register_path("#{base_path}/app/packs")
|
16
|
+
|
17
|
+
# Register the entrypoints for your module. These entrypoints can be included
|
18
|
+
# within your application using `javascript_pack_tag` and if you include any
|
19
|
+
# SCSS files within the entrypoints, they become available for inclusion using
|
20
|
+
# `stylesheet_pack_tag`.
|
21
|
+
Decidim::Webpacker.register_entrypoints(
|
22
|
+
decidim_navigation_maps: "#{base_path}/app/packs/entrypoints/decidim_navigation_maps.js",
|
23
|
+
decidim_admin_navigation_maps: "#{base_path}/app/packs/entrypoints/decidim_admin_navigation_maps.js"
|
24
|
+
)
|
25
|
+
|
26
|
+
# If you want to import some extra SCSS files in the Decidim main SCSS file
|
27
|
+
# without adding any extra stylesheet inclusion tags, you can use the following
|
28
|
+
# method to register the stylesheet import for the main application.
|
29
|
+
# Decidim::Webpacker.register_stylesheet_import("stylesheets/decidim/navigation_maps/navigation_maps")
|
30
|
+
|
31
|
+
# If you want to do the same but include the SCSS file for the admin panel's
|
32
|
+
# main SCSS file, you can use the following method.
|
33
|
+
# Decidim::Webpacker.register_stylesheet_import("stylesheets/decidim/navigation_maps/admin", group: :admin)
|
34
|
+
|
35
|
+
# If you want to override some SCSS variables/settings for Foundation from the
|
36
|
+
# module, you can add the following registered import.
|
37
|
+
# Decidim::Webpacker.register_stylesheet_import("stylesheets/decidim/foo/settings", type: :settings)
|
38
|
+
|
39
|
+
# If you want to do the same but override the SCSS variables of the admin
|
40
|
+
# panel's styles, you can use the following method.
|
41
|
+
# Decidim::Webpacker.register_stylesheet_import("stylesheets/decidim/foo/admin_settings", type: :settings, group: :admin)
|
data/config/locales/cs.yml
CHANGED
@@ -29,7 +29,7 @@ cs:
|
|
29
29
|
view: Zapojte se
|
30
30
|
navigation_map_settings_form:
|
31
31
|
add: Přidat
|
32
|
-
autohide_tabs:
|
32
|
+
autohide_tabs: Skrýt navigaci v záložkách, pokud je pouze jedna mapa
|
33
33
|
blueprint_image: Obrázek plánu
|
34
34
|
description: Popis
|
35
35
|
editor: Editor mapy
|
data/db/seeds.rb
CHANGED
@@ -24,18 +24,19 @@ if !ENV["SKIP_MODULE_SEEDS"] && (!Rails.env.production? || ENV["SEED"])
|
|
24
24
|
blueprint1 = Decidim::NavigationMaps::Blueprint.create(
|
25
25
|
organization: organization,
|
26
26
|
content_block: content_block,
|
27
|
-
image: File.new(File.join(seeds_root, "antarctica.png")),
|
28
27
|
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
29
28
|
description: Decidim::Faker::Localized.sentence(word_count: 10)
|
30
29
|
)
|
31
30
|
|
32
|
-
Decidim::NavigationMaps::Blueprint.create(
|
31
|
+
blueprint2 = Decidim::NavigationMaps::Blueprint.create(
|
33
32
|
organization: organization,
|
34
|
-
image: File.new(File.join(seeds_root, "penguins.jpg")),
|
35
33
|
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
36
34
|
description: Decidim::Faker::Localized.sentence(word_count: 10)
|
37
35
|
)
|
38
36
|
|
37
|
+
blueprint1.image.attach(io: File.open(File.join(seeds_root, "antarctica.png")), filename: "antarctica.png", content_type: "image/png")
|
38
|
+
blueprint2.image.attach(io: File.open(File.join(seeds_root, "penguins.jpg")), filename: "penguins.jpg", content_type: "image/jpeg")
|
39
|
+
|
39
40
|
Decidim::NavigationMaps::BlueprintArea.create(
|
40
41
|
blueprint: blueprint1,
|
41
42
|
area_id: "10",
|
@@ -84,7 +85,7 @@ if !ENV["SKIP_MODULE_SEEDS"] && (!Rails.env.production? || ENV["SEED"])
|
|
84
85
|
link_type: "link",
|
85
86
|
color: "#ffbb00",
|
86
87
|
title: { en: "Penguins" },
|
87
|
-
description: { en: "Penguins are
|
88
|
+
description: { en: "Penguins are beautiful animals" }
|
88
89
|
)
|
89
90
|
|
90
91
|
Decidim::NavigationMaps::BlueprintArea.create(
|
@@ -121,10 +122,10 @@ if !ENV["SKIP_MODULE_SEEDS"] && (!Rails.env.production? || ENV["SEED"])
|
|
121
122
|
blueprint = Decidim::NavigationMaps::Blueprint.create(
|
122
123
|
organization: organization,
|
123
124
|
content_block: content_block,
|
124
|
-
image: File.new(File.join(seeds_root, "pla-cerda.jpg")),
|
125
125
|
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
126
126
|
description: Decidim::Faker::Localized.sentence(word_count: 10)
|
127
127
|
)
|
128
|
+
blueprint1.image.attach(io: File.open(File.join(seeds_root, "pla-cerda.jpg")), filename: "pla-cerda.jpg", content_type: "image/jpeg")
|
128
129
|
|
129
130
|
Decidim::NavigationMaps::BlueprintArea.create(
|
130
131
|
blueprint: blueprint,
|
@@ -22,10 +22,6 @@ module Decidim
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
initializer "decidim_navigation_maps.admin_assets" do |app|
|
26
|
-
app.config.assets.precompile += %w(admin/decidim_navigation_maps_manifest.js admin/decidim_navigation_maps_manifest.css)
|
27
|
-
end
|
28
|
-
|
29
25
|
def load_seed
|
30
26
|
nil
|
31
27
|
end
|
@@ -9,10 +9,6 @@ module Decidim
|
|
9
9
|
class Engine < ::Rails::Engine
|
10
10
|
isolate_namespace Decidim::NavigationMaps
|
11
11
|
|
12
|
-
initializer "decidim_navigation_maps.assets" do |app|
|
13
|
-
app.config.assets.precompile += %w(decidim_navigation_maps_manifest.js decidim_navigation_maps_manifest.css)
|
14
|
-
end
|
15
|
-
|
16
12
|
initializer "decidim.navigation_maps.content_blocks" do
|
17
13
|
Decidim.content_blocks.register(:homepage, :navigation_map) do |content_block|
|
18
14
|
content_block.cell = "decidim/navigation_maps/content_blocks/navigation_map"
|
@@ -41,6 +37,10 @@ module Decidim
|
|
41
37
|
Cell::ViewModel.view_paths << File.expand_path("#{Decidim::NavigationMaps::Engine.root}/app/cells")
|
42
38
|
Cell::ViewModel.view_paths << File.expand_path("#{Decidim::NavigationMaps::Engine.root}/app/views") # for partials
|
43
39
|
end
|
40
|
+
|
41
|
+
initializer "decidim_notify.webpacker.assets_path" do
|
42
|
+
Decidim.register_assets_path File.expand_path("app/packs", root)
|
43
|
+
end
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -7,7 +7,7 @@ module Decidim
|
|
7
7
|
delegate :available_locales, to: :current_organization
|
8
8
|
|
9
9
|
def valid_blueprints
|
10
|
-
content_block_blueprints.
|
10
|
+
content_block_blueprints.joins(:image_attachment).order(:created_at)
|
11
11
|
end
|
12
12
|
|
13
13
|
def valid_blueprints?
|
@@ -5,8 +5,6 @@ require "decidim/navigation_maps/engine"
|
|
5
5
|
require "decidim/navigation_maps/admin_engine"
|
6
6
|
|
7
7
|
module Decidim
|
8
|
-
# This namespace holds the logic of the `NavigationMaps` component. This component
|
9
|
-
# allows users to create navigation_maps in a participatory space.
|
10
8
|
module NavigationMaps
|
11
9
|
autoload :NavigationMapCellHelpers, "decidim/navigation_maps/navigation_map_cell_helpers"
|
12
10
|
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "decidim/gem_manager"
|
4
|
+
|
5
|
+
namespace :decidim_navigation_maps do
|
6
|
+
namespace :webpacker do
|
7
|
+
desc "Installs Decidim Awesome webpacker files in Rails instance application"
|
8
|
+
task install: :environment do
|
9
|
+
raise "Decidim gem is not installed" if decidim_path.nil?
|
10
|
+
|
11
|
+
install_navigation_maps_npm
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "Adds Decidim Awesome dependencies in package.json"
|
15
|
+
task upgrade: :environment do
|
16
|
+
raise "Decidim gem is not installed" if decidim_path.nil?
|
17
|
+
|
18
|
+
install_navigation_maps_npm
|
19
|
+
end
|
20
|
+
|
21
|
+
def install_navigation_maps_npm
|
22
|
+
navigation_maps_npm_dependencies.each do |type, packages|
|
23
|
+
system! "npm i --save-#{type} #{packages.join(" ")}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def navigation_maps_npm_dependencies
|
28
|
+
@navigation_maps_npm_dependencies ||= begin
|
29
|
+
package_json = JSON.parse(File.read(navigation_maps_path.join("package.json")))
|
30
|
+
|
31
|
+
{
|
32
|
+
prod: package_json["dependencies"].map { |package, version| "#{package}@#{version}" },
|
33
|
+
dev: package_json["devDependencies"].map { |package, version| "#{package}@#{version}" }
|
34
|
+
}.freeze
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def navigation_maps_path
|
39
|
+
@navigation_maps_path ||= Pathname.new(navigation_maps_gemspec.full_gem_path) if Gem.loaded_specs.has_key?(gem_name)
|
40
|
+
end
|
41
|
+
|
42
|
+
def navigation_maps_gemspec
|
43
|
+
@navigation_maps_gemspec ||= Gem.loaded_specs[gem_name]
|
44
|
+
end
|
45
|
+
|
46
|
+
def rails_app_path
|
47
|
+
@rails_app_path ||= Rails.root
|
48
|
+
end
|
49
|
+
|
50
|
+
def system!(command)
|
51
|
+
system("cd #{rails_app_path} && #{command}") || abort("\n== Command #{command} failed ==")
|
52
|
+
end
|
53
|
+
|
54
|
+
def gem_name
|
55
|
+
"decidim-navigation_maps"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :navigation_maps do
|
4
|
+
namespace :active_storage_migrations do
|
5
|
+
desc "Migrates editor images from Carrierwave to ActiveStorage"
|
6
|
+
task migrate_from_carrierwave: :environment do
|
7
|
+
stdout = Logger.new($stdout)
|
8
|
+
stdout.level = Logger::INFO
|
9
|
+
Rails.logger.extend(ActiveSupport::Logger.broadcast(stdout))
|
10
|
+
Decidim::Organization.find_each do |organization|
|
11
|
+
puts "Migrating Organization #{organization.id} (#{organization.host})..."
|
12
|
+
routes_mappings = []
|
13
|
+
Decidim::NavigationMaps::MigrateLegacyImagesJob.perform_now(organization.id, routes_mappings)
|
14
|
+
|
15
|
+
path = Rails.root.join("tmp/navigation_maps_editor_images_mappings.csv")
|
16
|
+
dirname = File.dirname(path)
|
17
|
+
FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
|
18
|
+
File.open(path, "wb") do |file|
|
19
|
+
file.write(Decidim::Exporters::CSV.new(routes_mappings).export.read)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
desc "Checks editor images migrated from Carrierwave to ActiveStorage"
|
25
|
+
task check_migration_from_carrierwave: :environment do
|
26
|
+
logger = ActiveSupport::TaggedLogging.new(Logger.new($stdout))
|
27
|
+
|
28
|
+
Decidim::CarrierWaveMigratorService.check_migration(
|
29
|
+
klass: Decidim::NavigationMaps::Blueprint,
|
30
|
+
cw_attribute: "image",
|
31
|
+
cw_uploader: Decidim::NavigationMaps::Cw::BlueprintUploader,
|
32
|
+
as_attribute: "image",
|
33
|
+
logger: logger
|
34
|
+
)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-navigation_maps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Vergés
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: decidim-admin
|
@@ -16,60 +16,60 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.25'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '0.
|
22
|
+
version: '0.27'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0.
|
29
|
+
version: '0.25'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '0.
|
32
|
+
version: '0.27'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: decidim-core
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '0.
|
39
|
+
version: '0.25'
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '0.
|
42
|
+
version: '0.27'
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '0.
|
49
|
+
version: '0.25'
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: '0.
|
52
|
+
version: '0.27'
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: decidim-dev
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: '0.
|
59
|
+
version: '0.25'
|
60
60
|
- - "<"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '0.
|
62
|
+
version: '0.27'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '0.
|
69
|
+
version: '0.25'
|
70
70
|
- - "<"
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: '0.
|
72
|
+
version: '0.27'
|
73
73
|
description: Allows to create visual guiding maps in content blocks for Decidim.
|
74
74
|
email:
|
75
75
|
- ivan@platoniq.net
|
@@ -80,18 +80,6 @@ files:
|
|
80
80
|
- LICENSE-AGPLv3.txt
|
81
81
|
- README.md
|
82
82
|
- Rakefile
|
83
|
-
- app/assets/config/admin/decidim_navigation_maps_manifest.css
|
84
|
-
- app/assets/config/admin/decidim_navigation_maps_manifest.js
|
85
|
-
- app/assets/config/decidim_navigation_maps_manifest.css
|
86
|
-
- app/assets/config/decidim_navigation_maps_manifest.js
|
87
|
-
- app/assets/images/decidim/navigation_maps/icon.svg
|
88
|
-
- app/assets/javascripts/decidim/navigation_maps/admin/map_editor.js
|
89
|
-
- app/assets/javascripts/decidim/navigation_maps/admin/navigation_maps.js
|
90
|
-
- app/assets/javascripts/decidim/navigation_maps/map_view.js
|
91
|
-
- app/assets/javascripts/decidim/navigation_maps/navigation_maps.js
|
92
|
-
- app/assets/stylesheets/decidim/navigation_maps/_variables.scss
|
93
|
-
- app/assets/stylesheets/decidim/navigation_maps/admin/navigation_maps.scss
|
94
|
-
- app/assets/stylesheets/decidim/navigation_maps/navigation_maps.scss
|
95
83
|
- app/cells/decidim/navigation_maps/content_blocks/groups_navigation_map_cell.rb
|
96
84
|
- app/cells/decidim/navigation_maps/content_blocks/navigation_map/_styles.erb
|
97
85
|
- app/cells/decidim/navigation_maps/content_blocks/navigation_map/_tabs.erb
|
@@ -113,15 +101,29 @@ files:
|
|
113
101
|
- app/forms/decidim/navigation_maps/area_form.rb
|
114
102
|
- app/forms/decidim/navigation_maps/blueprint_form.rb
|
115
103
|
- app/forms/decidim/navigation_maps/blueprint_forms.rb
|
104
|
+
- app/jobs/decidim/navigation_maps/migrate_legacy_images_job.rb
|
116
105
|
- app/models/decidim/navigation_maps/application_record.rb
|
117
106
|
- app/models/decidim/navigation_maps/blueprint.rb
|
118
107
|
- app/models/decidim/navigation_maps/blueprint_area.rb
|
108
|
+
- app/packs/entrypoints/decidim_admin_navigation_maps.js
|
109
|
+
- app/packs/entrypoints/decidim_admin_navigation_maps.scss
|
110
|
+
- app/packs/entrypoints/decidim_navigation_maps.js
|
111
|
+
- app/packs/entrypoints/decidim_navigation_maps.scss
|
112
|
+
- app/packs/src/decidim/navigation_maps/admin/map_editor.js
|
113
|
+
- app/packs/src/decidim/navigation_maps/admin/navigation_maps.js
|
114
|
+
- app/packs/src/decidim/navigation_maps/map_view.js
|
115
|
+
- app/packs/src/decidim/navigation_maps/navigation_maps.js
|
116
|
+
- app/packs/stylesheets/decidim/navigation_maps/_variables.scss
|
117
|
+
- app/packs/stylesheets/decidim/navigation_maps/admin/navigation_maps.scss
|
118
|
+
- app/packs/stylesheets/decidim/navigation_maps/navigation_maps.scss
|
119
119
|
- app/queries/decidim/navigation_maps/content_block_blueprints.rb
|
120
120
|
- app/queries/decidim/navigation_maps/organization_blueprints.rb
|
121
121
|
- app/uploaders/decidim/navigation_maps/blueprint_uploader.rb
|
122
|
+
- app/uploaders/decidim/navigation_maps/cw/blueprint_uploader.rb
|
122
123
|
- app/views/decidim/navigation_maps/admin/areas/_form.html.erb
|
123
124
|
- app/views/decidim/navigation_maps/admin/areas/new.html.erb
|
124
125
|
- app/views/decidim/navigation_maps/admin/areas/show.html.erb
|
126
|
+
- config/assets.rb
|
125
127
|
- config/i18n-tasks.yml
|
126
128
|
- config/locales/ca.yml
|
127
129
|
- config/locales/cs.yml
|
@@ -147,6 +149,8 @@ files:
|
|
147
149
|
- lib/decidim/navigation_maps/test/factories.rb
|
148
150
|
- lib/decidim/navigation_maps/version.rb
|
149
151
|
- lib/tasks/custom_seeds.rake
|
152
|
+
- lib/tasks/decidim_navigation_maps_webpacker_tasks.rake
|
153
|
+
- lib/tasks/navigation_maps_active_storage_migration_tasks.rake
|
150
154
|
- vendor/assets/images/draw/layers-2x.png
|
151
155
|
- vendor/assets/images/draw/layers.png
|
152
156
|
- vendor/assets/images/draw/marker-icon-2x.png
|
@@ -185,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
189
|
- !ruby/object:Gem::Version
|
186
190
|
version: '0'
|
187
191
|
requirements: []
|
188
|
-
rubygems_version: 3.1.
|
192
|
+
rubygems_version: 3.1.6
|
189
193
|
signing_key:
|
190
194
|
specification_version: 4
|
191
195
|
summary: A decidim navigation_maps module
|
@@ -1 +0,0 @@
|
|
1
|
-
//= link decidim/navigation_maps/navigation_maps.js
|
@@ -1 +0,0 @@
|
|
1
|
-
<svg height="35px" width="35px" fill="#000000" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" viewBox="0 1 511 511" style="enable-background:new 0 1 511 511;" xml:space="preserve"><g><path d="M205.6,146.9c-22.2,0-40.2,18-40.2,40.2c0,22.2,18,40.2,40.2,40.2c22.2,0,40.2-18,40.2-40.2 C245.9,165,227.8,146.9,205.6,146.9z M205.6,206.6c-10.7,0-19.3-8.7-19.3-19.3c0-10.7,8.7-19.3,19.3-19.3 c10.6,0,19.3,8.7,19.3,19.3C225,197.9,216.3,206.6,205.6,206.6z"/><path d="M406.6,178V70.3c0-5.8-4.2-10.1-10-10.1H10.6C4.8,60.3,0,64.6,0,70.3v304.9c0,5.8,4.8,10.9,10.6,10.9h242 c24.5,39.8,68.7,66.7,119.1,66.7c77,0,139.4-62.8,139.4-139.7C511,248.4,467.4,193.7,406.6,178z M21,365.2v-284h364.7v92.9 c-4.2-0.5-9.1-0.7-14-0.7c-0.3,0-0.6,0-0.6,0v-66.4c0-5.8-5-10-10.9-10H47.2c-5.8,0-10.5,4.2-10.5,10v231.8 c0,5.8,4.7,10.8,10.5,10.8h189.7c1.5,5.2,3.1,10.5,5.2,15.7H21z M232.9,328.6H57.6v-40.4l61.5-54.3c2.8-2.5,7-2.6,10-0.2l63.3,50.6 c10.7,8.6,26,8.4,36.5-0.5l7.6-6.5c-3,11.4-4.6,23.6-4.6,35.8C232,318.3,232.3,323.3,232.9,328.6z M215.7,267.8 c-2.8,2.4-7,2.4-10,0.1l-63.4-50.6c-10.9-8.7-26.5-8.4-37,0.9l-47.7,42V117.9H350v57.2c-37.7,6-70.1,26.8-91.4,56.4L215.7,267.8z M371.6,431.7C306.2,431.7,253,378.4,253,313s53.2-118.6,118.6-118.6c65.4,0,118.6,53.2,118.6,118.6 C490.4,378.4,437.1,431.7,371.6,431.7z"/><path d="M435.4,234c-34.8-34.6-91-34.6-125.6,0c-13.7,13.7-22.4,31.2-25,50.4c-2.5,18.5,0.9,37.8,9.9,54.4c0,0,0,0.1,0.1,0.1 c4.4,8,9.4,14.7,15.2,20.4l55.1,55.1c2,2,4.6,3,7.4,3s5.5-1.2,7.4-3l55.1-55.1c16.9-16.9,26.2-39.2,26.2-62.8 C461.4,273,452.2,250.7,435.4,234z M420.1,344.6l-47.7,47.7l-47.7-47.7c-4.4-4.4-8.2-9.5-11.6-15.7c-14.2-26.6-9.6-58.8,11.6-80.1 c26.4-26.4,69.4-26.4,95.8,0c12.8,12.8,19.8,29.8,19.7,47.7C440.2,314.6,433,331.7,420.1,344.6z"/><path d="M372.3,241.7c-29,0-52.7,23.7-52.7,52.7c0,29,23.7,52.7,52.7,52.7s52.7-23.7,52.7-52.7 C425.1,265.4,401.5,241.7,372.3,241.7z M372.3,326c-17.5,0-31.8-14.2-31.8-31.8c0-17.5,14.3-31.8,31.8-31.8 c17.5,0,31.8,14.3,31.8,31.8C404.1,311.8,389.9,326,372.3,326z"/></g></svg>
|
@@ -1,88 +0,0 @@
|
|
1
|
-
// Creates a map
|
2
|
-
//= require decidim/navigation_maps/map_view
|
3
|
-
|
4
|
-
function NavigationMapEditor(map_object, table_object) {
|
5
|
-
var self = this;
|
6
|
-
// Call constructor of superclass to initialize superclass-derived members.
|
7
|
-
NavigationMapView.call(self, map_object, function() {
|
8
|
-
self.createControls();
|
9
|
-
if(self.blueprint) {
|
10
|
-
self.createAreas();
|
11
|
-
}
|
12
|
-
});
|
13
|
-
self.table_object = table_object;
|
14
|
-
this.createAreaCallback = function () {};
|
15
|
-
this.editAreaCallback = function () {};
|
16
|
-
this.removeAreaCallback = function () {};
|
17
|
-
}
|
18
|
-
|
19
|
-
// NavigationMapEditor derives from NavigationMapView
|
20
|
-
NavigationMapEditor.prototype = Object.create(NavigationMapView.prototype);
|
21
|
-
NavigationMapEditor.prototype.constructor = NavigationMapEditor;
|
22
|
-
|
23
|
-
NavigationMapEditor.prototype.createControls = function() {
|
24
|
-
var self = this;
|
25
|
-
self.map.pm.addControls({
|
26
|
-
position: 'topleft',
|
27
|
-
drawCircle: false,
|
28
|
-
drawMarker: false,
|
29
|
-
drawCircleMarker: false,
|
30
|
-
drawPolyline: false,
|
31
|
-
cutPolygon: false
|
32
|
-
});
|
33
|
-
|
34
|
-
self.map.on('pm:create', function(e) {
|
35
|
-
var geojson = e.layer.toGeoJSON();
|
36
|
-
self.blueprint[e.layer._leaflet_id] = geojson;
|
37
|
-
self.attachEditorEvents(e.layer);
|
38
|
-
self.createAreaCallback(e.layer._leaflet_id, e.layer, self);
|
39
|
-
});
|
40
|
-
|
41
|
-
self.map.on('pm:remove', function(e) {
|
42
|
-
delete self.blueprint[e.layer._leaflet_id];
|
43
|
-
self.removeAreaCallback(e.layer._leaflet_id, e.layer, self);
|
44
|
-
});
|
45
|
-
};
|
46
|
-
|
47
|
-
NavigationMapEditor.prototype.editing = function() {
|
48
|
-
var pm = this.map.pm;
|
49
|
-
return pm.globalRemovalEnabled() || pm.globalDragModeEnabled() || pm.globalEditEnabled();
|
50
|
-
};
|
51
|
-
|
52
|
-
// register callback to handle area edits,removals and creations
|
53
|
-
NavigationMapView.prototype.onCreateArea = function(callback) {
|
54
|
-
this.createAreaCallback = callback;
|
55
|
-
};
|
56
|
-
NavigationMapView.prototype.onEditArea = function(callback) {
|
57
|
-
this.editAreaCallback = callback;
|
58
|
-
};
|
59
|
-
NavigationMapView.prototype.onRemoveArea = function(callback) {
|
60
|
-
this.removeCreateCallback = callback;
|
61
|
-
};
|
62
|
-
|
63
|
-
NavigationMapEditor.prototype.attachEditorEvents = function (layer) {
|
64
|
-
var self = this;
|
65
|
-
|
66
|
-
layer.on('mouseover', function(e) {
|
67
|
-
e.target.getElement().classList.add('selected')
|
68
|
-
});
|
69
|
-
|
70
|
-
layer.on('mouseout', function(e) {
|
71
|
-
e.target.getElement().classList.remove('selected')
|
72
|
-
});
|
73
|
-
|
74
|
-
layer.on('pm:edit', function(e) {
|
75
|
-
self.blueprint[e.target._leaflet_id] = e.target.toGeoJSON();
|
76
|
-
self.editAreaCallback(e.target._leaflet_id, e.target, self);
|
77
|
-
});
|
78
|
-
|
79
|
-
layer.on('click', function(e) {
|
80
|
-
if(!self.editing()) {
|
81
|
-
self.clickAreaCallback(e.target._leaflet_id, e.target, self);
|
82
|
-
}
|
83
|
-
});
|
84
|
-
};
|
85
|
-
|
86
|
-
NavigationMapEditor.prototype.getBlueprint = function () {
|
87
|
-
return this.blueprint;
|
88
|
-
};
|