Files
nairobi/app/views/admin/poll/polls/_form.html.erb
Javi Martín 629df5ab9b Simplify getting imageable/documentable in forms
The imageable/documentable object is always the object the form builder
is based on; since we're already passing the form builder, we don't have
to pass the object as well.

The only exception are the poll answers. In this case, we're passing a
new answer as the object. That's OK; the same hack that we're using to
send the data to the answer URL without displaying existing attachments
causes the form to keep working the same way.
2021-07-13 16:58:13 +02:00

74 lines
1.9 KiB
Plaintext

<%= render "shared/globalize_locales", resource: @poll %>
<%= translatable_form_for [:admin, @poll] do |f| %>
<%= render "shared/errors", resource: @poll %>
<div class="row">
<div class="clear">
<div class="small-12 medium-6 column">
<%= f.date_field :starts_at %>
</div>
<div class="small-12 medium-6 column">
<%= f.date_field :ends_at %>
</div>
</div>
</div>
<div class="row">
<%= f.translatable_fields do |translations_form| %>
<div class="small-12 medium-6 column">
<%= translations_form.text_field :name %>
</div>
<div class="small-12 column">
<%= translations_form.text_area :summary, rows: 4 %>
</div>
<div class="small-12 column">
<%= translations_form.text_area :description, rows: 8 %>
</div>
<% end %>
</div>
<div class="row">
<div class="images small-12 column">
<%= render "images/nested_image", f: f %>
</div>
<div class="clear">
<div class="small-6 medium-6 column">
<%= f.check_box :geozone_restricted, data: { checkbox_toggle: "#geozones" } %>
</div>
</div>
</div>
<div id="geozones" style="<%= @poll.geozone_restricted? ? "" : "display:none" %>">
<div class="row">
<%= f.collection_check_boxes(:geozone_ids, @geozones, :id, :name) do |b| %>
<div class="small-6 medium-3 column">
<%= b.label do %>
<%= b.check_box + b.text %>
<% end %>
</div>
<% end %>
</div>
</div>
<div class="row">
<div class="small-12 column">
<%= render SDG::RelatedListSelectorComponent.new(f) %>
</div>
</div>
<div class="row">
<div class="clear">
<div class="small-12 medium-4 large-2 column">
<%= f.submit t("admin.polls.#{admin_submit_action(@poll)}.submit_button"),
class: "button success expanded margin-top" %>
</div>
</div>
</div>
<% end %>