ChainsView.js revision 7782eea19adf2402dccf24482783172eaeae3540
/**
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2015 ForgeRock AS.
*/
/*global define*/
"jquery",
"underscore",
"bootstrap-dialog",
events: {
"change input[data-chain-name]" : "chainSelected",
"click button.delete-chain-btn": "deleteChain",
"click #deleteChains" : "deleteChains",
"click #selectAll" : "selectAll",
"click #addChain" : "addChain"
},
addChain: function(e) {
e.preventDefault();
var self = this,
invalidName = false,
UIUtils.fillTemplateWithData("templates/admin/views/realms/authentication/chains/AddChainTemplate.html", self.data, function(html) {
title: $.t("console.authentication.chains.createNewChain"),
buttons: [{
label: $.t("common.form.next"),
cssClass: "btn-primary",
// TODO : More client side validation here
});
if (invalidName){
// FIXME: This needs to come from a template or partial. This is a temporay fix.
var alert = "<div class='alert alert-warning' role='alert'>"+
"<div class='media'>"+
"<button type='button' class='close' data-dismiss='alert'><span aria-hidden='true'>×</span><span class='sr-only'>"+$.t("common.form.close")+"</span></button>"+
"<div class='media-left' href=#'>"+
"<i class='fa fa-exclamation-circle'></i>"+
"</div>"+
"<div class='media-body'>"+ $.t("console.authentication.chains.duplicateChain") +"</div>"+
"</div>"+
"</div>";
} else {
SMSRealmDelegate.authentication.chains.create(self.data.realmPath, { _id: chainName }).done(function() {
trigger: true
});
}).fail(function() {
// TODO: Add failure condition
});
}
}
}, {
label: $.t("common.form.cancel"),
}
}]
});
});
},
chainSelected: function(event) {
if (checked) {
} else {
}
},
this.$el.find(".sorted-chains input[type=checkbox][data-chain-name]:not(:disabled)").prop("checked", checked);
if (checked) {
} else {
}
},
deleteChain: function(event) {
var self = this,
});
},
deleteChains: function() {
var self = this,
chainNames = self.$el.find(".sorted-chains input[type=checkbox][data-chain-name]:checked").toArray().map(function(element) {
}),
});
});
},
var self = this,
sortedChains = [];
// Add default chains to top of list.
} else {
}
});
self.parentRender(function() {
if (callback) {
callback();
}
});
}).fail(function() {
// TODO: Add failure condition
});
}
});
return ChainsView;
});