decidim-debates 0.30.3 → 0.31.0.rc1
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/debates/debate_card_metadata_cell.rb +33 -2
- data/app/cells/decidim/debates/debate_l_cell.rb +1 -1
- data/app/commands/decidim/debates/admin/create_debate.rb +2 -2
- data/app/commands/decidim/debates/admin/update_debate.rb +2 -2
- data/app/commands/decidim/debates/create_debate.rb +2 -3
- data/app/commands/decidim/debates/update_debate.rb +2 -2
- data/app/controllers/decidim/debates/admin/debate_closes_controller.rb +1 -1
- data/app/controllers/decidim/debates/admin/debates_controller.rb +2 -2
- data/app/controllers/decidim/debates/debates_controller.rb +4 -4
- data/app/forms/decidim/debates/debate_form.rb +0 -2
- data/app/helpers/decidim/debates/application_helper.rb +3 -4
- data/app/models/decidim/debates/debate.rb +32 -10
- data/app/packs/src/decidim/debates/admin/debates.js +2 -2
- data/app/permissions/decidim/debates/permissions.rb +3 -3
- data/app/presenters/decidim/debates/admin_log/value_types/debate_title_description_presenter.rb +1 -1
- data/app/presenters/decidim/debates/debate_presenter.rb +6 -14
- data/app/views/decidim/debates/admin/debate_closes/edit.html.erb +1 -1
- data/app/views/decidim/debates/admin/debates/_actions.html.erb +71 -27
- data/app/views/decidim/debates/admin/debates/_debate-tr.html.erb +5 -5
- data/app/views/decidim/debates/admin/debates/_form.html.erb +2 -2
- data/app/views/decidim/debates/admin/debates/index.html.erb +8 -5
- data/app/views/decidim/debates/admin/debates/manage_trash.html.erb +2 -1
- data/app/views/decidim/debates/debates/_close_debate_modal.html.erb +1 -1
- data/app/views/decidim/debates/debates/_debate_actions.html.erb +8 -8
- data/app/views/decidim/debates/debates/_form.html.erb +0 -4
- data/app/views/decidim/debates/debates/show.html.erb +10 -16
- data/config/assets.rb +2 -2
- data/config/locales/ar.yml +0 -8
- data/config/locales/bg.yml +0 -14
- data/config/locales/ca-IT.yml +13 -17
- data/config/locales/ca.yml +13 -17
- data/config/locales/cs.yml +12 -16
- data/config/locales/de.yml +12 -16
- data/config/locales/el.yml +0 -14
- data/config/locales/en.yml +12 -16
- data/config/locales/es-MX.yml +12 -16
- data/config/locales/es-PY.yml +12 -16
- data/config/locales/es.yml +12 -16
- data/config/locales/eu.yml +18 -22
- data/config/locales/fi-plain.yml +12 -16
- data/config/locales/fi.yml +12 -16
- data/config/locales/fr-CA.yml +8 -15
- data/config/locales/fr.yml +8 -15
- data/config/locales/ga-IE.yml +0 -10
- data/config/locales/gl.yml +0 -6
- data/config/locales/hu.yml +0 -14
- data/config/locales/id-ID.yml +0 -6
- data/config/locales/is-IS.yml +0 -4
- data/config/locales/it.yml +0 -14
- data/config/locales/ja.yml +12 -16
- data/config/locales/lb.yml +0 -12
- data/config/locales/lt.yml +0 -14
- data/config/locales/lv.yml +0 -4
- data/config/locales/nl.yml +0 -10
- data/config/locales/no.yml +0 -14
- data/config/locales/pl.yml +0 -14
- data/config/locales/pt-BR.yml +0 -14
- data/config/locales/pt.yml +0 -15
- data/config/locales/ro-RO.yml +1 -14
- data/config/locales/ru.yml +0 -4
- data/config/locales/sk.yml +0 -6
- data/config/locales/sv.yml +16 -14
- data/config/locales/tr-TR.yml +0 -15
- data/config/locales/uk.yml +0 -4
- data/config/locales/zh-CN.yml +0 -14
- data/config/locales/zh-TW.yml +0 -14
- data/db/migrate/20250515115545_rename_debates_endorsements_count_to_likes.rb +11 -0
- data/lib/decidim/api/debate_type.rb +15 -1
- data/lib/decidim/debates/component.rb +25 -9
- data/lib/decidim/debates/debate_serializer.rb +2 -2
- data/lib/decidim/debates/engine.rb +8 -39
- data/lib/decidim/debates/seeds.rb +1 -1
- data/lib/decidim/debates/test/factories.rb +22 -21
- data/lib/decidim/debates/version.rb +1 -1
- metadata +13 -15
- data/app/queries/decidim/debates/metrics/debate_followers_metric_measure.rb +0 -31
- data/app/queries/decidim/debates/metrics/debate_participants_metric_measure.rb +0 -27
- data/app/queries/decidim/debates/metrics/debates_metric_manage.rb +0 -45
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 4c9f8e30d7afe437d9c28ed29d5463d37ceface72085d419c2bed216844de31c
         | 
| 4 | 
            +
              data.tar.gz: 3d859fb0772f667b6e97452975f47f7c48b2b65dad47aef6e5a3d3ceb115e723
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: e8d3efe88814c1aadfba5577fe7782e9182655dabc9ff21820618655c74550b4be101d5f66a8c832aec96d8a9d4c24c44c4181c5bc8241bad5380bf20698cd9e
         | 
