mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-18 00:00:12 +01:00
fix wrong passing of params to ajax
This commit is contained in:
parent
53daa0f1e3
commit
78d28d41e0
1 changed files with 13 additions and 13 deletions
|
|
@ -480,7 +480,7 @@ var TodoItems = {
|
||||||
$('.drop_target').hide(); // IE8 doesn't call stop() in this situation
|
$('.drop_target').hide(); // IE8 doesn't call stop() in this situation
|
||||||
|
|
||||||
ajax_options = default_ajax_options_for_scripts('POST', relative_to_root('todos/add_predecessor'), $(this));
|
ajax_options = default_ajax_options_for_scripts('POST', relative_to_root('todos/add_predecessor'), $(this));
|
||||||
ajax_options.data += "&predecessor="+dropped_todo + "&successor="+dragged_todo
|
ajax_options.data << {predecessor: dropped_todo, successor: dragged_todo}
|
||||||
$.ajax(ajax_options);
|
$.ajax(ajax_options);
|
||||||
},
|
},
|
||||||
drop_todo_on_context: function(evt, ui) {
|
drop_todo_on_context: function(evt, ui) {
|
||||||
|
|
@ -492,7 +492,7 @@ var TodoItems = {
|
||||||
$('.drop_target').hide();
|
$('.drop_target').hide();
|
||||||
|
|
||||||
ajax_options = default_ajax_options_for_scripts('POST', relative_to_root('todos/'+dragged_todo + '/change_context'), target);
|
ajax_options = default_ajax_options_for_scripts('POST', relative_to_root('todos/'+dragged_todo + '/change_context'), target);
|
||||||
ajax_options.data += "&todo[context_id]="+context_id
|
ajax_options.data << {"todo[context_id]": context_id}
|
||||||
$.ajax(ajax_options);
|
$.ajax(ajax_options);
|
||||||
},
|
},
|
||||||
setup_drag_and_drop: function() {
|
setup_drag_and_drop: function() {
|
||||||
|
|
@ -586,7 +586,7 @@ var TodoItems = {
|
||||||
$(document).on("click",'.item-container a.delete_dependency_button', function(evt){
|
$(document).on("click",'.item-container a.delete_dependency_button', function(evt){
|
||||||
var predecessor_id=$(this).attr("x_predecessors_id");
|
var predecessor_id=$(this).attr("x_predecessors_id");
|
||||||
var ajax_options = default_ajax_options_for_scripts('DELETE', this.href, $(this).parents('.item-container'));
|
var ajax_options = default_ajax_options_for_scripts('DELETE', this.href, $(this).parents('.item-container'));
|
||||||
ajax_options.data += "&predecessor="+predecessor_id
|
ajax_options.data << {predecessor: predecessor_id}
|
||||||
$.ajax(ajax_options);
|
$.ajax(ajax_options);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
@ -1155,11 +1155,12 @@ function generic_get_script_for_list(element, getter, param){
|
||||||
function default_ajax_options_for_submit(ajax_type, element_to_block) {
|
function default_ajax_options_for_submit(ajax_type, element_to_block) {
|
||||||
// the complete is not a function but an array so you can push other
|
// the complete is not a function but an array so you can push other
|
||||||
// functions that will be executed after the ajax call completes
|
// functions that will be executed after the ajax call completes
|
||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
type: ajax_type,
|
type: ajax_type,
|
||||||
async: true,
|
async: true,
|
||||||
block_element: element_to_block,
|
block_element: element_to_block,
|
||||||
data: "_source_view=" + SOURCE_VIEW,
|
data: {_source_view: SOURCE_VIEW, _group_view_by: GROUP_VIEW_BY},
|
||||||
beforeSend: function() {
|
beforeSend: function() {
|
||||||
if (this.block_element) {
|
if (this.block_element) {
|
||||||
$(this.block_element).block({
|
$(this.block_element).block({
|
||||||
|
|
@ -1180,8 +1181,9 @@ function default_ajax_options_for_submit(ajax_type, element_to_block) {
|
||||||
TracksPages.page_notify('error', i18n['common.ajaxError']+': '+status, 8);
|
TracksPages.page_notify('error', i18n['common.ajaxError']+': '+status, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(typeof(TAG_NAME) !== 'undefined')
|
if(typeof(TAG_NAME) !== 'undefined') {
|
||||||
options.data += "&_tag_name="+ TAG_NAME;
|
options.data["_tag_name"] = TAG_NAME;
|
||||||
|
}
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1208,7 +1210,7 @@ function post_with_ajax_and_block_element(the_url, element_to_block) {
|
||||||
|
|
||||||
function put_with_ajax_and_block_element(the_url, element_to_block) {
|
function put_with_ajax_and_block_element(the_url, element_to_block) {
|
||||||
var options = default_ajax_options_for_scripts('POST', the_url, element_to_block);
|
var options = default_ajax_options_for_scripts('POST', the_url, element_to_block);
|
||||||
options.data += '&_method=put';
|
options.data["_method"] = "put";
|
||||||
$.ajax(options);
|
$.ajax(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1220,12 +1222,10 @@ $(document).ajaxSend(function(event, request, settings) {
|
||||||
/* Set up authenticity token properly */
|
/* Set up authenticity token properly */
|
||||||
if ( settings.type == 'POST' || settings.type == 'post' ) {
|
if ( settings.type == 'POST' || settings.type == 'post' ) {
|
||||||
if(typeof(AUTH_TOKEN) != 'undefined'){
|
if(typeof(AUTH_TOKEN) != 'undefined'){
|
||||||
settings.data = (settings.data ? settings.data + "&" : "")
|
settings.data["authenticity_token"] = AUTH_TOKEN;
|
||||||
+ "authenticity_token=" + encodeURIComponent( AUTH_TOKEN ) + "&"
|
settings.data["_source_view"] = SOURCE_VIEW;
|
||||||
+ "_source_view=" + encodeURIComponent( SOURCE_VIEW );
|
|
||||||
} else {
|
} else {
|
||||||
settings.data = (settings.data ? settings.data + "&" : "")
|
settings.data["_source_view"] = SOURCE_VIEW;
|
||||||
+ "_source_view=" + encodeURIComponent( SOURCE_VIEW );
|
|
||||||
}
|
}
|
||||||
request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||||
}
|
}
|
||||||
|
|
@ -1238,7 +1238,7 @@ function setup_periodic_check(url_for_check, interval_in_sec, method) {
|
||||||
function(){
|
function(){
|
||||||
var settings = default_ajax_options_for_scripts( method ? method : "GET", url_for_check, null);
|
var settings = default_ajax_options_for_scripts( method ? method : "GET", url_for_check, null);
|
||||||
if(typeof(AUTH_TOKEN) != 'undefined'){
|
if(typeof(AUTH_TOKEN) != 'undefined'){
|
||||||
settings.data += "&authenticity_token=" + encodeURIComponent( AUTH_TOKEN )
|
settings.data << {authenticity_token: AUTH_TOKEN}
|
||||||
}
|
}
|
||||||
$.ajax(settings);
|
$.ajax(settings);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue