From 9a65958d2da11c18bd1c3e43ac95c3545492fc11 Mon Sep 17 00:00:00 2001 From: CroneKorkN Date: Sun, 18 Jan 2026 18:24:14 +0100 Subject: [PATCH] options and params fixes --- app/views/server_templates/show.html.slim | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/views/server_templates/show.html.slim b/app/views/server_templates/show.html.slim index bde03e3..83b3a44 100644 --- a/app/views/server_templates/show.html.slim +++ b/app/views/server_templates/show.html.slim @@ -26,13 +26,14 @@ section.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 - = f.label "Key" + = f.label :config_key, "Key" = f.text_field :config_key, placeholder: "e.g., sv_pure" .form-group - = f.label "Value" + = f.label :config_value, "Value" = f.text_field :config_value, placeholder: "e.g., 2" = f.submit "Add Option", class: "btn btn--small" @@ -45,7 +46,7 @@ th Value th Actions tbody - - @server_template.config_options.each do |opt| + - @server_template.config_options.select(&:persisted?).each do |opt| tr td = opt.config_key td = opt.config_value @@ -55,13 +56,14 @@ section.startup-params 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 - = f.label "Key" + = f.label :param_key, "Key" = f.text_field :param_key, placeholder: "e.g., +map" .form-group - = f.label "Value" + = f.label :param_value, "Value" = f.text_field :param_value, placeholder: "e.g., c1m1_hotel" = f.submit "Add Parameter", class: "btn btn--small" @@ -74,7 +76,7 @@ th Value th Actions tbody - - @server_template.startup_params.each do |param| + - @server_template.startup_params.select(&:persisted?).each do |param| tr td = param.param_key td = param.param_value