added "clear all claims" function
parent
cf70a20069
commit
0781592357
|
@ -37,8 +37,14 @@
|
||||||
"email-address": "email address",
|
"email-address": "email address",
|
||||||
"share-email": "Share with email address",
|
"share-email": "Share with email address",
|
||||||
"new": "New Policy",
|
"new": "New Policy",
|
||||||
"edit": "Edit Policy"
|
"edit": "Edit Policy",
|
||||||
|
"claim-name": "claim name",
|
||||||
|
"friendly-claim-name": "friendly claim name",
|
||||||
|
"claim-value": "claim value",
|
||||||
|
"value-type-text": "Text",
|
||||||
|
"value-type-number": "Number",
|
||||||
|
"clear-all": "Clear all claims",
|
||||||
|
"clear-all-confirm": "Are you sure you want to clear all claims from this policy?"
|
||||||
},
|
},
|
||||||
"webfinger-error": "Error",
|
"webfinger-error": "Error",
|
||||||
"webfinger-error-description": "The server was unable to find an identity provider for <code>__email__</code>.",
|
"webfinger-error-description": "The server was unable to find an identity provider for <code>__email__</code>.",
|
||||||
|
|
|
@ -413,6 +413,7 @@ var PolicyFormView = Backbone.View.extend({
|
||||||
events:{
|
events:{
|
||||||
'click .btn-share': 'addWebfingerClaim',
|
'click .btn-share': 'addWebfingerClaim',
|
||||||
'click .btn-share-advanced': 'addAdvancedClaim',
|
'click .btn-share-advanced': 'addAdvancedClaim',
|
||||||
|
'click .btn-clear': 'clearAllClaims',
|
||||||
'click .btn-save': 'savePolicy',
|
'click .btn-save': 'savePolicy',
|
||||||
'click .btn-cancel': 'cancel'
|
'click .btn-cancel': 'cancel'
|
||||||
},
|
},
|
||||||
|
@ -522,14 +523,12 @@ var PolicyFormView = Backbone.View.extend({
|
||||||
if (!claimsRequired) {
|
if (!claimsRequired) {
|
||||||
claimsRequired = [];
|
claimsRequired = [];
|
||||||
}
|
}
|
||||||
console.log(claimsRequired);
|
|
||||||
claimsRequired.push({
|
claimsRequired.push({
|
||||||
name: name,
|
name: name,
|
||||||
friendlyName: friendly,
|
friendlyName: friendly,
|
||||||
value: value,
|
value: value,
|
||||||
issuer: issuers
|
issuer: issuers
|
||||||
});
|
});
|
||||||
console.log(claimsRequired);
|
|
||||||
|
|
||||||
this.model.set({
|
this.model.set({
|
||||||
scopes: scopes,
|
scopes: scopes,
|
||||||
|
@ -559,11 +558,25 @@ var PolicyFormView = Backbone.View.extend({
|
||||||
"keyboard" : true,
|
"keyboard" : true,
|
||||||
"show" : true // ensure the modal is shown immediately
|
"show" : true // ensure the modal is shown immediately
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
clearAllClaims:function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
if (confirm($.t('policy.policy-form.clear-all-confirm'))) {
|
||||||
|
|
||||||
|
var scopes = $('#scopes input[type="checkbox"]:checked').map(function(idx, elem) { return $(elem).val(); }).get();
|
||||||
|
|
||||||
|
var claimsRequired = [];
|
||||||
|
|
||||||
|
this.model.set({
|
||||||
|
scopes: scopes,
|
||||||
|
claimsRequired: claimsRequired
|
||||||
|
}, {trigger: false});
|
||||||
|
|
||||||
|
this.render();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
savePolicy:function(e) {
|
savePolicy:function(e) {
|
||||||
|
|
|
@ -196,6 +196,7 @@
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<button class="btn btn-info btn-share-advanced"><i class="icon-share icon-white"></i> <span data-i18n="policy.policy-form.share-advanced">Add to claim set</span></button>
|
<button class="btn btn-info btn-share-advanced"><i class="icon-share icon-white"></i> <span data-i18n="policy.policy-form.share-advanced">Add to claim set</span></button>
|
||||||
|
<button class="btn btn-danger btn-clear"><i class="icon-trash icon-white"></i> <span data-i18n="policy.policy-form.clear-all">Clear all claims</span></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
Loading…
Reference in New Issue