decidim-assemblies 0.30.3 → 0.31.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 +4 -4
 - data/app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_settings_form/show.erb +3 -1
 - data/app/commands/decidim/assemblies/admin/create_assembly.rb +1 -1
 - data/app/commands/decidim/assemblies/admin/{copy_assembly.rb → duplicate_assembly.rb} +20 -21
 - data/app/commands/decidim/assemblies/admin/update_assembly.rb +1 -1
 - data/app/controllers/decidim/assemblies/admin/assemblies_controller.rb +3 -3
 - data/app/controllers/decidim/assemblies/admin/assembly_duplicates_controller.rb +35 -0
 - data/app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb +1 -1
 - data/app/controllers/decidim/assemblies/admin/assembly_landing_page_controller.rb +4 -0
 - data/app/forms/decidim/assemblies/admin/{assembly_copy_form.rb → assembly_duplicate_form.rb} +4 -4
 - data/app/forms/decidim/assemblies/admin/assembly_form.rb +0 -1
 - data/app/helpers/decidim/assemblies/filter_assemblies_helper.rb +1 -1
 - data/app/models/decidim/assembly.rb +0 -4
 - data/app/packs/entrypoints/decidim_assemblies_admin.js +0 -1
 - data/app/packs/src/decidim/assemblies/admin/assemblies.js +3 -62
 - data/app/packs/src/decidim/assemblies/controllers/.gitkeep +0 -0
 - data/app/packs/src/decidim/assemblies/controllers/assembly_admin/assembly_admin.test.js +1077 -0
 - data/app/packs/src/decidim/assemblies/controllers/assembly_admin/controller.js +66 -0
 - data/app/permissions/decidim/assemblies/permissions.rb +7 -7
 - data/app/presenters/decidim/assemblies/admin_log/assembly_presenter.rb +0 -1
 - data/app/presenters/decidim/assemblies/assembly_stats_presenter.rb +1 -3
 - data/app/queries/decidim/assemblies/assemblies_stats_followers_count.rb +14 -0
 - data/app/queries/decidim/assemblies/assemblies_stats_participants_count.rb +14 -0
 - data/app/serializers/decidim/assemblies/assembly_importer.rb +0 -1
 - data/app/views/decidim/assemblies/admin/assemblies/_assembly_row.html.erb +118 -49
 - data/app/views/decidim/assemblies/admin/assemblies/_form.html.erb +8 -12
 - data/app/views/decidim/assemblies/admin/assemblies/edit.html.erb +1 -9
 - data/app/views/decidim/assemblies/admin/assemblies/index.html.erb +2 -2
 - data/app/views/decidim/assemblies/admin/assemblies/index.js.erb +4 -0
 - data/app/views/decidim/assemblies/admin/assemblies/manage_trash.html.erb +2 -1
 - data/app/views/decidim/assemblies/admin/assemblies/new.html.erb +1 -1
 - data/app/views/decidim/assemblies/admin/{assembly_copies → assembly_duplicates}/_form.html.erb +4 -4
 - data/app/views/decidim/assemblies/admin/assembly_duplicates/new.html.erb +19 -0
 - data/app/views/decidim/assemblies/admin/assembly_user_roles/index.html.erb +42 -18
 - data/app/views/decidim/assemblies/assemblies/index.html.erb +0 -1
 - data/app/views/layouts/decidim/admin/_manage_assemblies.html.erb +1 -1
 - data/config/assets.rb +2 -3
 - data/config/locales/ar.yml +0 -13
 - data/config/locales/bg.yml +0 -17
 - data/config/locales/bs-BA.yml +0 -4
 - data/config/locales/ca-IT.yml +11 -16
 - data/config/locales/ca.yml +11 -16
 - data/config/locales/cs.yml +11 -16
 - data/config/locales/de.yml +12 -17
 - data/config/locales/el.yml +0 -13
 - data/config/locales/en.yml +11 -16
 - data/config/locales/es-MX.yml +12 -17
 - data/config/locales/es-PY.yml +12 -17
 - data/config/locales/es.yml +12 -17
 - data/config/locales/eu.yml +11 -16
 - data/config/locales/fi-plain.yml +11 -16
 - data/config/locales/fi.yml +11 -16
 - data/config/locales/fr-CA.yml +11 -16
 - data/config/locales/fr.yml +11 -16
 - data/config/locales/ga-IE.yml +0 -6
 - data/config/locales/gl.yml +0 -13
 - data/config/locales/he-IL.yml +0 -12
 - data/config/locales/hu.yml +0 -14
 - data/config/locales/id-ID.yml +0 -12
 - data/config/locales/is-IS.yml +0 -10
 - data/config/locales/it.yml +4 -17
 - data/config/locales/ja.yml +12 -17
 - data/config/locales/kaa.yml +0 -3
 - data/config/locales/ko.yml +0 -4
 - data/config/locales/lb.yml +0 -12
 - data/config/locales/lt.yml +0 -14
 - data/config/locales/lv.yml +0 -13
 - data/config/locales/nl.yml +0 -13
 - data/config/locales/no.yml +0 -13
 - data/config/locales/pl.yml +0 -17
 - data/config/locales/pt-BR.yml +0 -17
 - data/config/locales/pt.yml +0 -18
 - data/config/locales/ro-RO.yml +2 -14
 - data/config/locales/ru.yml +0 -10
 - data/config/locales/sk.yml +0 -8
 - data/config/locales/sl.yml +0 -12
 - data/config/locales/sq-AL.yml +0 -15
 - data/config/locales/sr-CS.yml +0 -4
 - data/config/locales/sv.yml +10 -16
 - data/config/locales/tr-TR.yml +0 -13
 - data/config/locales/uk.yml +0 -10
 - data/config/locales/zh-CN.yml +0 -13
 - data/config/locales/zh-TW.yml +0 -13
 - data/db/migrate/20250604081741_remove_hastags_column_assemblies.rb +7 -0
 - data/lib/decidim/api/assembly_type.rb +10 -6
 - data/lib/decidim/assemblies/admin_engine.rb +1 -1
 - data/lib/decidim/assemblies/api.rb +0 -1
 - data/lib/decidim/assemblies/engine.rb +5 -14
 - data/lib/decidim/assemblies/participatory_space.rb +14 -0
 - data/lib/decidim/assemblies/query_extensions.rb +0 -18
 - data/lib/decidim/assemblies/seeds.rb +2 -3
 - data/lib/decidim/assemblies/test/factories.rb +2 -2
 - data/lib/decidim/assemblies/version.rb +1 -1
 - metadata +22 -20
 - data/app/controllers/decidim/assemblies/admin/assembly_copies_controller.rb +0 -35
 - data/app/packs/entrypoints/decidim_assemblies.js +0 -4
 - data/app/packs/src/decidim/assemblies/assemblies.js +0 -14
 - data/app/queries/decidim/assemblies/metrics/assemblies_metric_manage.rb +0 -27
 - data/app/views/decidim/assemblies/admin/assembly_copies/new.html.erb +0 -19
 - data/lib/decidim/api/assemblies_type_type.rb +0 -16
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 5812b1925cb6b6ea4340092bb4f6375ff8faf33fb6dd65fa875faebf6d23fa68
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 320223272a252555df9bfdbd64761a0fb97f4a3b99cdddeacc1b634f3a448aa1
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 20a195fba6c8b3d809267b2c538f960ecf2795d7a7aa8a2fe317cc6baf362235b640015f549da7246e28899ad504cb9b897313bd2c5df731160a6c9668e470bd
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 2f6334b646b80a359b1089a0666573c4a0895a0967d00aba1abfaafe801ae3c788f5f2f022133619527e1dd4f7a8b8e4d0b860cae999b509c1368e90f0fd2efc
         
     | 
