1
0
mirror of https://github.com/fspc/bike-database.git synced 2025-02-23 01:23:24 -05:00

lk | bike#edit uses different _form than bike#new

This commit is contained in:
Louis Knapp 2015-10-11 12:37:54 -05:00
parent 5b8535a880
commit 1f8371c10e
6 changed files with 20 additions and 16 deletions

View File

@ -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"

View File

@ -87,4 +87,4 @@
%span.input-group-addon $
= 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

View 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"

View File

@ -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

View File

@ -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

View File

@ -1,4 +1,4 @@
.container
%h1 New bike
= render 'form'
= render 'new_form'
= link_to 'Back', bikes_path