generated from dxw/rails-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
_form.html.haml
34 lines (31 loc) · 2.3 KB
/
_form.html.haml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
= form_with model: matched_effort, url: path do |f|
= f.govuk_error_summary
= f.hidden_field :activity_id, value: @activity.id
= f.govuk_collection_select :organisation_id,
list_of_matched_effort_providers,
:id,
:name,
options: { include_blank: true }
= f.govuk_radio_buttons_fieldset(:funding_type, legend: -> { tag.legend(t("form.legend.matched_effort.funding_type"), class: "govuk-fieldset__legend") }) do
- MatchedEffort::FundingType.all.each_with_index do |funding_type, i|
- if funding_type.categories.count.zero?
= f.govuk_radio_button(:funding_type, funding_type.coded_name, label: { text: funding_type.name }, link_errors: (i == 0))
- else
= f.govuk_radio_button(:funding_type, funding_type.coded_name, label: { text: funding_type.name }, link_errors: (i == 0)) do
= f.govuk_radio_buttons_fieldset(:category, legend: -> { tag.legend(t("form.legend.matched_effort.category"), class: "govuk-fieldset__legend") }) do
- funding_type.categories.each do |category|
= f.govuk_radio_button :category, category.coded_name, label: { text: category.name }
= f.govuk_text_field :committed_amount, width: 20
= f.govuk_collection_select :currency,
default_currency_options,
:code,
:name,
hint: { text: t("form.hint.matched_effort.currency") }
= f.govuk_text_field :exchange_rate, width: 20, hint: { text: t("form.hint.matched_effort.exchange_rate") }
= f.govuk_date_field :date_of_exchange_rate, legend: -> { tag.legend(t("form.legend.matched_effort.date_of_exchange_rate"), class: "govuk-fieldset__legend") }
= f.govuk_text_area :notes
= f.govuk_submit t("default.button.submit")
- if action_name == "new"
= link_to t("form.link.activity.back"), organisation_activity_other_funding_path(@activity.organisation, @activity), class: "govuk-button govuk-button--secondary", "data-module": "govuk-button", role: "button"
- if action_name == "edit"
= link_to t("default.button.delete"), activity_matched_effort_path(@activity, @matched_effort), method: "delete" , class: "govuk-button govuk-button--warning", "data-module": "govuk-button", role: "button", data: { confirm: "Are you sure you want to delete this matched effort?" }