| 
         @@ -8,7 +8,7 @@ module Decidim 
     | 
|
| 
       8 
8 
     | 
    
         
             
                  class CreateAssembly < Decidim::Commands::CreateResource
         
     | 
| 
       9 
9 
     | 
    
         
             
                    fetch_file_attributes :hero_image, :banner_image
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
                    fetch_form_attributes :title, :subtitle, :weight, :slug, : 
     | 
| 
      
 11 
     | 
    
         
            +
                    fetch_form_attributes :title, :subtitle, :weight, :slug, :description, :short_description,
         
     | 
| 
       12 
12 
     | 
    
         
             
                                          :promoted, :taxonomizations, :parent, :announcement, :organization,
         
     | 
| 
       13 
13 
     | 
    
         
             
                                          :private_space, :developer_group, :local_area, :target, :participatory_scope,
         
     | 
| 
       14 
14 
     | 
    
         
             
                                          :participatory_structure, :meta_scope, :purpose_of_action,
         
     | 
| 
         @@ -3,9 +3,9 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module Decidim
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Assemblies
         
     | 
| 
       5 
5 
     | 
    
         
             
                module Admin
         
     | 
| 
       6 
     | 
    
         
            -
                  # A command with all the business logic when  
     | 
| 
      
 6 
     | 
    
         
            +
                  # A command with all the business logic when duplicating a new participatory
         
     | 
