Set default value to owned plugin form

Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
This commit is contained in:
Kenji Okimoto 2018-06-12 18:02:46 +09:00
parent 6e8f5a2979
commit f194aae880
No known key found for this signature in database
GPG Key ID: F9E3E329A5C5E4A1
2 changed files with 16 additions and 4 deletions

View File

@ -72,6 +72,13 @@ const OwnedPluginForm = {
}, },
inputName: function(pluginType, option) { inputName: function(pluginType, option) {
return `setting[${pluginType}[0]][${option.name}]` return `setting[${pluginType}[0]][${option.name}]`
},
checked: function(checked) {
if (checked === true || checked === "true") {
return "checked"
} else {
return ""
}
} }
} }
} }

View File

@ -19,13 +19,17 @@
"data-placement" => "right", "data-placement" => "right",
"v-bind:title" => "option.desc"} "v-bind:title" => "option.desc"}
{{ option.name }} {{ option.name }}
%input{"v-bind:id" => "inputId(pluginType, option)", %select{"v-bind:id" => "inputId(pluginType, option)",
"v-bind:name" => "inputName(pluginType, option)", "v-bind:name" => "inputName(pluginType, option)",
"type" => "text", "class" => "form-control"}
"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"'} %template{"v-else-if" => 'option.type==="bool"'}
%input{"v-bind:id" => "inputId(pluginType, option)", %input{"v-bind:id" => "inputId(pluginType, option)",
"v-bind:name" => "inputName(pluginType, option)", "v-bind:name" => "inputName(pluginType, option)",
"v-bind:checked" => "checked(option.default)",
"type" => "checkbox"} "type" => "checkbox"}
%label{"v-bind:for" => "inputId(pluginType, option)", %label{"v-bind:for" => "inputId(pluginType, option)",
"data-toggle" => "tooltip", "data-toggle" => "tooltip",
@ -40,5 +44,6 @@
{{ option.name }} {{ option.name }}
%input{"v-bind:id" => "inputId(pluginType, option)", %input{"v-bind:id" => "inputId(pluginType, option)",
"v-bind:name" => "inputName(pluginType, option)", "v-bind:name" => "inputName(pluginType, option)",
"v-bind:value" => "option.default",
"type" => "text", "type" => "text",
"class" => "form-control"} "class" => "form-control"}