diff --git a/app/assets/javascripts/bikes.js b/app/assets/javascripts/bikes.js index f2398ea..ba530d6 100644 --- a/app/assets/javascripts/bikes.js +++ b/app/assets/javascripts/bikes.js @@ -21,7 +21,7 @@ $("#add_bike_submit").click(function(){ contentType: 'application/json', dataType: "json", success: function(data, status, xhr){ - window.location = data.bikes[0].id; + window.location = data.bikes[0].id + "?add_bike=1"; }, error: function(data, status ){ displayFormErrors(data.responseJSON); diff --git a/app/controllers/bikes_controller.rb b/app/controllers/bikes_controller.rb index e2985d5..981ccd3 100644 --- a/app/controllers/bikes_controller.rb +++ b/app/controllers/bikes_controller.rb @@ -10,6 +10,7 @@ class BikesController < AuthenticatedController def show @bike = Bike.find_by_id(params[:id]) @task_list_id = @bike.task_list.id + @show_add_bike = true if params[:add_bike] end end diff --git a/app/views/bikes/show.html.haml b/app/views/bikes/show.html.haml index e836177..ca71f7d 100644 --- a/app/views/bikes/show.html.haml +++ b/app/views/bikes/show.html.haml @@ -1,3 +1,7 @@ +- if @show_add_bike + %p + %a{class: "btn btn-lg btn-block btn-info", href: new_bike_path} Add Another Bike? + %a{ class: "btn btn-default btn-lg", href: root_path} %span{ class:"icon-home"} %h2 #{@bike.shop_id}: #{@bike.bike_brand}