| 
       7 
7 
     | 
    
         
             
                  # assembly in the system.
         
     | 
| 
       8 
     | 
    
         
            -
                  class  
     | 
| 
      
 8 
     | 
    
         
            +
                  class DuplicateAssembly < Decidim::Command
         
     | 
| 
       9 
9 
     | 
    
         
             
                    # Public: Initializes the command.
         
     | 
| 
       10 
10 
     | 
    
         
             
                    #
         
     | 
| 
       11 
11 
     | 
    
         
             
                    # form - A form object with the params.
         
     | 
| 
         @@ -27,27 +27,26 @@ module Decidim 
     | 
|
| 
       27 
27 
     | 
    
         | 
| 
       28 
28 
     | 
    
         
             
                      Decidim.traceability.perform_action!("duplicate", @assembly, @user) do
         
     | 
| 
       29 
29 
     | 
    
         
             
                        Assembly.transaction do
         
     | 
| 
       30 
     | 
    
         
            -
                           
     | 
| 
       31 
     | 
    
         
            -
                           
     | 
| 
       32 
     | 
    
         
            -
                           
     | 
| 
       33 
     | 
    
         
            -
                           
     | 
| 
      
 30 
     | 
    
         
            +
                          duplicate_assembly
         
     | 
| 
      
 31 
     | 
    
         
            +
                          duplicate_assembly_attachments
         
     | 
| 
      
 32 
     | 
    
         
            +
                          duplicate_assembly_components if @form.duplicate_components?
         
     | 
| 
      
 33 
     | 
    
         
            +
                          duplicate_landing_page_blocks if @form.duplicate_landing_page_blocks?
         
     | 
| 
       34 
34 
     | 
    
         
             
                        end
         
     | 
| 
       35 
35 
     | 
    
         
             
                      end
         
     | 
| 
       36 
36 
     | 
    
         | 
