decidim-core 0.25.0.rc1 → 0.25.0.rc2

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: 439b8a5979b3c9f5853b9cb3720dc06126e02b0ff35d035f805e55e949f2538d
4
- data.tar.gz: 4254bb83ac96d7e010637444e314053530d795443141f35359a8fe4185db6d86
3
+ metadata.gz: 4f79ffb8df1322e287abbc21fa43fae864cd76b7505c56ef58fcca6832e24d65
4
+ data.tar.gz: ac09f979e6e0594e05e591b4d8ca6524301d9ee445fdebb0e76be572f04e6a32
5
5
  SHA512:
6
- metadata.gz: 214ed5e5165e86efe8919bf98301c5cc2a6107299dc94aa30aa37fad64b6511276f8a81bf387527b7ecda013d064ad536d5a2db76fa2fdbc8818433b33ad369d
7
- data.tar.gz: ab54e8cd03bf5c383f4993a52c491fb061b1a5422551640680aaa713c5960b6263446720d1c9f6e284bc03eefc41aba7619603ad444cfe3c7eb5558fc2901cf7
6
+ metadata.gz: 4afd6c6ecfadff2d1237451bd8e112053f20f55ac42e3035a7557d8d4a667060ffb82d098c6134ffacc0b4736ab40896ab03b596664188510bff859b878b07db
7
+ data.tar.gz: c3d2ff88bdcef9ebe353035eba87992f236dd45496c68f274bbf945dddf3197e760bb5d249facd71b5003865a729b27f0c7d87f1d345ca6cfea9f6ff98bb8480
@@ -37,7 +37,12 @@ export default class ExternalLink {
37
37
  }
38
38
 
39
39
  this.$link.addClass("external-link-container");
40
- this.$link.append(` ${this.generateElement()}`);
40
+ let spacer = " ";
41
+ if (this.$link.text().trim().length < 1) {
42
+ // Fixes image links extra space
43
+ spacer = "";
44
+ }
45
+ this.$link.append(`${spacer}${this.generateElement()}`);
41
46
  }
42
47
 