| 7 | 
            +
              data.tar.gz: 866ae0b62ca79ce2b3d83a3d79373b7465a17ab6585d2ba93ead57258232596fccd849cf907dcd448082fa99008522b6f02ccf75efbc30c4cedd96323c4584b8
         | 
| @@ -18,17 +18,48 @@ module Decidim | |
| 18 18 | 
             
                  end
         | 
| 19 19 |  | 
| 20 20 | 
             
                  def debate_items
         | 
| 21 | 
            -
                    [duration, comments_count_item,  | 
| 21 | 
            +
                    [label, duration, comments_count_item, likes_count_item] + taxonomy_items + [coauthors_item]
         | 
| 22 22 | 
             
                  end
         | 
| 23 23 |  | 
| 24 24 | 
             
                  def duration
         | 
| 25 | 
            -
                    text = format_date_range(debate.start_time, debate.end_time) | 
| 25 | 
            +
                    text = format_date_range(debate.start_time, debate.end_time)
         | 
| 26 | 
            +
                    return if text.blank?
         | 
| 26 27 |  | 
| 27 28 | 
             
                    {
         | 
| 28 29 | 
             
                      text:,
         | 
| 29 30 | 
             
                      icon: "time-line"
         | 
| 30 31 | 
             
                    }
         | 
| 31 32 | 
             
                  end
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                  # i18n-tasks-use t("decidim.debates.debates.show.ongoing")
         | 
| 35 | 
            +
                  # i18n-tasks-use t("decidim.debates.debates.show.not_started")
         | 
| 36 | 
            +
                  def label
         | 
| 37 | 
            +
                    {
         | 
| 38 | 
            +
                      text: content_tag("span", t(label_string, scope: "decidim.debates.debates.show"), class: "#{label_class} label")
         | 
| 39 | 
            +
                    }
         | 
| 40 | 
            +
                  end
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                  def label_string
         | 
| 43 | 
            +
                    case debate.state
         | 
| 44 | 
            +
                    when :ongoing
         | 
| 45 | 
            +
                      "ongoing"
         | 
| 46 | 
            +
                    when :not_started
         | 
| 47 | 
            +
                      "not_started"
         | 
| 48 | 
            +
                    else
         | 
| 49 | 
            +
                      "closed"
         | 
| 50 | 
            +
                    end
         | 
| 51 | 
            +
                  end
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                  def label_class
         | 
| 54 | 
            +
                    case debate.state
         | 
| 55 | 
            +
                    when :ongoing
         | 
| 56 | 
            +
                      "success"
         | 
| 57 | 
            +
                    when :not_started
         | 
| 58 | 
            +
                      "warning"
         | 
| 59 | 
            +
                    else
         | 
| 60 | 
            +
                      "alert"
         | 
| 61 | 
            +
                    end
         | 
| 62 | 
            +
                  end
         | 
| 32 63 | 
             
                end
         | 
| 33 64 | 
             
              end
         | 
| 34 65 | 
             
            end
         | 
| @@ -34,8 +34,8 @@ module Decidim | |
| 34 34 | 
             
                    def extra_params = { visibility: "all" }
         | 
| 35 35 |  | 
| 36 36 | 
             
                    def attributes
         | 
| 37 | 
            -
                      parsed_title = Decidim::ContentProcessor. | 
| 38 | 
            -
                      parsed_description = Decidim::ContentProcessor.parse_with_processor(: | 
| 37 | 
            +
                      parsed_title = Decidim::ContentProcessor.parse(form.title, current_organization: form.current_organization).rewrite
         | 
| 38 | 
            +
                      parsed_description = Decidim::ContentProcessor.parse_with_processor(:inline_images, form.description, current_organization: form.current_organization).rewrite
         | 
| 39 39 | 
             
                      super.merge({
         | 
| 40 40 | 
             
                                    author: form.current_organization,
         | 
| 41 41 | 
             
                                    title: parsed_title,
         | 
| @@ -30,8 +30,8 @@ module Decidim | |
| 30 30 | 
             
                    private
         | 
| 31 31 |  | 
| 32 32 | 
             
                    def attributes
         | 
| 33 | 
            -
                      parsed_title = Decidim::ContentProcessor. | 
| 34 | 
            -
                      parsed_description = Decidim::ContentProcessor.parse_with_processor(: | 
| 33 | 
            +
                      parsed_title = Decidim::ContentProcessor.parse(form.title, current_organization: form.current_organization).rewrite
         | 
| 34 | 
            +
                      parsed_description = Decidim::ContentProcessor.parse_with_processor(:inline_images, form.description, current_organization: form.current_organization).rewrite
         | 
| 35 35 |  | 
| 36 36 | 
             
                      attrs = {
         | 
| 37 37 | 
             
                        title: parsed_title,
         | 
| @@ -57,12 +57,11 @@ module Decidim | |
| 57 57 | 
             
                  end
         | 
| 58 58 |  | 
| 59 59 | 
             
                  def attributes
         | 
| 60 | 
            -
                    parsed_title = Decidim::ContentProcessor. | 
| 61 | 
            -
                    parsed_description = Decidim::ContentProcessor.parse_with_processor(: | 
| 60 | 
            +
                    parsed_title = Decidim::ContentProcessor.parse(form.title, current_organization: form.current_organization).rewrite
         | 
| 61 | 
            +
                    parsed_description = Decidim::ContentProcessor.parse_with_processor(:inline_images, form.description, current_organization: form.current_organization).rewrite
         | 
| 62 62 |  | 
| 63 63 | 
             
                    super.merge({
         | 
| 64 64 | 
             
                                  author: form.current_user,
         | 
| 65 | 
            -
                                  decidim_user_group_id: form.user_group_id,
         | 
| 66 65 | 
             
                                  title: { I18n.locale => parsed_title },
         | 
| 67 66 | 
             
                                  description: { I18n.locale => parsed_description },
         | 
| 68 67 | 
             
                                  component: form.current_component
         | 
| @@ -46,8 +46,8 @@ module Decidim | |
| 46 46 | 
             
                  def extra_params = { visibility: "public-only" }
         | 
| 47 47 |  | 
| 48 48 | 
             
                  def attributes
         | 
| 49 | 
            -
                    parsed_title = Decidim::ContentProcessor. | 
| 50 | 
            -
                    parsed_description = Decidim::ContentProcessor.parse_with_processor(: | 
| 49 | 
            +
                    parsed_title = Decidim::ContentProcessor.parse(form.title, current_organization: form.current_organization).rewrite
         | 
| 50 | 
            +
                    parsed_description = Decidim::ContentProcessor.parse_with_processor(:inline_images, form.description, current_organization: form.current_organization).rewrite
         | 
| 51 51 | 
             
                    super.merge({
         | 
| 52 52 | 
             
                                  title: { I18n.locale => parsed_title },
         | 
| 53 53 | 
             
                                  description: { I18n.locale => parsed_description }
         | 
| @@ -34,7 +34,7 @@ module Decidim | |
| 34 34 |  | 
| 35 35 | 
             
                        on(:invalid) do
         | 
| 36 36 | 
             
                          flash.now[:alert] = I18n.t("debates.create.invalid", scope: "decidim.debates.admin")
         | 
| 37 | 
            -
                          render action: "new"
         | 
| 37 | 
            +
                          render action: "new", status: :unprocessable_entity
         | 
| 38 38 | 
             
                        end
         | 
| 39 39 | 
             
                      end
         | 
| 40 40 | 
             
                    end
         | 
| @@ -57,7 +57,7 @@ module Decidim | |
| 57 57 |  | 
| 58 58 | 
             
                        on(:invalid) do
         | 
| 59 59 | 
             
                          flash.now[:alert] = I18n.t("debates.update.invalid", scope: "decidim.debates.admin")
         | 
| 60 | 
            -
                          render action: "edit"
         | 
| 60 | 
            +
                          render action: "edit", status: :unprocessable_entity
         | 
| 61 61 | 
             
                        end
         | 
| 62 62 | 
             
                      end
         | 
| 63 63 | 
             
                    end
         | 
| @@ -35,7 +35,7 @@ module Decidim | |
| 35 35 |  | 
| 36 36 | 
             
                      on(:invalid) do
         | 
| 37 37 | 
             
                        flash.now[:alert] = I18n.t("debates.create.invalid", scope: "decidim.debates")
         | 
| 38 | 
            -
                        render action: "new"
         | 
| 38 | 
            +
                        render action: "new", status: :unprocessable_entity
         | 
| 39 39 | 
             
                      end
         | 
| 40 40 | 
             
                    end
         | 
| 41 41 | 
             
                  end
         | 
| @@ -63,7 +63,7 @@ module Decidim | |
| 63 63 |  | 
| 64 64 | 
             
                      on(:invalid) do
         | 
| 65 65 | 
             
                        flash.now[:alert] = I18n.t("debates.update.invalid", scope: "decidim.debates")
         | 
| 66 | 
            -
                        render :edit
         | 
| 66 | 
            +
                        render :edit, status: :unprocessable_entity
         | 
| 67 67 | 
             
                      end
         | 
| 68 68 | 
             
                    end
         | 
| 69 69 | 
             
                  end
         | 
| @@ -116,9 +116,9 @@ module Decidim | |
| 116 116 | 
             
                    {
         | 
| 117 117 | 
             
                      search_text_cont: "",
         | 
| 118 118 | 
             
                      with_any_origin: nil,
         | 
| 119 | 
            -
                      activity:  | 
| 119 | 
            +
                      activity: "all",
         | 
| 120 120 | 
             
                      with_any_taxonomies: nil,
         | 
| 121 | 
            -
                      with_any_state:  | 
| 121 | 
            +
                      with_any_state: "all"
         | 
| 122 122 | 
             
                    }
         | 
| 123 123 | 
             
                  end
         | 
| 124 124 |  | 
| @@ -11,7 +11,6 @@ module Decidim | |
| 11 11 |  | 
| 12 12 | 
             
                  attribute :title, String
         | 
| 13 13 | 
             
                  attribute :description, String
         | 
| 14 | 
            -
                  attribute :user_group_id, Integer
         | 
| 15 14 | 
             
                  attribute :attachment, AttachmentForm
         | 
| 16 15 |  | 
| 17 16 | 
             
                  attachments_attribute :documents
         | 
| @@ -27,7 +26,6 @@ module Decidim | |
| 27 26 | 
             
                    # user locale is taken as the text locale.
         | 
| 28 27 | 
             
                    self.title = debate.title.values.first
         | 
| 29 28 | 
             
                    self.description = debate.description.values.first
         | 
| 30 | 
            -
                    self.user_group_id = debate.decidim_user_group_id
         | 
| 31 29 | 
             
                    self.documents = debate.attachments
         | 
| 32 30 | 
             
                  end
         | 
| 33 31 |  | 
| @@ -8,7 +8,7 @@ module Decidim | |
| 8 8 | 
             
                  include PaginateHelper
         | 
| 9 9 | 
             
                  include Decidim::Comments::CommentsHelper
         | 
| 10 10 | 
             
                  include Decidim::RichTextEditorHelper
         | 
| 11 | 
            -
                  include Decidim:: | 
| 11 | 
            +
                  include Decidim::LikeableHelper
         | 
| 12 12 | 
             
                  include Decidim::FollowableHelper
         | 
| 13 13 | 
             
                  include Decidim::CheckBoxesTreeHelper
         | 
| 14 14 | 
             
                  include Decidim::DateRangeHelper
         | 
| @@ -44,7 +44,6 @@ module Decidim | |
| 44 44 | 
             
                  # its origin.
         | 
| 45 45 | 
             
                  def filter_origin_values
         | 
| 46 46 | 
             
                    origin_keys = %w(official participants)
         | 
| 47 | 
            -
                    origin_keys << "user_group" if current_organization.user_groups_enabled?
         | 
| 48 47 |  | 
| 49 48 | 
             
                    origin_values = origin_keys.map { |key| [key, t(key, scope: "decidim.debates.debates.filters")] }
         | 
| 50 49 | 
             
                    origin_values.prepend(["", all_filter_text])
         | 
| @@ -60,7 +59,7 @@ module Decidim | |
| 60 59 | 
             
                  # Returns a TreeNode to be used in the list filters to filter debates by
         | 
| 61 60 | 
             
                  # its state.
         | 
| 62 61 | 
             
                  def filter_debates_state_values
         | 
| 63 | 
            -
                    %w( | 
| 62 | 
            +
                    %w(ongoing closed).map { |k| [k, t(k, scope: "decidim.debates.debates.filters.state_values")] }.prepend(
         | 
| 64 63 | 
             
                      ["all", all_filter_text]
         | 
| 65 64 | 
             
                    )
         | 
| 66 65 | 
             
                  end
         | 
| @@ -74,7 +73,7 @@ module Decidim | |
| 74 73 | 
             
                      items = [{
         | 
| 75 74 | 
             
                        method: :with_any_state,
         | 
| 76 75 | 
             
                        collection: filter_debates_state_values,
         | 
| 77 | 
            -
                        label: t("decidim. | 
| 76 | 
            +
                        label: t("decidim.debates.debates.filters.state"),
         | 
| 78 77 | 
             
                        id: "date",
         | 
| 79 78 | 
             
                        type: :radio_buttons
         | 
| 80 79 | 
             
                      }]
         | 
| @@ -25,7 +25,7 @@ module Decidim | |
| 25 25 | 
             
                  include Decidim::Searchable
         | 
| 26 26 | 
             
                  include Decidim::TranslatableResource
         | 
| 27 27 | 
             
                  include Decidim::TranslatableAttributes
         | 
| 28 | 
            -
                  include Decidim:: | 
| 28 | 
            +
                  include Decidim::Likeable
         | 
| 29 29 | 
             
                  include Decidim::Randomable
         | 
| 30 30 | 
             
                  include Decidim::FilterableResource
         | 
| 31 31 | 
             
                  include Decidim::SoftDeletable
         | 
| @@ -47,7 +47,8 @@ module Decidim | |
| 47 47 |  | 
| 48 48 | 
             
                  scope :updated_at_desc, -> { order(arel_table[:updated_at].desc) }
         | 
| 49 49 | 
             
                  scope :open, -> { where(closed_at: nil) }
         | 
| 50 | 
            -
                  scope :closed, -> { where.not(closed_at: nil) }
         | 
| 50 | 
            +
                  scope :closed, -> { where.not(closed_at: nil).or(where(end_time: ..Time.current)) }
         | 
| 51 | 
            +
                  scope :ongoing, -> { open.where(start_time: ..Time.current, end_time: Time.current..).or(open.where(start_time: nil, end_time: nil)) }
         | 
| 51 52 | 
             
                  scope :authored_by, ->(author) { where(author:) }
         | 
| 52 53 | 
             
                  scope :commented_by, lambda { |author|
         | 
| 53 54 | 
             
                    joins(:comments).where(
         | 
| @@ -58,7 +59,7 @@ module Decidim | |
| 58 59 | 
             
                      }
         | 
| 59 60 | 
             
                    )
         | 
| 60 61 | 
             
                  }
         | 
| 61 | 
            -
                  scope_search_multi :with_any_state, [: | 
| 62 | 
            +
                  scope_search_multi :with_any_state, [:ongoing, :closed]
         | 
| 62 63 |  | 
| 63 64 | 
             
                  # Returns the presenter for this debate, to be used in the views.
         | 
| 64 65 | 
             
                  # Required by ResourceRenderer.
         | 
| @@ -98,23 +99,44 @@ module Decidim | |
| 98 99 | 
             
                    start_time.present? && end_time.present?
         | 
| 99 100 | 
             
                  end
         | 
| 100 101 |  | 
| 101 | 
            -
                  # Public: Checks whether the debate is an AMA-styled one and is  | 
| 102 | 
            +
                  # Public: Checks whether the debate is an AMA-styled one and is ongoing.
         | 
| 102 103 | 
             
                  #
         | 
| 103 104 | 
             
                  # Returns a boolean.
         | 
| 104 | 
            -
                  def  | 
| 105 | 
            +
                  def ongoing_ama?
         | 
| 105 106 | 
             
                    ama? && Time.current.between?(start_time, end_time)
         | 
| 106 107 | 
             
                  end
         | 
| 107 108 |  | 
| 108 | 
            -
                  # Public: Checks if the debate is  | 
| 109 | 
            +
                  # Public: Checks if the debate is ongoing or not.
         | 
| 109 110 | 
             
                  #
         | 
| 110 111 | 
             
                  # Returns a boolean.
         | 
| 111 | 
            -
                  def  | 
| 112 | 
            -
                    (ama? &&  | 
| 112 | 
            +
                  def ongoing?
         | 
| 113 | 
            +
                    (ama? && ongoing_ama?) || !ama?
         | 
| 114 | 
            +
                  end
         | 
| 115 | 
            +
             | 
| 116 | 
            +
                  def not_started?
         | 
| 117 | 
            +
                    start_time.present? && start_time > Time.current
         | 
| 118 | 
            +
                  end
         | 
| 119 | 
            +
             | 
| 120 | 
            +
                  # Note that a debate can be finished even if it is not closed (meaning it has no conclusions).
         | 
| 121 | 
            +
                  def finished?
         | 
| 122 | 
            +
                    end_time.present? && end_time < Time.current
         | 
| 123 | 
            +
                  end
         | 
| 124 | 
            +
             | 
| 125 | 
            +
                  def state
         | 
| 126 | 
            +
                    if closed?
         | 
| 127 | 
            +
                      :closed
         | 
| 128 | 
            +
                    elsif ongoing?
         | 
| 129 | 
            +
                      :ongoing
         | 
| 130 | 
            +
                    elsif not_started?
         | 
| 131 | 
            +
                      :not_started
         | 
| 132 | 
            +
                    else
         | 
| 133 | 
            +
                      :finished
         | 
| 134 | 
            +
                    end
         | 
| 113 135 | 
             
                  end
         | 
| 114 136 |  | 
| 115 137 | 
             
                  # Public: Overrides the `accepts_new_comments?` CommentableWithComponent concern method.
         | 
| 116 138 | 
             
                  def accepts_new_comments?
         | 
| 117 | 
            -
                    return false unless  | 
| 139 | 
            +
                    return false unless ongoing?
         | 
| 118 140 | 
             
                    return false if closed?
         | 
| 119 141 |  | 
| 120 142 | 
             
                    commentable? && !comments_blocked? && comments_allowed?
         | 
| @@ -202,7 +224,7 @@ module Decidim | |
| 202 224 |  | 
| 203 225 | 
             
                    update_columns(
         | 
| 204 226 | 
             
                      last_comment_at: last_comment&.created_at,
         | 
| 205 | 
            -
                      last_comment_by_id: last_comment&. | 
| 227 | 
            +
                      last_comment_by_id: last_comment&.decidim_author_id,
         | 
| 206 228 | 
             
                      last_comment_by_type: last_comment&.decidim_author_type,
         | 
| 207 229 | 
             
                      comments_count:,
         | 
| 208 230 | 
             
                      updated_at: Time.current
         | 
| @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            import createFieldDependentInputs from "src/decidim/admin/field_dependent_inputs.component"
         | 
| 2 2 |  | 
| 3 | 
            -
             | 
| 4 | 
            -
              const $debateType = $('[name="debate[finite]"');
         | 
| 3 | 
            +
            document.addEventListener("turbo:load", () => {
         | 
| 4 | 
            +
              const $debateType = $('[name="debate[finite]"]');
         | 
| 5 5 |  | 
| 6 6 | 
             
              createFieldDependentInputs({
         | 
| 7 7 | 
             
                controllerField: $debateType,
         | 
| @@ -19,8 +19,8 @@ module Decidim | |
| 19 19 | 
             
                      allow!
         | 
| 20 20 | 
             
                    when :edit
         | 
| 21 21 | 
             
                      can_edit_debate?
         | 
| 22 | 
            -
                    when : | 
| 23 | 
            -
                       | 
| 22 | 
            +
                    when :like
         | 
| 23 | 
            +
                      can_like_debate?
         | 
| 24 24 | 
             
                    when :close
         | 
| 25 25 | 
             
                      can_close_debate?
         | 
| 26 26 | 
             
                    end
         | 
| @@ -47,7 +47,7 @@ module Decidim | |
| 47 47 | 
             
                    disallow!
         | 
| 48 48 | 
             
                  end
         | 
| 49 49 |  | 
| 50 | 
            -
                  def  | 
| 50 | 
            +
                  def can_like_debate?
         | 
| 51 51 | 
             
                    return disallow! if debate.closed?
         | 
| 52 52 |  | 
| 53 53 | 
             
                    allow!
         | 
    
        data/app/presenters/decidim/debates/admin_log/value_types/debate_title_description_presenter.rb
    CHANGED
    
    | @@ -10,7 +10,7 @@ module Decidim | |
| 10 10 | 
             
                      def present
         | 
| 11 11 | 
             
                        return unless value
         | 
| 12 12 |  | 
| 13 | 
            -
                        renderer = Decidim::ContentRenderers:: | 
| 13 | 
            +
                        renderer = Decidim::ContentRenderers::BlobRenderer.new(h.decidim_escape_translated(value))
         | 
| 14 14 | 
             
                        renderer.render(links: false).html_safe
         | 
| 15 15 | 
             
                      end
         | 
| 16 16 | 
             
                    end
         | 
| @@ -18,23 +18,21 @@ module Decidim | |
| 18 18 | 
             
                  def author
         | 
| 19 19 | 
             
                    @author ||= if official?
         | 
| 20 20 | 
             
                                  Decidim::Debates::OfficialAuthorPresenter.new
         | 
| 21 | 
            -
                                elsif user_group
         | 
| 22 | 
            -
                                  Decidim::UserGroupPresenter.new(user_group)
         | 
| 23 21 | 
             
                                else
         | 
| 24 22 | 
             
                                  Decidim::UserPresenter.new(super)
         | 
| 25 23 | 
             
                                end
         | 
| 26 24 | 
             
                  end
         | 
| 27 25 |  | 
| 28 | 
            -
                  def title( | 
| 26 | 
            +
                  def title(html_escape: false, all_locales: false)
         | 
| 29 27 | 
             
                    return unless debate
         | 
| 30 28 |  | 
| 31 | 
            -
                    super(debate.title,  | 
| 29 | 
            +
                    super(debate.title, html_escape, all_locales)
         | 
| 32 30 | 
             
                  end
         | 
| 33 31 |  | 
| 34 | 
            -
                  def description( | 
| 32 | 
            +
                  def description(links: false, strip_tags: false, all_locales: false)
         | 
| 35 33 | 
             
                    return unless debate
         | 
| 36 34 |  | 
| 37 | 
            -
                    content_handle_locale(debate.description, all_locales,  | 
| 35 | 
            +
                    content_handle_locale(debate.description, all_locales, links, strip_tags)
         | 
| 38 36 | 
             
                  end
         | 
| 39 37 |  | 
| 40 38 | 
             
                  def last_comment_at
         | 
| @@ -49,20 +47,14 @@ module Decidim | |
| 49 47 |  | 
| 50 48 | 
             
                  def participants_count
         | 
| 51 49 | 
             
                    comments_authors.count do |author|
         | 
| 52 | 
            -
                      author.is_a?(Decidim::User)
         | 
| 53 | 
            -
                    end
         | 
| 54 | 
            -
                  end
         | 
| 55 | 
            -
             | 
| 56 | 
            -
                  def groups_count
         | 
| 57 | 
            -
                    comments_authors.count do |author|
         | 
| 58 | 
            -
                      author.is_a?(Decidim::UserGroup)
         | 
| 50 | 
            +
                      author.is_a?(Decidim::User) && !author.group?
         | 
| 59 51 | 
             
                    end
         | 
| 60 52 | 
             
                  end
         | 
| 61 53 |  | 
| 62 54 | 
             
                  private
         | 
| 63 55 |  | 
| 64 56 | 
             
                  def comments_authors
         | 
| 65 | 
            -
                    @comments_authors ||= debate.comments.includes(:author | 
| 57 | 
            +
                    @comments_authors ||= debate.comments.includes(:author).map(&:author).uniq
         | 
| 66 58 | 
             
                  end
         | 
| 67 59 | 
             
                end
         | 
| 68 60 | 
             
              end
         | 
| @@ -12,7 +12,7 @@ | |
| 12 12 |  | 
| 13 13 | 
             
                      <div class="card-section">
         | 
| 14 14 | 
             
                        <div class="row column">
         | 
| 15 | 
            -
                          <%= f.translated :editor, :conclusions, autofocus: true, rows: 15 %>
         | 
| 15 | 
            +
                          <%= f.translated :editor, :conclusions, autofocus: true, rows: 15, data: { controller: "character-counter" } %>
         | 
| 16 16 | 
             
                        </div>
         | 
| 17 17 | 
             
                      </div>
         | 
| 18 18 | 
             
                    </div>
         | 
| @@ -1,27 +1,71 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
               | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
               | 
| 7 | 
            -
                 | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 1 | 
            +
            <button type="button" data-controller="dropdown" data-target="actions-post-<%= debate.id %>" aria-label="<%= t("decidim.admin.actions.actions_label", resource: debate.title) %>">
         | 
| 2 | 
            +
              <%= icon "more-fill", class: "text-secondary" %>
         | 
| 3 | 
            +
            </button>
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            <div class="inline-block relative">
         | 
| 6 | 
            +
              <ul id="actions-post-<%= debate.id %>" class="dropdown dropdown__action" aria-hidden="true">
         | 
| 7 | 
            +
                <% if view == :deleted %>
         | 
| 8 | 
            +
                  <% if allowed_to? :restore, :debate, trashable_deleted_resource: debate %>
         | 
| 9 | 
            +
                    <li class="dropdown__item">
         | 
| 10 | 
            +
                      <%= link_to url_for(action: :restore, id: debate, controller: "debates"), method: :patch, class: "dropdown__button" do %>
         | 
| 11 | 
            +
                        <%= icon "refresh-line" %>
         | 
| 12 | 
            +
                        <%= t("decidim.admin.actions.restore") %>
         | 
| 13 | 
            +
                      <% end %>
         | 
| 14 | 
            +
                    </li>
         | 
| 15 | 
            +
                  <% end %>
         | 
| 16 | 
            +
                <% else %>
         | 
| 17 | 
            +
                  <% if allowed_to? :update, :debate, debate: debate %>
         | 
| 18 | 
            +
                    <li class="dropdown__item">
         | 
| 19 | 
            +
                      <%= link_to edit_debate_path(debate), class: "dropdown__button" do %>
         | 
| 20 | 
            +
                        <%= icon "pencil-line" %>
         | 
| 21 | 
            +
                        <%= t("actions.edit", scope: "decidim.debates") %>
         | 
| 22 | 
            +
                      <% end %>
         | 
| 23 | 
            +
                    </li>
         | 
| 24 | 
            +
                  <% end %>
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                  <% if allowed_to? :close, :debate, debate: debate %>
         | 
| 27 | 
            +
                    <li class="dropdown__item">
         | 
| 28 | 
            +
                      <%= link_to edit_debate_debate_close_path(debate_id: debate.id, id: debate.id), class: "dropdown__button" do %>
         | 
| 29 | 
            +
                        <%= icon "lock-line" %>
         | 
| 30 | 
            +
                        <%= t("actions.close", scope: "decidim.debates") %>
         | 
| 31 | 
            +
                      <% end %>
         | 
| 32 | 
            +
                    </li>
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                    <hr>
         | 
| 35 | 
            +
                  <% end %>
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                  <li class="dropdown__item">
         | 
| 38 | 
            +
                    <%= link_to resource_locator(debate).path, target: :blank, data: { "external-link": false }, class: "dropdown__button" do %>
         | 
| 39 | 
            +
                      <%= icon "eye-line" %>
         | 
| 40 | 
            +
                      <%= t("actions.preview", scope: "decidim.admin") %>
         | 
| 41 | 
            +
                    <% end %>
         | 
| 42 | 
            +
                  </li>
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                  <hr>
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                  <li class="dropdown__item">
         | 
| 47 | 
            +
                    <%= dropdown_resource_permissions_link(debate) %>
         | 
| 48 | 
            +
                  </li>
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                  <hr>
         | 
| 51 | 
            +
             | 
| 52 | 
            +
                  <li class="dropdown__item">
         | 
| 53 | 
            +
                    <% if allowed_to? :soft_delete, :debate, trashable_deleted_resource: debate %>
         | 
| 54 | 
            +
                      <%= link_to soft_delete_debate_path(debate), method: :patch, data: { confirm: t("actions.confirm_delete_debate", scope: "decidim.debates") }, class: "dropdown__button" do %>
         | 
| 55 | 
            +
                        <%= icon "delete-bin-line" %>
         | 
| 56 | 
            +
                        <%= t("actions.soft_delete", scope: "decidim.admin") %>
         | 
| 57 | 
            +
                      <% end %>
         | 
| 58 | 
            +
                    <% else %>
         | 
| 59 | 
            +
                      <div class="dropdown__button-disabled">
         | 
| 60 | 
            +
                        <%= with_tooltip t("tooltips.deleted_debates_info", scope: "decidim.admin") do %>
         | 
| 61 | 
            +
                          <%= icon "delete-bin-line", class: "text-gray" %>
         | 
| 62 | 
            +
                          <span>
         | 
| 63 | 
            +
                            <%= t("actions.soft_delete", scope: "decidim.admin") %>
         | 
| 64 | 
            +
                          </span>
         | 
| 65 | 
            +
                        <% end %>
         | 
| 66 | 
            +
                      </div>
         | 
| 67 | 
            +
                    <% end %>
         | 
| 68 | 
            +
                  </li>
         | 
| 69 | 
            +
                <% end %>
         | 
| 70 | 
            +
              </ul>
         | 
| 71 | 
            +
            </div>
         | 
| @@ -1,25 +1,25 @@ | |
| 1 1 | 
             
            <tr data-id="<%= debate.id %>">
         | 
| 2 | 
            -
              <td>
         | 
| 2 | 
            +
              <td data-label="<%= t("models.debate.fields.title", scope: "decidim.debates") %>">
         | 
| 3 3 | 
             
                <% if allowed_to? :update, :debate, debate: debate %>
         | 
| 4 4 | 
             
                  <%= link_to present(debate).title(html_escape: true), edit_debate_path(debate) %>
         | 
| 5 5 | 
             
                <% else %>
         | 
| 6 6 | 
             
                  <%= present(debate).title(html_escape: true) %><br>
         | 
| 7 7 | 
             
                <% end %>
         | 
| 8 8 | 
             
              </td>
         | 
| 9 | 
            -
              <td>
         | 
| 9 | 
            +
              <td data-label="<%= t("models.debate.fields.start_time", scope: "decidim.debates") %>">
         | 
| 10 10 | 
             
                <% if debate.start_time %>
         | 
| 11 11 | 
             
                  <%= l debate.start_time, format: :long %>
         | 
| 12 12 | 
             
                <% end %>
         | 
| 13 13 | 
             
              </td>
         | 
| 14 | 
            -
              <td>
         | 
| 14 | 
            +
              <td data-label="<%= t("models.debate.fields.end_time", scope: "decidim.debates") %>">
         | 
| 15 15 | 
             
                <% if debate.end_time %>
         | 
| 16 16 | 
             
                  <%= l debate.end_time, format: :long %>
         | 
| 17 17 | 
             
                <% end %>
         | 
| 18 18 | 
             
              </td>
         | 
| 19 | 
            -
              <td>
         | 
| 19 | 
            +
              <td data-label="<%= t("models.debate.fields.taxonomies", scope: "decidim.debates") %>">
         | 
| 20 20 | 
             
                <%= debate.taxonomies.map { |taxonomy| decidim_sanitize_translated(taxonomy.name) }.join(", ") %>
         | 
| 21 21 | 
             
              </td>
         | 
| 22 | 
            -
              <td class="table-list__actions">
         | 
| 22 | 
            +
              <td class="table-list__actions" data-label="<%= t("actions.title", scope: "decidim.debates") %>">
         | 
| 23 23 | 
             
                <%= render partial: "decidim/debates/admin/debates/actions", locals: { debate:, view: } %>
         | 
| 24 24 | 
             
              </td>
         | 
| 25 25 | 
             
            </tr>
         | 
| @@ -2,11 +2,11 @@ | |
| 2 2 | 
             
              <div class="card pt-4">
         | 
| 3 3 | 
             
                <div class="card-section debate-fields">
         | 
| 4 4 | 
             
                   <div class="row column">
         | 
| 5 | 
            -
                    <%= form.translated :text_field, :title, autofocus: true,  | 
| 5 | 
            +
                    <%= form.translated :text_field, :title, autofocus: true, aria: { label: :title } %>
         | 
| 6 6 | 
             
                  </div>
         | 
| 7 7 |  | 
| 8 8 | 
             
                   <div class="row column">
         | 
| 9 | 
            -
                    <%= form.translated :editor, :description,  | 
| 9 | 
            +
                    <%= form.translated :editor, :description, resource_mentionable: true, aria: { label: :description } %>
         | 
| 10 10 | 
             
                  </div>
         | 
| 11 11 |  | 
| 12 12 | 
             
                  <div class="row column">
         | 
| @@ -1,14 +1,17 @@ | |
| 1 1 | 
             
            <% add_decidim_page_title(t(".title")) %>
         | 
| 2 | 
            +
             | 
| 2 3 | 
             
            <div class="card">
         | 
| 3 4 | 
             
              <div class="item_show__header">
         | 
| 4 5 | 
             
                <h1 class="item_show__header-title">
         | 
| 5 6 | 
             
                  <%= t(".title") %>
         | 
| 6 | 
            -
                   | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 7 | 
            +
                  <div class="flex align-middle gap-x-4 ml-auto">
         | 
| 8 | 
            +
                    <%= export_dropdown if allowed_to? :export, :debates %>
         | 
| 9 | 
            +
                    <%= link_to t("actions.new", scope: "decidim.debates"), new_debate_path, class: "button button__sm button__secondary" if allowed_to? :create, :debate %>
         | 
| 10 | 
            +
                    <%= render partial: "decidim/admin/components/resource_action" %>
         | 
| 11 | 
            +
                  </div>
         | 
| 9 12 | 
             
                </h1>
         | 
| 10 13 | 
             
              </div>
         | 
| 11 | 
            -
              <div class="table- | 
| 14 | 
            +
              <div class="table-stacked">
         | 
| 12 15 | 
             
                <table class="table-list">
         | 
| 13 16 | 
             
                  <%= render partial: "debates-thead" %>
         | 
| 14 17 | 
             
                  <tbody>
         | 
| @@ -21,7 +24,7 @@ | |
| 21 24 | 
             
              </div>
         | 
| 22 25 | 
             
              <% if allowed_to? :manage_trash, :debate, participatory_space: current_participatory_space %>
         | 
| 23 26 | 
             
                <div class="card mt-4">
         | 
| 24 | 
            -
                  <%= link_to manage_trash_debates_path, class: "flex items-center | 
| 27 | 
            +
                  <%= link_to manage_trash_debates_path, class: "flex items-center  text-secondary" do %>
         | 
| 25 28 | 
             
                    <%= icon "delete-bin-2-line", class: "mr-2 fill-current text-secondary", role: "img" %>
         | 
| 26 29 | 
             
                    <%= t("actions.view_deleted_debates", scope: "decidim.debates") %>
         | 
| 27 30 | 
             
                    <span class="ml-2">
         | 
| @@ -1,11 +1,12 @@ | |
| 1 1 | 
             
            <% add_decidim_page_title(t(".title")) %>
         | 
| 2 | 
            +
             | 
| 2 3 | 
             
            <div class="card">
         | 
| 3 4 | 
             
              <div class="item_show__header">
         | 
| 4 5 | 
             
                <h1 class="item_show__header-title">
         | 
| 5 6 | 
             
                  <%= t(".title") %>
         | 
| 6 7 | 
             
                </h1>
         | 
| 7 8 | 
             
              </div>
         | 
| 8 | 
            -
              <div class="table- | 
| 9 | 
            +
              <div class="table-stacked">
         | 
| 9 10 | 
             
                <table class="table-list">
         | 
| 10 11 | 
             
                  <%= render partial: "debates-thead" %>
         | 
| 11 12 | 
             
                  <tbody>
         | 
| @@ -8,7 +8,7 @@ | |
| 8 8 | 
             
                  <div class="my-8" id="dialog-desc-close-debate">
         | 
| 9 9 | 
             
                    <p><%= t("description", scope: "decidim.debates.debates.close_debate_modal") %></p>
         | 
| 10 10 | 
             
                    <div class="form__wrapper">
         | 
| 11 | 
            -
                      <%= f.text_area :conclusions, rows: 10 %>
         | 
| 11 | 
            +
                      <%= f.text_area :conclusions, rows: 10, data: { controller: "character-counter" } %>
         | 
| 12 12 | 
             
                    </div>
         | 
| 13 13 | 
             
                  </div>
         | 
| 14 14 | 
             
                </div>
         |