| 
       37 
     | 
    
         
            -
                      broadcast(:ok, @ 
     | 
| 
      
 37 
     | 
    
         
            +
                      broadcast(:ok, @duplicated_assembly)
         
     | 
| 
       38 
38 
     | 
    
         
             
                    end
         
     | 
| 
       39 
39 
     | 
    
         | 
| 
       40 
40 
     | 
    
         
             
                    private
         
     | 
| 
       41 
41 
     | 
    
         | 
| 
       42 
42 
     | 
    
         
             
                    attr_reader :form
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
       44 
     | 
    
         
            -
                    def  
     | 
| 
       45 
     | 
    
         
            -
                      @ 
     | 
| 
      
 44 
     | 
    
         
            +
                    def duplicate_assembly
         
     | 
| 
      
 45 
     | 
    
         
            +
                      @duplicated_assembly = Assembly.create!(
         
     | 
| 
       46 
46 
     | 
    
         
             
                        organization: @assembly.organization,
         
     | 
| 
       47 
47 
     | 
    
         
             
                        title: form.title,
         
     | 
| 
       48 
48 
     | 
    
         
             
                        subtitle: @assembly.subtitle,
         
     | 
| 
       49 
49 
     | 
    
         
             
                        slug: form.slug,
         
     | 
| 
       50 
     | 
    
         
            -
                        hashtag: @assembly.hashtag,
         
     | 
| 
       51 
50 
     | 
    
         
             
                        description: @assembly.description,
         
     | 
| 
       52 
51 
     | 
    
         
             
                        short_description: @assembly.short_description,
         
     | 
| 
       53 
52 
     | 
    
         
             
                        promoted: @assembly.promoted,
         
     | 
| 
         @@ -64,47 +63,47 @@ module Decidim 
     | 
|
| 
       64 
63 
     | 
    
         
             
                      )
         
     | 
| 
       65 
64 
     | 
    
         
             
                    end
         
     | 
| 
       66 
65 
     | 
    
         | 
| 
       67 
     | 
    
         
            -
                    def  
     | 
| 
      
 66 
     | 
    
         
            +
                    def duplicate_assembly_attachments
         
     | 
| 
       68 
67 
     | 
    
         
             
                      [:hero_image, :banner_image].each do |attribute|
         
     | 
| 
       69 
68 
     | 
    
         
             
                        next unless @assembly.attached_uploader(attribute).attached?
         
     | 
| 
       70 
69 
     | 
    
         | 
| 
       71 
     | 
    
         
            -
                        @ 
     | 
| 
      
 70 
     | 
    
         
            +
                        @duplicated_assembly.send(attribute).attach(@assembly.send(attribute).blob)
         
     | 
| 
       72 
71 
     | 
    
         
             
                      end
         
     | 
| 
       73 
72 
     | 
    
         
             
                    end
         
     | 
| 
       74 
73 
     | 
    
         | 
| 
       75 
     | 
    
         
            -
                    def  
     | 
| 
      
 74 
     | 
    
         
            +
                    def duplicate_assembly_components
         
     | 
| 
       76 
75 
     | 
    
         
             
                      @assembly.components.each do |component|
         
     | 
| 
       77 
76 
     | 
    
         
             
                        new_component = Component.create!(
         
     | 
| 
       78 
77 
     | 
    
         
             
                          manifest_name: component.manifest_name,
         
     | 
| 
       79 
78 
     | 
    
         
             
                          name: component.name,
         
     | 
| 
       80 
     | 
    
         
            -
                          participatory_space: @ 
     | 
| 
      
 79 
     | 
    
         
            +
                          participatory_space: @duplicated_assembly,
         
     | 
| 
       81 
80 
     | 
    
         
             
                          settings: component.settings,
         
     | 
| 
       82 
81 
     | 
    
         
             
                          step_settings: component.step_settings,
         
     | 
| 
       83 
82 
     | 
    
         
             
                          weight: component.weight
         
     | 
| 
       84 
83 
     | 
    
         
             
                        )
         
     | 
| 
       85 
     | 
    
         
            -
                        component.manifest.run_hooks(: 
     | 
| 
      
 84 
     | 
    
         
            +
                        component.manifest.run_hooks(:duplicate, new_component:, old_component: component)
         
     | 
| 
       86 
85 
     | 
    
         
             
                      end
         
     | 
| 
       87 
86 
     | 
    
         
             
                    end
         
     | 
| 
       88 
87 
     | 
    
         | 
| 
       89 
     | 
    
         
            -
                    def  
     | 
| 
      
 88 
     | 
    
         
            +
                    def duplicate_landing_page_blocks
         
     | 
| 
       90 
89 
     | 
    
         
             
                      blocks = Decidim::ContentBlock.where(scoped_resource_id: @assembly.id, scope_name: "assembly_homepage", organization: @assembly.organization)
         
     | 
| 
       91 
90 
     | 
    
         
             
                      return if blocks.blank?
         
     | 
| 
       92 
91 
     | 
    
         | 
| 
       93 
92 
     | 
    
         
             
                      blocks.each do |block|
         
     | 
| 
       94 
93 
     | 
    
         
             
                        new_block = Decidim::ContentBlock.create!(
         
     | 
| 
       95 
     | 
    
         
            -
                          organization: @ 
     | 
| 
      
 94 
     | 
    
         
            +
                          organization: @duplicated_assembly.organization,
         
     | 
| 
       96 
95 
     | 
    
         
             
                          scope_name: "assembly_homepage",
         
     | 
| 
       97 
     | 
    
         
            -
                          scoped_resource_id: @ 
     | 
| 
      
 96 
     | 
    
         
            +
                          scoped_resource_id: @duplicated_assembly.id,
         
     | 
| 
       98 
97 
     | 
    
         
             
                          manifest_name: block.manifest_name,
         
     | 
| 
       99 
98 
     | 
    
         
             
                          settings: block.settings,
         
     | 
| 
       100 
99 
     | 
    
         
             
                          weight: block.weight,
         
     | 
| 
       101 
     | 
    
         
            -
                          published_at: block.published_at.present? ? @ 
     | 
| 
      
 100 
     | 
    
         
            +
                          published_at: block.published_at.present? ? @duplicated_assembly.created_at : nil # determine if block is active/inactive
         
     | 
| 
       102 
101 
     | 
    
         
             
                        )
         
     | 
| 
       103 
     | 
    
         
            -
                         
     | 
| 
      
 102 
     | 
    
         
            +
                        duplicate_block_attachments(block, new_block) if block.attachments.present?
         
     | 
| 
       104 
103 
     | 
    
         
             
                      end
         
     | 
| 
       105 
104 
     | 
    
         
             
                    end
         
     | 
| 
       106 
105 
     | 
    
         | 
| 
       107 
     | 
    
         
            -
                    def  
     | 
| 
      
 106 
     | 
    
         
            +
                    def duplicate_block_attachments(block, new_block)
         
     | 
| 
       108 
107 
     | 
    
         
             
                      block.attachments.map(&:name).each do |name|
         
     | 
| 
       109 
108 
     | 
    
         
             
                        original_image = block.images_container.send(name).blob
         
     | 
| 
       110 
109 
     | 
    
         
             
                        next if original_image.blank?
         
     | 
| 
         @@ -8,7 +8,7 @@ module Decidim 
     | 
|
| 
       8 
8 
     | 
    
         
             
                  class UpdateAssembly < Decidim::Commands::UpdateResource
         
     | 
| 
       9 
9 
     | 
    
         
             
                    fetch_file_attributes :hero_image, :banner_image
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
                    fetch_form_attributes :title, :subtitle, :slug, : 
     | 
| 
      
 11 
     | 
    
         
            +
                    fetch_form_attributes :title, :subtitle, :slug, :promoted, :description, :short_description,
         
     | 
| 
       12 
12 
     | 
    
         
             
                                          :taxonomizations, :parent, :private_space, :developer_group, :local_area,
         
     | 
| 
       13 
13 
     | 
    
         
             
                                          :target, :participatory_scope, :participatory_structure, :meta_scope,
         
     | 
| 
       14 
14 
     | 
    
         
             
                                          :purpose_of_action, :composition, :creation_date, :created_by,
         
     | 
| 
         @@ -37,7 +37,7 @@ module Decidim 
     | 
|
| 
       37 
37 
     | 
    
         | 
| 
       38 
38 
     | 
    
         
             
                        on(:invalid) do
         
     | 
| 
       39 
39 
     | 
    
         
             
                          flash.now[:alert] = I18n.t("assemblies.create.error", scope: "decidim.admin")
         
     | 
| 
       40 
     | 
    
         
            -
                          render :new
         
     | 
| 
      
 40 
     | 
    
         
            +
                          render :new, status: :unprocessable_entity
         
     | 
| 
       41 
41 
     | 
    
         
             
                        end
         
     | 
| 
       42 
42 
     | 
    
         
             
                      end
         
     | 
| 
       43 
43 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -63,12 +63,12 @@ module Decidim 
     | 
|
| 
       63 
63 
     | 
    
         | 
| 
       64 
64 
     | 
    
         
             
                        on(:invalid) do
         
     | 
| 
       65 
65 
     | 
    
         
             
                          flash.now[:alert] = I18n.t("assemblies.update.error", scope: "decidim.admin")
         
     | 
| 
       66 
     | 
    
         
            -
                          render :edit, layout: "decidim/admin/assembly"
         
     | 
| 
      
 66 
     | 
    
         
            +
                          render :edit, layout: "decidim/admin/assembly", status: :unprocessable_entity
         
     | 
| 
       67 
67 
     | 
    
         
             
                        end
         
     | 
| 
       68 
68 
     | 
    
         
             
                      end
         
     | 
| 
       69 
69 
     | 
    
         
             
                    end
         
     | 
| 
       70 
70 
     | 
    
         | 
| 
       71 
     | 
    
         
            -
                    def  
     | 
| 
      
 71 
     | 
    
         
            +
                    def duplicate
         
     | 
| 
       72 
72 
     | 
    
         
             
                      enforce_permission_to :create, :assembly, assembly: collection.find_by(id: params[:parent_id])
         
     | 
| 
       73 
73 
     | 
    
         
             
                    end
         
     | 
| 
       74 
74 
     | 
    
         | 
| 
         @@ -0,0 +1,35 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Decidim
         
     | 
| 
      
 4 
     | 
    
         
            +
              module Assemblies
         
     | 
| 
      
 5 
     | 
    
         
            +
                module Admin
         
     | 
| 
      
 6 
     | 
    
         
            +
                  # Controller that allows managing assemblies.
         
     | 
| 
      
 7 
     | 
    
         
            +
                  #
         
     | 
| 
      
 8 
     | 
    
         
            +
                  class AssemblyDuplicatesController < Decidim::Assemblies::Admin::ApplicationController
         
     | 
| 
      
 9 
     | 
    
         
            +
                    include Concerns::AssemblyAdmin
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                    def new
         
     | 
| 
      
 12 
     | 
    
         
            +
                      enforce_permission_to :create, :assembly
         
     | 
| 
      
 13 
     | 
    
         
            +
                      @form = form(AssemblyDuplicateForm).from_model(current_assembly)
         
     | 
| 
      
 14 
     | 
    
         
            +
                    end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                    def create
         
     | 
| 
      
 17 
     | 
    
         
            +
                      enforce_permission_to :create, :assembly
         
     | 
| 
      
 18 
     | 
    
         
            +
                      @form = form(AssemblyDuplicateForm).from_params(params)
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                      DuplicateAssembly.call(@form, current_assembly, current_user) do
         
     | 
| 
      
 21 
     | 
    
         
            +
                        on(:ok) do
         
     | 
| 
      
 22 
     | 
    
         
            +
                          flash[:notice] = I18n.t("assemblies_duplicates.create.success", scope: "decidim.admin")
         
     | 
| 
      
 23 
     | 
    
         
            +
                          redirect_to assemblies_path
         
     | 
| 
      
 24 
     | 
    
         
            +
                        end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                        on(:invalid) do
         
     | 
| 
      
 27 
     | 
    
         
            +
                          flash.now[:alert] = I18n.t("assemblies_duplicates.create.error", scope: "decidim.admin")
         
     | 
| 
      
 28 
     | 
    
         
            +
                          render :new, status: :unprocessable_entity
         
     | 
| 
      
 29 
     | 
    
         
            +
                        end
         
     | 
| 
      
 30 
     | 
    
         
            +
                      end
         
     | 
| 
      
 31 
     | 
    
         
            +
                    end
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
              end
         
     | 
| 
      
 35 
     | 
    
         
            +
            end
         
     | 
    
        data/app/forms/decidim/assemblies/admin/{assembly_copy_form.rb → assembly_duplicate_form.rb}
    RENAMED
    
    | 
         @@ -3,10 +3,10 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            module Decidim
         
     | 
| 
       4 
4 
     | 
    
         
             
              module Assemblies
         
     | 
| 
       5 
5 
     | 
    
         
             
                module Admin
         
     | 
| 
       6 
     | 
    
         
            -
                  # A form object used to  
     | 
| 
      
 6 
     | 
    
         
            +
                  # A form object used to duplicate a assemblies from the admin
         
     | 
| 
       7 
7 
     | 
    
         
             
                  # dashboard.
         
     | 
| 
       8 
8 
     | 
    
         
             
                  #
         
     | 
| 
       9 
     | 
    
         
            -
                  class  
     | 
| 
      
 9 
     | 
    
         
            +
                  class AssemblyDuplicateForm < Form
         
     | 
| 
       10 
10 
     | 
    
         
             
                    include TranslatableAttributes
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
                    translatable_attribute :title, String
         
     | 
| 
         @@ -14,8 +14,8 @@ module Decidim 
     | 
|
| 
       14 
14 
     | 
    
         
             
                    mimic :assembly
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
                    attribute :slug, String
         
     | 
| 
       17 
     | 
    
         
            -
                    attribute : 
     | 
| 
       18 
     | 
    
         
            -
                    attribute : 
     | 
| 
      
 17 
     | 
    
         
            +
                    attribute :duplicate_components, Boolean
         
     | 
| 
      
 18 
     | 
    
         
            +
                    attribute :duplicate_landing_page_blocks, Boolean
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
                    validates :slug, presence: true, format: { with: Decidim::Assembly.slug_format }
         
     | 
| 
       21 
21 
     | 
    
         
             
                    validates :title, translatable_presence: true
         
     | 
| 
         @@ -13,7 +13,7 @@ module Decidim 
     | 
|
| 
       13 
13 
     | 
    
         
             
                      items.append(method: "with_any_taxonomies[#{taxonomy_filter.root_taxonomy_id}]",
         
     | 
| 
       14 
14 
     | 
    
         
             
                                   collection: filter_taxonomy_values_for(taxonomy_filter),
         
     | 
| 
       15 
15 
     | 
    
         
             
                                   label: decidim_sanitize_translated(taxonomy_filter.name),
         
     | 
| 
       16 
     | 
    
         
            -
                                   id: "taxonomy")
         
     | 
| 
      
 16 
     | 
    
         
            +
                                   id: "taxonomy-#{taxonomy_filter.root_taxonomy_id}")
         
     | 
| 
       17 
17 
     | 
    
         
             
                    end
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
                    items.reject { |item| item[:collection].blank? }
         
     | 
| 
         @@ -1,63 +1,4 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
              const $assemblyScopeEnabled = $("#assembly_scopes_enabled");
         
     | 
| 
       3 
     | 
    
         
            -
              const $assemblyScopeId = $("#assembly_scope_id");
         
     | 
| 
      
 1 
     | 
    
         
            +
            import { definitionsFromContext } from "src/decidim/refactor/support/stimulus"
         
     | 
| 
       4 
2 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
                  const checked = event.target.checked;
         
     | 
| 
       8 
     | 
    
         
            -
                  $assemblyScopeId.attr("disabled", !checked);
         
     | 
| 
       9 
     | 
    
         
            -
                })
         
     | 
