decidim-debates 0.21.0 → 0.23.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/decidim/gamification/badges/commented_debates.svg +1 -78
  3. data/app/cells/decidim/debates/debate_activity_cell.rb +4 -0
  4. data/app/cells/decidim/debates/debate_m/data.erb +10 -8
  5. data/app/cells/decidim/debates/debate_m/footer.erb +6 -1
  6. data/app/cells/decidim/debates/debate_m/multiple_dates.erb +1 -1
  7. data/app/cells/decidim/debates/debate_m_cell.rb +24 -2
  8. data/app/commands/decidim/debates/admin/close_debate.rb +54 -0
  9. data/app/commands/decidim/debates/admin/create_debate.rb +4 -2
  10. data/app/commands/decidim/debates/admin/update_debate.rb +5 -2
  11. data/app/commands/decidim/debates/close_debate.rb +58 -0
  12. data/app/commands/decidim/debates/create_debate.rb +17 -12
  13. data/app/commands/decidim/debates/update_debate.rb +56 -0
  14. data/app/controllers/decidim/debates/admin/debate_closes_controller.rb +43 -0
  15. data/app/controllers/decidim/debates/admin/debates_controller.rb +4 -2
  16. data/app/controllers/decidim/debates/debates_controller.rb +70 -9
  17. data/app/controllers/decidim/debates/orderable.rb +41 -0
  18. data/app/controllers/decidim/debates/versions_controller.rb +16 -0
  19. data/app/controllers/decidim/debates/widgets_controller.rb +19 -0
  20. data/app/events/decidim/debates/close_debate_event.rb +15 -0
  21. data/app/events/decidim/debates/create_debate_event.rb +0 -2
  22. data/app/forms/decidim/debates/admin/close_debate_form.rb +34 -0
  23. data/app/forms/decidim/debates/admin/debate_form.rb +5 -1
  24. data/app/forms/decidim/debates/close_debate_form.rb +39 -0
  25. data/app/forms/decidim/debates/debate_form.rb +27 -1
  26. data/app/helpers/decidim/debates/admin/application_helper.rb +13 -0
  27. data/app/helpers/decidim/debates/application_helper.rb +37 -1
  28. data/app/models/decidim/debates/debate.rb +67 -12
  29. data/app/permissions/decidim/debates/admin/permissions.rb +3 -1
  30. data/app/permissions/decidim/debates/permissions.rb +28 -0
  31. data/app/presenters/decidim/debates/admin_log/debate_presenter.rb +6 -2
  32. data/app/presenters/decidim/debates/admin_log/value_types/debate_title_description_presenter.rb +20 -0
  33. data/app/presenters/decidim/debates/debate_presenter.rb +62 -7
  34. data/app/presenters/decidim/debates/log/resource_presenter.rb +18 -0
  35. data/app/presenters/decidim/debates/official_author_presenter.rb +1 -29
  36. data/app/queries/decidim/debates/metrics/debates_metric_manage.rb +2 -8
  37. data/app/services/decidim/debates/debate_search.rb +13 -23
  38. data/app/services/decidim/debates/diff_renderer.rb +27 -0
  39. data/app/views/decidim/debates/admin/debate_closes/edit.html.erb +17 -0
  40. data/app/views/decidim/debates/admin/debates/_form.html.erb +5 -5
  41. data/app/views/decidim/debates/admin/debates/index.html.erb +7 -1
  42. data/app/views/decidim/debates/debates/_close_debate_modal.html.erb +13 -0
  43. data/app/views/decidim/debates/debates/_debates.html.erb +7 -0
  44. data/app/views/decidim/debates/debates/_filters.html.erb +20 -6
  45. data/app/views/decidim/debates/debates/_form.html.erb +19 -0
  46. data/app/views/decidim/debates/debates/edit.html.erb +24 -0
  47. data/app/views/decidim/debates/debates/index.html.erb +4 -5
  48. data/app/views/decidim/debates/debates/new.html.erb +7 -26
  49. data/app/views/decidim/debates/debates/show.html.erb +87 -9
  50. data/app/views/decidim/debates/versions/index.html.erb +8 -0
  51. data/app/views/decidim/debates/versions/show.html.erb +10 -0
  52. data/config/locales/am-ET.yml +1 -0
  53. data/config/locales/ar.yml +2 -1
  54. data/config/locales/bg-BG.yml +7 -0
  55. data/config/locales/bg.yml +15 -0
  56. data/config/locales/ca.yml +73 -1
  57. data/config/locales/cs.yml +112 -40
  58. data/config/locales/da-DK.yml +1 -0
  59. data/config/locales/da.yml +1 -0
  60. data/config/locales/de.yml +95 -23
  61. data/config/locales/el.yml +154 -0
  62. data/config/locales/en.yml +73 -1
  63. data/config/locales/eo.yml +1 -0
  64. data/config/locales/es-MX.yml +73 -1
  65. data/config/locales/es-PY.yml +73 -1
  66. data/config/locales/es.yml +73 -1
  67. data/config/locales/et-EE.yml +1 -0
  68. data/config/locales/et.yml +1 -0
  69. data/config/locales/eu.yml +2 -1
  70. data/config/locales/fi-plain.yml +73 -1
  71. data/config/locales/fi.yml +78 -6
  72. data/config/locales/fr-CA.yml +223 -0
  73. data/config/locales/fr.yml +73 -1
  74. data/config/locales/ga-IE.yml +1 -0
  75. data/config/locales/gl.yml +7 -1
  76. data/config/locales/hr-HR.yml +1 -0
  77. data/config/locales/hr.yml +1 -0
  78. data/config/locales/hu.yml +26 -1
  79. data/config/locales/id-ID.yml +2 -1
  80. data/config/locales/is-IS.yml +2 -1
  81. data/config/locales/is.yml +102 -0
  82. data/config/locales/it.yml +45 -10
  83. data/config/locales/ja-JP.yml +195 -0
  84. data/config/locales/ja.yml +221 -0
  85. data/config/locales/ko-KR.yml +1 -0
  86. data/config/locales/ko.yml +1 -0
  87. data/config/locales/lt-LT.yml +1 -0
  88. data/config/locales/lt.yml +1 -0
  89. data/config/locales/lv.yml +135 -0
  90. data/config/locales/mt-MT.yml +1 -0
  91. data/config/locales/mt.yml +1 -0
  92. data/config/locales/nl.yml +50 -2
  93. data/config/locales/no.yml +117 -71
  94. data/config/locales/om-ET.yml +1 -0
  95. data/config/locales/pl.yml +100 -45
  96. data/config/locales/pt-BR.yml +3 -4
  97. data/config/locales/pt.yml +56 -36
  98. data/config/locales/ro-RO.yml +173 -0
  99. data/config/locales/ru.yml +2 -1
  100. data/config/locales/si-LK.yml +1 -0
  101. data/config/locales/sk-SK.yml +156 -0
  102. data/config/locales/sk.yml +157 -0
  103. data/config/locales/sl.yml +22 -0
  104. data/config/locales/so-SO.yml +1 -0
  105. data/config/locales/sr-CS.yml +6 -0
  106. data/config/locales/sv.yml +60 -1
  107. data/config/locales/sw-KE.yml +1 -0
  108. data/config/locales/ti-ER.yml +1 -0
  109. data/config/locales/tr-TR.yml +103 -31
  110. data/config/locales/uk.yml +2 -1
  111. data/config/locales/vi-VN.yml +1 -0
  112. data/config/locales/vi.yml +1 -0
  113. data/config/locales/zh-CN.yml +218 -0
  114. data/config/locales/zh-TW.yml +1 -0
  115. data/db/migrate/20200320105918_index_foreign_keys_in_decidim_debates_debates.rb +7 -0
  116. data/db/migrate/20200703134657_close_debates.rb +9 -0
  117. data/db/migrate/20200708072042_fix_debates_i18n_fields.rb +48 -0
  118. data/db/migrate/20200716143929_add_endorsable_to_debates.rb +8 -0
  119. data/db/migrate/20200827154116_add_commentable_counter_cache_to_debates.rb +14 -0
  120. data/db/migrate/20200902133452_add_cached_comment_metadata_to_debates.rb +23 -0
  121. data/lib/decidim/debates/admin_engine.rb +3 -1
  122. data/lib/decidim/debates/component.rb +44 -1
  123. data/lib/decidim/debates/engine.rb +7 -1
  124. data/lib/decidim/debates/test/factories.rb +62 -6
  125. data/lib/decidim/debates/version.rb +1 -1
  126. metadata +85 -17
@@ -6,41 +6,31 @@ module Decidim
6
6
  # `current_component` param with a `Decidim::Component` in order to
7
7
  # find the debates.
8
8
  class DebateSearch < ResourceSearch
9
+ text_search_fields :title, :description
10
+
9
11
  # Public: Initializes the service.
10
12
  # component - A Decidim::Component to get the debates from.
11
13
  # page - The page number to paginate the results.
12
- # per_page - The number of proposals to return per page.
14
+ # per_page - The number of debates to return per page.
13
15
  def initialize(options = {})
14
16
  super(Debate.not_hidden, options)
15
17
  end
16
18
 
17
- # Handle the search_text filter. We have to cast the JSONB columns
18
- # into a `text` type so that we can search.
19
- def search_search_text
20
- query
21
- .where("decidim_debates_debates.title::text ILIKE ?", "%#{search_text}%")
22
- .or(query.where("decidim_debates_debates.description::text ILIKE ?", "%#{search_text}%"))
23
- end
24
-
25
- # Handle the origin filter
26
- def search_origin
27
- if origin == "official"
28
- query.where(author: component.organization)
29
- elsif origin == "citizens"
30
- query.where.not(decidim_author_type: "Decidim::Organization")
19
+ # Handle the activity filter
20
+ def search_activity
21
+ case activity
22
+ when "commented"
23
+ query.commented_by(user)
24
+ when "my_debates"
25
+ query.authored_by(user)
31
26
  else # Assume 'all'
