decidim-debates 0.20.1 → 0.23.1

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 +27 -1
  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 +55 -0
  28. data/app/models/decidim/debates/debate.rb +60 -8
  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 +64 -3
  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/types/decidim/debates/debate_type.rb +28 -0
  40. data/app/types/decidim/debates/debates_type.rb +32 -0
  41. data/app/views/decidim/debates/admin/debate_closes/edit.html.erb +17 -0
  42. data/app/views/decidim/debates/admin/debates/_form.html.erb +5 -5
  43. data/app/views/decidim/debates/admin/debates/index.html.erb +7 -1
  44. data/app/views/decidim/debates/debates/_close_debate_modal.html.erb +13 -0
  45. data/app/views/decidim/debates/debates/_debates.html.erb +7 -0
  46. data/app/views/decidim/debates/debates/_filters.html.erb +20 -6
  47. data/app/views/decidim/debates/debates/_form.html.erb +19 -0
  48. data/app/views/decidim/debates/debates/edit.html.erb +22 -0
  49. data/app/views/decidim/debates/debates/index.html.erb +4 -5
  50. data/app/views/decidim/debates/debates/new.html.erb +2 -23
  51. data/app/views/decidim/debates/debates/show.html.erb +86 -10
  52. data/app/views/decidim/debates/versions/index.html.erb +8 -0
  53. data/app/views/decidim/debates/versions/show.html.erb +10 -0
  54. data/config/locales/am-ET.yml +1 -0
  55. data/config/locales/ar.yml +2 -1
  56. data/config/locales/bg-BG.yml +7 -0
  57. data/config/locales/bg.yml +15 -0
  58. data/config/locales/ca.yml +73 -1
  59. data/config/locales/cs.yml +112 -40
  60. data/config/locales/da-DK.yml +1 -0
  61. data/config/locales/da.yml +1 -0
  62. data/config/locales/de.yml +51 -1
  63. data/config/locales/el.yml +155 -0
  64. data/config/locales/en.yml +73 -1
  65. data/config/locales/eo.yml +1 -0
  66. data/config/locales/es-MX.yml +73 -1
  67. data/config/locales/es-PY.yml +73 -1
  68. data/config/locales/es.yml +73 -1
  69. data/config/locales/et-EE.yml +1 -0
  70. data/config/locales/et.yml +1 -0
  71. data/config/locales/eu.yml +2 -1
  72. data/config/locales/fi-plain.yml +73 -1
  73. data/config/locales/fi.yml +78 -6
  74. data/config/locales/fr-CA.yml +223 -0
  75. data/config/locales/fr.yml +73 -1
  76. data/config/locales/ga-IE.yml +1 -0
  77. data/config/locales/gl.yml +2 -1
  78. data/config/locales/hr-HR.yml +1 -0
  79. data/config/locales/hr.yml +1 -0
  80. data/config/locales/hu.yml +26 -1
  81. data/config/locales/id-ID.yml +2 -1
  82. data/config/locales/is-IS.yml +2 -1
  83. data/config/locales/is.yml +102 -0
  84. data/config/locales/it.yml +45 -10
  85. data/config/locales/ja-JP.yml +195 -0
  86. data/config/locales/ja.yml +221 -0
  87. data/config/locales/ko-KR.yml +1 -0
  88. data/config/locales/ko.yml +1 -0
  89. data/config/locales/lt-LT.yml +1 -0
  90. data/config/locales/lt.yml +1 -0
  91. data/config/locales/lv.yml +135 -0
  92. data/config/locales/mt-MT.yml +1 -0
  93. data/config/locales/mt.yml +1 -0
  94. data/config/locales/nl.yml +49 -1
  95. data/config/locales/no.yml +115 -71
  96. data/config/locales/om-ET.yml +1 -0
  97. data/config/locales/pl.yml +100 -45
  98. data/config/locales/pt-BR.yml +3 -4
  99. data/config/locales/pt.yml +56 -36
  100. data/config/locales/ro-RO.yml +173 -0
  101. data/config/locales/ru.yml +2 -1
  102. data/config/locales/sk-SK.yml +156 -0
  103. data/config/locales/sk.yml +157 -0
  104. data/config/locales/sl.yml +22 -0
  105. data/config/locales/so-SO.yml +1 -0
  106. data/config/locales/sr-CS.yml +6 -0
  107. data/config/locales/sv.yml +54 -1
  108. data/config/locales/ti-ER.yml +1 -0
  109. data/config/locales/tr-TR.yml +2 -1
  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 +50 -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 +83 -14
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Debates
5
+ DebateType = GraphQL::ObjectType.define do
6
+ interfaces [
7
+ -> { Decidim::Core::CategorizableInterface },
8
+ -> { Decidim::Comments::CommentableInterface },
9
+ -> { Decidim::Core::AuthorableInterface }
10
+ ]
11
+
12
+ name "Debate"
13
+ description "A debate"
14
+
15
+ field :id, !types.ID, "The internal ID for this debate"
16
+ field :title, Decidim::Core::TranslatedFieldType, "The title for this debate"
17
+ field :description, Decidim::Core::TranslatedFieldType, "The description for this debate"
18
+ field :instructions, Decidim::Core::TranslatedFieldType, "The instructions for this debate"
19
+ field :startTime, Decidim::Core::DateTimeType, "The start time for this debate", property: :start_time
20
+ field :endTime, Decidim::Core::DateTimeType, "The end time for this debate", property: :end_time
21
+ field :image, types.String, "The image of this debate"
22
+ field :createdAt, Decidim::Core::DateTimeType, "When this debate was created", property: :created_at
23
+ field :updatedAt, Decidim::Core::DateTimeType, "When this debate was updated", property: :updated_at
24
+ field :informationUpdates, Decidim::Core::TranslatedFieldType, "The information updates for this debate", property: :information_updates
25
+ field :reference, types.String, "The reference for this debate"
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Debates
5
+ DebatesType = GraphQL::ObjectType.define do
6
+ interfaces [-> { Decidim::Core::ComponentInterface }]
7
+
8
+ name "Debates"
9
+ description "A debates component of a participatory space."
10
+
11
+ connection :debates, DebateType.connection_type do
12
+ resolve ->(component, _args, _ctx) {
13
+ DebatesTypeHelper.base_scope(component).includes(:component)
14
+ }
15
+ end
16
+
17
+ field(:debate, DebateType) do
18
+ argument :id, !types.ID
19
+
20
+ resolve ->(component, args, _ctx) {
21
+ DebatesTypeHelper.base_scope(component).find_by(id: args[:id])
22
+ }
23
+ end
24
+ end
25
+
26
+ module DebatesTypeHelper
27
+ def self.base_scope(component)
28
+ Debate.where(component: component)
29
+ end
30
+ end
31
+ end
32
+ 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,22 @@
1
+ <div class="row columns">
2
+ <%= link_to :back, class: "muted-link" do %>
3
+ <%= icon "chevron-left", class: "icon--small", role: "img" %>
4
+ <%= t(".back") %>
5
+ <% end %>
6
+ <h2 class="section-heading"><%= t(".title") %></h2>
7
+ </div>
8
+
9
+ <div class="row">
10
+ <div class="columns large-6 medium-centered">
11
+ <div class="card">
12
+ <div class="card__content">
13
+ <%= decidim_form_for(@form) do |form| %>
14
+ <%= render partial: "form", locals: { form: form } %>
15
+ <div class="actions">
16
+ <%= form.submit t(".save"), class: "button expanded", data: { disable: true } %>
17
+ </div>
18
+ <% end %>
19
+ </div>
20
+ </div>
21
+ </div>
22
+ </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,6 +1,6 @@
1
1
  <div class="row columns">
