mirror of
				https://github.com/fspc/bike-database.git
				synced 2025-11-03 16:45:35 -05:00 
			
		
		
		
	lk | bike#edit uses different _form than bike#new
This commit is contained in:
		
							parent
							
								
									5b8535a880
								
							
						
					
					
						commit
						1f8371c10e
					
				@ -9,4 +9,4 @@
 | 
			
		||||
 | 
			
		||||
  .row
 | 
			
		||||
    .actions.col-sm-offset-2
 | 
			
		||||
      = f.submit value: "Log another bike", class: "btn btn-default"
 | 
			
		||||
      = f.submit value: "Update", class: "btn btn-default"
 | 
			
		||||
							
								
								
									
										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
 | 
			
		||||
    .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"
 | 
			
		||||
  = render 'form' 
 | 
			
		||||
  = render 'edit_form'
 | 
			
		||||
  = link_to 'Show', @bike
 | 
			
		||||
  |
 | 
			
		||||
  = link_to 'Back', bikes_path
 | 
			
		||||
 | 
			
		||||
@ -7,31 +7,23 @@
 | 
			
		||||
  %table.table.table-striped.table-bordered.table-hover
 | 
			
		||||
    %thead
 | 
			
		||||
      %tr
 | 
			
		||||
        %th Brand
 | 
			
		||||
        %th Model
 | 
			
		||||
        %th
 | 
			
		||||
        %th Bike
 | 
			
		||||
        %th
 | 
			
		||||
    %tbody
 | 
			
		||||
      - @unsold_bikes.each do |bike|
 | 
			
		||||
        %tr
 | 
			
		||||
          %td= bike.brand
 | 
			
		||||
          %td= bike.model
 | 
			
		||||
          %td= link_to 'Show', bike
 | 
			
		||||
          %td= bike.name
 | 
			
		||||
          %td= link_to 'Edit', edit_bike_path(bike)
 | 
			
		||||
 | 
			
		||||
  %h1 All Bikes
 | 
			
		||||
  %table.table.table-striped.table-bordered.table-hover
 | 
			
		||||
    %thead
 | 
			
		||||
      %tr
 | 
			
		||||
        %th Brand
 | 
			
		||||
        %th Model
 | 
			
		||||
        %th
 | 
			
		||||
        %th Bike
 | 
			
		||||
        %th
 | 
			
		||||
    %tbody
 | 
			
		||||
      - @bikes.each do |bike|
 | 
			
		||||
        %tr
 | 
			
		||||
          %td= bike.brand
 | 
			
		||||
          %td= bike.model
 | 
			
		||||
          %td= link_to 'Show', bike
 | 
			
		||||
          %td= bike.name
 | 
			
		||||
          %td= link_to 'Edit', edit_bike_path(bike)
 | 
			
		||||
  =will_paginate @bikes
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
.container
 | 
			
		||||
  %h1 New bike
 | 
			
		||||
  = render 'form'
 | 
			
		||||
  = render 'new_form'
 | 
			
		||||
  = link_to 'Back', bikes_path
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user