32
27
  query
33
28
  end
34
29
  end
35
30
 
36
- def search_order_start_time
37
- if order_start_time == "asc"
38
- query.order("start_time ASC")
39
- elsif order_start_time == "desc"
40
- query.order("start_time DESC")
41
- else
42
- query.order("start_time ASC")
43
- end
31
+ # Handle the state filter
32
+ def search_state
33
+ apply_scopes(%w(open closed), state)
44
34
  end
45
35
  end
46
36
  end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Debates
5
+ class DiffRenderer < BaseDiffRenderer
6
+ private
7
+
8
+ # Lists which attributes will be diffable and how they should be rendered.
9
+ def attribute_types
10
+ {
11
+ title: :i18n,
12
+ description: :i18n,
13
+ information_updates: :i18n,
14
+ instructions: :i18n,
15
+ start_time: :string,
16
+ end_time: :string,
17
+ conclusions: :i18n,
18
+ closed_at: :string
19
+ }
20
+ end
21
+
22
+ def debate
23
+ @debate ||= Debate.find_by(id: version.item_id)
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,17 @@
1
+ <%= decidim_form_for(@form, url: debate_debate_close_path(debate, @form), html: { class: "form edit_close_debate" }) do |f| %>
2
+ <div class="card">
3
+ <div class="card-divider">
4
+ <h2 class="card-title"><%= t(".title") %></h2>
5
+ </div>
6
+
7
+ <div class="card-section">
8
+ <div class="row column">
9
+ <%= f.translated :editor, :conclusions, autofocus: true, rows: 15 %>
10
+ </div>
11
+ </div>
12
+ </div>
13
+
14
+ <div class="button--double form-general-submit">
15
+ <%= f.submit t(".close") %>
16
+ </div>
17
+ <% end %>
@@ -4,12 +4,12 @@
4
4
  </div>
