fixed scope UI

pull/516/head
Justin Richer 11 years ago
parent 2b663bb23c
commit 5e676e0e59

@ -19,11 +19,14 @@ var SystemScopeModel = Backbone.Model.extend({
defaults:{ defaults:{
id:null, id:null,
description:null, description:null,
icon:null, icon:null,
value:null, value:null,
defaultScope:false, defaultScope:false,
allowDynReg:false allowDynReg:false,
structured:false,
structuredParamDescription:null,
structuredValue:null
}, },
urlRoot: 'api/scopes' urlRoot: 'api/scopes'
@ -226,7 +229,16 @@ var SystemScopeFormView = Backbone.View.extend({
events:{ events:{
'click .btn-save':'saveScope', 'click .btn-save':'saveScope',
'click .btn-cancel': function() {app.navigate('admin/scope', {trigger: true}); }, 'click .btn-cancel': function() {app.navigate('admin/scope', {trigger: true}); },
'click .btn-icon':'selectIcon' 'click .btn-icon':'selectIcon',
'change #isStructured input':'toggleStructuredParamDescription'
},
toggleStructuredParamDescription:function(event) {
if ($('#isStructured input', this.el).is(':checked')) {
$('#structuredParamDescription', this.el).show();
} else {
$('#structuredParamDescription', this.el).hide();
}
}, },
saveScope:function(event) { saveScope:function(event) {
@ -244,8 +256,8 @@ var SystemScopeFormView = Backbone.View.extend({
icon:$('#iconDisplay input').val(), icon:$('#iconDisplay input').val(),
defaultScope:$('#defaultScope input').is(':checked'), defaultScope:$('#defaultScope input').is(':checked'),
allowDynReg:$('#allowDynReg input').is(':checked'), allowDynReg:$('#allowDynReg input').is(':checked'),
structured:$('#structured').is(':checked'), structured:$('#isStructured input').is(':checked'),
structuredParamDescription:$('#structuredParamDescription').val() structuredParamDescription:$('#structuredParamDescription input').val()
}); });
if (valid) { if (valid) {
@ -310,6 +322,7 @@ var SystemScopeFormView = Backbone.View.extend({
$(".modal-body", this.el).append(this.iconTemplate({items:items})); $(".modal-body", this.el).append(this.iconTemplate({items:items}));
}, this); }, this);
this.toggleStructuredParamDescription();
return this; return this;
} }

@ -143,14 +143,14 @@
</div> </div>
<div class="control-group"> <div class="control-group">
<div class="controls"> <div class="controls" id="isStructured">
<label class="checkbox"> <label class="checkbox">
<input type="checkbox" id="isStructured" <%=structured ? 'checked' : '' %>> is a structured scope <input type="checkbox" <%=structured ? 'checked' : '' %>> is a structured scope
</label> </label>
<p class="help-block">Is the scope structured with structured values like <code>base:extension</code>?</p> <p class="help-block">Is the scope structured with structured values like <code>base:extension</code>?</p>
</div> </div>
<div class="controls"> <div class="controls" id="structuredParamDescription">
<input type="text" id="structuredParamDescription" value="<%=structuredParamDescription ? structuredParamDescription : '' %>"> <input type="text" value="<%=structuredParamDescription ? structuredParamDescription : '' %>">
<p class="help-block">Human-readable description of the structured parameter</p> <p class="help-block">Human-readable description of the structured parameter</p>
</div> </div>
</div> </div>

Loading…
Cancel
Save