Revision 3dc29e42
Von Sven Schöling vor fast 8 Jahren hinzugefügt
js/kivi.ActionBar.js | ||
---|---|---|
3 | 3 |
|
4 | 4 |
k.ActionBarAction = function(e) { |
5 | 5 |
var data = $(e).data('action'); |
6 |
|
|
7 |
if (data.disabled) |
|
8 |
$(e).addClass('layout-actionbar-action-disabled'); |
|
6 | 9 |
// dispatch as needed |
7 | 10 |
if (data.submit) { |
8 | 11 |
var form = data.submit[0]; |
9 | 12 |
var params = data.submit[1]; |
10 | 13 |
$(e).click(function(event) { |
11 |
var $hidden, key; |
|
14 |
var $hidden, key, func; |
|
15 |
if (data.disabled) return; |
|
16 |
if (data.confirm && !confirm(data.confirm)) return; |
|
17 |
if (data.checks) { |
|
18 |
for (var check in data.check) { |
|
19 |
func = kivi.get_function_by_name(check); |
|
20 |
if (!func()) return; |
|
21 |
} |
|
22 |
} |
|
12 | 23 |
for (key in params) { |
13 | 24 |
$hidden = $('<input type=hidden>') |
14 | 25 |
$hidden.attr('name', key) |
... | ... | |
21 | 32 |
// TODO: what to do with templated calls |
22 | 33 |
console.log(data.function) |
23 | 34 |
$(e).click(function(event) { |
24 |
var func = kivi.get_function_by_name(data.function[0]); |
|
35 |
var func; |
|
36 |
if (data.disabled) return; |
|
37 |
if (data.confirm && !confirm(data.confirm)) return; |
|
38 |
if (data.checks) { |
|
39 |
for (var check in data.check) { |
|
40 |
func = kivi.get_function_by_name(check); |
|
41 |
if (!func()) return; |
|
42 |
} |
|
43 |
} |
|
44 |
func = kivi.get_function_by_name(data.function[0]); |
|
25 | 45 |
func.apply(document, data.function.slice(1)) |
26 | 46 |
}); |
27 | 47 |
} |
Auch abrufbar als: Unified diff
ActionBar: calling conventions geändert, +check/disabled/confirm