2
2
  <%= link_to :back, class: "muted-link" do %>
3
- <%= icon "chevron-left", class: "icon--small" %>
3
+ <%= icon "chevron-left", class: "icon--small", role: "img", "aria-hidden": true %>
4
4
  <%= t(".back") %>
5
5
  <% end %>
6
6
  <h2 class="section-heading"><%= t(".title") %></h2>
@@ -11,26 +11,7 @@
11
11
  <div class="card">
12
12
  <div class="card__content">
13
13
  <%= decidim_form_for(@form) do |form| %>
14
- <div class="field">
15
- <%= form.text_field :title %>
16
- </div>
17
-
18
- <div class="field">
19
- <%= form.text_area :description, rows: 10 %>
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
-
14
+ <%= render partial: "form", locals: { form: form } %>
34
15
  <div class="actions">
35
16
  <%= form.submit t(".create"), class: "button expanded", data: { disable: true } %>
36
17
  </div>
@@ -39,5 +20,3 @@
39
20
  </div>
40
21
  </div>
41
22
  </div>
42
-
43
- <%= javascript_include_tag "decidim/proposals/add_proposal" %>
@@ -14,16 +14,33 @@ 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
+ <%= link_to debates_path(filter_link_params), class: "small hollow" do %>
18
+ <%= icon "chevron-left", class: "icon--small", role: "img", "aria-hidden": true %>
19
+ <%= t(".back") %>
20
+ <% end %>
20
21
 
