options and params fixes

This commit is contained in:
CroneKorkN 2026-01-18 18:24:14 +01:00
parent 7ade38ecad
commit 9a65958d2d
Signed by: cronekorkn
SSH key fingerprint: SHA256:v0410ZKfuO1QHdgKBsdQNF64xmTxOF8osF1LIqwTcVw

View file

@ -26,13 +26,14 @@
section.config-options section.config-options
h3 Config Options h3 Config Options
= form_with url: server_template_config_options_path(@server_template), method: :post, local: true do |f| - config_option = @server_template.config_options.build
= form_with model: config_option, url: server_template_config_options_path(@server_template), method: :post, local: true do |f|
.form-group .form-group
= f.label "Key" = f.label :config_key, "Key"
= f.text_field :config_key, placeholder: "e.g., sv_pure" = f.text_field :config_key, placeholder: "e.g., sv_pure"
.form-group .form-group
= f.label "Value" = f.label :config_value, "Value"
= f.text_field :config_value, placeholder: "e.g., 2" = f.text_field :config_value, placeholder: "e.g., 2"
= f.submit "Add Option", class: "btn btn--small" = f.submit "Add Option", class: "btn btn--small"
@ -45,7 +46,7 @@
th Value th Value
th Actions th Actions
tbody tbody
- @server_template.config_options.each do |opt| - @server_template.config_options.select(&:persisted?).each do |opt|
tr tr
td = opt.config_key td = opt.config_key
td = opt.config_value td = opt.config_value
@ -55,13 +56,14 @@
section.startup-params section.startup-params
h3 Startup Parameters h3 Startup Parameters
= form_with url: server_template_startup_params_path(@server_template), method: :post, local: true do |f| - startup_param = @server_template.startup_params.build
= form_with model: startup_param, url: server_template_startup_params_path(@server_template), method: :post, local: true do |f|
.form-group .form-group
= f.label "Key" = f.label :param_key, "Key"
= f.text_field :param_key, placeholder: "e.g., +map" = f.text_field :param_key, placeholder: "e.g., +map"
.form-group .form-group
= f.label "Value" = f.label :param_value, "Value"
= f.text_field :param_value, placeholder: "e.g., c1m1_hotel" = f.text_field :param_value, placeholder: "e.g., c1m1_hotel"
= f.submit "Add Parameter", class: "btn btn--small" = f.submit "Add Parameter", class: "btn btn--small"
@ -74,7 +76,7 @@
th Value th Value
th Actions th Actions
tbody tbody
- @server_template.startup_params.each do |param| - @server_template.startup_params.select(&:persisted?).each do |param|
tr tr
td = param.param_key td = param.param_key
td = param.param_value td = param.param_value