43
48
  generateElement() {
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Luxembourgish localisation
3
+ */
4
+ ;(function(jQuery) {
5
+ jQuery.fn.fdatepicker.dates.lb = {
6
+ days: ["Sonndeg", "Méindeg", "Dënschdeg", "Mëttwoch", "Donneschdeg", "Freideg", "Samschdeg", "Sonndeg"],
7
+ daysShort: ["Son", "Méi", "Dën", "Mët", "Don", "Fre", "Sam", "Son"],
8
+ daysMin: ["So", "Mé", "Dë", "Më", "Do", "Fr", "Sa", "So"],
9
+ months: ["Januar", "Februar", "Mäerz", "Abrëll", "Mee", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"],
10
+ monthsShort: ["Jan", "Febr", "Mrz", "Abr", "Mee", "Jun", "Jul", "Aug", "Sept", "Okt", "Nov", "Dez"],
11
+ today: "Haut"
12
+ };
13
+ }(jQuery));
@@ -63,3 +63,5 @@ import "foundation-datepicker/js/locales/foundation-datepicker.vi"
63
63
  import "foundation-datepicker/js/locales/foundation-datepicker.zh-CN"
64
64
  import "foundation-datepicker/js/locales/foundation-datepicker.zh-TW"
65
65
 
66
+ import "src/decidim/foundation-datepicker/js/locales/foundation-datepicker.lb"
67
+
@@ -13,7 +13,6 @@ const DEFAULT_ATTRIBUTES = {
13
13
  */
14
14
  export default function icon(iconKey, attributes = {}) {
15
15
  const iconAttributes = $.extend(DEFAULT_ATTRIBUTES, attributes);
16
- const corsMode = window.Decidim.config.get("cors_enabled");
17
16
  const title = iconAttributes.title || iconAttributes.ariaLabel;
18
17
  Reflect.deleteProperty(iconAttributes, "title");
19
18
 
@@ -30,11 +29,7 @@ export default function icon(iconKey, attributes = {}) {
30
29
  }
31
30
  });
32
31
 
33
- let iconsPath = ""
34
- if (corsMode === true) {
35
- iconsPath = window.Decidim.config.get("icons_path");
36
- }
37
-
32
+ const iconsPath = window.Decidim.config.get("icons_path");
38
33
  const elHtml = `<svg><use href="${iconsPath}#icon-${iconKey}"></use></svg>`;
39
34
  const $el = $(elHtml);
40
35
  if (title) {
@@ -110,12 +110,7 @@ $(() => {
110
110
  menuItemTemplate: function(item) {
111
111
  let svg = "";
112
112
  if (window.Decidim && item.original.__typename === "UserGroup") {
113
- let corsMode = window.Decidim.config.get("cors_enabled");
114
-
115
- let iconsPath = ""
116
- if (corsMode === true) {
117
- iconsPath = window.Decidim.config.get("icons_path");
118
- }
113
+ const iconsPath = window.Decidim.config.get("icons_path");
119
114
 
120
115
  svg = `<span class="is-group">${item.original.membersCount}x <svg class="icon--members icon"><use href="${iconsPath}#icon-members"/></svg></span>`;
121
116
  }
@@ -121,8 +121,7 @@ $(() => {
121
121
  let enabled = item.original.directMessagesEnabled === "true";
122
122
  if (window.Decidim && item.original.__typename === "UserGroup") {
123
123
  enabled = true;
124
- let corsMode = window.Decidim.config.get("cors_enabled");
125
- let iconsPath = corsMode ? "" : window.Decidim.config.get("icons_path");
124
+ const iconsPath = window.Decidim.config.get("icons_path");
126
125
  svg = `<span class="is-group">${item.original.membersCount}x <svg class="icon--members icon"><use href="${iconsPath}#icon-members"/></svg></span>`;
127
126
  }
128
127
  let disabledElementClass = enabled ? "" : "disabled-tribute-element";
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ # A presenter to render attributes for resources
5
+ class ResourcePresenter < SimpleDelegator
6
+ include Decidim::TranslatableAttributes
7
+ include Decidim::SanitizeHelper
8
+
9
+ def title(resource_title, links, html_escape, all_locales, extras: true)
10
+ handle_locales(resource_title, all_locales) do |content|
11
+ content = decidim_html_escape(content) if html_escape
12
+
13
+ renderer = Decidim::ContentRenderers::HashtagRenderer.new(content)
14
+ renderer.render(links: links, extras: extras).html_safe
15
+ end
16
+ end
17
+
18
+ def handle_locales(content, all_locales, &block)
19
+ if all_locales
20
+ content.each_with_object({}) do |(key, value), parsed_content|
21
+ parsed_content[key] = if key == "machine_translations"
22
+ handle_locales(value, all_locales, &block)
23
+ else
24
+ block.call(value)
25
+ end
26
+ end
27
+ else
28
+ yield(translated_attribute(content))
29
+ end
30
+ end
31
+ end
32
+ end
@@ -75,9 +75,14 @@ module Decidim
75
75
  #
76
76
  # Returns an array of hashes.
77
77
  def generate_i18n_changeset(attribute, values, type)
78
- values.map! { |value| value.is_a?(String) ? JSON.parse(value) : value }
78
+ values.map! do |value|
79
+ value = value.is_a?(String) ? JSON.parse(value) : value
80
+ value.is_a?(Hash) ? value : { I18n.default_locale.to_s => value }
81
+ rescue JSON::ParserError
82
+ { I18n.default_locale.to_s => value }
83
+ end
79
84
 
80
- locales = values[0].to_h.keys | values[1].to_h.keys
85
+ locales = values[0].keys | values[1].keys
81
86
  locales.flat_map do |locale|
82
87
  previous_value = values.first.try(:[], locale)
83
88
  new_value = values.last.try(:[], locale)
@@ -21,7 +21,7 @@
21
21
  <%= stylesheet_pack_tag "decidim_core", media: "all" %>
22
22
  <%= invisible_captcha_styles %>
23
23
  <%= organization_colors %>
24
- <%= javascript_pack_tag "decidim_core" %>
24
+ <%= javascript_pack_tag "decidim_core", defer: false %>
25
25
 
26
26
  <%= render partial: "layouts/decidim/head_extra" %>
27
27
  <%== current_organization.header_snippets if Decidim.enable_html_header_snippets %>
@@ -1,7 +1,6 @@
1
1
  <%
2
2
  js_configs = {
3
- cors_enabled: Decidim.cors_enabled,
4
- icons_path: asset_pack_path("media/images/icons.svg"),
3
+ icons_path: Decidim.cors_enabled ? "" : asset_pack_path("media/images/icons.svg"),
5
4
  messages: {
6
5
  "selfxssWarning": {
7
6
  title: t("decidim.security.selfxss_warning.title"),
@@ -33,12 +32,4 @@ validator_messages = {
33
32
  Decidim.InputCharacterCounter.configureMessages(<%== character_messages.to_json %>);
34
33
  Decidim.ExternalLink.configureMessages(<%== external_link_messages.to_json %>);
35
34
  Decidim.FormValidator.configureMessages(<%== validator_messages.to_json %>);
36
- DecidimComments = {
37
- assets: {
38
- 'icons.svg': "<%= asset_pack_path "media/images/icons.svg" %>"
39
- }
40
- }
41
- Decidim.assets = {
42
- 'icons.svg': "<%= asset_pack_path "media/images/icons.svg" %>"
43
- }
44
35
  </script>
@@ -4,7 +4,7 @@
4
4
  <a rel="license noopener" class="cc-badge"
5
5
  href="http://creativecommons.org/licenses/by-sa/4.0/"
6
6
  target="_blank">
7
- <%= image_pack_tag("cc-badge.png", alt: t("layouts.decidim.footer.cc_by_license")) %>
7
+ <%= image_pack_tag("media/images/cc-badge.png", alt: t("layouts.decidim.footer.cc_by_license")) %>
8
8
  </a>
9
9
  <%= t("layouts.decidim.footer.made_with_open_source").html_safe %>
10
10
  </div>
@@ -13,7 +13,7 @@
13
13
  <a rel="decidim noopener"
14
14
  href="https://decidim.org/"
15
15
  target="_blank">
16
- <%= image_pack_tag("decidim-logo.svg", alt: t("layouts.decidim.footer.decidim_logo")) %>
16
+ <%= image_pack_tag("media/images/decidim-logo.svg", alt: t("layouts.decidim.footer.decidim_logo")) %>
17
17
  </a>
18
18
  </div>
19
19
  </div>
@@ -4,7 +4,7 @@
4
4
  <title><%= decidim_page_title %></title>
5
5
  <%= csrf_meta_tags %>
6
6
  <%= stylesheet_pack_tag "decidim_core" %>
7
- <%= javascript_pack_tag "decidim_core" %>
7
+ <%= javascript_pack_tag "decidim_core", defer: false %>
8
8
  </head>
9
9
 
10
10
  <body class="widget">
@@ -68,7 +68,7 @@ shared_context "with frontend map elements" do
68
68
  <head>
69
69
  <title>Map Test</title>
70
70
  #{stylesheet_pack_tag "decidim_core"}
71
- #{javascript_pack_tag "decidim_core"}
71
+ #{javascript_pack_tag "decidim_core", defer: false}
72
72
  #{builder.stylesheet_snippets}
73
73
  #{builder.javascript_snippets}
74
74
  #{head_extra}
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-core version.
5
5
  module Core
6
6
  def self.version
7
- "0.25.0.rc1"
7
+ "0.25.0.rc2"
8
8
  end
9
9
  end
10
10
  end
data/lib/decidim/core.rb CHANGED
@@ -157,7 +157,7 @@ module Decidim
157
157
 
158
158
  # Exposes a configuration option: The application available locales.
159
159
  config_accessor :available_locales do
160
- %w(en bg ar ca cs da de el eo es es-MX es-PY et eu fi-pl fi fr fr-CA ga gl hr hu id is it ja ko lt lv mt nl no pl pt pt-BR ro ru sk sl sr sv tr uk vi zh-CN zh-TW)
160
+ %w(en bg ar ca cs da de el eo es es-MX es-PY et eu fi-pl fi fr fr-CA ga gl hr hu id is it ja ko lb lt lv mt nl no pl pt pt-BR ro ru sk sl sr sv tr uk vi zh-CN zh-TW)
161
161
  end
162
162
 
163
163
  # Exposes a configuration option: The application default locale.
@@ -81,7 +81,7 @@ module Decidim
81
81
 
82
82
  # @see Decidim::Map::View::Builder#javascript_snippets
83
83
  def javascript_snippets
84
- template.javascript_pack_tag("decidim_map_provider_default")
84
+ template.javascript_pack_tag("decidim_map_provider_default", defer: false)
85
85
  end
86
86
  end
87
87
  end
@@ -10,7 +10,7 @@ module Decidim
10
10
  class Builder < Decidim::Map::Autocomplete::Builder
11
11
  # @see Decidim::Map::FrontendUtility::Builder#javascript_snippets
12
12
  def javascript_snippets
13
- template.javascript_pack_tag("decidim_geocoding_provider_here")
13
+ template.javascript_pack_tag("decidim_geocoding_provider_here", defer: false)
14
14
  end
15
15
  end
16
16
  end
@@ -10,7 +10,7 @@ module Decidim
10
10
  class Builder < Decidim::Map::Autocomplete::Builder
11
11
  # @see Decidim::Map::FrontendUtility::Builder#javascript_snippets
12
12
  def javascript_snippets
13
- template.javascript_pack_tag("decidim_geocoding_provider_photon")
13
+ template.javascript_pack_tag("decidim_geocoding_provider_photon", defer: false)
14
14
  end
15
15
  end
16
16
  end
@@ -41,7 +41,7 @@ module Decidim
41
41
  class Builder < Decidim::Map::DynamicMap::Builder
42
42
  # @see Decidim::Map::DynamicMap::Builder#javascript_snippets
43
43
  def javascript_snippets
44
- template.javascript_pack_tag("decidim_map_provider_here")
44
+ template.javascript_pack_tag("decidim_map_provider_here", defer: false)
45
45
  end
46
46
  end
47
47
  end
@@ -29,29 +29,26 @@ development:
29
29
  # Notice that we use a different port (to prevent blocking the default one) as
30
30
  # there will be at least two webpack servers running
31
31
  port: 3035
32
- public: localhost:3035
33
- # Inject browserside javascript that required by both HMR and Live(full) reload
34
- inject_client: true
35
32
  # Hot Module Replacement updates modules while the application is running without a full reload
36
33
  hmr: false
37
- # Inline should be set to true if using HMR; it inserts a script to take care of live reloading
38
- inline: true
39
- # Should we show a full-screen overlay in the browser when there are compiler errors or warnings?
40
- overlay: true
34
+ client:
35
+ # Should we show a full-screen overlay in the browser when there are compiler errors or warnings?
36
+ overlay: true
37
+ # May also be a string
38
+ # webSocketURL:
39
+ # hostname: "0.0.0.0"
40
+ # pathname: "/ws"
41
+ # port: 8080
41
42
  # Should we use gzip compression?
42
43
  compress: true
43
44
  # Note that apps that do not check the host are vulnerable to DNS rebinding attacks
44
- disable_host_check: true
45
- # This option lets the browser open with your local IP
46
- use_local_ip: false
47
- # When enabled, nothing except the initial startup information will be written to the console.
48
- # This also means that errors or warnings from webpack are not visible.
49
- quiet: false
50
- pretty: false
45
+ allowed_hosts: "all"
46
+ pretty: true
51
47
  headers:
52
48
  'Access-Control-Allow-Origin': '*'
53
- watch_options:
54
- ignored: '**/node_modules/**'
49
+ static:
50
+ watch:
51
+ ignored: '**/node_modules/**'
55
52
 
56
53
  test:
57
54
  <<: *default
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This is overridden because of a bug in Rails 6.0 which forces the yarn:install
4
+ # task to the end of assets:precompile task which fails when bin/yarn has been
5
+ # removed from Decidim applications. This should be fixed with Rails 6.1.
6
+ #
7
+ # See:
8
+ # https://git.io/JEH9s (and the equivalent line in Rails 6.1)
9
+ # https://github.com/rails/rails/commit/87e9ae053d661daa3b8549e1cc9ea5ecd3b8ad62
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "decidim/gem_manager"
4
+
3
5
  namespace :decidim do
4
6
  namespace :webpacker do
5
7
  desc "Installs Decidim webpacker files in Rails instance application"
@@ -74,8 +76,8 @@ namespace :decidim do
74
76
  if decidim_gemspec.source.is_a?(Bundler::Source::Rubygems)
75
77
  if released_version?
76
78
  return {
77
- dev: "@decidim/dev@~#{decidim_gemspec.version}",
78
- prod: "@decidim/all@~#{decidim_gemspec.version}"
79
+ dev: "@decidim/dev@~#{Decidim::GemManager.semver_friendly_version(decidim_gemspec.version.to_s)}",
80
+ prod: "@decidim/all@~#{Decidim::GemManager.semver_friendly_version(decidim_gemspec.version.to_s)}"
79
81
  }
80
82
  else
81
83
  gem_path = Pathname(decidim_gemspec.full_gem_path)
@@ -164,3 +166,10 @@ if (config_path = Decidim::Webpacker.configuration.configuration_file)
164
166
  config_path: Pathname.new(config_path)
165
167
  )
166
168
  end
169
+
170
+ # Remove the yarn install prerequisity from assets:precompile
171
+ Rake::Task["assets:precompile"].prerequisites.delete("webpacker:yarn_install")
172
+
173
+ # Add gem overrides path to the beginning in order to override rake tasks
174
+ # Needed because of a bug in Rails 6.0 (see the overridden task for details)
175
+ $LOAD_PATH.unshift "#{Gem.loaded_specs["decidim-core"].full_gem_path}/lib/gem_overrides"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.0.rc1
4
+ version: 0.25.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-07-28 00:00:00.000000000 Z
13
+ date: 2021-09-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: active_link_to
@@ -762,20 +762,14 @@ dependencies:
762
762
  requirements:
763
763
  - - "~>"
764
764
  - !ruby/object:Gem::Version
765
- version: 6.0.0.beta.7
766
- - - "<"
767
- - !ruby/object:Gem::Version
768
- version: 6.0.0.c
765
+ version: 6.0.0.rc.5
769
766
  type: :runtime
770
767
  prerelease: false
771
768
  version_requirements: !ruby/object:Gem::Requirement
772
769
  requirements:
773
770
  - - "~>"
774
771
  - !ruby/object:Gem::Version
775
- version: 6.0.0.beta.7
776
- - - "<"
777
- - !ruby/object:Gem::Version
778
- version: 6.0.0.c
772
+ version: 6.0.0.rc.5
779
773
  - !ruby/object:Gem::Dependency
780
774
  name: wisper
781
775
  requirement: !ruby/object:Gem::Requirement
@@ -796,28 +790,28 @@ dependencies:
796
790
  requirements:
797
791
  - - '='
798
792
  - !ruby/object:Gem::Version
799
- version: 0.25.0.rc1
793
+ version: 0.25.0.rc2
800
794
  type: :runtime
801
795
  prerelease: false
802
796
  version_requirements: !ruby/object:Gem::Requirement
803
797
  requirements:
804
798
  - - '='
805
799
  - !ruby/object:Gem::Version
806
- version: 0.25.0.rc1
800
+ version: 0.25.0.rc2
807
801
  - !ruby/object:Gem::Dependency
808
802
  name: decidim-dev
809
803
  requirement: !ruby/object:Gem::Requirement
810
804
  requirements:
811
805
  - - '='
812
806
  - !ruby/object:Gem::Version
813
- version: 0.25.0.rc1
807
+ version: 0.25.0.rc2
814
808
  type: :development
815
809
  prerelease: false
816
810
  version_requirements: !ruby/object:Gem::Requirement
817
811
  requirements:
818
812
  - - '='
819
813
  - !ruby/object:Gem::Version
820
- version: 0.25.0.rc1
814
+ version: 0.25.0.rc2
821
815
  description: Adds core features so other engines can hook into the framework.
822
816
  email:
823
817
  - josepjaume@gmail.com
@@ -1444,6 +1438,7 @@ files:
1444
1438
  - app/packs/src/decidim/form_filter.component_for_testing.js
1445
1439
  - app/packs/src/decidim/form_filter.js
1446
1440
  - app/packs/src/decidim/form_validator.js
1441
+ - app/packs/src/decidim/foundation-datepicker/js/locales/foundation-datepicker.lb.js
1447
1442
  - app/packs/src/decidim/foundation_datepicker_locales.js
1448
1443
  - app/packs/src/decidim/gallery.js
1449
1444
  - app/packs/src/decidim/geocoding.js
@@ -1675,6 +1670,7 @@ files:
1675
1670
  - app/presenters/decidim/nil_presenter.rb
1676
1671
  - app/presenters/decidim/official_author_presenter.rb
1677
1672
  - app/presenters/decidim/resource_locator_presenter.rb
1673
+ - app/presenters/decidim/resource_presenter.rb
1678
1674
  - app/presenters/decidim/stats_presenter.rb
1679
1675
  - app/presenters/decidim/user_group_presenter.rb
1680
1676
  - app/presenters/decidim/user_presenter.rb
@@ -2556,6 +2552,7 @@ files:
2556
2552
  - lib/decidim/webpacker/webpacker.yml
2557
2553
  - lib/devise/models/decidim_newsletterable.rb
2558
2554
  - lib/devise/models/decidim_validatable.rb
2555
+ - lib/gem_overrides/rails/tasks/yarn.rake
2559
2556
  - lib/gem_overrides/webpacker/runner.rb
2560
2557
  - lib/premailer/adapter/decidim.rb
2561
2558
  - lib/tasks/decidim_active_storage_migration_tasks.rake
@@ -2584,7 +2581,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2584
2581
  - !ruby/object:Gem::Version
2585
2582
  version: 1.3.1
2586
2583
  requirements: []
2587
- rubygems_version: 3.1.4
2584
+ rubygems_version: 3.1.2
2588
2585
  signing_key:
2589
2586
  specification_version: 4
2590
2587
  summary: The core of the Decidim framework.