Browse Source

Fixed forwarding on time entry creation

denney-fix-saving-dates
Jason Denney 11 years ago
parent
commit
7dd556d718
  1. 5
      app/assets/javascripts/time_entries.js
  2. 2
      app/views/time_entries/new.haml

5
app/assets/javascripts/time_entries.js

@ -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);
}
});

2
app/views/time_entries/new.haml

@ -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…
Cancel
Save