decidim-debates 0.29.3 → 0.30.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.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/debates/content_blocks/highlighted_debates/content.erb +16 -0
  3. data/app/cells/decidim/debates/content_blocks/highlighted_debates_cell.rb +49 -0
  4. data/app/cells/decidim/debates/debate_card_metadata_cell.rb +2 -11
  5. data/app/cells/decidim/debates/debate_g/show.erb +12 -0
  6. data/app/cells/decidim/debates/debate_g_cell.rb +23 -0
  7. data/app/cells/decidim/debates/debate_metadata_g_cell.rb +14 -0
  8. data/app/commands/decidim/debates/admin/create_debate.rb +25 -2
  9. data/app/commands/decidim/debates/admin/update_debate.rb +34 -5
  10. data/app/commands/decidim/debates/create_debate.rb +22 -1
  11. data/app/commands/decidim/debates/update_debate.rb +26 -2
  12. data/app/controllers/decidim/debates/admin/debates_controller.rb +17 -14
  13. data/app/controllers/decidim/debates/debates_controller.rb +8 -4
  14. data/app/controllers/decidim/debates/versions_controller.rb +1 -1
  15. data/app/forms/decidim/debates/admin/debate_form.rb +34 -26
  16. data/app/forms/decidim/debates/debate_form.rb +12 -29
  17. data/app/helpers/decidim/debates/application_helper.rb +8 -8
  18. data/app/models/decidim/debates/debate.rb +28 -1
  19. data/app/permissions/decidim/debates/admin/permissions.rb +5 -5
  20. data/app/presenters/decidim/debates/admin_log/debate_presenter.rb +1 -1
  21. data/app/presenters/decidim/debates/debate_presenter.rb +1 -1
  22. data/app/queries/decidim/debates/metrics/debate_followers_metric_measure.rb +2 -2
  23. data/app/queries/decidim/debates/metrics/debate_participants_metric_measure.rb +2 -2
  24. data/app/queries/decidim/debates/metrics/debates_metric_manage.rb +6 -6
  25. data/app/serializers/decidim/debates/download_your_data_debate_serializer.rb +6 -13
  26. data/app/views/decidim/debates/admin/debates/_actions.html.erb +27 -0
  27. data/app/views/decidim/debates/admin/debates/_debate-tr.html.erb +25 -0
  28. data/app/views/decidim/debates/admin/debates/_debates-thead.html.erb +9 -0
  29. data/app/views/decidim/debates/admin/debates/_form.html.erb +27 -6
  30. data/app/views/decidim/debates/admin/debates/index.html.erb +17 -55
  31. data/app/views/decidim/debates/admin/debates/manage_trash.html.erb +19 -0
  32. data/app/views/decidim/debates/debates/_debate_actions.html.erb +33 -0
  33. data/app/views/decidim/debates/debates/_debates.html.erb +1 -1
  34. data/app/views/decidim/debates/debates/_form.html.erb +19 -6
  35. data/app/views/decidim/debates/debates/index.html.erb +2 -2
  36. data/app/views/decidim/debates/debates/new.html.erb +0 -1
  37. data/app/views/decidim/debates/debates/show.html.erb +31 -44
  38. data/config/locales/ar.yml +10 -13
  39. data/config/locales/bg.yml +2 -15
  40. data/config/locales/ca.yml +80 -17
  41. data/config/locales/cs.yml +80 -17
  42. data/config/locales/de.yml +80 -17
  43. data/config/locales/el.yml +2 -16
  44. data/config/locales/en.yml +79 -16
  45. data/config/locales/es-MX.yml +80 -17
  46. data/config/locales/es-PY.yml +80 -17
  47. data/config/locales/es.yml +80 -17
  48. data/config/locales/eu.yml +89 -26
  49. data/config/locales/fi-plain.yml +81 -18
  50. data/config/locales/fi.yml +81 -18
  51. data/config/locales/fr-CA.yml +42 -17
  52. data/config/locales/fr.yml +42 -17
  53. data/config/locales/ga-IE.yml +0 -11
  54. data/config/locales/gl.yml +2 -13
  55. data/config/locales/hu.yml +2 -16
  56. data/config/locales/id-ID.yml +2 -13
  57. data/config/locales/is-IS.yml +1 -13
  58. data/config/locales/it.yml +3 -17
  59. data/config/locales/ja.yml +60 -17
  60. data/config/locales/lb.yml +1 -7
  61. data/config/locales/lt.yml +2 -15
  62. data/config/locales/lv.yml +2 -11
  63. data/config/locales/nl.yml +3 -15
  64. data/config/locales/no.yml +2 -16
  65. data/config/locales/pl.yml +2 -15
  66. data/config/locales/pt-BR.yml +2 -15
  67. data/config/locales/pt.yml +2 -40
  68. data/config/locales/ro-RO.yml +33 -49
  69. data/config/locales/ru.yml +1 -15
  70. data/config/locales/sk.yml +2 -13
  71. data/config/locales/sl.yml +0 -2
  72. data/config/locales/sv.yml +2 -15
  73. data/config/locales/tr-TR.yml +2 -16
  74. data/config/locales/uk.yml +1 -15
  75. data/config/locales/zh-CN.yml +2 -14
  76. data/config/locales/zh-TW.yml +2 -16
  77. data/db/migrate/20200827154116_add_commentable_counter_cache_to_debates.rb +1 -1
  78. data/db/migrate/20200902133452_add_cached_comment_metadata_to_debates.rb +1 -1
  79. data/db/migrate/20210310120652_add_followable_counter_cache_to_debates.rb +1 -1
  80. data/db/migrate/20240828103648_add_deleted_at_to_decidim_debates_debates.rb +8 -0
  81. data/db/migrate/20241017153555_add_comments_layout_to_debates.rb +7 -0
  82. data/decidim-debates.gemspec +1 -1
  83. data/lib/decidim/api/debate_type.rb +6 -8
  84. data/lib/decidim/api/debates_type.rb +4 -5
  85. data/lib/decidim/debates/admin_engine.rb +7 -0
  86. data/lib/decidim/debates/component.rb +19 -4
  87. data/lib/decidim/debates/debate_serializer.rb +83 -0
  88. data/lib/decidim/debates/seeds.rb +1 -8
  89. data/lib/decidim/debates/test/factories.rb +2 -0
  90. data/lib/decidim/debates/version.rb +1 -1
  91. data/lib/decidim/debates.rb +1 -0
  92. metadata +27 -16
  93. data/app/helpers/decidim/debates/admin/application_helper.rb +0 -13
  94. data/config/locales/ca-IT.yml +0 -224
