1
0
mirror of https://github.com/fspc/BikeShed-1.git synced 2025-02-28 16:53:23 -05:00

Show add another bike link after creating bike

This commit is contained in:
Jason Denney 2014-05-04 11:14:50 -04:00
parent b9b6ed5ca0
commit 5c4007a1be
3 changed files with 6 additions and 1 deletions

View File

@ -21,7 +21,7 @@ $("#add_bike_submit").click(function(){
contentType: 'application/json', contentType: 'application/json',
dataType: "json", dataType: "json",
success: function(data, status, xhr){ success: function(data, status, xhr){
window.location = data.bikes[0].id; window.location = data.bikes[0].id + "?add_bike=1";
}, },
error: function(data, status ){ error: function(data, status ){
displayFormErrors(data.responseJSON); displayFormErrors(data.responseJSON);

View File

@ -10,6 +10,7 @@ class BikesController < AuthenticatedController
def show def show
@bike = Bike.find_by_id(params[:id]) @bike = Bike.find_by_id(params[:id])
@task_list_id = @bike.task_list.id @task_list_id = @bike.task_list.id
@show_add_bike = true if params[:add_bike]
end end
end end

View File

@ -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} %a{ class: "btn btn-default btn-lg", href: root_path}
%span{ class:"icon-home"} %span{ class:"icon-home"}
%h2 #{@bike.shop_id}: #{@bike.bike_brand} %h2 #{@bike.shop_id}: #{@bike.bike_brand}