Simplify attributes in settings forms

Rails automatically assigns that id and that URL to forms for existing
records.
This commit is contained in:
Javi Martín
2021-08-20 21:46:43 +02:00
parent e6127decac
commit d9076b9d02
2 changed files with 2 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
<%= form_for(feature, url: admin_setting_path(feature), html: { id: "edit_#{dom_id(feature)}" }) do |f| %>
<%= form_for([:admin, feature]) do |f| %>
<%= f.hidden_field :tab, value: tab if tab %>
<%= f.hidden_field :value, id: dom_id(feature), value: (feature.enabled? ? "" : "active") %>
<%= f.submit(t("admin.settings.index.features.#{feature.enabled? ? "disable" : "enable"}"),

View File

@@ -1,4 +1,4 @@
<%= form_for(setting, url: admin_setting_path(setting), html: { id: "edit_#{dom_id(setting)}" }) do |f| %>
<%= form_for([:admin, setting]) do |f| %>
<%= f.hidden_field :tab, value: tab if defined?(tab) %>
<div class="small-12 medium-6 large-8 column">
<%= f.text_area :value, label: false, id: dom_id(setting), lines: 1 %>