mirror of https://github.com/fspc/BikeShed-1.git
Jason Denney
12 years ago
8 changed files with 211 additions and 5 deletions
@ -0,0 +1,35 @@ |
|||||
|
class BikesController < AuthenticatedController |
||||
|
expose(:bike) |
||||
|
|
||||
|
expose(:bikes) { Bike.order('id').paginate(:page => params[:page]) } |
||||
|
|
||||
|
def index |
||||
|
end |
||||
|
|
||||
|
def show |
||||
|
end |
||||
|
|
||||
|
def new |
||||
|
end |
||||
|
|
||||
|
def create |
||||
|
if bike.save |
||||
|
redirect_to bike |
||||
|
else |
||||
|
render :new |
||||
|
end |
||||
|
end |
||||
|
|
||||
|
def update |
||||
|
if bike.save |
||||
|
redirect_to bike |
||||
|
else |
||||
|
render :edit |
||||
|
end |
||||
|
end |
||||
|
|
||||
|
def destroy |
||||
|
bike.destroy |
||||
|
redirect_to bikes_url |
||||
|
end |
||||
|
end |
@ -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' |
@ -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" |
@ -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' |
@ -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" |
@ -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' |
Loading…
Reference in new issue