Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 2738c03e

Von Moritz Bunkus vor mehr als 12 Jahren hinzugefügt

  • ID 2738c03e1340255baade2fd357aafbbfd1347d5e
  • Vorgänger 341fbe8b
  • Nachfolger 3ce4cab3

ClientJS: Unterstützung für Browser-Redirects ("$js->redirect_to")

Unterschiede anzeigen:

SL/ClientJS.pm
'jstree:select_node' => 2, # $.jstree._reference($(<TARGET>)).<FUNCTION>(<ARGS>, true)
'jstree:deselect_node' => 2,
'jstree:deselect_all' => 1,
# ## other stuff ##
redirect_to => 1, # window.location.href = <TARGET>
);
sub AUTOLOAD {
......
The messages of multiple calls of C<error> on the same C<$self> will
be merged.
=item C<redirect_to $url>
Redirects the browser window to the new URL by setting the JavaScript
property C<window.location.href>. Note that
L<SL::Controller::Base/redirect_to> is AJAX aware and uses this
function if the current request is an AJAX request as determined by
L<SL::Request/is_ajax>.
=back
=head2 JQUERY FUNCTIONS
js/client_js.js
else if (action[0] == 'jstree:deselect_node') $.jstree._reference($(action[1])).deselect_node(action[2]);
else if (action[0] == 'jstree:deselect_all') $.jstree._reference($(action[1])).deselect_all();
// ## other stuff ##
else if (action[0] == 'redirect_to') window.location.href = action[1];
else console.log('Unknown action: ' + action[0]);
});
......
// console.log("current_content_type " + $('#current_content_type').val() + ' ID ' + $('#current_content_id').val());
}
function submit_ajax_form(url, form_selector, additional_data) {
var separator = /\?/.test(url) ? '&' : '?';
$.post(url + separator + $(form_selector).serialize(), additional_data, eval_json_result);
return true;
}
// Local Variables:
// mode: js
// End:
scripts/generate_client_js_actions.tpl
// console.log("current_content_type " + $('#current_content_type').val() + ' ID ' + $('#current_content_id').val());
}
function submit_ajax_form(url, form_selector, additional_data) {
var separator = /\?/.test(url) ? '&' : '?';
$.post(url + separator + $(form_selector).serialize(), additional_data, eval_json_result);
return true;
}
// Local Variables:
// mode: js
// End:

Auch abrufbar als: Unified diff