Feature #3748: Add password dialog to settings tab

This commit is contained in:
Carlos Martín committed 2015-06-18 16:43:50 +02:00
1 parent 735c542037
commit 4a564557a2
5 files changed
+33 -4

No files matched your search

@@ -13,6 +13,7 @@ define(function(require) {
};
var _dialogs = [
require('tabs/users-tab/dialogs/password')
];
var _panels = [
@@ -62,6 +62,9 @@ define(function(require) {
"User.update_password" : {
type: "custom",
call: function(){
Sunstone.getDialog(PASSWORD_DIALOG_ID).setParams(
{selectedElements: Sunstone.getDataTable(TAB_ID).elements()});
Sunstone.getDialog(PASSWORD_DIALOG_ID).reset();
Sunstone.getDialog(PASSWORD_DIALOG_ID).show();
}
},
@@ -35,13 +35,22 @@ define(function(require) {
Dialog.prototype.html = _html;
Dialog.prototype.onShow = _onShow;
Dialog.prototype.setup = _setup;
Dialog.prototype.setParams = _setParams;
return Dialog;
/*
FUNCTION DEFINITIONS
*/
/**
* @param {object} params
* - params.selectedElements : Array of user ids
*/
function _setParams(params) {
this.selectedElements = params.selectedElements;
}
function _html() {
return TemplateHTML({
'dialogId': this.dialogId,
@@ -68,9 +77,7 @@ define(function(require) {
var inputs = that.userCreation.retrieve(context);
var selElems = Sunstone.getDataTable(TAB_ID).elements();
Sunstone.runAction('User.passwd', selElems, inputs.password);
Sunstone.runAction('User.passwd', that.selectedElements, inputs.password);
Sunstone.getDialog(DIALOG_ID).hide();
Sunstone.getDialog(DIALOG_ID).reset();
@@ -24,6 +24,7 @@ define(function(require) {
var PANEL_ID = require('./info/panelId');
var RESOURCE = "User";
var XML_ROOT = "USER";
var PASSWORD_DIALOG_ID = require('tabs/users-tab/dialogs/password/dialogId');
/*
CONSTRUCTOR
@@ -132,6 +133,15 @@ define(function(require) {
$("#user_ssh_public_key_textarea", context).show().focus();
});
// Password button
context.off("click", "#update_password");
context.on("click", "#update_password", function(){
Sunstone.getDialog(PASSWORD_DIALOG_ID).setParams(
{selectedElements: [that.element.ID]});
Sunstone.getDialog(PASSWORD_DIALOG_ID).reset();
Sunstone.getDialog(PASSWORD_DIALOG_ID).show();
});
context.off("change", "#user_ssh_public_key_textarea");
context.on("change", "#user_ssh_public_key_textarea", function() {
var user_id = that.element.ID;
@@ -28,6 +28,14 @@
<td class="value_td">{{element.AUTH_DRIVER}}</td>
<td></td>
</tr>
<tr>
<td class="key_td">{{tr "Password"}}</td>
<td class="value_td" colspan="2">
<button id="update_password" type="button" class="button tiny radius secondary" >
{{tr "Update password"}} <a><i class="fa fa-pencil-square-o"/></a>
</button>
</td>
</tr>
<tr>
<td class="key_td">{{tr "Table Order"}}</td>
<td class="value_td_table_order">{{valOrDefault element.TEMPLATE.TABLE_ORDER "-"}}</td>