Skip to content

Commit

Permalink
Show add another bike link after creating bike
Browse files Browse the repository at this point in the history
  • Loading branch information
spacemunkay committed May 4, 2014
1 parent b9b6ed5 commit 5c4007a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/assets/javascripts/bikes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions app/controllers/bikes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def new
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
4 changes: 4 additions & 0 deletions app/views/bikes/show.html.haml
Original file line number Diff line number Diff line change
@@ -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}
Expand Down

0 comments on commit 5c4007a

Please sign in to comment.