decidim-debates 0.29.2 → 0.30.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.
Files changed (90) 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/forms/decidim/debates/admin/debate_form.rb +34 -26
  15. data/app/forms/decidim/debates/debate_form.rb +12 -29
  16. data/app/helpers/decidim/debates/application_helper.rb +8 -8
  17. data/app/models/decidim/debates/debate.rb +23 -1
  18. data/app/permissions/decidim/debates/admin/permissions.rb +5 -5
  19. data/app/presenters/decidim/debates/admin_log/debate_presenter.rb +1 -1
  20. data/app/presenters/decidim/debates/debate_presenter.rb +1 -1
  21. data/app/queries/decidim/debates/metrics/debate_followers_metric_measure.rb +2 -2
  22. data/app/queries/decidim/debates/metrics/debate_participants_metric_measure.rb +2 -2
  23. data/app/queries/decidim/debates/metrics/debates_metric_manage.rb +6 -6
  24. data/app/serializers/decidim/debates/download_your_data_debate_serializer.rb +6 -13
  25. data/app/views/decidim/debates/admin/debates/_actions.html.erb +27 -0
  26. data/app/views/decidim/debates/admin/debates/_debate-tr.html.erb +25 -0
  27. data/app/views/decidim/debates/admin/debates/_debates-thead.html.erb +9 -0
  28. data/app/views/decidim/debates/admin/debates/_form.html.erb +27 -6
  29. data/app/views/decidim/debates/admin/debates/index.html.erb +17 -55
  30. data/app/views/decidim/debates/admin/debates/manage_trash.html.erb +19 -0
  31. data/app/views/decidim/debates/debates/_debate_actions.html.erb +33 -0
  32. data/app/views/decidim/debates/debates/_form.html.erb +19 -6
  33. data/app/views/decidim/debates/debates/index.html.erb +10 -1
  34. data/app/views/decidim/debates/debates/show.html.erb +31 -44
  35. data/config/locales/ar.yml +9 -12
  36. data/config/locales/bg.yml +1 -15
  37. data/config/locales/ca.yml +79 -16
  38. data/config/locales/cs.yml +79 -16
  39. data/config/locales/de.yml +79 -16
  40. data/config/locales/el.yml +1 -15
  41. data/config/locales/en.yml +78 -15
  42. data/config/locales/es-MX.yml +79 -16
  43. data/config/locales/es-PY.yml +79 -16
  44. data/config/locales/es.yml +79 -16
  45. data/config/locales/eu.yml +79 -16
  46. data/config/locales/fi-plain.yml +79 -16
  47. data/config/locales/fi.yml +79 -16
  48. data/config/locales/fr-CA.yml +41 -16
  49. data/config/locales/fr.yml +41 -16
  50. data/config/locales/ga-IE.yml +0 -10
  51. data/config/locales/gl.yml +1 -13
  52. data/config/locales/hu.yml +1 -15
  53. data/config/locales/id-ID.yml +1 -13
  54. data/config/locales/is-IS.yml +0 -10
  55. data/config/locales/it.yml +1 -15
  56. data/config/locales/ja.yml +79 -16
  57. data/config/locales/lb.yml +0 -6
  58. data/config/locales/lt.yml +1 -15
  59. data/config/locales/lv.yml +1 -11
  60. data/config/locales/nl.yml +1 -14
  61. data/config/locales/no.yml +1 -15
  62. data/config/locales/pl.yml +1 -15
  63. data/config/locales/pt-BR.yml +1 -15
  64. data/config/locales/pt.yml +1 -15
  65. data/config/locales/ro-RO.yml +32 -46
  66. data/config/locales/ru.yml +0 -12
  67. data/config/locales/sk.yml +1 -13
  68. data/config/locales/sl.yml +0 -2
  69. data/config/locales/sv.yml +1 -15
  70. data/config/locales/tr-TR.yml +1 -15
  71. data/config/locales/uk.yml +0 -12
  72. data/config/locales/zh-CN.yml +1 -13
  73. data/config/locales/zh-TW.yml +1 -15
  74. data/db/migrate/20200827154116_add_commentable_counter_cache_to_debates.rb +1 -1
  75. data/db/migrate/20200902133452_add_cached_comment_metadata_to_debates.rb +1 -1
  76. data/db/migrate/20210310120652_add_followable_counter_cache_to_debates.rb +1 -1
  77. data/db/migrate/20240828103648_add_deleted_at_to_decidim_debates_debates.rb +8 -0
  78. data/db/migrate/20241017153555_add_comments_layout_to_debates.rb +7 -0
  79. data/decidim-debates.gemspec +1 -1
  80. data/lib/decidim/api/debate_type.rb +6 -8
  81. data/lib/decidim/api/debates_type.rb +4 -5
  82. data/lib/decidim/debates/admin_engine.rb +7 -0
  83. data/lib/decidim/debates/component.rb +19 -4
  84. data/lib/decidim/debates/debate_serializer.rb +83 -0
  85. data/lib/decidim/debates/seeds.rb +1 -8
  86. data/lib/decidim/debates/test/factories.rb +2 -0
  87. data/lib/decidim/debates/version.rb +1 -1
  88. data/lib/decidim/debates.rb +1 -0
  89. metadata +27 -15
  90. data/app/helpers/decidim/debates/admin/application_helper.rb +0 -13
