We need to build a votation type object in the form so translations are applied automatically.
74 lines
2.9 KiB
Plaintext
74 lines
2.9 KiB
Plaintext
<%= render "shared/globalize_locales", resource: @question %>
|
|
|
|
<%= translatable_form_for(@question, url: form_url) do |f| %>
|
|
|
|
<%= render "shared/errors", resource: @question %>
|
|
|
|
<%= f.hidden_field :proposal_id %>
|
|
|
|
<div class="row">
|
|
<div class="small-12">
|
|
<% if @poll.present? %>
|
|
<%= f.hidden_field :poll_id, value: @poll.id %>
|
|
<% elsif @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">
|
|
<% if !@question.persisted? %>
|
|
<%= fields_for :votation_type, @question.votation_type || @question.build_votation_type do |votation_f| %>
|
|
<div class="small-12 medium-6">
|
|
<%= votation_f.select :enum_type,
|
|
options_for_select(VotationType.enum_types.map { |k, v| [t(k, scope: :enum_type), v] },
|
|
params.dig(:votation_type, :enum_type)), default: 0,
|
|
disabled: @question.persisted? %>
|
|
</div>
|
|
|
|
<div class="info-type">
|
|
<span class="js-description_text">
|
|
<%= t("polls.index.descriptions.unique") %>
|
|
</span>
|
|
<div class="small-12 medium-6 margin-description js-max_votes hidden ">
|
|
<%= votation_f.number_field :max_votes, min: 1, max: 999,
|
|
value: params.dig(:votation_type, :max_votes) %>
|
|
</div>
|
|
<div class="small-12 medium-6 js-prioritization_type hidden">
|
|
<%= votation_f.select :prioritization_type,
|
|
options_for_select(VotationType.prioritization_types.map { |k, v| [t(k, scope: :prioritization_type), v] },
|
|
params.dig(:votation_type, :prioritization_type)), default: 0,
|
|
disabled: @question.persisted? %>
|
|
</div>
|
|
<div class="small-12 medium-6 js-max_group_votes hidden">
|
|
<%= votation_f.number_field :max_groups_answers, min: 1, max: 999,
|
|
value: params.dig(:votation_type, :max_groups_answers) %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
<% 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 %>
|