From 7dd556d71878485d7f9e9b604bc3f5804ddac0c7 Mon Sep 17 00:00:00 2001 From: Jason Denney Date: Sun, 27 Apr 2014 15:46:13 -0400 Subject: [PATCH] Fixed forwarding on time entry creation --- app/assets/javascripts/time_entries.js | 5 +---- app/views/time_entries/new.haml | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/time_entries.js b/app/assets/javascripts/time_entries.js index 3e2b0dc..a504ded 100644 --- a/app/assets/javascripts/time_entries.js +++ b/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); } }); diff --git a/app/views/time_entries/new.haml b/app/views/time_entries/new.haml index de4b173..4f10444 100644 --- a/app/views/time_entries/new.haml +++ b/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" => "#{"."}"}