5
5
 
6
6
  <div class="card-section">
7
- <div class="row column">
8
- <%= form.translated :text_field, :title, autofocus: true %>
7
+ <div class="row column hashtags__container">
8
+ <%= form.translated :text_field, :title, autofocus: true, class: "js-hashtags", hashtaggable: true %>
9
9
  </div>
10
10
 
11
- <div class="row column">
12
- <%= form.translated :editor, :description %>
11
+ <div class="row column hashtags__container">
12
+ <%= form.translated :editor, :description, hashtaggable: true %>
13
13
  </div>
14
14
 
15
15
  <div class="row column">
@@ -30,7 +30,7 @@
30
30
  </div>
31
31
 
32
32
  <div class="row column">
33
- <%= form.categories_select :decidim_category_id, current_participatory_space.categories, prompt: "", disable_parents: false %>
33
+ <%= form.categories_select :decidim_category_id, current_participatory_space.categories, include_blank: "", disable_parents: false %>
34
34
  </div>
35
35
  </div>
36
36
  </div>
@@ -15,6 +15,7 @@
15
15
  <th><%= t("models.debate.fields.title", scope: "decidim.debates") %></th>
16
16
  <th><%= t("models.debate.fields.start_time", scope: "decidim.debates") %></th>
17
17
  <th><%= t("models.debate.fields.end_time", scope: "decidim.debates") %></th>
18
+ <%= th_resource_scope_label %>
18
19
  <th class="actions"><%= t("actions.title", scope: "decidim.debates") %></th>
19
20
  </tr>
20
21
  </thead>
@@ -22,7 +23,7 @@
22
23
  <% debates.each do |debate| %>
23
24
  <tr data-id="<%= debate.id %>">
24
25
  <td>
25
- <%= link_to translated_attribute(debate.title), resource_locator(debate).path, target: :blank %><br>
26
+ <%= link_to present(debate).title, resource_locator(debate).path, target: :blank %><br>
26
27
  </td>
27
28
  <td>
28
29
  <% if debate.start_time %>
@@ -34,11 +35,16 @@
34
35
  <%= l debate.end_time, format: :long %>
35
36
  <% end %>
36
37
  </td>
38
+ <%= td_resource_scope_for(debate.scope) %>
37
39
  <td class="table-list__actions">
38
40
  <% if allowed_to? :update, :debate, debate: debate %>
39
41
  <%= icon_link_to "pencil", edit_debate_path(debate), t("actions.edit", scope: "decidim.debates"), class: "action-icon--edit" %>
40
42
  <% end %>
41
43
 
44
+ <% if allowed_to? :close, :debate, debate: debate %>
45
+ <%= icon_link_to "lock-locked", edit_debate_debate_close_path(debate_id: debate.id, id: debate.id), t("actions.close", scope: "decidim.debates"), class: "action-icon--close" %>
46
+ <% end %>
47
+
42
48
  <% if allowed_to? :delete, :debate, debate: debate %>
43
49
  <%= icon_link_to "circle-x", debate_path(debate), t("actions.destroy", scope: "decidim.debates"), method: :delete, class: "action-icon--remove", data: { confirm: t("actions.confirm_destroy", scope: "decidim.debates") } %>
44
50
  <% end %>