@@ -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:) }
@@ -136,6 +140,16 @@ module Decidim
136
140
  self.class.name
137
141
  end
138
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
+
139
153
  # Public: Override Commentable concern method `users_to_notify_on_comment_created`
140
154
  def users_to_notify_on_comment_created
141
155
  return Decidim::User.where(id: followers).or(Decidim::User.where(id: component.participatory_space.admins)).distinct if official?
@@ -206,13 +220,21 @@ module Decidim
206
220
  ransacker_i18n_multi :search_text, [:title, :description]
207
221
 
208
222
  def self.ransackable_scopes(_auth_object = nil)
209
- [:with_any_state, :with_any_origin, :with_any_category, :with_any_scope]
223
+ [:with_any_state, :with_any_origin, :with_any_taxonomies]
210
224
  end
211
225
 
212
226
  def self.ransack(params = {}, options = {})
213
227
  DebateSearch.new(self, params, options)
214
228
  end
215
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
+
216
238
  private
217
239
 
218
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 %>
@@ -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,8 +1,17 @@
1
+ <% add_decidim_meta_tags(
2
+ description: translated_attribute(current_participatory_space.short_description),
3
+ title: t("decidim.components.pagination.page_title",
4
+ component_name: component_name,
5
+ current_page: paginated_debates.current_page,
6
+ total_pages: paginated_debates.total_pages ),
7
+ url: debates_url,
8
+ resource: current_component) %>
9
+
1
10
  <% content_for :aside do %>
2
11
  <h1 class="title-decorator"><%= component_name %></h1>
3
12
 
4
13
  <% if current_settings.creation_enabled? && current_component.participatory_space.can_participate?(current_user) %>
5
- <%= 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 %>
6
15
  <span><%= t(".new_debate") %></span>
7
16
  <%= icon "add-fill" %>
8
17
  <% end %>
@@ -1,8 +1,8 @@
1
- <% add_decidim_meta_tags({
2
- description: translated_attribute(debate.description),
3
- title: present(debate).title,
4
- url: debate_url(debate.id)
5
- }) %>
1
+ <% add_decidim_meta_tags(
2
+ description: translated_attribute(debate.description),
3
+ title: present(debate).title,
4
+ url: debate_url(debate.id),
5
+ resource: debate) %>
6
6
 
7
7
  <%