@@ -7,6 +7,7 @@ module Decidim
7
7
  # debate.
8
8
  class Debate < Debates::ApplicationRecord
9
9
  include Decidim::HasComponent
10
+ include Decidim::Taxonomizable
10
11
  include Decidim::HasCategory
11
12
  include Decidim::Resourceable
12
13
  include Decidim::Followable
@@ -15,6 +16,7 @@ module Decidim
15
16
  include Decidim::ScopableResource
16
17
  include Decidim::Authorable
17
18
  include Decidim::Reportable
19
+ include Decidim::HasAttachments
18
20
  include Decidim::HasReference
19
21
  include Decidim::Traceable
20
22
  include Decidim::Loggable
@@ -26,6 +28,7 @@ module Decidim
26
28
  include Decidim::Endorsable
27
29
  include Decidim::Randomable
28
30
  include Decidim::FilterableResource
31
+ include Decidim::SoftDeletable
29
32
 
30
33
  belongs_to :last_comment_by, polymorphic: true, foreign_type: "last_comment_by_type", optional: true
31
34
  component_manifest_name "debates"
@@ -42,6 +45,7 @@ module Decidim
42
45
  index_on_create: ->(debate) { debate.visible? },
43
46
  index_on_update: ->(debate) { debate.visible? })
44
47
 
48
+ scope :updated_at_desc, -> { order(arel_table[:updated_at].desc) }
45
49
  scope :open, -> { where(closed_at: nil) }
46
50
  scope :closed, -> { where.not(closed_at: nil) }
47
51
  scope :authored_by, ->(author) { where(author:) }
@@ -74,6 +78,11 @@ module Decidim
74
78
  end_time
75
79
  end
76
80
 
81
+ # Public: Overrides the `reported_content_url` Reportable concern method.
82
+ def reported_content_url
83
+ ResourceLocatorPresenter.new(self).url
84
+ end
85
+
77
86
  # Public: Overrides the `reported_attributes` Reportable concern method.
