mirror of https://github.com/fspc/BikeShed-1.git
Jason Denney
12 years ago
6 changed files with 72 additions and 7 deletions
@ -0,0 +1,30 @@ |
|||||
|
class BikeBrandsController < AuthenticatedController |
||||
|
expose(:bike_brand) do |
||||
|
if params[:id] |
||||
|
BikeBrand.find(params[:id]) |
||||
|
elsif params[:bike_brand] |
||||
|
BikeBrand.new(params[:bike_brand]) |
||||
|
else |
||||
|
BikeBrand.new |
||||
|
end |
||||
|
end |
||||
|
|
||||
|
expose(:bike_brands) { BikeBrand.order('id').paginate(:page => params[:page]) } |
||||
|
|
||||
|
def index |
||||
|
end |
||||
|
|
||||
|
def show |
||||
|
end |
||||
|
|
||||
|
def new |
||||
|
end |
||||
|
|
||||
|
def create |
||||
|
if bike_brand.save |
||||
|
redirect_to bike_brands_url |
||||
|
else |
||||
|
render :new |
||||
|
end |
||||
|
end |
||||
|
end |
@ -0,0 +1,8 @@ |
|||||
|
= form_for bike_brand, :html => { :class => 'form-horizontal' } do |f| |
||||
|
.control-group |
||||
|
= f.label :brand, :class => 'control-label' |
||||
|
.controls |
||||
|
= f.text_field :brand, :class => 'text_field' |
||||
|
.form-actions |
||||
|
= f.submit nil, :class => 'btn btn-primary' |
||||
|
= link_to t('.cancel', :default => t("helpers.links.cancel")), bike_brands_path, :class => 'btn' |
@ -0,0 +1,15 @@ |
|||||
|
- model_class = BikeBrand.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(:brand) |
||||
|
%tbody |
||||
|
- bike_brands.each do |bike_brand| |
||||
|
%tr |
||||
|
%td= link_to bike_brand.id, bike_brand_path(bike_brand) |
||||
|
%td= link_to bike_brand.brand, bike_brand_path(bike_brand) |
||||
|
= will_paginate bike_brands |
||||
|
= link_to t('.new', :default => t("helpers.links.new")), new_bike_brand_path, :class => 'btn btn-primary' |
@ -0,0 +1,4 @@ |
|||||
|
- model_class = bike_brand.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,11 @@ |
|||||
|
- model_class = bike_brand.class |
||||
|
.page-header |
||||
|
%h1=t '.title', :default => model_class.model_name.human |
||||
|
|
||||
|
%p |
||||
|
%strong= model_class.human_attribute_name(:brand) + ':' |
||||
|
%br |
||||
|
= bike_brand.brand |
||||
|
|
||||
|
.form-actions |
||||
|
= link_to t('.back', :default => t("helpers.links.back")), bike_brands_path, :class => 'btn' |
Loading…
Reference in new issue