diff --git a/Gemfile b/Gemfile index 1e08cbd31c..b9302cf2c3 100644 --- a/Gemfile +++ b/Gemfile @@ -10,7 +10,6 @@ gem "decidim-comments", path: "decidim-comments" gem "decidim-decidim_awesome", "~> 0.8.1" -## gem "decidim-term_customizer", git: "https://github.com/mainio/decidim-module-term_customizer.git", branch: "0.24-stable" gem "decidim-term_customizer", git: "https://github.com/codeforjapan/decidim-module-term_customizer.git", branch: "release/0.25-stable" gem "bootsnap" @@ -27,7 +26,7 @@ gem "newrelic_rpm" gem "omniauth-line_login", path: "omniauth-line_login" -# gem "decidim-user_extension", path: "decidim-user_extension" +gem "decidim-user_extension", path: "decidim-user_extension" group :development, :test do gem "byebug", "~> 11.0", platform: :mri diff --git a/Gemfile.lock b/Gemfile.lock index 7d9ddf486d..7e6d89b731 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -14,6 +14,14 @@ PATH decidim-core (= 0.25.2) redcarpet (~> 3.5, >= 3.5.1) +PATH + remote: decidim-user_extension + specs: + decidim-user_extension (0.2.0) + decidim-admin + decidim-core + rails + PATH remote: omniauth-line_login specs: @@ -847,6 +855,7 @@ DEPENDENCIES decidim-decidim_awesome (~> 0.8.1) decidim-dev (= 0.25.2) decidim-term_customizer! + decidim-user_extension! deface dotenv-rails factory_bot_rails diff --git a/decidim-user_extension/app/assets/config/decidim_user_extension_manifest.js b/decidim-user_extension/app/assets/config/decidim_user_extension_manifest.js deleted file mode 100644 index 147e7fbc94..0000000000 --- a/decidim-user_extension/app/assets/config/decidim_user_extension_manifest.js +++ /dev/null @@ -1,2 +0,0 @@ -//= link_directory ../javascripts/decidim/user_extension .js -//= link_directory ../stylesheets/decidim/user_extension .css diff --git a/decidim-user_extension/app/packs/entrypoints/decidim_user_extension.js b/decidim-user_extension/app/packs/entrypoints/decidim_user_extension.js new file mode 100644 index 0000000000..20e5023237 --- /dev/null +++ b/decidim-user_extension/app/packs/entrypoints/decidim_user_extension.js @@ -0,0 +1 @@ +import "src/decidim/user_extension" \ No newline at end of file diff --git a/decidim-user_extension/app/packs/entrypoints/decidim_user_extention.scss b/decidim-user_extension/app/packs/entrypoints/decidim_user_extention.scss new file mode 100644 index 0000000000..b0da0ebcca --- /dev/null +++ b/decidim-user_extension/app/packs/entrypoints/decidim_user_extention.scss @@ -0,0 +1 @@ +@import "../stylesheets/decidim/user_extension/application.css"; \ No newline at end of file diff --git a/decidim-user_extension/app/assets/images/decidim/user_extension/.keep b/decidim-user_extension/app/packs/images/decidim/user_extension/.keep similarity index 100% rename from decidim-user_extension/app/assets/images/decidim/user_extension/.keep rename to decidim-user_extension/app/packs/images/decidim/user_extension/.keep diff --git a/decidim-user_extension/app/assets/javascripts/decidim/user_extension/application.js b/decidim-user_extension/app/packs/src/decidim/user_extension/application.js similarity index 100% rename from decidim-user_extension/app/assets/javascripts/decidim/user_extension/application.js rename to decidim-user_extension/app/packs/src/decidim/user_extension/application.js diff --git a/decidim-user_extension/app/assets/stylesheets/decidim/user_extension/application.css b/decidim-user_extension/app/packs/stylesheets/decidim/user_extension/application.css similarity index 100% rename from decidim-user_extension/app/assets/stylesheets/decidim/user_extension/application.css rename to decidim-user_extension/app/packs/stylesheets/decidim/user_extension/application.css diff --git a/decidim-user_extension/app/views/decidim/account/show.html.erb b/decidim-user_extension/app/views/decidim/account/show.html.erb index 8c837b5aea..1989bb5e66 100644 --- a/decidim-user_extension/app/views/decidim/account/show.html.erb +++ b/decidim-user_extension/app/views/decidim/account/show.html.erb @@ -17,9 +17,17 @@ <%= f.url_field :personal_url %> <%= f.text_area :about, rows: 5 %> + <%= f.collection_select( + :locale, + @account.organization.available_locales, + :to_s, + ->(locale) {locale_name(locale) } + ) %> +

<%= t(".available_locales_helper") %>

+ <% if current_organization.available_authorizations&.include?("user_extension") %> - <%= render partial: "user_extension", locals: {f: f} %> + <%= render partial: "user_extension", locals: {f: f} %> <% end %> @@ -28,7 +36,7 @@ <% else %> <% if current_organization.sign_in_enabled? %>

- <%= t ".change_password" %> + <%= t ".change_password" %>

<%= render partial: "password_fields", locals: { form: f } %> diff --git a/decidim-user_extension/app/views/layouts/decidim/user_extension/application.html.erb b/decidim-user_extension/app/views/layouts/decidim/user_extension/application.html.erb index 5e174a4491..c1be77e3b5 100644 --- a/decidim-user_extension/app/views/layouts/decidim/user_extension/application.html.erb +++ b/decidim-user_extension/app/views/layouts/decidim/user_extension/application.html.erb @@ -5,7 +5,7 @@ <%= csrf_meta_tags %> <%= csp_meta_tag %> - <%= stylesheet_pack_tag "decidim/user_extension/application", media: "all" %> + <%= stylesheet_pack_tag "decidim/user_extension/application", media: "all" %> <%= javascript_pack_tag "decidim/user_extension/application" %> diff --git a/decidim-user_extension/lib/decidim/user_extension/engine.rb b/decidim-user_extension/lib/decidim/user_extension/engine.rb index 2c45c51582..f82aa57508 100644 --- a/decidim-user_extension/lib/decidim/user_extension/engine.rb +++ b/decidim-user_extension/lib/decidim/user_extension/engine.rb @@ -21,8 +21,8 @@ class Engine < ::Rails::Engine # root to: "user_extension#index" end - initializer "decidim_user_extension.assets" do |app| - app.config.assets.precompile += %w(decidim_user_extension_manifest.js) + initializer "decidim_user_extension.assets_path" do |app| + Decidim.register_assets_path File.expand_path("app/packs", root) end initializer "decidim_user_extension.engine_additions" do diff --git a/decidim-user_extension/lib/decidim/user_extension/version.rb b/decidim-user_extension/lib/decidim/user_extension/version.rb index d55e628ae5..adcc61b139 100644 --- a/decidim-user_extension/lib/decidim/user_extension/version.rb +++ b/decidim-user_extension/lib/decidim/user_extension/version.rb @@ -2,14 +2,14 @@ module Decidim module UserExtension - VERSION = "0.1.0" + VERSION = "0.2.0" def self.version Decidim::UserExtension::VERSION end def self.decidim_version - ">= 0.23.0" + ">= 0.25.2" end end end