Files
nairobi/app/components/admin/budget_phases/form_component.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

69 lines
2.3 KiB
Plaintext

<%= render "shared/globalize_locales", resource: phase %>
<%= translatable_form_for [namespace, phase.budget, phase], html: { class: "budget-phases-form" } do |f| %>
<%= render "shared/errors", resource: phase %>
<%= render Admin::BudgetsWizard::ModelFieldComponent.new %>
<fieldset>
<legend aria-describedby="phase_duration_description">
<%= t("admin.budget_phases.edit.duration") %>
</legend>
<p class="help-text" id="phase_duration_description">
<%= t("admin.budget_phases.edit.duration_description") %>
</p>
<div class="date-field">
<%= f.date_field :starts_at, id: "start_date" %>
</div>
<div class="date-field">
<%= f.date_field :ends_at, id: "end_date" %>
</div>
</fieldset>
<div class="small-12 column margin">
<%= f.check_box :enabled %>
<span class="help-text" id="phase-summary-help-text">
<%= t("admin.budget_phases.edit.enabled_help_text") %>
</span>
</div>
<%= f.translatable_fields do |translations_form| %>
<div class="small-12 column">
<%= translations_form.text_field :name, hint: t("admin.budget_phases.edit.name_help_text") %>
</div>
<div class="small-12 column">
<%= translations_form.text_area :description,
maxlength: Budget::Phase::DESCRIPTION_MAX_LENGTH,
class: "html-area",
hint: t("admin.budget_phases.edit.description_help_text") %>
</div>
<div class="small-12 column">
<p class="form-label"><%= t("admin.budget_phases.edit.main_call_to_action") %></p>
<p class="help-text"> <%= t("admin.budget_phases.edit.main_call_to_action_description") %></p>
<%= translations_form.text_field :main_link_text %>
</div>
<% end %>
<div class="small-12 column">
<%= f.text_field :main_link_url, placeholder: t("admin.shared.example_url") %>
</div>
<% if feature?(:allow_images) %>
<div class="images small-12 column">
<%= render "images/nested_image", f: f %>
<p class="help-text"><%= t("admin.budget_phases.edit.image_description") %></p>
</div>
<% end %>
<div class="small-12 column">
<%= f.submit t("admin.budget_phases.edit.save_changes"), class: "button success" %>
</div>
<% end %>