21
- <%= cell "decidim/author", Decidim::Debates::DebatePresenter.new(debate).author, context: { extra_classes: ["author-data--small"] } %>
22
+ <h2 class="heading3">
23
+ <%== present(debate).title(links: true) %>
24
+ </h2>
22
25
 
26
+ <% debate_presenter = Decidim::Debates::DebatePresenter.new(debate) %>
27
+ <%= cell "decidim/author", debate_presenter.author, from: debate, context: { extra_classes: ["author-data--small"] } %>
23
28
  </div>
24
29
  <div class="row">
25
- <div class="columns section view-side mediumlarge-4 mediumlarge-push-8
26
- large-3 large-push-9">
30
+ <div class="columns section view-side mediumlarge-4 mediumlarge-push-8 large-3 large-push-9">
31
+ <% if allowed_to?(:edit, :debate, debate: debate) %>
32
+ <%= link_to t(".edit_debate"), edit_debate_path(debate), class: "button secondary hollow expanded button-sc button--icon follow-button" %>
33
+ <% elsif admin_allowed_to?(:update, :debate, debate: debate) %>
34
+ <%= link_to t(".edit_debate"), resource_locator(debate).edit, class: "button secondary hollow expanded button-sc button--icon follow-button" %>
35
+ <% end %>
36
+ <% close_debate_action_text = (debate.closed? ? ".edit_conclusions" : ".close_debate" ) %>
37
+ <% if allowed_to?(:close, :debate, debate: debate) %>
38
+ <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">
39
+ <%= t(close_debate_action_text) %>
40
+ </button>
41
+ <% elsif admin_allowed_to?(:close, :debate, debate: debate) %>
42
+ <%= 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" %>
43
+ <% end %>
27
44
  <div class="card extra">
28
45
  <div class="card__content">
29
46
  <% if debate.start_time.present? && debate.end_time.present? %>