@@ -0,0 +1,13 @@
1
+ <div class="reveal close-debate-modal" id="closeDebateModal" data-reveal>
2
+ <div class="reveal__header">
3
+ <h3 class="reveal__title"><%= t("decidim.debates.debates.show.close_debate") %></h3>
4
+ <button class="close-button" data-close aria-label="<%= t(".close") %>" type="button">
5
+ <span aria-hidden="true">&times;</span>
6
+ </button>
7
+ </div>
8
+ <p><%= t(".description") %></p>
9
+ <%= decidim_form_for form, url: close_debate_path(debate), method: :post do |f| %>
10
+ <%= f.text_area :conclusions, rows: 10 %>
11
+ <%= f.submit t(".send") %>
12
+ <% end %>
13
+ </div>
@@ -1,4 +1,11 @@
1
+ <div class="collection-sort-controls row small-up-1 medium-up-3 card-grid">
2
+ <div class="column">
3
+ <%= order_selector available_orders, i18n_scope: "decidim.debates.debates.orders" %>
4
+ </div>
5
+ </div>
6
+
1
7
  <div class="row small-up-1 medium-up-2 card-grid">
2
8
  <%= render paginated_debates %>
3
9
  </div>
10
+
4
11
  <%= decidim_paginate paginated_debates %>
@@ -1,20 +1,34 @@
1
+ <%= render partial: "decidim/shared/filter_form_help", locals: { skip_to_id: "debates" } %>
2
+
1
3
  <%= filter_form_for filter do |form| %>
2
4
  <div class="filters__section">
3
5
  <div class="filters__search">
4
6
  <div class="input-group">
5
- <%= form.search_field :search_text, label: false, class: "input-group-field", placeholder: t(".search") %>
7
+ <%= form.search_field :search_text, label: false, class: "input-group-field", placeholder: t(".search"), title: t(".search"), data: { disable_dynamic_change: true } %>
6
8
  <div class="input-group-button">
7
- <button type="submit" class="button button--muted">
8
- <%= icon "magnifying-glass", aria_label: t(".search") %>
9
+ <button type="submit" class="button" aria-controls="debates">
10
+ <%= icon "magnifying-glass", aria_label: t(".search"), role: "img" %>
9
11
  </button>
10
12
  </div>
11
13
  </div>
12
14
  </div>
13
15
  </div>
14
16
 
15
- <%= form.collection_radio_buttons :origin, [["all", t(".all")], ["official", t(".official")], ["citizens", t(".citizens")]], :first, :last, legend_title: t(".origin") %>
17
+ <%= form.check_boxes_tree :state, filter_debates_state_values, legend_title: t(".state"), "aria-controls": "debates" %>
18
+
19
+ <% if current_participatory_space.has_subscopes? %>
20
+ <%= form.check_boxes_tree :scope_id, filter_scopes_values, legend_title: t(".scope"), "aria-controls": "debates" %>
21
+ <% end %>
16
22
 
17
- <% if current_component.categories.any? %>
18
- <%= form.categories_select :category_id, current_component.categories, legend_title: t(".category"), disable_parents: false, label: false, prompt: t(".category_prompt") %>
23
+ <% if current_participatory_space.categories.any? %>
24
+ <%= form.check_boxes_tree :category_id, filter_categories_values, legend_title: t(".category"), "aria-controls": "debates" %>
19
25
  <% end %>
26
+
27
+ <%= form.check_boxes_tree :origin, filter_origin_values, legend_title: t(".origin"), "aria-controls": "debates" %>
28
+
29
+ <% if current_user %>
30
+ <%= form.collection_radio_buttons :activity, activity_filter_values, :first, :last, { legend_title: t(".activity") }, "aria-controls": "debates" %>
31
+ <% end %>
32
+
33
+ <%= hidden_field_tag :order, order, id: nil, class: "order_filter" %>
20
34
  <% end %>
