<% 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: debate ) %>
<%= link_to debates_path(filter_link_params), class: "small hollow" do %> <%= icon "chevron-left", class: "icon--small", role: "img", "aria-hidden": true %> <%= t(".back") %> <% end %>

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

<% debate_presenter = Decidim::Debates::DebatePresenter.new(debate) %> <%= cell "decidim/author", debate_presenter.author, from: debate, context: { extra_classes: ["author-data--small"] } %>
<% if allowed_to?(:edit, :debate, debate: debate) %> <%= link_to t(".edit_debate"), edit_debate_path(debate), class: "button secondary hollow expanded button-sc button--icon follow-button" %> <% elsif admin_allowed_to?(:update, :debate, debate: debate) %> <%= link_to t(".edit_debate"), resource_locator(debate).edit, class: "button secondary hollow expanded button-sc button--icon follow-button" %> <% end %> <% close_debate_action_text = (debate.closed? ? ".edit_conclusions" : ".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 hollow expanded button-sc button--icon follow-button" %> <% end %>
<%= cell("decidim/date_range", { start: debate.start_time, end: debate.end_time }) %> <% if endorsements_enabled? && allowed_to?(:endorse, :debate, debate: debate) %>
<%= endorsement_buttons_cell(debate) %>
<% end %> <%= follow_button_for(debate) %>
<%= t ".last_comment_by" %> <% if debate_presenter.last_comment_by %> <%= cell "decidim/author", debate_presenter.last_comment_by, context: { extra_classes: ["author-data--small"] } %> <% else %> <%= t ".no_comments_yet" %> <% end %>
<%= t ".participants_count" %> <%= debate_presenter.participants_count %>
<%= t ".groups_count" %> <%= debate_presenter.groups_count %>
<%= resource_reference(debate) %> <%= resource_version(debate_presenter, versions_path: debate_versions_path(debate)) %> <%= render partial: "decidim/shared/share_modal" %> <%= embed_modal_for debate_widget_url(debate, format: :js) %>
<% if debate.closed? %> <%= t(".debate_closed") %> <% end %> <%= render_debate_description(debate) %> <% if debate.closed? %> <%= cell("decidim/announcement", { title: t(".debate_conclusions_are", date: l(debate.closed_at, format: :decidim_short)), body: simple_format(translated_attribute(debate.conclusions)) }, callout_class: "success") %> <% end %> <% if translated_attribute(debate.instructions).present? %>
<%= decidim_sanitize(simple_format(translated_attribute(debate.instructions), {}, sanitize: false)) %>
<% end %> <% if translated_attribute(debate.information_updates).present? %>
<%= decidim_sanitize(simple_format(translated_attribute(debate.information_updates), {}, sanitize: false)) %>
<% end %> <%= render partial: "decidim/shared/tags", locals: { resource: debate, tags_class_extra: "tags--debate" } %> <%= cell "decidim/endorsers_list", debate %>
<%= comments_for debate %> <%= cell("decidim/flag_modal", debate) %> <%= render partial: "close_debate_modal", locals: { debate: debate, form: close_debate_form } %>