| 
       10 
     | 
    
         
            -
                $assemblyScopeId.attr("disabled", !$assemblyScopeEnabled.prop("checked"));
         
     | 
| 
       11 
     | 
    
         
            -
              }
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
              const $form = $(".assembly_form_admin");
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
              if ($form.length > 0) {
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
                const $privateSpace = $form.find("#private_space");
         
     | 
| 
       18 
     | 
    
         
            -
                const $isTransparent = $form.find("#is_transparent");
         
     | 
| 
       19 
     | 
    
         
            -
                const $specialFeatures = $form.find("#special_features");
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
                const toggleDisabledHiddenFields = () => {
         
     | 
| 
       23 
     | 
    
         
            -
                  const enabledPrivateSpace = $privateSpace.find("input[type='checkbox']").prop("checked");
         
     | 
| 
       24 
     | 
    
         
            -
                  $isTransparent.find("input[type='checkbox']").attr("disabled", "disabled");
         
     | 
| 
       25 
     | 
    
         
            -
                  $specialFeatures.hide();
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                  if (enabledPrivateSpace) {
         
     | 
| 
       28 
     | 
    
         
            -
                    $isTransparent.find("input[type='checkbox']").attr("disabled", !enabledPrivateSpace);
         
     | 
| 
       29 
     | 
    
         
            -
                    $specialFeatures.show();
         
     | 
| 
       30 
     | 
    
         
            -
                  }
         
     | 
| 
       31 
     | 
    
         
            -
                };
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
                $privateSpace.on("change", toggleDisabledHiddenFields);
         
     | 
| 
       34 
     | 
    
         
            -
                toggleDisabledHiddenFields();
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
                const $assemblyType = $form.find("#assembly_assembly_type");
         
     | 
| 
       37 
     | 
    
         
            -
                const $assemblyTypeOther = $form.find("#assembly_type_other");
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
                const $assemblyCreatedBy = $form.find("#assembly_created_by");
         
     | 
| 
       40 
     | 
    
         
            -
                const $assemblyCreatedByOther = $form.find("#created_by_other");
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
                const toggleDependsOnSelect = ($target, $showDiv) => {
         
     | 
| 
       43 
     | 
    
         
            -
                  const value = $target.val();
         
     | 
| 
       44 
     | 
    
         
            -
                  $showDiv.hide();
         
     | 
| 
       45 
     | 
    
         
            -
                  if (value === "others") {
         
     | 
| 
       46 
     | 
    
         
            -
                    $showDiv.show();
         
     | 
| 
       47 
     | 
    
         
            -
                  }
         
     | 
| 
       48 
     | 
    
         
            -
                };
         
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
                $assemblyType.on("change", (ev) => {
         
     | 
| 
       51 
     | 
    
         
            -
                  const $target = $(ev.target);
         
     | 
| 
       52 
     | 
    
         
            -
                  toggleDependsOnSelect($target, $assemblyTypeOther);
         
     | 
| 
       53 
     | 
    
         
            -
                });
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
                $assemblyCreatedBy.on("change", (ev) => {
         
     | 
| 
       56 
     | 
    
         
            -
                  const $target = $(ev.target);
         
     | 
| 
       57 
     | 
    
         
            -
                  toggleDependsOnSelect($target, $assemblyCreatedByOther);
         
     | 
| 
       58 
     | 
    
         
            -
                });
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
                toggleDependsOnSelect($assemblyType, $assemblyTypeOther);
         
     | 
| 
       61 
     | 
    
         
            -
                toggleDependsOnSelect($assemblyCreatedBy, $assemblyCreatedByOther);
         
     | 
| 
       62 
     | 
    
         
            -
              }
         
     | 
| 
       63 
     | 
    
         
            -
            });
         
     | 
| 
      
 3 
     | 
    
         
            +
            const context = require.context("../controllers", true, /controller\.js$/)
         
     | 
| 
      
 4 
     | 
    
         
            +
            window.Stimulus.load(definitionsFromContext(context))
         
     | 
| 
         
            File without changes
         
     |