Revision 4b1bcc47
Von Martin Helmling vor mehr als 8 Jahren hinzugefügt
SL/ClientJS.pm | ||
---|---|---|
116 | 116 |
|
117 | 117 |
flash => 2, # kivi.display_flash(<TARGET>, <ARGS>) |
118 | 118 |
flash_detail => 2, # kivi.display_flash_detail(<TARGET>, <ARGS>) |
119 |
clear_flash => 2, # kivi.display_flash_detail(<TARGET>, <ARGS>) |
|
119 | 120 |
reinit_widgets => 0, # kivi.reinit_widgets() |
120 | 121 |
run => -1, # kivi.run(<TARGET>, <ARGS>) |
121 | 122 |
run_once_for => 3, # kivi.run_once_for(<TARGET>, <ARGS>) |
js/client_js.js | ||
---|---|---|
5 | 5 |
// SL/ClientJS.pm for instructions. |
6 | 6 |
|
7 | 7 |
namespace("kivi", function(ns) { |
8 |
ns.display_flash = function(type, message) { |
|
8 |
ns.display_flash = function(type, message, noscroll) {
|
|
9 | 9 |
$('#flash_' + type + '_content').text(message); |
10 | 10 |
$('#flash_' + type).show(); |
11 |
$('#frame-header')[0].scrollIntoView(); |
|
11 |
if (!noscroll) { |
|
12 |
$('#frame-header')[0].scrollIntoView(); |
|
13 |
} |
|
12 | 14 |
}; |
13 | 15 |
|
14 | 16 |
ns.display_flash_detail = function(type, message) { |
... | ... | |
148 | 150 |
else if (action[0] == 'redirect_to') window.location.href = action[1]; |
149 | 151 |
else if (action[0] == 'flash') kivi.display_flash(action[1], action[2]); |
150 | 152 |
else if (action[0] == 'flash_detail') kivi.display_flash_detail(action[1], action[2]); |
153 |
else if (action[0] == 'clear_flash') kivi.clear_flash(action[1], action[2]); |
|
151 | 154 |
else if (action[0] == 'reinit_widgets') kivi.reinit_widgets(); |
152 | 155 |
else if (action[0] == 'run') kivi.run(action[1], action.slice(2, action.length)); |
153 | 156 |
else if (action[0] == 'run_once_for') kivi.run_once_for(action[1], action[2], action[3]); |
scripts/generate_client_js_actions.tpl | ||
---|---|---|
5 | 5 |
// SL/ClientJS.pm for instructions. |
6 | 6 |
|
7 | 7 |
namespace("kivi", function(ns) { |
8 |
ns.display_flash = function(type, message) { |
|
8 |
ns.display_flash = function(type, message, noscroll) {
|
|
9 | 9 |
$('#flash_' + type + '_content').text(message); |
10 | 10 |
$('#flash_' + type).show(); |
11 |
$('#frame-header')[0].scrollIntoView(); |
|
11 |
if (!noscroll) { |
|
12 |
$('#frame-header')[0].scrollIntoView(); |
|
13 |
} |
|
12 | 14 |
}; |
13 | 15 |
|
14 | 16 |
ns.display_flash_detail = function(type, message) { |
... | ... | |
16 | 18 |
$('#flash_' + type + '_disp').show(); |
17 | 19 |
}; |
18 | 20 |
|
21 |
ns.clear_flash = function(category , timeout) { |
|
22 |
window.setTimeout(function(){ |
|
23 |
$('#flash_' + category).hide(); |
|
24 |
$('#flash_detail_' + category).hide(); |
|
25 |
$('#flash_' + category + '_disp').hide(); |
|
26 |
$('#flash_' + category + '_content').empty(); |
|
27 |
$('#flash_' + category + '_detail').empty(); |
|
28 |
}, timeout); |
|
29 |
}; |
|
30 |
|
|
19 | 31 |
ns.eval_json_result = function(data) { |
20 | 32 |
if (!data) |
21 | 33 |
return; |
Auch abrufbar als: Unified diff
Flashanzeige erweitert: Löschen und Springen abschalten
1. Funktion zum Text löschen nach Timeout
Bei neuen Controllern, die per AJAX laufen, ist es empfehlenswert
bestimmte Texte nach einer gewissen Zeit implizit zu löschen,
damit eine weitere identische Anzeige erkennbar ist.
Änderung in clientjs:
2. nach Ausgabe einer Flash Anzeige (Info/Warning/Error)
wird nach oben gesprungen ( derzeit zum frame-header).
Damit wird die Anzeige auf jeden Fall sichtbar.