wip: UI refactoring

* Ajax 302 catcher is working
* Fixed little issue in the autocompleter plugin

see #204
This commit is contained in:
Antoine Nguyen
2012-04-24 14:42:15 +02:00
parent 26dfcef9ef
commit 2b8c57ff50
2 changed files with 8 additions and 4 deletions
+4 -1
View File
@@ -70,10 +70,13 @@
},
select_entry: function(evt) {
var $link;
if (evt != undefined) {
evt.preventDefault();
$link = $(evt.target);
} else {
$link = this.$menu.find('.active > a');
}
var $link = this.$menu.find('.active > a');
var curvalue = this.$element.attr("value");
this.$element.attr("value", curvalue.substr(
+4 -3
View File
@@ -206,17 +206,18 @@ function simple_ajax_request(e) {
* Simple function that redirect ajax requests to the login page if
* the status code received with a response is equal to 278.
*/
function ajax_login_redirect() {
if (this.status != 278) {
function ajax_login_redirect(xhr) {
if (xhr.status != 278) {
return;
}
var params = "?next=" + window.location.pathname;
window.location.href =
this.xhr.getResponseHeader("Location").replace(/\?.*$/, params);
xhr.getResponseHeader("Location").replace(/\?.*$/, params);
}
$(document).ready(function() {
$(document).ajaxSuccess(function(e, xhr, settings) { ajax_login_redirect(xhr); });
$(document).on('click', 'a[data-toggle="ajaxmodal"]', modalbox);
$(document).on('click', 'a[data-toggle="ajaxmodal-autowidth"]', modalbox_autowidth);
});