Files
grecia/app/views/admin/legislation/questions/_form.html.erb
Javi Martín 6fa67b5e53 Use active record translations for labels
This way we can simplify the way we generate form fields. In some cases,
we also use the human attribute in table headers, which IMHO makes
sense.

I haven't moved all of them: for example, sometimes a label is
different depending on whether it's shown to administrators, valuators,
or users. And I haven't touched the ones related to devise, since I
wasn't sure about possible side effects.

Note I've also removed placeholders when they had the same text as their
labels, since they weren't helpful. On the contrary, the added redundant
text to the form, potentially distracting users.
2019-10-07 01:56:23 +02:00

52 lines
1.9 KiB
Plaintext

<%= render "shared/globalize_locales", resource: @question %>
<%= translatable_form_for [:admin, @process, @question], url: url, html: { data: { watch_changes: true } } do |f| %>
<% if @question.errors.any? %>
<div class="small-12 medium-9 column">
<div id="error_explanation" data-alert class="callout alert" data-closable>
<button class="close-button" aria-label="<%= t("application.close") %>" type="button" data-close>
<span aria-hidden="true">&times;</span>
</button>
<strong>
<%= @question.errors.count %>
<%= t("admin.legislation.questions.errors.form.error", count: @question.errors.count) %>
</strong>
</div>
</div>
<% end %>
<div class="row">
<%= f.translatable_fields do |translations_form| %>
<div class="small-12 medium-9 column end">
<%= translations_form.text_area :title, rows: 5,
placeholder: t("admin.legislation.questions.form.title_placeholder") %>
</div>
<% end %>
</div>
<div class="row">
<div class="small-12 medium-9 column">
<%= f.label :question_options, t("admin.legislation.questions.form.question_options") %>
</div>
<div id="nested_question_options">
<%= f.fields_for :question_options do |ff| %>
<%= render "question_option_fields", f: ff %>
<% end %>
<div class="js-add-fields-container">
<div class="small-12 medium-9 column">
<%= link_to_add_association t("admin.legislation.questions.form.add_option"),
f, :question_options, class: "button hollow" %>
</div>
</div>
</div>
<div class="small-12 medium-6 large-3 clear column end margin-top">
<%= f.submit(class: "button success expanded", value: t("admin.legislation.questions.#{admin_submit_action(@question)}.submit_button")) %>
</div>
</div>
<% end %>