decidim-navigation_maps 1.0.1 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e228cc94eee3b96290ccd2f50156f43b1a63b8186dc64e38a25a88489bd121be
4
- data.tar.gz: 597e8726199d2363007e79dc4cf6273134e624103f560d9328050a79b12ae638
3
+ metadata.gz: 3095b1ee4ac0d8128711b37b7a59bcc5eb0b42d4ffebfb0021bcc1b549c80dab
4
+ data.tar.gz: 468c412868fb61196861df0aeceef155551d8f83e4d58dc556778ecbd2ebed2e
5
5
  SHA512:
6
- metadata.gz: 7550cf1cb5f185cf3f08be289c16c367cde992a339bff165d590d763aa613763ceb13673da48980c0f1463a17b34180d6fadd086b04f9cfd9702ed5a7494b2cf
7
- data.tar.gz: 67288244baeecf271c36951d3b0a1d810723dc3d7f9f761878b7f63e06d8c49062af75ed29cb6953a78bef7bf5d92a5a1f0a001da44bb536bef153a48b200d3e
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.0.0"
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, 0.21.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
 
@@ -63,7 +63,7 @@
63
63
 
64
64
  .tabs-content {
65
65
  .map {
66
- height: 475px;
66
+ height: 700px;
67
67
  }
68
68
  .thumbnail {
69
69
  img {
@@ -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>
@@ -5,7 +5,7 @@
5
5
  <p>{{:description}}</p>
6
6
  <div class="map-info__button">
7
7
  <a href="{{:link}}" class="button button--sc">
8
- <%= t(".view") %>
8
+ <%= t("navigation_map.view", scope: "decidim.navigation_maps.content_blocks") %>
9
9
  </a>
10
10
  </div>
11
11
  </div>
@@ -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 ".info" %></a>
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 ".editor" %></a>
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 }) %>
@@ -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 ".add" %></a></li>
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>
@@ -33,3 +33,4 @@
33
33
  <%= render partial: "modal" %>
34
34
  <%= javascript_include_tag "decidim/navigation_maps/admin/navigation_maps" %>
35
35
  <%= stylesheet_link_tag "decidim/navigation_maps/admin/navigation_maps" %>
36
+ <% console %>
@@ -48,6 +48,7 @@ module Decidim
48
48
  def update_blueprint!(form)
49
49
  @blueprint.image = form.image if form.image.present?
50
50
  @blueprint.title = form.title
51
+ @blueprint.height = form.height
51
52
  @blueprint.description = form.description
52
53
  @blueprint.save!
53
54
  end
@@ -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
 
@@ -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
- - "decidim.components.navigation_maps.name"
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
@@ -32,6 +32,7 @@ ca:
32
32
  blueprint_image: Imatge del plànol
33
33
  description: Descripció
34
34
  editor: Editor del mapa
35
+ height: Alçada (px)
35
36
  id: Id
36
37
  image_missing: Si us plau, afegeix una imatge del plànol per començar
37
38
  info: Informació general
@@ -32,6 +32,7 @@ cs:
32
32
  blueprint_image: Obrázek plánu
33
33
  description: Popis
34
34
  editor: Editor mapy
35
+ height: Height (px)
35
36
  id: Id
36
37
  image_missing: Pro začátek přidejte obrázek plánu
37
38
  info: Obecné informace
@@ -33,6 +33,7 @@ en:
33
33
  blueprint_image: Blueprint image
34
34
  description: Description
35
35
  editor: Map Editor
36
+ height: Height (px)
36
37
  id: Id
37
38
  image_missing: Please add a blueprint image to start
38
39
  info: General info
@@ -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: Navigation Maps
27
+ name: Mapas interactivos
28
28
  navigation_map:
29
- view: Take part
29
+ view: Participar
30
30
  navigation_map_settings_form:
31
- add: Add
32
- blueprint_image: Blueprint image
33
- description: Description
34
- editor: Map 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: Please add a blueprint image to start
37
- info: General info
38
- link: Link
39
- remove_blueprint: Delete this blueprint
40
- title: Title
41
- type: Type
42
- upload_image: 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 creating blueprint
45
- success: Blueprint created successfully
45
+ error: Error al crear el plano
46
+ success: Plano creado correctamente
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddHeightToNavigationMapsBlueprints < ActiveRecord::Migration[5.2]
4
+ def change
5
+ add_column :decidim_navigation_maps_blueprints, :height, :integer, null: false, default: 475
6
+ end
7
+ end
@@ -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
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  # This holds the decidim-meetings version.
5
5
  module NavigationMaps
6
- VERSION = "1.0.1"
7
- DECIDIM_VERSION = [">= 0.18.0", "< 0.22"].freeze
6
+ VERSION = "1.1.0"
7
+ DECIDIM_VERSION = [">= 0.22", "< 0.24"].freeze
8
8
  end
9
9
  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.0.1
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 00:00:00.000000000 Z
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.18.0
19
+ version: '0.22'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '0.22'
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.18.0
29
+ version: '0.22'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '0.22'
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.18.0
39
+ version: '0.22'
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: '0.22'
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.18.0
49
+ version: '0.22'
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: '0.22'
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.18.0
59
+ version: '0.22'
60
60
  - - "<"
61
61
  - !ruby/object:Gem::Version
62
- version: '0.22'
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.18.0
69
+ version: '0.22'
70
70
  - - "<"
71
71
  - !ruby/object:Gem::Version
72
- version: '0.22'
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.5'
176
+ version: '2.6'
173
177
  required_rubygems_version: !ruby/object:Gem::Requirement
174
178
  requirements:
175
179
  - - ">="