added "add new policy" controls
parent
214097584a
commit
d4e3639236
|
@ -506,6 +506,7 @@ var AppRouter = Backbone.Router.extend({
|
|||
|
||||
"user/policy":"policy",
|
||||
"user/policy/:rsid":"editPolicies",
|
||||
"user/policy/:rsid/new":"newPolicy",
|
||||
"user/policy/:rsid/:pid":"editPolicy",
|
||||
|
||||
"dev/dynreg":"dynReg",
|
||||
|
@ -1131,7 +1132,31 @@ var AppRouter = Backbone.Router.extend({
|
|||
},
|
||||
|
||||
newPolicy:function(rsid) {
|
||||
this.breadCrumbView.collection.reset();
|
||||
this.breadCrumbView.collection.add([
|
||||
{text:$.t('admin.home'), href:""},
|
||||
{text:$.t('policy.resource-sets'), href:"manage/#user/policy"},
|
||||
{text:$.t('policy.edit-policies'), href:"manage/#user/policy/" + rsid},
|
||||
{text:$.t('policy.edit-policy'), href:"manage/#user/policy/" + rsid + "/new"}
|
||||
]);
|
||||
|
||||
this.updateSidebar('user/policy');
|
||||
|
||||
var policy = policy = new PolicyModel({}, {rsid: rsid});
|
||||
|
||||
var rs = this.resourceSetList.get(rsid);
|
||||
if (rs == null) {
|
||||
// need to load it directly
|
||||
rs = new ResourceSetModel({id: rsid});
|
||||
this.resourceSetList.add(rs); // it will be loaded below, don't need to load it again in the future
|
||||
}
|
||||
|
||||
var view = new PolicyFormView({model: policy, rs: rs, systemScopeList: this.systemScopeList});
|
||||
|
||||
view.load(function() {
|
||||
$('#content').html(view.render().el);
|
||||
setPageTitle($.t('policy.edit-policy'));
|
||||
});
|
||||
},
|
||||
|
||||
editPolicy:function(rsid, pid) {
|
||||
|
|
|
@ -270,6 +270,7 @@ var PolicyListView = Backbone.View.extend({
|
|||
},
|
||||
|
||||
events:{
|
||||
'click .btn-add':'addPolicy',
|
||||
'click .btn-cancel':'cancel'
|
||||
},
|
||||
|
||||
|
@ -290,6 +291,11 @@ var PolicyListView = Backbone.View.extend({
|
|||
}
|
||||
},
|
||||
|
||||
addPolicy:function(e) {
|
||||
e.preventDefault();
|
||||
app.navigate('user/policy/' + this.options.rs.get('id') +'/new', {trigger: true});
|
||||
},
|
||||
|
||||
render:function (eventName) {
|
||||
$(this.el).html($('#tmpl-policy-table').html());
|
||||
|
||||
|
@ -442,8 +448,12 @@ var PolicyFormView = Backbone.View.extend({
|
|||
|
||||
var base = $('base').attr('href');
|
||||
$.getJSON(base + '/api/emailsearch?' + $.param({'identifier': email}), function(data) {
|
||||
|
||||
_self.model.set({
|
||||
|
||||
// grab the current state of the scopes checkboxes just in case
|
||||
var scopes = $('#scopes input[type="checkbox"]:checked').map(function(idx, elem) { return $(elem).val(); }).get();
|
||||
|
||||
_self.model.set({
|
||||
scopes: scopes,
|
||||
claimsRequired: data
|
||||
}, {trigger: false});
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
|
||||
<script type="text/html" id="tmpl-policy-table">
|
||||
<div class="well well-small">
|
||||
<button class="btn btn-small btn-success btn-add"><i class="icon-plus icon-white"></i> <span data-i18n="policy.policy-table.new">Add New Policy</span></button>
|
||||
<button class="btn btn-small btn-cancel"><i class="icon-list"></i> <span data-i18n="policy.policy-table.return">Return to list</span></button>
|
||||
</div>
|
||||
|
||||
|
@ -92,6 +93,7 @@
|
|||
</table>
|
||||
|
||||
<div class="well well-small">
|
||||
<button class="btn btn-small btn-success btn-add"><i class="icon-plus icon-white"></i> <span data-i18n="policy.policy-table.new">Add New Policy</span></button>
|
||||
<button class="btn btn-small btn-cancel"><i class="icon-list"></i> <span data-i18n="policy.policy-table.return">Return to list</span></button>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue