Merge "Settings tab multiple fixes"

This commit is contained in:
Jenkins 2014-03-06 09:37:04 +00:00 committed by Gerrit Code Review
commit 7cc12c6df7
2 changed files with 20 additions and 22 deletions

View File

@ -86,25 +86,23 @@ function(utils, models, commonViews, dialogViews, settingsTabTemplate, settingsG
},
composeBindings: function() {
this.bindings = {};
_.each(this.settings.attributes, function(settingsGroup, attr) {
if (settingsGroup.metadata.toggleable) {
this.bindings['input[name="' + attr + '.enabled"' + ']'] = attr + '.metadata.enabled';
_.each(this.settings.attributes, function(group, groupName) {
if (this.settings.get(groupName + '.metadata.toggleable')) {
this.bindings['input[name="' + groupName + '.enabled' + '"]'] = groupName + '.metadata.enabled';
}
_.each(settingsGroup, function(setting, settingTitle) {
if (settingTitle != 'metadata') {
this.bindings['input[name=' + settingTitle + ']'] = attr + '.' + settingTitle + '.value';
if (settingsGroup.metadata.toggleable) {
this.bindings['input[name=' + settingTitle + ']'] = {
observe: attr + '.' + settingTitle + '.value',
attributes: [{
name: 'disabled',
observe: attr + '.metadata.enabled',
onGet: function(){
return !settingsGroup.metadata.enabled;
}
}]
};
}
_.each(group, function(setting, settingName) {
if (settingName == 'metadata') {return;}
var settingBindings = this.bindings['input[name="' + groupName + '.' + settingName + '"]'] = {
observe: groupName + '.' + settingName + '.value'
};
if (this.settings.get(groupName + '.metadata.toggleable')) {
settingBindings.attributes = [{
name: 'disabled',
observe: groupName + '.metadata.enabled',
onGet: function(value) {
return !value;
}
}];
}
}, this);
}, this);

View File

@ -1,7 +1,7 @@
<% var disabled = locked ? 'disabled' : '' %>
<% var ns = "cluster_page.settings_tab." + groupName + "." %>
<% if (settings.metadata.toggleable){ %>
<% if (settings.metadata && settings.metadata.toggleable) { %>
<legend class="openstack-settings">
<label class="toggleable">
<div class="tumbler">
@ -28,7 +28,7 @@
<label class="parameter-box clearfix">
<div class="parameter-control">
<div class="custom-tumbler">
<input type="checkbox" name="<%- settingName %>" <%= disabled %> />
<input type="checkbox" name="<%- groupName + '.' + settingName %>" <%= disabled %> />
<!-- [if !IE |(gte IE 9)]> --><span>&nbsp;</span><!-- <![endif] -->
</div>
</div>
@ -42,7 +42,7 @@
<label class="parameter-box clearfix">
<div class="parameter-control">
<div class="custom-tumbler">
<input type="radio" name="<%- settingName %>" value="<%- option['data'] %>" <%= disabled %> />
<input type="radio" name="<%- groupName + '.' + settingName %>" value="<%- option.data %>" <%= disabled %> />
<!-- [if !IE |(gte IE 9)]> --><span>&nbsp;</span><!-- <![endif] -->
</div>
</div>
@ -58,7 +58,7 @@
<label class="parameter-box clearfix">
<div class="openstack-sub-title parameter-name"><%- $.t(ns + settingName + '.label', {defaultValue: setting.label}) %></div>
<div class="parameter-control <%= setting.type == 'password' ? 'input-append' : '' %>">
<input type="<%= setting.type %>" class="<%= setting.type == 'password' ? 'input-append' : '' %>" name="<%- settingName %>" value="" <%= disabled %> />
<input type="<%= setting.type %>" class="<%= setting.type == 'password' ? 'input-append' : '' %>" name="<%- groupName + '.' + settingName %>" value="" <%= disabled %> />
<% if (setting.type == 'password') { %>
<span class="add-on"><i class="icon-eye"></i><i class="icon-eye-off hide"></i></span>
<% } %>