feature #3748: Fix confirm dialogs

This commit is contained in:
Daniel Molina committed 2015-04-28 15:51:39 +02:00
1 parent a4e445839d
commit 2c26b0e790
4 files changed
+13 -14

No files matched your search

+1 -1
View File
@@ -571,7 +571,7 @@ define(function(require) {
dialogElement.foundation('reveal', 'reflow');
dialogElement.on('opened.fndtn.reveal', function () {
dialog.onShow(dialog.dialogId);
dialog.onShow(dialogElement);
});
dialogElement.on('click', '.resetDialog', function() {
@@ -16,27 +16,27 @@ define(function(require) {
//find out if we are running an action with a parametre on a datatable
//items or if its just an action
$('#confirm_with_select_proceed', dialog).click(function() {
var action = $(this).val();
var action = Sunstone.getActions[action];
var actionId = dialog.data('buttonAction');
var action = Sunstone.getAction(actionId);
var param = $('.resource_list_select', dialog).val();
if (!param.length) {
notifyError("You must select a value");
Notifier.notifyError("You must select a value");
return false;
};
if (!action) {
notifyError("Action " + action + " not defined.");
Notifier.notifyError("Action " + action + " not defined.");
return false;
};
var error;
switch (action.type){
case "multiple":
error = Sunstone.runAction(action, action.elements(), param);
error = Sunstone.runAction(actionId, action.elements(), param);
break;
default:
error = Sunstone.runAction(action, param);
error = Sunstone.runAction(actionId, param);
break;
}
@@ -53,7 +53,7 @@ define(function(require) {
var _onShow = function(dialog) {
var actionId = dialog.data('buttonAction');
var tabId = dialog.data('buttonTab');
var button = Sunstone.getButton(tabId, action);
var button = Sunstone.getButton(tabId, actionId);
var tip = Locale.tr("You have to confirm this action");
if (button.tip == undefined) {
@@ -67,12 +67,11 @@ define(function(require) {
}
$('#confirm_with_select_tip', dialog).text(tip);
$('#confirm_with_select_proceed', dialog).val(action);
var action = Sunstone.getAction(action);
var action = Sunstone.getAction(actionId);
var elements = action.elements();
if (elements) {
var str = action.split('.');
var str = actionId.split('.');
$(".confirm_action", dialog).html(str[1] + ' ' + str[0] + ': ' + elements.join(', '))
}
@@ -13,8 +13,7 @@ define(function(require) {
return false;
}
var _onShow = function(dialogId) {
var dialog = $('#' + dialogId);
var _onShow = function(dialog) {
var actionId = dialog.data('buttonAction');
var tabId = dialog.data('buttonTab');
var button = Sunstone.getButton(tabId, actionId);
@@ -1,5 +1,6 @@
define(function(require) {
var Notifier = require('utils/notifier');
var Locale = require('utils/locale');
require('opennebula/cluster');
require('opennebula/user');
require('opennebula/group');
@@ -17,7 +18,7 @@ define(function(require) {
if (empty_value) {
select_str += '<option class="empty_value" value="">' +
tr("Please select") + '</option>';
Locale.tr("Please select") + '</option>';
}
if (resource == "Cluster") {