diff --git a/app/javascript/packs/owned_plugin_form.js b/app/javascript/packs/owned_plugin_form.js index 2264898..d74019f 100644 --- a/app/javascript/packs/owned_plugin_form.js +++ b/app/javascript/packs/owned_plugin_form.js @@ -72,6 +72,13 @@ const OwnedPluginForm = { }, inputName: function(pluginType, option) { return `setting[${pluginType}[0]][${option.name}]` + }, + checked: function(checked) { + if (checked === true || checked === "true") { + return "checked" + } else { + return "" + } } } } diff --git a/app/views/shared/vue/_owned_plugin_form.html.haml b/app/views/shared/vue/_owned_plugin_form.html.haml index 8e56b21..b70915d 100644 --- a/app/views/shared/vue/_owned_plugin_form.html.haml +++ b/app/views/shared/vue/_owned_plugin_form.html.haml @@ -19,13 +19,17 @@ "data-placement" => "right", "v-bind:title" => "option.desc"} {{ option.name }} - %input{"v-bind:id" => "inputId(pluginType, option)", - "v-bind:name" => "inputName(pluginType, option)", - "type" => "text", - "class" => "form-control"} + %select{"v-bind:id" => "inputId(pluginType, option)", + "v-bind:name" => "inputName(pluginType, option)", + "class" => "form-control"} + %option{"v-for" => "item in option.list", + "v-bind:value" => "item", + "v-bind:selected" => "option.default === item"} + {{ item }} %template{"v-else-if" => 'option.type==="bool"'} %input{"v-bind:id" => "inputId(pluginType, option)", "v-bind:name" => "inputName(pluginType, option)", + "v-bind:checked" => "checked(option.default)", "type" => "checkbox"} %label{"v-bind:for" => "inputId(pluginType, option)", "data-toggle" => "tooltip", @@ -40,5 +44,6 @@ {{ option.name }} %input{"v-bind:id" => "inputId(pluginType, option)", "v-bind:name" => "inputName(pluginType, option)", + "v-bind:value" => "option.default", "type" => "text", "class" => "form-control"}