@@ -34,23 +51,74 @@ edit_link(
34
51
  <%= l debate.start_time, format: "%H:%M" %> - <%= l debate.end_time, format: "%H:%M" %>
35
52
  </div>
36
53
  <% end %>
37
- <%= render partial: "decidim/shared/follow_button", locals: { followable: debate, large: false } %>
54
+
55
+ <% if endorsements_enabled? && allowed_to?(:endorse, :debate, debate: debate) %>
56
+ <div class="row collapse buttons__row">
57
+ <div class="column small-12 collapse">
58
+ <%= endorsement_buttons_cell(debate) %>
59
+ </div>
60
+ </div>
61
+ <% end %>
62
+ <%= follow_button_for(debate) %>
63
+ </div>
64
+ </div>
65
+ <div class="card extra">
66
+ <div class="definition-data">
67
+ <div class="definition-data__item definition-data__item">
68
+ <span class="definition-data__title">
69
+ <%= t ".last_comment_by" %>
70
+ </span>
71
+ <span class="definition-data__text">
72
+ <% if debate_presenter.last_comment_by %>
73
+ <%= cell "decidim/author", debate_presenter.last_comment_by, context: { extra_classes: ["author-data--small"] } %>
74
+ <% else %>
75
+ <%= t ".no_comments_yet" %>
76
+ <% end %>
77
+ </span>
78
+ </div>
79
+
80
+ <div class="definition-data__item definition-data__item--double">
81
+ <span class="definition-data__title">
82
+ <%= t ".participants_count" %>
83
+ </span>
84
+ <span class="definition-data__number"><%= debate_presenter.participants_count %></span>
85
+ </div>
86
+
87
+ <div class="definition-data__item definition-data__item--double">
88
+ <span class="definition-data__title">
89
+ <%= t ".groups_count" %>
90
+ </span>
91
+ <span class="definition-data__number"><%= debate_presenter.groups_count %></span>
92
+ </div>
38
93
  </div>
39
94
  </div>
40
95
  <%= resource_reference(debate) %>
96
+ <%= resource_version(debate_presenter, versions_path: debate_versions_path(debate)) %>
41
97
  <%= render partial: "decidim/shared/share_modal" %>
98
+ <%= embed_modal_for debate_widget_url(debate, format: :js) %>
42
99
  </div>
43
100
  <div class="columns mediumlarge-8 mediumlarge-pull-4">
44
101
  <div class="section">
45
- <p><%= decidim_sanitize(simple_format(translated_attribute(debate.description))) %></p>
102
+ <% if debate.closed? %>
103
+ <span class="success label proposal-status">
104
+ <%= t(".debate_closed") %>
105
+ </span>
106
+ <% end %>
107
+
108
+ <%= render_debate_description(debate) %>
109
+
110
+ <% if debate.closed? %>
111
+ <%= 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" }) %>
112
+ <% end %>
113
+
46
114
  <% if translated_attribute(debate.instructions).present? %>
47
115
  <div class="callout secondary">
48
- <%= decidim_sanitize(simple_format(translated_attribute(debate.instructions))) %>
116
+ <%= decidim_sanitize(simple_format(translated_attribute(debate.instructions), {}, sanitize: false)) %>
49
117
  </div>
50
118
  <% end %>
51
119
  <% if translated_attribute(debate.information_updates).present? %>
52
120
  <div class="callout success">
53
- <%= simple_format(translated_attribute(debate.information_updates)) %>
121
+ <%= decidim_sanitize(simple_format(translated_attribute(debate.information_updates), {}, sanitize: false)) %>
54
122
  </div>
55
123
  <% end %>
56
124
  <% if debate.category %>
@@ -58,6 +126,8 @@ edit_link(
58
126
  <li><%= link_to translated_attribute(debate.category.name), debates_path(filter: { category_id: debate.category.id }) %></li>
59
127
  </ul>
60
128
  <% end %>
129
+
130
+ <%= cell "decidim/endorsers_list", debate %>
61
131
  </div>
62
132
  </div>
63
133
  </div>
@@ -71,3 +141,9 @@ edit_link(
71
141
  url: decidim.report_path(sgid: debate.to_sgid.to_s)
72
142
  }
73
143
  %>
144
+ <%=
145
+ render partial: "close_debate_modal", locals: {
146
+ debate: debate,
147
+ form: close_debate_form
148
+ }
149
+ %>