Add bike routes, controller, and views. Update model.

This commit is contained in:
Jason Denney
2012-12-09 14:26:58 -05:00
parent 885caefaf7
commit d3c466761e
8 changed files with 211 additions and 5 deletions
+48
View File
@@ -0,0 +1,48 @@
= form_for bike, :html => { :class => 'form-horizontal' } do |f|
.control-group
= f.label :serial_number, :class => 'control-label'
.controls
= f.text_field :serial_number, :class => 'text_field'
.control-group
= f.label :bike_brand_id, :class => 'control-label'
.controls
= f.number_field :bike_brand_id, :class => 'number_field'
.control-group
= f.label :bike_model_id, :class => 'control-label'
.controls
= f.number_field :bike_model_id, :class => 'number_field'
.control-group
= f.label :color, :class => 'control-label'
.controls
= f.text_field :color, :class => 'text_field'
.control-group
= f.label :bike_style_id, :class => 'control-label'
.controls
= f.number_field :bike_style_id, :class => 'number_field'
.control-group
= f.label :seat_tube_height, :class => 'control-label'
.controls
= f.text_field :seat_tube_height, :class => 'text_field'
.control-group
= f.label :top_tube_length, :class => 'control-label'
.controls
= f.text_field :top_tube_length, :class => 'text_field'
.control-group
= f.label :wheel_size, :class => 'control-label'
.controls
= f.number_field :wheel_size, :class => 'number_field'
.control-group
= f.label :value, :class => 'control-label'
.controls
= f.text_field :value, :class => 'text_field'
.control-group
= f.label :bike_condition_id, :class => 'control-label'
.controls
= f.text_field :bike_condition_id, :class => 'text_field'
.control-group
= f.label :bike_status_id, :class => 'control-label'
.controls
= f.number_field :bike_status_id, :class => 'number_field'
.form-actions
= f.submit nil, :class => 'btn btn-primary'
= link_to t('.cancel', :default => t("helpers.links.cancel")), bikes_path, :class => 'btn'
+4
View File
@@ -0,0 +1,4 @@
- model_class = bike.class
.page-header
%h1=t '.title', :default => t('helpers.titles.edit', :model => model_class.model_name.human, :default => "Edit #{model_class.model_name.human}")
= render :partial => "form"
+41
View File
@@ -0,0 +1,41 @@
- model_class = Bike.new.class
.page-header
%h1=t '.title', :default => model_class.model_name.human.pluralize
%table.table.table-striped
%thead
%tr
%th= model_class.human_attribute_name(:id)
%th= model_class.human_attribute_name(:serial_number)
%th= model_class.human_attribute_name(:bike_brand_id)
%th= model_class.human_attribute_name(:bike_model_id)
%th= model_class.human_attribute_name(:color)
%th= model_class.human_attribute_name(:bike_style_id)
%th= model_class.human_attribute_name(:seat_tube_height)
%th= model_class.human_attribute_name(:top_tube_length)
%th= model_class.human_attribute_name(:wheel_size)
%th= model_class.human_attribute_name(:value)
%th= model_class.human_attribute_name(:bike_condition_id)
%th= model_class.human_attribute_name(:bike_status_id)
%th= model_class.human_attribute_name(:created_at)
%th=t '.actions', :default => t("helpers.actions")
%tbody
- bikes.each do |bike|
%tr
%td= link_to bike.id, bike_path(bike)
%td= link_to bike.serial_number, bike_path(bike)
%td= bike.brand
%td= bike.model
%td= bike.color
%td= bike.style
%td= bike.seat_tube_height
%td= bike.top_tube_length
%td= bike.wheel_size
%td= bike.value
%td= bike.condition
%td= bike.status
%td= bike.created_at
%td
= link_to t('.edit', :default => t("helpers.links.edit")), edit_bike_path(bike), :class => 'btn btn-mini'
= link_to t('.destroy', :default => t("helpers.links.destroy")), bike_path(bike), :method => :delete, :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')), :class => 'btn btn-mini btn-danger'
= will_paginate bikes
= link_to t('.new', :default => t("helpers.links.new")), new_bike_path, :class => 'btn btn-primary'
+4
View File
@@ -0,0 +1,4 @@
- model_class = bike.class
.page-header
%h1=t '.title', :default => t('helpers.titles.new', :model => model_class.model_name.human, :default => "New #{model_class.model_name.human}")
= render :partial => "form"
+53
View File
@@ -0,0 +1,53 @@
- model_class = bike.class
.page-header
%h1=t '.title', :default => model_class.model_name.human
%p
%strong= model_class.human_attribute_name(:serial_number) + ':'
%br
= bike.serial_number
%p
%strong= model_class.human_attribute_name(:bike_brand_id) + ':'
%br
= bike.brand
%p
%strong= model_class.human_attribute_name(:bike_model_id) + ':'
%br
= bike.model
%p
%strong= model_class.human_attribute_name(:color) + ':'
%br
= bike.color
%p
%strong= model_class.human_attribute_name(:bike_style_id) + ':'
%br
= bike.style
%p
%strong= model_class.human_attribute_name(:seat_tube_height) + ':'
%br
= bike.seat_tube_height
%p
%strong= model_class.human_attribute_name(:top_tube_length) + ':'
%br
= bike.top_tube_length
%p
%strong= model_class.human_attribute_name(:wheel_size) + ':'
%br
= bike.wheel_size
%p
%strong= model_class.human_attribute_name(:value) + ':'
%br
= bike.value
%p
%strong= model_class.human_attribute_name(:bike_condition_id) + ':'
%br
= bike.condition
%p
%strong= model_class.human_attribute_name(:bike_status_id) + ':'
%br
= bike.status
.form-actions
= link_to t('.back', :default => t("helpers.links.back")), bikes_path, :class => 'btn'
= link_to t('.edit', :default => t("helpers.links.edit")), edit_bike_path(bike), :class => 'btn'
= link_to t('.destroy', :default => t("helpers.links.destroy")), bike_path(bike), :method => "delete", :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')), :class => 'btn btn-danger'