<% add_decidim_meta_tags({ description: translated_attribute(debate.description), title: present(debate).title, url: debate_url(debate.id) }) %> <% edit_link( resource_locator(debate).edit, :update, :debate, debate: ) %> <%= render partial: "close_debate_modal", locals: { debate:, form: close_debate_form } %> <%= render layout: "layouts/decidim/shared/layout_item", locals: { back_path: debates_path, commentable: debate } do %>

<%== present(debate).title(links: true, html_escape: true) %>

<% debate_presenter = Decidim::Debates::DebatePresenter.new(debate) %>
<%= cell "decidim/author", debate_presenter.author, skip_profile_link: true %> <% if debate.closed? %> <%= t("debate_closed", scope: "decidim.debates.debates.show") %> <% end %>
<%= render_debate_description(debate) %>
<% if debate.closed? || translated_attribute(debate.instructions).present? || translated_attribute(debate.information_updates).present? %>
<%= 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? %> <%= cell("decidim/announcement", decidim_sanitize_editor_admin(simple_format(translated_attribute(debate.instructions), {}, sanitize: false))) if translated_attribute(debate.instructions).present? %> <%= cell("decidim/announcement", decidim_sanitize_editor_admin(simple_format(translated_attribute(debate.information_updates), {}, sanitize: false)), callout_class: "success") if translated_attribute(debate.information_updates).present? %>
<% end %>
<% if endorsements_enabled? %> <% if allowed_to?(:endorse, :debate, debate: debate) %> <%= endorsement_buttons_cell(debate) %> <% else %> <%= endorsers_list_cell(debate) %> <% end %> <% end %> <%= cell "decidim/comments_button", nil %>
<%= render partial: "decidim/shared/tags", locals: { resource: debate } %>
<%= cell "decidim/endorsers_list", debate, layout: :full %> <% content_for :aside do %> <% 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) %>
<% if allowed_to?(:edit, :debate, debate: debate) %> <%= link_to t("edit_debate", scope: "decidim.debates.debates.show"), edit_debate_path(debate), class: "button button__secondary button__xl w-full mb-4" %> <% elsif admin_allowed_to?(:update, :debate, debate: debate) %> <%= link_to t("edit_debate", scope: "decidim.debates.debates.show"), resource_locator(debate).edit, class: "button button__secondary button__xl w-full mb-4" %> <% end %> <% close_debate_action_text = (debate.closed? ? "decidim.debates.debates.show.edit_conclusions" : "decidim.debates.debates.show.close_debate" ) %> <% if allowed_to?(:close, :debate, debate: debate) %> <% elsif admin_allowed_to?(:close, :debate, debate: debate) %> <%= 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" %> <% end %>
<% end %>
<%= icon "calendar-line", class: "inline-block" %> <%= t("start", scope: "decidim.debates.models.debate.fields") %> - <%= t("end", scope: "decidim.debates.models.debate.fields") %>
<%= format_date_range(debate.start_time, debate.end_time) || t("open", scope: "decidim.debates.debates.show") %>
<%= t("participants_count", scope: "decidim.debates.debates.show") %> <%= debate_presenter.participants_count %>
<%= t("groups_count", scope: "decidim.debates.debates.show") %> <%= debate_presenter.groups_count %>
<%= follow_button_for(debate) %> <%= cell "decidim/share_button", nil %> <%= cell "decidim/report_button", debate %>
<% end %> <% content_for :item_footer do %> <%= comments_for debate %> <% end %> <% end %>