mirror of
https://github.com/fspc/BikeShed-1.git
synced 2026-09-16 16:31:38 -04:00
Added tasks controller, spec, JS, apitesthelper
Had an issue with calling render_views in the specs to render the jbuilder json templates and also getting the devise sign_in method to work, ended up adding a helper to add the username/password for a user
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
$(".task_list_task").click(function(){
|
||||
$("#update_tasks_submit").removeClass("disabled");
|
||||
});
|
||||
|
||||
$("#update_tasks_submit").click(function(){
|
||||
|
||||
tasks = [];
|
||||
$(".task_list_task").each(function(){
|
||||
tasks.push({
|
||||
id: parseInt($(this).data("id")),
|
||||
done: $(this).is(":checked")
|
||||
});
|
||||
});
|
||||
|
||||
json_data = { tasks: tasks };
|
||||
|
||||
$.ajax({
|
||||
url: $("#update_tasks_submit").data("url"),
|
||||
type: "PUT",
|
||||
data: JSON.stringify(json_data),
|
||||
contentType: 'application/json',
|
||||
dataType: "json",
|
||||
success: function(data, status, xhr){
|
||||
//should re-render via JS, but for now reload
|
||||
location.reload();
|
||||
},
|
||||
error: function(data, status ){
|
||||
alert("An error occured updating tasks");
|
||||
//displayFormErrors(data.responseJSON);
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user