78
87
  def reported_attributes
79
88
  [:title, :description]
@@ -131,6 +140,16 @@ module Decidim
131
140
  self.class.name
132
141
  end
133
142
 
143
+ # Public: Checks whether the comments are displayed in a single-column layout.
144
+ def single_column_layout?
145
+ comments_layout == "single_column"
146
+ end
147
+
148
+ # Public: Checks whether the comments are displayed in a two-column layout.
149
+ def two_columns_layout?
150
+ comments_layout == "two_columns"
151
+ end
152
+
134
153
  # Public: Override Commentable concern method `users_to_notify_on_comment_created`
135
154
  def users_to_notify_on_comment_created
136
155
  return Decidim::User.where(id: followers).or(Decidim::User.where(id: component.participatory_space.admins)).distinct if official?
@@ -201,13 +220,21 @@ module Decidim
201
220
  ransacker_i18n_multi :search_text, [:title, :description]
202
221
 
203
222
  def self.ransackable_scopes(_auth_object = nil)
204
- [:with_any_state, :with_any_origin, :with_any_category, :with_any_scope]
223
+ [:with_any_state, :with_any_origin, :with_any_taxonomies]
205
224
  end
206
225
 
207
226
  def self.ransack(params = {}, options = {})
208
227
  DebateSearch.new(self, params, options)
209
228
  end
210
229
 
230
+ def self.ransackable_attributes(_auth_object = nil)
231
+ %w(search_text title description)
232
+ end
233
+
234
+ def self.ransackable_associations(_auth_object = nil)
235
+ %w(taxonomies)
236
+ end
237
+
211
238
  private
212
239
 
213
240
  def comments_blocked?
@@ -8,7 +8,7 @@ module Decidim
8
8
  # The public part needs to be implemented yet
9
9
  return permission_action if permission_action.scope != :admin
10
10
 
11
- can_export_comments?
11
+ can_export_debates?
12
12
 
13
13
  return permission_action if permission_action.subject != :debate
14
14
 
@@ -17,8 +17,8 @@ module Decidim
17
17
  allow!
18
18
  when :update
19
19
  toggle_allow(debate && !debate.closed? && debate.official?)
20
- when :delete, :close
21
- toggle_allow(debate && debate.official?)
20
+ when :close
21
+ toggle_allow(debate&.official?)
22
22
  end
23
23
 
24
24
  permission_action
@@ -30,8 +30,8 @@ module Decidim
30
30
  @debate ||= context.fetch(:debate, nil)
31
31
  end
32
32
 
33
- def can_export_comments?
34
- allow! if permission_action.subject == :comments && permission_action.action == :export
33
+ def can_export_debates?
34
+ allow! if permission_action.subject == :debates && permission_action.action == :export
35
35
  end
36
36
  end
37
37
  end
@@ -32,7 +32,7 @@ module Decidim
32
32
 
33
33
  def action_string
34
34
  case action
35
- when "create", "update"
35
+ when "create", "update", "soft_delete", "restore"
36
36
  "decidim.debates.admin_log.debate.#{action}"
37
37
  else
38
38
  super
@@ -28,7 +28,7 @@ module Decidim
28
28
  def title(links: false, all_locales: false, html_escape: false)
29
29
  return unless debate
30
30
 
31
- super debate.title, links, html_escape, all_locales
31
+ super(debate.title, links, html_escape, all_locales)
32
32
  end
33
33
 
34
34
  def description(strip_tags: false, extras: true, links: false, all_locales: false)
@@ -14,10 +14,10 @@ module Decidim
14
14
  debates = Decidim::Debates::Debate.where(component: @resource).joins(:component)
15
15
 
16
16
  debates_followers = Decidim::Follow.where(followable: debates).joins(:user)
17
- .where("decidim_follows.created_at <= ?", end_time)
17
+ .where(decidim_follows: { created_at: ..end_time })
18
18
  cumulative_users = debates_followers.pluck(:decidim_user_id)
19
19
 
20
- debates_followers = debates_followers.where("decidim_follows.created_at >= ?", start_time)
20
+ debates_followers = debates_followers.where(decidim_follows: { created_at: start_time.. })
21
21
  quantity_users = debates_followers.pluck(:decidim_user_id)
