Skip to content

Commit a12f684

Browse files
committed
Merge branch 'master' of github.com:serghey-rodin/vesta
2 parents aeb8788 + 7d25c63 commit a12f684

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

web/js/actions.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,41 @@ App.Actions.update_cs_value = function(evt)
4242
if (App.Tmp[App.Env.world + '_selected_records'] > 0) {
4343
var confirm_message_key = App.Tmp[App.Env.world + '_selected_records'] == 1 ? 1 + ' record' : App.Tmp[App.Env.world + '_selected_records'] + ' records';
4444
var confirmed = confirm('This action will ' + val.toLowerCase() + ' ' + confirm_message_key + '. Do you want to proceede?');
45+
if (confirmed) {
46+
fb.log('mass_' + val);
47+
var func_name = val.toLowerCase();
48+
'function' == typeof App.Actions['mass_' + func_name] ? App.Actions['mass_' + func_name]() : false;
49+
}
50+
}
51+
}
52+
53+
App.Actions.mass_delete = function()
54+
{
55+
App.Actions.mass_action('massiveDelete');
56+
}
57+
58+
App.Actions.mass_suspend = function()
59+
{
60+
App.Actions.mass_action('massiveSuspend');
61+
}
62+
63+
App.Actions.mass_unsuspend = function()
64+
{
65+
App.Actions.mass_action('massiveUnsuspend');
66+
}
67+
68+
App.Actions.mass_action = function(method_name)
69+
{
70+
var rows = $('.checked-row');
71+
if (rows.length > 0) {
72+
var acc = [];
73+
rows.each(function(i, o) {
74+
acc[acc.length++] = App.Helpers.evalJSON($(o).find('.source').val());
75+
});
76+
77+
App.Ajax.request(App.Env.world+'.'+method_name, {'entities': App.Helpers.toJSON(acc)}, function() {
78+
App.Pages.prepareHTML();
79+
});
4580
}
4681
}
4782

0 commit comments

Comments
 (0)