mirror of
https://github.com/fspc/BikeShed-1.git
synced 2025-02-28 16:53:23 -05:00
Fixed forwarding on time entry creation
This commit is contained in:
parent
338905878e
commit
7dd556d718
@ -19,7 +19,7 @@ $(document).ready(function(){
|
||||
// If a bike is selected, forward to the bike
|
||||
// checklist.
|
||||
bike_id = parseInt($("#bike_id").val());
|
||||
if( bike_id >= 0 ){
|
||||
if( bike_id > 0 ){
|
||||
forward = "/task_lists/" + bike_id + "/edit";
|
||||
}
|
||||
|
||||
@ -30,7 +30,6 @@ $(document).ready(function(){
|
||||
bike_id: bike_id,
|
||||
description: $("#description_id").val(),
|
||||
}]};
|
||||
console.log(json_data);
|
||||
|
||||
$.ajax({
|
||||
url: $("#add_time_entry_submit").data("url"),
|
||||
@ -39,11 +38,9 @@ $(document).ready(function(){
|
||||
contentType: 'application/json',
|
||||
dataType: "json",
|
||||
success: function(data, status, xhr){
|
||||
console.log(data);
|
||||
window.location = forward;
|
||||
},
|
||||
error: function(data, status ){
|
||||
console.log(data);
|
||||
displayFormErrors(data.responseJSON);
|
||||
}
|
||||
});
|
||||
|
@ -39,4 +39,4 @@
|
||||
%textarea{id: "description_id", placeholder: "Work description", class: "input-lg" }
|
||||
.control-group
|
||||
.controls
|
||||
%input{id: "add_time_entry_submit", value: "Add Time Entry", type: "button", class: "btn btn-lg btn-block btn-primary", "data-url" => "#{api_create_time_entry_path}"}
|
||||
%input{id: "add_time_entry_submit", value: "Add Time Entry", type: "button", class: "btn btn-lg btn-block btn-primary", "data-url" => "#{api_create_time_entry_path}", "data-forward" => "#{"."}"}
|
||||
|
Loading…
x
Reference in New Issue
Block a user