mirror of
				https://github.com/fspc/bike-database.git
				synced 2025-10-30 16:25:36 -04:00 
			
		
		
		
	lk | bike#edit uses different _form than bike#new
This commit is contained in:
		
							parent
							
								
									5b8535a880
								
							
						
					
					
						commit
						1f8371c10e
					
				| @ -9,4 +9,4 @@ | |||||||
| 
 | 
 | ||||||
|   .row |   .row | ||||||
|     .actions.col-sm-offset-2 |     .actions.col-sm-offset-2 | ||||||
|       = f.submit value: "Log another bike", class: "btn btn-default" |       = f.submit value: "Update", class: "btn btn-default" | ||||||
| @ -87,4 +87,4 @@ | |||||||
|             %span.input-group-addon $ |             %span.input-group-addon $ | ||||||
|             = f.text_field :price, class: "form-control", disabled: disabled |             = f.text_field :price, class: "form-control", disabled: disabled | ||||||
| 
 | 
 | ||||||
|           %a{href: "http://www.bicyclebluebook.com/SearchBikes.aspx"} Look It Up  |           %a{href: "http://www.bicyclebluebook.com/SearchBikes.aspx"} Look It Up | ||||||
|  | |||||||
							
								
								
									
										12
									
								
								app/views/bikes/_new_form.html.haml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								app/views/bikes/_new_form.html.haml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,12 @@ | |||||||
|  | = form_for @bike, html: {class: 'form-horizontal'} do |f| | ||||||
|  |   - if @bike.errors.any? | ||||||
|  |     #error_explanation | ||||||
|  |       %h2= pluralize(@bike.errors.count, "error") + " prohibited this bike from being saved:" | ||||||
|  |       %ul | ||||||
|  |         - @bike.errors.full_messages.each do |msg| | ||||||
|  |           %li= msg | ||||||
|  |   = render 'fields', f: f | ||||||
|  | 
 | ||||||
|  |   .row | ||||||
|  |     .actions.col-sm-offset-2 | ||||||
|  |       = f.submit value: "+ Log Another", class: "btn btn-default" | ||||||
| @ -4,7 +4,7 @@ | |||||||
|       %h1 Edit bike |       %h1 Edit bike | ||||||
|     .col-sm-3.col-sm-offset-3 |     .col-sm-3.col-sm-offset-3 | ||||||
|       =button_to "Mark as sold", {action: "mark_as_sold", id: @bike.id}, method: :patch, class: "btn btn-default" |       =button_to "Mark as sold", {action: "mark_as_sold", id: @bike.id}, method: :patch, class: "btn btn-default" | ||||||
|   = render 'form'  |   = render 'edit_form' | ||||||
|   = link_to 'Show', @bike |   = link_to 'Show', @bike | ||||||
|   | |   | | ||||||
|   = link_to 'Back', bikes_path |   = link_to 'Back', bikes_path | ||||||
|  | |||||||
| @ -7,31 +7,23 @@ | |||||||
|   %table.table.table-striped.table-bordered.table-hover |   %table.table.table-striped.table-bordered.table-hover | ||||||
|     %thead |     %thead | ||||||
|       %tr |       %tr | ||||||
|         %th Brand |         %th Bike | ||||||
|         %th Model |  | ||||||
|         %th |  | ||||||
|         %th |         %th | ||||||
|     %tbody |     %tbody | ||||||
|       - @unsold_bikes.each do |bike| |       - @unsold_bikes.each do |bike| | ||||||
|         %tr |         %tr | ||||||
|           %td= bike.brand |           %td= bike.name | ||||||
|           %td= bike.model |  | ||||||
|           %td= link_to 'Show', bike |  | ||||||
|           %td= link_to 'Edit', edit_bike_path(bike) |           %td= link_to 'Edit', edit_bike_path(bike) | ||||||
| 
 | 
 | ||||||
|   %h1 All Bikes |   %h1 All Bikes | ||||||
|   %table.table.table-striped.table-bordered.table-hover |   %table.table.table-striped.table-bordered.table-hover | ||||||
|     %thead |     %thead | ||||||
|       %tr |       %tr | ||||||
|         %th Brand |         %th Bike | ||||||
|         %th Model |  | ||||||
|         %th |  | ||||||
|         %th |         %th | ||||||
|     %tbody |     %tbody | ||||||
|       - @bikes.each do |bike| |       - @bikes.each do |bike| | ||||||
|         %tr |         %tr | ||||||
|           %td= bike.brand |           %td= bike.name | ||||||
|           %td= bike.model |  | ||||||
|           %td= link_to 'Show', bike |  | ||||||
|           %td= link_to 'Edit', edit_bike_path(bike) |           %td= link_to 'Edit', edit_bike_path(bike) | ||||||
|   =will_paginate @bikes |   =will_paginate @bikes | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| .container | .container | ||||||
|   %h1 New bike |   %h1 New bike | ||||||
|   = render 'form' |   = render 'new_form' | ||||||
|   = link_to 'Back', bikes_path |   = link_to 'Back', bikes_path | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user