From 7b11da9583d5f8f1d36f42d231d3df9dfeee9eb9 Mon Sep 17 00:00:00 2001 From: Jason Denney Date: Sun, 9 Feb 2014 22:01:42 -0500 Subject: [PATCH] Forward url on add bike/ don't display value if nil --- app/assets/javascripts/bikes.js | 2 +- app/views/bikes/show.html.haml | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/bikes.js b/app/assets/javascripts/bikes.js index 58eb18a..29997d8 100644 --- a/app/assets/javascripts/bikes.js +++ b/app/assets/javascripts/bikes.js @@ -20,7 +20,7 @@ $("#add_bike_submit").click(function(){ data: json_data, dataType: "json", success: function(data, status, xhr){ - //window.location = ""; + window.location = "/bikes/"+ data.bike.id; }, error: function(data, status ){ displayFormErrors(data.responseJSON); diff --git a/app/views/bikes/show.html.haml b/app/views/bikes/show.html.haml index 02dd2b5..f165e35 100644 --- a/app/views/bikes/show.html.haml +++ b/app/views/bikes/show.html.haml @@ -12,8 +12,9 @@ %dd #{@bike.seat_tube_height} %dt Purpose %dd #{@bike.bike_purpose} - %dt Value - %dd #{@bike.value} + - if !@bike.value.nil? + %dt Value + %dd #{@bike.value} - if !@bike.color.nil? %dt Color %dd{ style: "width: 50px; background-color: ##{@bike.color}; border: black; border-width: 1px; border-style: solid;"} #{@bike.color}