Revision 2738c03e
Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt
SL/ClientJS.pm | ||
---|---|---|
95 | 95 |
'jstree:select_node' => 2, # $.jstree._reference($(<TARGET>)).<FUNCTION>(<ARGS>, true) |
96 | 96 |
'jstree:deselect_node' => 2, |
97 | 97 |
'jstree:deselect_all' => 1, |
98 |
|
|
99 |
# ## other stuff ## |
|
100 |
redirect_to => 1, # window.location.href = <TARGET> |
|
98 | 101 |
); |
99 | 102 |
|
100 | 103 |
sub AUTOLOAD { |
... | ... | |
401 | 404 |
The messages of multiple calls of C<error> on the same C<$self> will |
402 | 405 |
be merged. |
403 | 406 |
|
407 |
=item C<redirect_to $url> |
|
408 |
|
|
409 |
Redirects the browser window to the new URL by setting the JavaScript |
|
410 |
property C<window.location.href>. Note that |
|
411 |
L<SL::Controller::Base/redirect_to> is AJAX aware and uses this |
|
412 |
function if the current request is an AJAX request as determined by |
|
413 |
L<SL::Request/is_ajax>. |
|
414 |
|
|
404 | 415 |
=back |
405 | 416 |
|
406 | 417 |
=head2 JQUERY FUNCTIONS |
js/client_js.js | ||
---|---|---|
109 | 109 |
else if (action[0] == 'jstree:deselect_node') $.jstree._reference($(action[1])).deselect_node(action[2]); |
110 | 110 |
else if (action[0] == 'jstree:deselect_all') $.jstree._reference($(action[1])).deselect_all(); |
111 | 111 |
|
112 |
// ## other stuff ## |
|
113 |
else if (action[0] == 'redirect_to') window.location.href = action[1]; |
|
114 |
|
|
112 | 115 |
else console.log('Unknown action: ' + action[0]); |
113 | 116 |
|
114 | 117 |
}); |
... | ... | |
116 | 119 |
// console.log("current_content_type " + $('#current_content_type').val() + ' ID ' + $('#current_content_id').val()); |
117 | 120 |
} |
118 | 121 |
|
122 |
function submit_ajax_form(url, form_selector, additional_data) { |
|
123 |
var separator = /\?/.test(url) ? '&' : '?'; |
|
124 |
$.post(url + separator + $(form_selector).serialize(), additional_data, eval_json_result); |
|
125 |
return true; |
|
126 |
} |
|
127 |
|
|
119 | 128 |
// Local Variables: |
120 | 129 |
// mode: js |
121 | 130 |
// End: |
scripts/generate_client_js_actions.tpl | ||
---|---|---|
32 | 32 |
// console.log("current_content_type " + $('#current_content_type').val() + ' ID ' + $('#current_content_id').val()); |
33 | 33 |
} |
34 | 34 |
|
35 |
function submit_ajax_form(url, form_selector, additional_data) { |
|
36 |
var separator = /\?/.test(url) ? '&' : '?'; |
|
37 |
$.post(url + separator + $(form_selector).serialize(), additional_data, eval_json_result); |
|
38 |
return true; |
|
39 |
} |
|
40 |
|
|
35 | 41 |
// Local Variables: |
36 | 42 |
// mode: js |
37 | 43 |
// End: |
Auch abrufbar als: Unified diff
ClientJS: Unterstützung für Browser-Redirects ("$js->redirect_to")