50 lines
2.2 KiB
Text
50 lines
2.2 KiB
Text
<% provide(:title, @subject.title ) %>
|
|
|
|
<h1 id="SubjectTitle">
|
|
<%= best_in_place_if allowed_to?(:edit_subject), @subject, :title %>
|
|
</h1>
|
|
|
|
<%= image_tag @subject.picture.url, class:"subject-main-image", alt:"#{@subject.title}" if @subject.picture? %>
|
|
|
|
<% if allowed_to?(:delete_minor_subject) %>
|
|
<%= link_to "Supprimer", @subject, method: :delete, data: { confirm: "Supprimer \"#{@subject.title}\" ?" }, class: "btn btn-primary btn-danger" %>
|
|
<% end %>
|
|
|
|
<p class="SubjectPresentationText"><%= best_in_place_if allowed_to?(:edit_subject), @subject, :presentation, as: :textarea %></p>
|
|
|
|
<section class="Positions">
|
|
|
|
<h2>Les positions </h2><%= pluralize(@subject.positions.count, 'positions') %>
|
|
|
|
<% if @subject.positions.any? %>
|
|
<ul class="Positions">
|
|
|
|
<%= render partial: "position", collection:@subject.positions, as: :position %>
|
|
|
|
|
|
<% if logged_in? && allowed_to?(:add_position) && allowed_to?(:add_statement) %>
|
|
<li id="new-position">
|
|
<%= form_for(@new_position) do |f| %>
|
|
<%= render 'shared/error_messages', object: f.object %>
|
|
<%= f.hidden_field :subject_id, :value => @subject.id %>
|
|
<span class="PositionTitle"><%= f.text_field :title, placeholder: "Nouvelle position" %></span>
|
|
<span class="PositionDescription"><%= f.text_area :description, placeholder: "Description" %></span>
|
|
|
|
<!-- Il est obligatoire d'ajouter une première prise de position pour valider une nouvelle position, donc on la met tout de suite dans le même formulaire -->
|
|
<p>Qui a pris cette position ?</p>
|
|
<%= autocomplete_field_tag 'PublicFigure', '',
|
|
autocomplete_autocomplete_public_figure_name_path,
|
|
id_element: '#position_public_figure_id',
|
|
class: "Autocomplete"
|
|
%>
|
|
<%= f.hidden_field :public_figure_id, value: ""%>
|
|
|
|
<%= f.submit "Ajouter", class: "btn btn-primary" %>
|
|
<% end %>
|
|
|
|
</li>
|
|
<% end %>
|
|
</ul>
|
|
<% end %>
|
|
|
|
</section>
|