@@ -0,0 +1,19 @@
1
+ <div class="field">
2
+ <%= form.text_field :title %>
3
+ </div>
4
+
5
+ <div class="field">
6
+ <%= text_editor_for_debate_description(form) %>
7
+ </div>
8
+
9
+ <% if current_participatory_space.categories&.any? %>
10
+ <div class="field">
11
+ <%= form.categories_select :category_id, current_participatory_space.categories, include_blank: t(".select_a_category"), disable_parents: false %>
12
+ </div>
13
+ <% end %>
14
+
15
+ <% if @form.id.blank? && Decidim::UserGroups::ManageableUserGroups.for(current_user).verified.any? %>
16
+ <div class="field">
17
+ <%= form.select :user_group_id, Decidim::UserGroups::ManageableUserGroups.for(current_user).verified.map{|g| [g.name, g.id]}, prompt: current_user.name %>
18
+ </div>
19
+ <% end %>
@@ -0,0 +1,24 @@
1
+ <div class="row columns">
2
+ <div class="m-bottom">
3
+ <%= link_to :back, class: "muted-link" do %>
4
+ <%= icon "chevron-left", class: "icon--small", role: "img" %>
5
+ <%= t(".back") %>
6
+ <% end %>
7
+ </div>
8
+ <h2 class="section-heading"><%= t(".title") %></h2>
9
+ </div>
10
+
11
+ <div class="row">
12
+ <div class="columns large-6 medium-centered">
13
+ <div class="card">
14
+ <div class="card__content">
15
+ <%= decidim_form_for(@form) do |form| %>
16
+ <%= render partial: "form", locals: { form: form } %>
17
+ <div class="actions">
18
+ <%= form.submit t(".save"), class: "button expanded", data: { disable: true } %>
19
+ </div>
20
+ <% end %>
21
+ </div>
22
+ </div>
23
+ </div>
24
+ </div>
@@ -2,16 +2,15 @@
2
2
 
3
3
  <div class="row columns">
4
4
  <div class="title-action">
5
- <h2 id="debates-count" class="title-action__title section-heading">
5
+ <h3 id="debates-count" class="title-action__title section-heading">
6
6
  <%= render partial: "count" %>
7
- </h2>
7
+ </h3>
8
8
  <% if current_settings.creation_enabled? && current_component.participatory_space.can_participate?(current_user) %>
9
9
  <%= action_authorized_link_to :create, new_debate_path, class: "title-action__action button small", data: { "redirect_url" => new_debate_path } do %>
10
10
  <%= t(".new_debate") %>
11
- <%= icon "plus" %>
11
+ <%= icon "plus", role: "img", "aria-hidden": true %>
12
12
  <% end %>
13
13
  <% end %>
14
- </a>
15
14
  </div>
16
15
  </div>
17
16
  <div class="row">
@@ -21,7 +20,7 @@
21
20
  <%= render partial: "filters" %>
22
21
  </div>
23
22
  </div>
24
- <div id="debates" class="columns mediumlarge-8 large-9">
23
+ <div id="debates" class="columns mediumlarge-8 large-9" aria-live="polite">
25
24
  <%= render partial: "debates" %>
26
25
  </div>
27
26
  </div>
@@ -1,8 +1,10 @@
1
1
  <div class="row columns">
2
- <%= link_to :back, class: "muted-link" do %>
3
- <%= icon "chevron-left", class: "icon--small" %>
4
- <%= t(".back") %>
5
- <% end %>
2
+ <div class="m-bottom">
3
+ <%= link_to :back, class: "muted-link" do %>
4
+ <%= icon "chevron-left", class: "icon--small", role: "img", "aria-hidden": true %>
5
+ <%= t(".back") %>
6
+ <% end %>
7
+ </div>
6
8
  <h2 class="section-heading"><%= t(".title") %></h2>
7
9
  </div>
8
10
 
@@ -11,26 +13,7 @@
11
13
  <div class="card">
12
14
  <div class="card__content">
13
15
  <%= decidim_form_for(@form) do |form| %>
14
- <div class="field">
15
- <%= form.text_field :title %>
16
- </div>
17
-
18
- <div class="field">
19
- <%= text_editor_for_debate_description(form) %>
20
- </div>
21
-
22
- <% if current_participatory_space.categories&.any? %>
23
- <div class="field">
24
- <%= form.categories_select :category_id, current_participatory_space.categories, prompt: t(".select_a_category"), disable_parents: false %>
25
- </div>
26
- <% end %>
27
-
28
- <% if Decidim::UserGroups::ManageableUserGroups.for(current_user).verified.any? %>
29
- <div class="field">
30
- <%= form.select :user_group_id, Decidim::UserGroups::ManageableUserGroups.for(current_user).verified.map{|g| [g.name, g.id]}, prompt: current_user.name %>
31
- </div>
32
- <% end %>
33
-
16
+ <%= render partial: "form", locals: { form: form } %>
34
17
  <div class="actions">