22
22
 
23
23
  {
@@ -12,13 +12,13 @@ module Decidim
12
12
 
13
13
  def calculate
14
14
  debates = Decidim::Debates::Debate.where(component: @resource).joins(:component)
15
- .where("decidim_debates_debates.created_at <= ?", end_time)
15
+ .where(decidim_debates_debates: { created_at: ..end_time })
16
16
  .where(decidim_author_type: Decidim::UserBaseEntity.name)
17
17
  .where.not(author: nil)
18
18
 
19
19
  {
20
20
  cumulative_users: debates.pluck(:decidim_author_id),
21
- quantity_users: debates.where("decidim_debates_debates.created_at >= ?", start_time).pluck(:decidim_author_id)
21
+ quantity_users: debates.where(decidim_debates_debates: { created_at: start_time.. }).pluck(:decidim_author_id)
22
22
  }
23
23
  end
24
24
  end
@@ -13,9 +13,9 @@ module Decidim
13
13
  next if cumulative_value.zero?
14
14
 
15
15
  quantity_value = quantity[key] || 0
16
- category_id, space_type, space_id = key
16
+ taxonomy_id, space_type, space_id = key
17
17
  record = Decidim::Metric.find_or_initialize_by(day: @day.to_s, metric_type: @metric_name,
18
- organization: @organization, decidim_category_id: category_id,
18
+ organization: @organization, decidim_taxonomy_id: taxonomy_id,
19
19
  participatory_space_type: space_type, participatory_space_id: space_id)
20
20
  record.assign_attributes(cumulative: cumulative_value, quantity: quantity_value)
21
21
  record.save!
@@ -28,16 +28,16 @@ module Decidim
28
28
  return @query if @query
29
29
 
30
30
  @query = Decidim::Debates::Debate.where(component: visible_components_from_spaces(retrieve_participatory_spaces)).joins(:component)
31
- .left_outer_joins(:category)
32
- @query = @query.where("decidim_debates_debates.start_time <= ?", end_time)
33
- @query = @query.group("decidim_categorizations.decidim_category_id",
31
+ .left_outer_joins(:taxonomizations)
32
+ @query = @query.where(decidim_debates_debates: { start_time: ..end_time })
33
+ @query = @query.group("decidim_taxonomizations.taxonomy_id",
34
34
  :participatory_space_type,
35
35
  :participatory_space_id)
36
36
  @query
37
37
  end
38
38
 
39
39
  def quantity
40
- @quantity ||= query.where("decidim_debates_debates.start_time >= ?", start_time).count
40
+ @quantity ||= query.where(decidim_debates_debates: { start_time: start_time.. }).count
41
41
  end
42
42
  end
43
43
  end
@@ -2,20 +2,13 @@
2
2
 
3
3
  module Decidim
4
4
  module Debates
5
- class DownloadYourDataDebateSerializer < Decidim::Exporters::Serializer
6
- # Serializes a Debate for download your data
5
+ class DownloadYourDataDebateSerializer < Decidim::Debates::DebateSerializer
6
+ # Serializes a Debate for download your data feature
7
+ #
8
+ # Remove the author information as it is the same of the user that
9
+ # requested the data
7
10
  def serialize
8
- {
9
- id: resource.id,
10
- title: resource.title,
11
- description: resource.description,
12
- instructions: resource.instructions,
13
- start_time: resource.start_time,
14
- end_time: resource.end_time,
15
- information_updates: resource.information_updates,
16
- reference: resource.reference,
17
- component: resource.component.name
18
- }
11
+ super.except!(:author)
19
12
  end
20
13
  end
21
14
  end
@@ -0,0 +1,27 @@
1
+ <% if view == :deleted %>
2
+ <% if allowed_to? :restore, :debate, trashable_deleted_resource: debate %>
3
+ <%= icon_link_to "refresh-line", url_for(action: :restore, id: debate, controller: "debates"), t("decidim.admin.actions.restore"), method: :patch, class: "action-icon--restore" %>
4
+ <% end %>
5
+ <% else %>
6
+ <% if allowed_to? :update, :debate, debate: debate %>
7
+ <%= icon_link_to "pencil-line", edit_debate_path(debate), t("actions.edit", scope: "decidim.debates"), class: "action-icon--edit" %>
8
+ <% else %>
9
+ <span class="action-space icon"></span>
10
+ <% end %>
11
+
12
+ <% if allowed_to? :close, :debate, debate: debate %>
13
+ <%= icon_link_to "lock-line" , edit_debate_debate_close_path(debate_id: debate.id, id: debate.id), t("actions.close", scope: "decidim.debates"), class: "action-icon--close" %>
14
+ <% else %>
15
+ <span class="action-space icon"></span>
16
+ <% end %>
17
+
18
+ <%= icon_link_to "eye-line", resource_locator(debate).path, t("actions.preview", scope: "decidim.admin"), class: "action-icon--preview", target: :blank, data: { "external-link": false } %>
19
+
20
+ <%= resource_permissions_link(debate) %>
21
+
22
+ <% if allowed_to? :soft_delete, :debate, trashable_deleted_resource: debate %>
23
+ <%= icon_link_to "delete-bin-line", soft_delete_debate_path(debate), t("actions.soft_delete", scope: "decidim.admin"), method: :patch, class: "action-icon--delete", data: { confirm: t("actions.confirm_delete_debate", scope: "decidim.debates") } %>
24
+ <% else %>
25
+ <%= icon "delete-bin-line", class: "action-icon action-icon--disabled", role: "img", aria_label: t("actions.soft_delete", scope: "decidim.admin") %>
26
+ <% end %>
27
+ <% end %>
@@ -0,0 +1,25 @@
1
+ <tr data-id="<%= debate.id %>">
2
+ <td>
3
+ <% if allowed_to? :update, :debate, debate: debate %>
4
+ <%= link_to present(debate).title(html_escape: true), edit_debate_path(debate) %>
5
+ <% else %>
6
+ <%= present(debate).title(html_escape: true) %><br>
7
+ <% end %>
8
+ </td>
9
+ <td>
10
+ <% if debate.start_time %>
11
+ <%= l debate.start_time, format: :long %>
12
+ <% end %>
13
+ </td>
14
+ <td>
15
+ <% if debate.end_time %>
16
+ <%= l debate.end_time, format: :long %>
17
+ <% end %>
18
+ </td>
19
+ <td>
20
+ <%= debate.taxonomies.map { |taxonomy| decidim_sanitize_translated(taxonomy.name) }.join(", ") %>
21
+ </td>
22
+ <td class="table-list__actions">
23
+ <%= render partial: "decidim/debates/admin/debates/actions", locals: { debate:, view: } %>
24
+ </td>
25
+ </tr>
@@ -0,0 +1,9 @@
1
+ <thead>
2
+ <tr>
3
+ <th><%= t("models.debate.fields.title", scope: "decidim.debates") %></th>
4
+ <th><%= t("models.debate.fields.start_time", scope: "decidim.debates") %></th>
5
+ <th><%= t("models.debate.fields.end_time", scope: "decidim.debates") %></th>
6
+ <th><%= t("models.debate.fields.taxonomies", scope: "decidim.debates") %></th>
7
+ <th><%= t("actions.title", scope: "decidim.debates") %></th>
8
+ </tr>
9
+ </thead>
@@ -34,19 +34,40 @@
34
34
  </div>
35
35
  </div>
36
36
 
37
- <% if current_component.has_subscopes? %>
38
- <div class="row column">
39
- <%= scopes_select_field form, :scope_id, root: current_component.scope %>
40
- </div>
37
+ <% if @form.taxonomy_filters&.any? %>
38
+ <% @form.taxonomy_filters.each do |filter| %>
39
+ <div class="row column">
40
+ <%= filter_taxonomy_items_select_field form, :taxonomies, filter %>
41
+ </div>
42
+ <% end %>
41
43
  <% end %>
42
44
 
43
45
  <div class="row column">
44
- <%= form.categories_select :decidim_category_id, current_participatory_space.categories, include_blank: "", disable_parents: false %>
46
+ <%= form.check_box :comments_enabled, label: t("enabled", scope: "decidim.comments.admin.shared.availability_fields") %>
45
47
  </div>
46
48
 
47
49
  <div class="row column">
48
- <%= form.check_box :comments_enabled, label: t("enabled", scope: "decidim.comments.admin.shared.availability_fields") %>
50
+ <%= label_tag :comments_layout, t(".comments_visualization") %>
51
+ <span class="help-text"><%= t(".comments_warning") %></span>
52
+ <div>
53
+ <%= form.collection_radio_buttons(:comments_layout, [[t(".single_column"), "single_column"], [t(".two_columns"), "two_columns"]], :last, :first) do |builder|
54
+ builder.label(class: "form__wrapper-checkbox-label") { builder.radio_button + builder.text }
55
+ end %>
56
+ </div>
49
57
  </div>
58
+
59
+ <% if component_settings.attachments_allowed? %>
60
+ <div class="row column">
61
+ <%= form.attachment :documents,
62
+ multiple: true,
63
+ label: t("decidim.debates.admin.debates.form.add_attachments"),
64
+ button_label: t("decidim.debates.admin.debates.form.add_attachments"),
65
+ button_edit_label: t("decidim.debates.admin.debates.form.edit_attachments"),
66
+ button_class: "button button__sm button__transparent-secondary",
67
+ help_i18n_scope: "decidim.forms.file_help.file",
68
+ help_text: t("decidim.debates.admin.debates.form.attachment_legend") %>
69
+ </div>
70
+ <% end %>
50
71
  </div>
51
72
  </div>
52
73
  </div>
@@ -3,69 +3,31 @@
3
3
  <div class="item_show__header">
4
4
  <h1 class="item_show__header-title">
5
5
  <%= t(".title") %>
6
- <%= export_dropdown if allowed_to? :export, :comments %>
6
+ <%= export_dropdown if allowed_to? :export, :debates %>
7
7
  <%= link_to t("actions.new", scope: "decidim.debates"), new_debate_path, class: "button button__sm button__secondary" if allowed_to? :create, :debate %>
8
8
  <%= render partial: "decidim/admin/components/resource_action" %>
9
9
  </h1>
10
10
  </div>
11
11
  <div class="table-scroll">
12
12
  <table class="table-list">
13
- <thead>
14
- <tr>
15
- <th><%= t("models.debate.fields.title", scope: "decidim.debates") %></th>
16
- <th><%= t("models.debate.fields.start_time", scope: "decidim.debates") %></th>
17
- <th><%= t("models.debate.fields.end_time", scope: "decidim.debates") %></th>
18
- <%= th_resource_scope_label %>
19
- <th><%= t("actions.title", scope: "decidim.debates") %></th>
20
- </tr>
21
- </thead>
13
+ <%= render partial: "debates-thead" %>
22
14
  <tbody>
23
- <% debates.each do |debate| %>
24
- <tr data-id="<%= debate.id %>">
25
- <td>
26
- <% if allowed_to? :update, :debate, debate: debate %>
27
- <%= link_to present(debate).title(html_escape: true), edit_debate_path(debate) %>
28
- <% else %>
29
- <%= present(debate).title(html_escape: true) %><br>
30
- <% end %>
31
- </td>
32
- <td>
33
- <% if debate.start_time %>
34
- <%= l debate.start_time, format: :long %>
35
- <% end %>
36
- </td>
37
- <td>
38
- <% if debate.end_time %>
39
- <%= l debate.end_time, format: :long %>
40
- <% end %>
41
- </td>
42
- <%= td_resource_scope_for(debate.scope) %>
43
- <td class="table-list__actions">
44
- <% if allowed_to? :update, :debate, debate: debate %>
45
- <%= icon_link_to "pencil-line", edit_debate_path(debate), t("actions.edit", scope: "decidim.debates"), class: "action-icon--edit" %>
46
- <% else %>
47
- <span class="action-space icon"></span>
48
- <% end %>
49
-
50
- <% if allowed_to? :close, :debate, debate: debate %>
51
- <%= icon_link_to "lock-line" , edit_debate_debate_close_path(debate_id: debate.id, id: debate.id), t("actions.close", scope: "decidim.debates"), class: "action-icon--close" %>
52
- <% else %>
53
- <span class="action-space icon"></span>
54
- <% end %>
55
-
56
- <%= icon_link_to "eye-line", resource_locator(debate).path, t("actions.preview", scope: "decidim.admin"), class: "action-icon--preview", target: :blank, data: { "external-link": false } %>
57
-
58
- <%= resource_permissions_link(debate) %>
59
-
60
- <% if allowed_to? :delete, :debate, debate: debate %>
61
- <%= icon_link_to "delete-bin-line", debate_path(debate), t("actions.destroy", scope: "decidim.debates"), method: :delete, class: "action-icon--remove", data: { confirm: t("actions.confirm_destroy", scope: "decidim.debates") } %>
62
- <% else %>
63
- <span class="action-space icon"></span>
64
- <% end %>
65
- </td>
66
- </tr>
67
- <% end %>
15
+ <%= render partial: "decidim/debates/admin/debates/debate-tr",
16
+ collection: debates,
17
+ as: :debate,
18
+ locals: { view: :index } %>
68
19
  </tbody>
69
20
  </table>
70
21
  </div>
22
+ <% if allowed_to? :manage_trash, :debate, participatory_space: current_participatory_space %>
23
+ <div class="card mt-4">
24
+ <%= link_to manage_trash_debates_path, class: "flex items-center underline text-secondary" do %>
25
+ <%= icon "delete-bin-2-line", class: "mr-2 fill-current text-secondary", role: "img" %>
26
+ <%= t("actions.view_deleted_debates", scope: "decidim.debates") %>
27
+ <span class="ml-2">
28
+ <%= icon_with_tooltip("information-line", t("actions.deleted_debate_info", scope: "decidim.debates")) %>
29
+ </span>
30
+ <% end %>
31
+ </div>
32
+ <% end %>
71
33
  </div>
@@ -0,0 +1,19 @@
1
+ <% add_decidim_page_title(t(".title")) %>
2
+ <div class="card">
3
+ <div class="item_show__header">
4
+ <h1 class="item_show__header-title">
5
+ <%= t(".title") %>
6
+ </h1>
7
+ </div>
8
+ <div class="table-scroll">
9
+ <table class="table-list">
10
+ <%= render partial: "debates-thead" %>
11
+ <tbody>
12
+ <%= render partial: "decidim/debates/admin/debates/debate-tr",
13
+ collection: trashable_deleted_collection,
14
+ as: :debate,
15
+ locals: { view: :deleted } %>
16
+ </tbody>
17
+ </table>
18
+ </div>
19
+ </div>
@@ -0,0 +1,33 @@
1
+
2
+ <% if allowed_to?(:edit, :debate, debate: debate) %>
3
+ <li role="menuitem">
4
+ <%= link_to edit_debate_path(debate), class: "button button__sm button__text button__text-secondary" do %>
5
+ <span><%= t("edit_debate", scope: "decidim.debates.debates.show") %></span>
6
+ <%= icon "pencil-line" %>
7
+ <% end %>
8
+ </li>
9
+ <% elsif admin_allowed_to?(:update, :debate, debate: debate) %>
10
+ <li role="menuitem">
11
+ <%= link_to resource_locator(debate).edit, class: "button button__sm button__text button__text-secondary" do %>
12
+ <span><%= t("edit_debate", scope: "decidim.debates.debates.show") %></span>
13
+ <%= icon "pencil-line" %>
14
+ <% end %>
15
+ </li>
16
+ <% end %>
17
+
18
+ <% close_debate_action_text = (debate.closed? ? "decidim.debates.debates.show.edit_conclusions" : "decidim.debates.debates.show.close_debate" ) %>
19
+ <% if allowed_to?(:close, :debate, debate: debate) %>
20
+ <li role="menuitem">
21
+ <button type="button" data-dialog-open="close-debate" title="<%= t(close_debate_action_text) %>" aria-controls="closeDebateModal" aria-haspopup="dialog" tabindex="0" class="button button__sm button__text button__text-secondary">
22
+ <span><%= t(close_debate_action_text) %></span>
23
+ <%= icon "lock-line" %>
24
+ </button>
25
+ </li>
26
+ <% elsif admin_allowed_to?(:close, :debate, debate: debate) %>
27
+ <li role="menuitem">
28
+ <%= link_to Decidim::EngineRouter.admin_proxy(debate.component).edit_debate_debate_close_path(debate_id: debate.id, id: debate.id), class: "button button__sm button__text button__text-secondary" do %>
29
+ <span><%= t(close_debate_action_text) %></span>
30
+ <%= icon "lock-line" %>
31
+ <% end %>
32
+ </li>
33
+ <% end %>
@@ -1,7 +1,7 @@
1
1
  <% if debates.empty? %>
2
2
  <%= cell("decidim/announcement", params[:filter].present? ? t(".empty_filters") : t(".empty")) %>
3
3
  <% else %>
4
- <h2 class="h5 md:h3 decorator" aria-live="polite" aria-atomic="true"><%= t("debates_count", scope: "decidim.debates.debates.count", count: paginated_debates.total_count) %></h2>
4
+ <h2 class="h5 md:h3 decorator"><%= t("debates_count", scope: "decidim.debates.debates.count", count: paginated_debates.total_count) %></h2>
5
5
 
6
6
  <%= order_selector available_orders, i18n_scope: "decidim.debates.debates.orders" %>
7
7
 
@@ -2,15 +2,28 @@
2
2
  <%= form.text_field :title %>
3
3
  <%= text_editor_for_debate_description(form) %>
4
4
 
5
- <% if current_component.has_subscopes? %>
6
- <%= scopes_select_field form, :scope_id, root: current_component.scope %>
7
- <% end %>
8
-
9
- <% if current_participatory_space.categories&.any? %>
10
- <%= form.categories_select :category_id, current_participatory_space.categories, include_blank: t(".select_a_category"), disable_parents: false %>
5
+ <% if @form.taxonomy_filters&.any? %>
6
+ <% @form.taxonomy_filters.each do |filter| %>
7
+ <div class="row column">
8
+ <%= filter_taxonomy_items_select_field form, :taxonomies, filter %>
9
+ </div>
10
+ <% end %>
11
11
  <% end %>
12
12
 
13
13
  <% if @form.id.blank? && Decidim::UserGroups::ManageableUserGroups.for(current_user).verified.any? %>
14
14
  <%= form.select :user_group_id, Decidim::UserGroups::ManageableUserGroups.for(current_user).verified.map { |g| [g.name, g.id] }, prompt: current_user.name %>
15
15
  <% end %>
16
+
17
+ <% if component_settings.attachments_allowed? %>
18
+ <div class="row column">
19
+ <%= form.attachment :documents,
20
+ multiple: true,
21
+ label: t("decidim.debates.admin.debates.form.add_attachments"),
22
+ button_label: t("decidim.debates.admin.debates.form.add_attachments"),
23
+ button_edit_label: t("decidim.debates.admin.debates.form.edit_attachments"),
24
+ button_class: "button button__lg button__transparent-secondary w-full",
25
+ help_i18n_scope: "decidim.forms.file_help.file",
26
+ help_text: t("decidim.debates.admin.debates.form.attachment_legend") %>
27
+ </div>
28
+ <% end %>
16
29
  </div>
@@ -1,7 +1,7 @@
1
1
  <% add_decidim_meta_tags(
2
2
  description: translated_attribute(current_participatory_space.short_description),
3
3
  title: t("decidim.components.pagination.page_title",
4
- component_name:,
4
+ component_name: component_name,
5
5
  current_page: paginated_debates.current_page,
6
6
  total_pages: paginated_debates.total_pages ),
7
7
  url: debates_url,
@@ -11,7 +11,7 @@
11
11
  <h1 class="title-decorator"><%= component_name %></h1>
12
12
 
13
13
  <% if current_settings.creation_enabled? && current_component.participatory_space.can_participate?(current_user) %>
14
- <%= action_authorized_link_to :create, new_debate_path, class: "button button__xl button__secondary w-full", data: { "redirect_url" => new_debate_path } do %>
14
+ <%= action_authorized_link_to :create, new_debate_path, permissions_holder: current_component, class: "button button__xl button__secondary w-full", data: { "redirect_url" => new_debate_path } do %>
15
15
  <span><%= t(".new_debate") %></span>
16
16
  <%= icon "add-fill" %>
17
17
  <% end %>
@@ -1,4 +1,3 @@
1
- <% add_decidim_page_title(t("title", scope: "decidim.debates.debates.new")) %>
2
1
  <%= render layout: "layouts/decidim/shared/layout_center" do %>
3
2
  <div class="text-center py-10">
4
3
  <h1 class="title-decorator inline-block text-left">