decidim-navigation_maps 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -2
- data/app/assets/stylesheets/decidim/navigation_maps/admin/navigation_maps.scss +1 -1
- 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/_template.erb +1 -1
- data/app/cells/decidim/navigation_maps/content_blocks/navigation_map_settings_form/_form.erb +8 -6
- data/app/cells/decidim/navigation_maps/content_blocks/navigation_map_settings_form/_tabs.erb +1 -1
- data/app/cells/decidim/navigation_maps/content_blocks/navigation_map_settings_form/show.erb +1 -0
- data/app/commands/decidim/navigation_maps/save_blueprints.rb +1 -0
- data/app/forms/decidim/navigation_maps/blueprint_form.rb +2 -0
- data/app/models/decidim/navigation_maps/blueprint.rb +3 -1
- data/config/i18n-tasks.yml +12 -1
- data/config/locales/ca.yml +1 -0
- data/config/locales/cs.yml +1 -0
- data/config/locales/en.yml +1 -0
- data/config/locales/es.yml +16 -15
- data/db/migrate/20210112135817_add_height_to_navigation_maps_blueprints.rb +7 -0
- data/db/seeds.rb +103 -0
- data/db/seeds/antarctica.png +0 -0
- data/db/seeds/penguins.jpg +0 -0
- data/lib/decidim/navigation_maps/version.rb +2 -2
- metadata +19 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3095b1ee4ac0d8128711b37b7a59bcc5eb0b42d4ffebfb0021bcc1b549c80dab
|
4
|
+
data.tar.gz: 468c412868fb61196861df0aeceef155551d8f83e4d58dc556778ecbd2ebed2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b440bff8af84241131b5e5c11c0b8567d1667a379d1156ca0d3b49c96992366ec304bc394aa8e7382efd38b05d22908471cdf98daf1a181c6b6de436d13abe9b
|
7
|
+
data.tar.gz: af9064b540070fe4cb45b242a2445d8170f7bfda68457fc4ad5a3eae917d0254afc55c9241c30278bad64115783357c2cbdc645ec97289b5a95380373d42c71f
|
data/README.md
CHANGED
@@ -15,6 +15,8 @@ homepage only).
|
|
15
15
|
|
16
16
|
👉 [Check the usage guide here!](USAGE.md)
|
17
17
|
|
18
|
+
![Homepage](examples/homepage.png)
|
19
|
+
|
18
20
|
![Admin editor](examples/admin.gif)
|
19
21
|
|
20
22
|
## Installation
|
@@ -22,7 +24,7 @@ homepage only).
|
|
22
24
|
Add this line to your application's Gemfile:
|
23
25
|
|
24
26
|
```ruby
|
25
|
-
gem "decidim-navigation_maps", "~> 1.
|
27
|
+
gem "decidim-navigation_maps", "~> 1.1.0"
|
26
28
|
```
|
27
29
|
|
28
30
|
And then execute:
|
@@ -37,7 +39,8 @@ Depending on your Decidim version, choose the corresponding Plugin version to en
|
|
37
39
|
|
38
40
|
| Navigation Maps version | Compatible Decidim versions |
|
39
41
|
|---|---|
|
40
|
-
| 1.0.x | 0.18.x
|
42
|
+
| 1.0.x | 0.18.x - 0.21.x |
|
43
|
+
| 1.1.x | 0.22.x, 0.23.x |
|
41
44
|
|
42
45
|
## Contributing
|
43
46
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<div class="tabs-content admin" data-tabs-content="navigation_maps-tabs">
|
3
3
|
<% tabs.each_with_index do |item, index| %>
|
4
4
|
<div class="tabs-panel<%= " is-active" if index.zero? %>" id="map<%= index %>">
|
5
|
-
<%= content_tag(:div, "", id: "navigation_maps-map-#{item.id}", class: "map", data: { id: item.id, image: item.image.url, blueprint: item.blueprint }) %>
|
5
|
+
<%= content_tag(:div, "", id: "navigation_maps-map-#{item.id}", class: "map", style: "height: #{item.height}px", data: { id: item.id, image: item.image.url, blueprint: item.blueprint }) %>
|
6
6
|
</div>
|
7
7
|
<% end %>
|
8
8
|
</div>
|
data/app/cells/decidim/navigation_maps/content_blocks/navigation_map_settings_form/_form.erb
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
<ul class="accordion" data-accordion>
|
2
2
|
<li class="accordion-item<%= " is-active" unless form.image? %>" data-accordion-item>
|
3
|
-
<a href="#" class="accordion-title"><%= t
|
3
|
+
<a href="#" class="accordion-title"><%= t("navigation_map_settings_form.info", scope: "decidim.navigation_maps.content_blocks") %></a>
|
4
4
|
|
5
5
|
<div class="accordion-content" data-tab-content>
|
6
|
-
<%= translated_field_tag :text_field_tag, "blueprints[#{form.ident}]", :title, form.title, { tabs_id: "blueprints_#{form.ident}_title", label: t(".title") } %>
|
6
|
+
<%= translated_field_tag :text_field_tag, "blueprints[#{form.ident}]", :title, form.title, { tabs_id: "blueprints_#{form.ident}_title", label: t("navigation_map_settings_form.title", scope: "decidim.navigation_maps.content_blocks") } %>
|
7
|
+
<%= label_tag t("navigation_map_settings_form.height", scope: "decidim.navigation_maps.content_blocks") %>
|
8
|
+
<%= text_field_tag "blueprints[#{form.ident}][height]", form.height, { id: "blueprints_#{form.ident}_height" } %>
|
7
9
|
|
8
|
-
<%= label_tag t(".blueprint_image") %>
|
10
|
+
<%= label_tag t("navigation_map_settings_form.blueprint_image", scope: "decidim.navigation_maps.content_blocks") %>
|
9
11
|
<div class="thumbnail">
|
10
12
|
<%= image_tag form.image.thumbnail.url if form.image? %>
|
11
13
|
</div>
|
12
|
-
<%= file_field_tag "blueprints[#{form.ident}][image]", { id: "blueprints_#{form.ident}_image", label: t(".title") } %>
|
14
|
+
<%= file_field_tag "blueprints[#{form.ident}][image]", { id: "blueprints_#{form.ident}_image", label: t("navigation_map_settings_form.title", scope: "decidim.navigation_maps.content_blocks") } %>
|
13
15
|
|
14
16
|
<%= hidden_field_tag "blueprints[#{form.ident}][id]", form.id, { id: "blueprints_#{form.ident}_id" } %>
|
15
17
|
<%= hidden_field_tag "blueprints[#{form.ident}][blueprint]", form.blueprint.to_json, { id: "blueprints_#{form.ident}_blueprint" } %>
|
@@ -17,7 +19,7 @@
|
|
17
19
|
<% if form.id %>
|
18
20
|
<label class="delete-tab">
|
19
21
|
<%= check_box_tag("blueprints[#{form.ident}][remove]", form.id) %>
|
20
|
-
<%= t(".remove_blueprint") %>
|
22
|
+
<%= t("navigation_map_settings_form.remove_blueprint", scope: "decidim.navigation_maps.content_blocks") %>
|
21
23
|
</label>
|
22
24
|
<% end %>
|
23
25
|
</div>
|
@@ -25,7 +27,7 @@
|
|
25
27
|
|
26
28
|
<% if form.image? %>
|
27
29
|
<li class="accordion-item is-active" data-accordion-item>
|
28
|
-
<a href="#" class="accordion-title"><%= t
|
30
|
+
<a href="#" class="accordion-title"><%= t("navigation_map_settings_form.editor", scope: "decidim.navigation_maps.content_blocks") %></a>
|
29
31
|
<div class="accordion-content navigation_maps-content" data-tab-content>
|
30
32
|
|
31
33
|
<%= content_tag(:div, "", id: "navigation_maps-map-#{form.ident}", class: "map", data: { id: form.ident, image: form.image.url, blueprint: form.blueprint }) %>
|
data/app/cells/decidim/navigation_maps/content_blocks/navigation_map_settings_form/_tabs.erb
CHANGED
@@ -2,5 +2,5 @@
|
|
2
2
|
<% tabs.each_with_index do |item, index| %>
|
3
3
|
<li class="tabs-title<%= " is-active" if index.zero? %>"><a data-tabs-target="map<%= index %>" href="#map<%= index %>"><%= translated_attribute(item.title).presence || "Tab #{index + 1}" %></a></li>
|
4
4
|
<% end %>
|
5
|
-
<li class="tabs-title"><a href="#map-new">+ <%= t
|
5
|
+
<li class="tabs-title"><a href="#map-new">+ <%= t("navigation_map_settings_form.add", scope: "decidim.navigation_maps.content_blocks") %></a></li>
|
6
6
|
</ul>
|
@@ -15,9 +15,11 @@ module Decidim
|
|
15
15
|
attribute :image
|
16
16
|
translatable_attribute :title, String
|
17
17
|
translatable_attribute :description, String
|
18
|
+
attribute :height, Integer
|
18
19
|
|
19
20
|
# validate :check_image_or_blueprint
|
20
21
|
validates :title, translatable_presence: true
|
22
|
+
validates :height, numericality: { greater_than: 0 }
|
21
23
|
|
22
24
|
# def check_image_or_blueprint
|
23
25
|
# return if image.present? || blueprint.present?
|
@@ -6,6 +6,8 @@ module Decidim
|
|
6
6
|
class Blueprint < ApplicationRecord
|
7
7
|
self.table_name = "decidim_navigation_maps_blueprints"
|
8
8
|
|
9
|
+
attribute :height, :integer, default: 475
|
10
|
+
|
9
11
|
belongs_to :organization, foreign_key: :decidim_organization_id, class_name: "Decidim::Organization"
|
10
12
|
has_many :areas,
|
11
13
|
foreign_key: "decidim_navigation_maps_blueprint_id",
|
@@ -14,8 +16,8 @@ module Decidim
|
|
14
16
|
|
15
17
|
validates :organization, presence: true
|
16
18
|
validates :image,
|
17
|
-
file_size: { less_than_or_equal_to: ->(_record) { Decidim.maximum_attachment_size } },
|
18
19
|
file_content_type: { allow: ["image/jpeg", "image/png", "image/svg+xml"] }
|
20
|
+
validates :height, numericality: { greater_than: 0 }
|
19
21
|
|
20
22
|
mount_uploader :image, Decidim::NavigationMaps::BlueprintUploader
|
21
23
|
|
data/config/i18n-tasks.yml
CHANGED
@@ -3,8 +3,19 @@
|
|
3
3
|
base_locale: en
|
4
4
|
locales: [en]
|
5
5
|
|
6
|
+
# Read and write translations.
|
7
|
+
data:
|
8
|
+
yaml:
|
9
|
+
write:
|
10
|
+
# do not wrap lines at 80 characters
|
11
|
+
line_width: -1
|
12
|
+
|
6
13
|
ignore_unused:
|
7
|
-
-
|
14
|
+
- decidim.components.navigation_maps.name
|
15
|
+
- decidim.navigation_maps.content_blocks.name
|
16
|
+
- decidim.navigation_maps.content_blocks.navigation_map_settings_form.*
|
8
17
|
|
18
|
+
# these keys are reused from decidim core
|
9
19
|
ignore_missing:
|
10
20
|
- decidim.participatory_processes.scopes.global
|
21
|
+
- decidim.content_blocks.html.html_content
|
data/config/locales/ca.yml
CHANGED
data/config/locales/cs.yml
CHANGED
data/config/locales/en.yml
CHANGED
data/config/locales/es.yml
CHANGED
@@ -24,22 +24,23 @@ es:
|
|
24
24
|
error: Se ha producido un error al guardar el área
|
25
25
|
success: Área guardada correctamente
|
26
26
|
content_blocks:
|
27
|
-
name:
|
27
|
+
name: Mapas interactivos
|
28
28
|
navigation_map:
|
29
|
-
view:
|
29
|
+
view: Participar
|
30
30
|
navigation_map_settings_form:
|
31
|
-
add:
|
32
|
-
blueprint_image:
|
33
|
-
description:
|
34
|
-
editor:
|
31
|
+
add: Añadir
|
32
|
+
blueprint_image: Imagen del plano
|
33
|
+
description: Descripción
|
34
|
+
editor: Editor de Mapa
|
35
|
+
height: Altura (px)
|
35
36
|
id: Id
|
36
|
-
image_missing:
|
37
|
-
info:
|
38
|
-
link:
|
39
|
-
remove_blueprint:
|
40
|
-
title:
|
41
|
-
type:
|
42
|
-
upload_image:
|
37
|
+
image_missing: Por favor, añade una imagen del plano para empezar
|
38
|
+
info: Información general
|
39
|
+
link: Enlace
|
40
|
+
remove_blueprint: Eliminar este plano
|
41
|
+
title: Título
|
42
|
+
type: Tipo
|
43
|
+
upload_image: Subir imagen
|
43
44
|
create:
|
44
|
-
error: Error
|
45
|
-
success:
|
45
|
+
error: Error al crear el plano
|
46
|
+
success: Plano creado correctamente
|
data/db/seeds.rb
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
if !Rails.env.production? || ENV["SEED"]
|
4
|
+
print "Creating seeds for decidim_navigation maps...\n" unless Rails.env.test?
|
5
|
+
|
6
|
+
require "decidim/faker/localized"
|
7
|
+
seeds_root = File.join(__dir__, "seeds")
|
8
|
+
|
9
|
+
organization = Decidim::Organization.first
|
10
|
+
|
11
|
+
Decidim::ContentBlock.create(
|
12
|
+
decidim_organization_id: organization.id,
|
13
|
+
weight: 1,
|
14
|
+
scope_name: :homepage,
|
15
|
+
manifest_name: :navigation_map,
|
16
|
+
published_at: Time.current,
|
17
|
+
settings: { title: Decidim::Faker::Localized.sentence(5) }
|
18
|
+
)
|
19
|
+
|
20
|
+
blueprint1 = Decidim::NavigationMaps::Blueprint.create(
|
21
|
+
organization: organization,
|
22
|
+
image: File.new(File.join(seeds_root, "antarctica.png")),
|
23
|
+
title: Decidim::Faker::Localized.sentence(2),
|
24
|
+
description: Decidim::Faker::Localized.sentence(10)
|
25
|
+
)
|
26
|
+
|
27
|
+
Decidim::NavigationMaps::Blueprint.create(
|
28
|
+
organization: organization,
|
29
|
+
image: File.new(File.join(seeds_root, "penguins.jpg")),
|
30
|
+
title: Decidim::Faker::Localized.sentence(2),
|
31
|
+
description: Decidim::Faker::Localized.sentence(10)
|
32
|
+
)
|
33
|
+
|
34
|
+
Decidim::NavigationMaps::BlueprintArea.create(
|
35
|
+
blueprint: blueprint1,
|
36
|
+
area_id: "10",
|
37
|
+
area_type: "Feature",
|
38
|
+
area: {
|
39
|
+
type: "Polygon",
|
40
|
+
coordinates: [[
|
41
|
+
[717.21875, 277.162511],
|
42
|
+
[717.21875, 317.104475],
|
43
|
+
[758.029018, 317.104475],
|
44
|
+
[758.029018, 277.162511],
|
45
|
+
[717.21875, 277.162511]
|
46
|
+
]]
|
47
|
+
},
|
48
|
+
link: "https://en.wikipedia.org/wiki/South_Pole",
|
49
|
+
link_type: "link",
|
50
|
+
color: "#ff2a00",
|
51
|
+
title: { en: "South Pole" },
|
52
|
+
description: { en: "It's cold in here" }
|
53
|
+
)
|
54
|
+
|
55
|
+
Decidim::NavigationMaps::BlueprintArea.create(
|
56
|
+
blueprint: blueprint1,
|
57
|
+
area_id: "11",
|
58
|
+
area_type: "Feature",
|
59
|
+
area: {
|
60
|
+
type: "Polygon",
|
61
|
+
coordinates: [[
|
62
|
+
[376.84375, 516.814296],
|
63
|
+
[384.658482, 464.716082],
|
64
|
+
[411.575893, 432.58885],
|
65
|
+
[438.493304, 416.091082],
|
66
|
+
[425.46875, 402.198225],
|
67
|
+
[436.756696, 383.095546],
|
68
|
+
[428.941964, 375.280814],
|
69
|
+
[448.912946, 358.783046],
|
70
|
+
[462.805804, 367.466082],
|
71
|
+
[486.25, 373.544207],
|
72
|
+
[526.191964, 416.091082],
|
73
|
+
[450.649554, 448.218314],
|
74
|
+
[401.15625, 484.687064],
|
75
|
+
[376.84375, 516.814296]
|
76
|
+
]]
|
77
|
+
},
|
78
|
+
link: "#map1",
|
79
|
+
link_type: "link",
|
80
|
+
color: "#ffbb00",
|
81
|
+
title: { en: "Penguins" },
|
82
|
+
description: { en: "Penguins are beatiful animals" }
|
83
|
+
)
|
84
|
+
|
85
|
+
Decidim::NavigationMaps::BlueprintArea.create(
|
86
|
+
blueprint: blueprint1,
|
87
|
+
area_id: "12",
|
88
|
+
area_type: "Feature",
|
89
|
+
area: {
|
90
|
+
type: "Polygon",
|
91
|
+
coordinates: [[
|
92
|
+
[1068.013393, 418.695993],
|
93
|
+
[1023.729911, 412.617868],
|
94
|
+
[1025.466518, 343.153582],
|
95
|
+
[1104.482143, 324.050903],
|
96
|
+
[1045.4375, 379.622332],
|
97
|
+
[1068.013393, 418.695993]
|
98
|
+
]]
|
99
|
+
},
|
100
|
+
link: "#map1",
|
101
|
+
link_type: "direct"
|
102
|
+
)
|
103
|
+
end
|
Binary file
|
Binary file
|
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.0
|
4
|
+
version: 1.1.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: 2021-01-
|
11
|
+
date: 2021-01-12 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.22'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '0.
|
22
|
+
version: '0.24'
|
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.22'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '0.
|
32
|
+
version: '0.24'
|
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.22'
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '0.
|
42
|
+
version: '0.24'
|
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.22'
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: '0.
|
52
|
+
version: '0.24'
|
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.22'
|
60
60
|
- - "<"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '0.
|
62
|
+
version: '0.24'
|
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.22'
|
70
70
|
- - "<"
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: '0.
|
72
|
+
version: '0.24'
|
73
73
|
description: Allows to map processes to image parts using maps.
|
74
74
|
email:
|
75
75
|
- ivan@platoniq.net
|
@@ -131,6 +131,10 @@ files:
|
|
131
131
|
- db/migrate/20191126045831_add_link_type_to_decidim_navigation_maps_blueprint_areas.rb
|
132
132
|
- db/migrate/20191126154019_add_area_id_to_decidim_navigation_maps_blueprint_areas.rb
|
133
133
|
- db/migrate/20191127093746_add_color_to_navigation_maps_blueprint_areas.rb
|
134
|
+
- db/migrate/20210112135817_add_height_to_navigation_maps_blueprints.rb
|
135
|
+
- db/seeds.rb
|
136
|
+
- db/seeds/antarctica.png
|
137
|
+
- db/seeds/penguins.jpg
|
134
138
|
- lib/decidim/navigation_maps.rb
|
135
139
|
- lib/decidim/navigation_maps/admin.rb
|
136
140
|
- lib/decidim/navigation_maps/admin_engine.rb
|
@@ -169,7 +173,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
169
173
|
requirements:
|
170
174
|
- - ">="
|
171
175
|
- !ruby/object:Gem::Version
|
172
|
-
version: '2.
|
176
|
+
version: '2.6'
|
173
177
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
178
|
requirements:
|
175
179
|
- - ">="
|