35
18
  <%= form.submit t(".create"), class: "button expanded", data: { disable: true } %>
36
19
  </div>
@@ -39,5 +22,3 @@
39
22
  </div>
40
23
  </div>
41
24
  </div>
42
-
43
- <%= javascript_include_tag "decidim/proposals/add_proposal" %>
@@ -14,16 +14,35 @@ edit_link(
14
14
  %>
15
15
 
16
16
  <div class="row column view-header">
17
- <h2 class="heading2">
18
- <%== present(debate).title %>
19
- </h2>
17
+ <div class="m-bottom">
18
+ <%= link_to debates_path(filter_link_params), class: "small hollow" do %>
19
+ <%= icon "chevron-left", class: "icon--small", role: "img", "aria-hidden": true %>
20
+ <%= t(".back") %>
21
+ <% end %>
22
+ </div>
20
23
 
21
- <%= cell "decidim/author", Decidim::Debates::DebatePresenter.new(debate).author, context: { extra_classes: ["author-data--small"] } %>
24
+ <h2 class="heading3">
25
+ <%== present(debate).title(links: true) %>
26
+ </h2>
22
27
 
28
+ <% debate_presenter = Decidim::Debates::DebatePresenter.new(debate) %>
29
+ <%= cell "decidim/author", debate_presenter.author, from: debate, context: { extra_classes: ["author-data--small"] } %>
23
30
  </div>
24
31
  <div class="row">
25
- <div class="columns section view-side mediumlarge-4 mediumlarge-push-8
26
- large-3 large-push-9">
32
+ <div class="columns section view-side mediumlarge-4 mediumlarge-push-8 large-3 large-push-9">
33
+ <% if allowed_to?(:edit, :debate, debate: debate) %>
34
+ <%= link_to t(".edit_debate"), edit_debate_path(debate), class: "button secondary hollow expanded button-sc button--icon follow-button" %>
35
+ <% elsif admin_allowed_to?(:update, :debate, debate: debate) %>
36
+ <%= link_to t(".edit_debate"), resource_locator(debate).edit, class: "button secondary hollow expanded button-sc button--icon follow-button" %>
37
+ <% end %>
38
+ <% close_debate_action_text = (debate.closed? ? ".edit_conclusions" : ".close_debate" ) %>
39
+ <% if allowed_to?(:close, :debate, debate: debate) %>
40
+ <button type="button" data-open="closeDebateModal" title="<%= t(close_debate_action_text) %>" aria-controls="closeDebateModal" aria-haspopup="true" tabindex="0" class="button hollow expanded button-sc button--icon follow-button">
41
+ <%= t(close_debate_action_text) %>
42
+ </button>
43
+ <% elsif admin_allowed_to?(:close, :debate, debate: debate) %>
44
+ <%= 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 hollow expanded button-sc button--icon follow-button" %>
45
+ <% end %>
27
46
  <div class="card extra">
28
47
  <div class="card__content">
29
48
  <% if debate.start_time.present? && debate.end_time.present? %>
@@ -34,23 +53,74 @@ edit_link(
34
53
  <%= l debate.start_time, format: "%H:%M" %> - <%= l debate.end_time, format: "%H:%M" %>
35
54
  </div>
36
55
  <% end %>
37
- <%= render partial: "decidim/shared/follow_button", locals: { followable: debate, large: false } %>
56
+
57
+ <% if endorsements_enabled? && allowed_to?(:endorse, :debate, debate: debate) %>
58
+ <div class="row collapse buttons__row">
59
+ <div class="column small-12 collapse">
60
+ <%= endorsement_buttons_cell(debate) %>
61
+ </div>
62
+ </div>
63
+ <% end %>
64
+ <%= follow_button_for(debate) %>
65
+ </div>
66
+ </div>
67
+ <div class="card extra">
68
+ <div class="definition-data">
69
+ <div class="definition-data__item definition-data__item">
70
+ <span class="definition-data__title">
71
+ <%= t ".last_comment_by" %>
72
+ </span>
73
+ <span class="definition-data__text">
74
+ <% if debate_presenter.last_comment_by %>
75
+ <%= cell "decidim/author", debate_presenter.last_comment_by, context: { extra_classes: ["author-data--small"] } %>
76
+ <% else %>
77
+ <%= t ".no_comments_yet" %>
78
+ <% end %>
79
+ </span>
80
+ </div>
81
+
82
+ <div class="definition-data__item definition-data__item--double">
83
+ <span class="definition-data__title">
84
+ <%= t ".participants_count" %>
85
+ </span>
86
+ <span class="definition-data__number"><%= debate_presenter.participants_count %></span>
87
+ </div>
88
+
89
+ <div class="definition-data__item definition-data__item--double">
90
+ <span class="definition-data__title">
91
+ <%= t ".groups_count" %>
92
+ </span>
93
+ <span class="definition-data__number"><%= debate_presenter.groups_count %></span>
94
+ </div>
38
95
  </div>
39
96
  </div>
40
97
  <%= resource_reference(debate) %>
98
+ <%= resource_version(debate_presenter, versions_path: debate_versions_path(debate)) %>
41
99
  <%= render partial: "decidim/shared/share_modal" %>
100
+ <%= embed_modal_for debate_widget_url(debate, format: :js) %>
42
101
  </div>
43
102
  <div class="columns mediumlarge-8 mediumlarge-pull-4">
44
103
  <div class="section">
104
+ <% if debate.closed? %>
105
+ <span class="success label proposal-status">
106
+ <%= t(".debate_closed") %>
107
+ </span>
108
+ <% end %>
109
+
45
110
  <%= render_debate_description(debate) %>
111
+
112
+ <% if debate.closed? %>
113
+ <%= cell("decidim/announcement", { announcement: { title: t(".debate_conclusions_are", date: l(debate.closed_at, format: :decidim_short)), body: simple_format(translated_attribute(debate.conclusions)) }, callout_class: "success" }) %>
114
+ <% end %>
115
+
46
116
  <% if translated_attribute(debate.instructions).present? %>
47
117
  <div class="callout secondary">
48
- <%= decidim_sanitize(simple_format(translated_attribute(debate.instructions))) %>
118
+ <%= decidim_sanitize(simple_format(translated_attribute(debate.instructions), {}, sanitize: false)) %>
49
119
  </div>
50
120
  <% end %>
51
121
  <% if translated_attribute(debate.information_updates).present? %>
52
122
  <div class="callout success">
53
- <%= simple_format(translated_attribute(debate.information_updates)) %>
123
+ <%= decidim_sanitize(simple_format(translated_attribute(debate.information_updates), {}, sanitize: false)) %>
54
124
  </div>
55
125
  <% end %>
56
126
  <% if debate.category %>
@@ -58,6 +128,8 @@ edit_link(
58
128
  <li><%= link_to translated_attribute(debate.category.name), debates_path(filter: { category_id: debate.category.id }) %></li>
59
129
  </ul>
60
130
  <% end %>
131
+
132
+ <%= cell "decidim/endorsers_list", debate %>
61
133
  </div>
62
134
  </div>
63
135
  </div>
@@ -71,3 +143,9 @@ edit_link(
71
143
  url: decidim.report_path(sgid: debate.to_sgid.to_s)
72
144
  }
73
145
  %>
146
+ <%=
147
+ render partial: "close_debate_modal", locals: {
148
+ debate: debate,
149
+ form: close_debate_form
150
+ }
151
+ %>