fixed scope UI

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

@ -23,7 +23,10 @@ var SystemScopeModel = Backbone.Model.extend({
icon:null,
value:null,
defaultScope:false,
allowDynReg:false
allowDynReg:false,
structured:false,
structuredParamDescription:null,
structuredValue:null
},
urlRoot: 'api/scopes'
@ -226,7 +229,16 @@ var SystemScopeFormView = Backbone.View.extend({
events:{
'click .btn-save':'saveScope',
'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) {
@ -244,8 +256,8 @@ var SystemScopeFormView = Backbone.View.extend({
icon:$('#iconDisplay input').val(),
defaultScope:$('#defaultScope input').is(':checked'),
allowDynReg:$('#allowDynReg input').is(':checked'),
structured:$('#structured').is(':checked'),
structuredParamDescription:$('#structuredParamDescription').val()
structured:$('#isStructured input').is(':checked'),
structuredParamDescription:$('#structuredParamDescription input').val()
});
if (valid) {
@ -310,6 +322,7 @@ var SystemScopeFormView = Backbone.View.extend({
$(".modal-body", this.el).append(this.iconTemplate({items:items}));
}, this);
this.toggleStructuredParamDescription();
return this;
}

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

Loading…
Cancel
Save