8
8
  edit_link(
@@ -26,14 +26,24 @@ edit_link(
26
26
  <%== present(debate).title(links: true, html_escape: true) %>
27
27
  </h1>
28
28
 
29
- <% debate_presenter = Decidim::Debates::DebatePresenter.new(debate) %>
30
- <div class="layout-author">
31
- <%= cell "decidim/author", debate_presenter.author, skip_profile_link: true %>
32
- <% if debate.closed? %>
29
+ <% debate_presenter = debate.presenter %>
30
+ <% if debate.closed? %>
31
+ <div class="layout-author has_status">
33
32
  <span class="success label">
34
33
  <%= t("debate_closed", scope: "decidim.debates.debates.show") %>
35
34
  </span>
36
- <% end %>
35
+ </div>
36
+ <% end %>
37
+
38
+ <div class="layout-author <%= "has_status" if debate.closed? %>">
39
+ <div class="relative flex items-center justify-center w-full">
40
+ <div class="w-10/12 flex items-center gap-4">
41
+ <%= cell "decidim/author", debate_presenter.author, skip_profile_link: true %>
42
+ </div>
43
+ <%= render "decidim/shared/resource_actions", resource: debate do %>
44
+ <%= render "decidim/debates/debates/debate_actions" %>
45
+ <% end %>
46
+ </div>
37
47
  </div>
38
48
  </section>
39
49
 
@@ -43,6 +53,8 @@ edit_link(
43
53
  </div>
44
54
  </section>
45
55
 
56
+ <%= cell "decidim/tab_panels", tab_panel_items %>
57
+
46
58
  <% if debate.closed? || translated_attribute(debate.instructions).present? || translated_attribute(debate.information_updates).present? %>
47
59
  <section class="layout-main__section">
48
60
  <%= cell("decidim/announcement", { title: t("debate_conclusions_are", scope: "decidim.debates.debates.show", date: l(debate.closed_at, format: :decidim_short)), body: simple_format(translated_attribute(debate.conclusions)) }, callout_class: "success") if debate.closed? %>
@@ -53,40 +65,21 @@ edit_link(
53
65
  </section>
54
66
  <% end %>
55
67
 
68
+ <%= cell("decidim/tags", debate) %>
69
+
56
70
  <section class="layout-main__section layout-main__buttons" data-buttons>
57
- <% if endorsements_enabled? %>
58
- <% if allowed_to?(:endorse, :debate, debate: debate) %>
59
- <%= endorsement_buttons_cell(debate) %>
60
- <% else %>
61
- <%= endorsers_list_cell(debate) %>
62
- <% end %>
71
+ <% if allowed_to?(:endorse, :debate, debate: debate) %>
72
+ <%= cell("decidim/endorsement_block", debate) %>
63
73
  <% end %>
64
- <%= cell "decidim/comments_button", nil %>
65
74
 
66
- <div class="ml-auto">
67
- <%= render partial: "decidim/shared/tags", locals: { resource: debate } %>
75
+ <%= cell "decidim/comments_button", nil %>
76
+ <div class="ml-auto lg:ml-0">
77
+ <%= cell "decidim/share_widget", debate %>
68
78
  </div>
69
79
  </section>
70
- <%= cell "decidim/endorsers_list", debate, layout: :full %>
80
+ <%= cell "decidim/endorsers_list", debate %>
71
81
 
72
82
  <% content_for :aside do %>
73
- <% if allowed_to?(:edit, :debate, debate: debate) || admin_allowed_to?(:update, :debate, debate: debate) || allowed_to?(:close, :debate, debate: debate) || admin_allowed_to?(:close, :debate, debate: debate) %>
74
- <section class="layout-aside__section layout-aside__buttons">
75
- <% if allowed_to?(:edit, :debate, debate: debate) %>
76
- <%= link_to t("edit_debate", scope: "decidim.debates.debates.show"), edit_debate_path(debate), class: "button button__secondary button__xl w-full mb-4" %>
77
- <% elsif admin_allowed_to?(:update, :debate, debate: debate) %>
78
- <%= link_to t("edit_debate", scope: "decidim.debates.debates.show"), resource_locator(debate).edit, class: "button button__secondary button__xl w-full mb-4" %>
79
- <% end %>
80
- <% close_debate_action_text = (debate.closed? ? "decidim.debates.debates.show.edit_conclusions" : "decidim.debates.debates.show.close_debate" ) %>
81
- <% if allowed_to?(:close, :debate, debate: debate) %>
82
- <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__secondary button__xl w-full mb-4">
83
- <%= t(close_debate_action_text) %>
84
- </button>
85
- <% elsif admin_allowed_to?(:close, :debate, debate: debate) %>
86
- <%= link_to t(close_debate_action_text), Decidim::EngineRouter.admin_proxy(debate.component).edit_debate_debate_close_path(debate_id: debate.id, id: debate.id), class: "button button__secondary button__xl w-full mb-4" %>
87
- <% end %>
88
- </section>
89
- <% end %>
90
83
  <section class="layout-aside__section">
91
84
  <div class="rounded p-4 bg-background mb-4 divide-y divide-gray-3 [&>*]:py-4 first:[&>*]:pt-0 last:[&>*]:pb-0">
92
85
  <div class="text-gray-2 space-y-1.5">
@@ -117,13 +110,7 @@ edit_link(
117
110
  </div>
118
111
  </div>
119
112
  </section>
120
- <section class="layout-aside__section actions__secondary">
121
- <%= follow_button_for(debate) %>
122
- <%= cell "decidim/share_button", nil %>
123
- <%= cell "decidim/report_button", debate %>
124
- </section>
125
-
126
- <% end %>
113
+ <% end %>
127
114
 
128
115
  <% content_for :item_footer do %>
129
116
  <%= comments_for debate %>