In this form, the only case where `poll` might be present without `question.poll` being present to is going to be the `new` action. We can assign the poll in the `new` action and get rid of the `poll` variable in the form.
39 lines
1.1 KiB
Plaintext
39 lines
1.1 KiB
Plaintext
<%= render "shared/globalize_locales", resource: question %>
|
|
|
|
<%= translatable_form_for(question, url: url) do |f| %>
|
|
|
|
<%= render "shared/errors", resource: question %>
|
|
|
|
<%= f.hidden_field :proposal_id %>
|
|
|
|
<div class="row">
|
|
<div class="small-12">
|
|
<% if question.poll.present? %>
|
|
<%= f.hidden_field :poll_id, value: question.poll.id %>
|
|
<% else %>
|
|
<div class="small-12 medium-6 large-4 column">
|
|
<% select_options = Poll.all.map { |p| [p.name, p.id] } %>
|
|
<%= f.select :poll_id,
|
|
options_for_select(select_options),
|
|
prompt: t("admin.questions.index.select_poll") %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<%= f.translatable_fields do |translations_form| %>
|
|
<div class="column">
|
|
<%= translations_form.text_field :title %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="small-12 medium-4 large-2 margin-top column">
|
|
<%= f.submit(class: "button success expanded", value: t("shared.save")) %>
|
|
</div>
|
|
</div>
|
|
|
|
<% end %>
|