Hide the current_rate when editing

This commit is contained in:
Oliver Günther
2026-05-26 20:14:44 +02:00
parent ae09ce6c72
commit 30904d940e
@@ -53,14 +53,15 @@ module Admin
input_width: :medium
)
f.text_field(
name: :current_rate,
label: ::CostType.human_attribute_name(:current_rate),
input_width: :small,
inputmode: :decimal,
value: current_rate_value,
trailing_visual: { text: { text: Setting.costs_currency } }
)
if model.new_record?
f.text_field(
name: :current_rate,
label: ::CostType.human_attribute_name(:current_rate),
input_width: :small,
inputmode: :decimal,
trailing_visual: { text: { text: Setting.costs_currency } }
)
end
f.check_box(
name: :default,
@@ -72,13 +73,6 @@ module Admin
label: ::CostType.human_attribute_name(:for_all_projects)
)
end
def current_rate_value
rate = model.rate_at(Date.current)
return "" unless rate
helpers.unitless_currency_number(rate.rate.round(2))
end
end
end
end