mirror of
https://github.com/fspc/BikeShed-1.git
synced 2025-02-28 16:53:23 -05:00
Added bike styles routes, controller and views
This commit is contained in:
parent
1c203d86f5
commit
e41426ea7b
31
app/controllers/acts_as_loggable/bike_actions_controller.rb
Normal file
31
app/controllers/acts_as_loggable/bike_actions_controller.rb
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
class ActsAsLoggable::BikeActionsController < AuthenticatedController
|
||||||
|
expose(:bike_action) do
|
||||||
|
if params[:id]
|
||||||
|
BikeAction.find(params[:id])
|
||||||
|
elsif params[:bike_action]
|
||||||
|
BikeAction.new(params[:bike_action])
|
||||||
|
else
|
||||||
|
puts "WhOOOPS"
|
||||||
|
#BikeAction.new(:max_members => 16)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
expose(:bike_actions) { BikeAction.order('id').paginate(:page => params[:page]) }
|
||||||
|
|
||||||
|
def index
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
if bike_action.save
|
||||||
|
redirect_to bike_actions_url
|
||||||
|
else
|
||||||
|
render :new
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
35
app/controllers/bike_styles_controller.rb
Normal file
35
app/controllers/bike_styles_controller.rb
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
class BikeStylesController < AuthenticatedController
|
||||||
|
expose(:bike_style)
|
||||||
|
|
||||||
|
expose(:bike_styles) { BikeStyle.order('id').paginate(:page => params[:page]) }
|
||||||
|
|
||||||
|
def index
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
if bike_style.save
|
||||||
|
redirect_to bike_styles_url
|
||||||
|
else
|
||||||
|
render :new
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
if bike_style.save
|
||||||
|
redirect_to bike_styles_url
|
||||||
|
else
|
||||||
|
render :edit
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
bike_style.destroy
|
||||||
|
redirect_to bike_styles_url
|
||||||
|
end
|
||||||
|
end
|
8
app/views/bike_styles/_form.html.haml
Normal file
8
app/views/bike_styles/_form.html.haml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
= form_for bike_style, :html => { :class => 'form-horizontal' } do |f|
|
||||||
|
.control-group
|
||||||
|
= f.label :style, :class => 'control-label'
|
||||||
|
.controls
|
||||||
|
= f.text_field :style, :class => 'text_field'
|
||||||
|
.form-actions
|
||||||
|
= f.submit nil, :class => 'btn btn-primary'
|
||||||
|
= link_to t('.cancel', :default => t("helpers.links.cancel")), bike_styles_path, :class => 'btn'
|
4
app/views/bike_styles/edit.html.haml
Normal file
4
app/views/bike_styles/edit.html.haml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
- model_class = bike_style.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"
|
21
app/views/bike_styles/index.html.haml
Normal file
21
app/views/bike_styles/index.html.haml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
- model_class = BikeStyle.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(:style)
|
||||||
|
%th= model_class.human_attribute_name(:created_at)
|
||||||
|
%th=t '.actions', :default => t("helpers.actions")
|
||||||
|
%tbody
|
||||||
|
- bike_styles.each do |bike_style|
|
||||||
|
%tr
|
||||||
|
%td= link_to bike_style.id, bike_style_path(bike_style)
|
||||||
|
%td= bike_style.style
|
||||||
|
%td=l bike_style.created_at
|
||||||
|
%td
|
||||||
|
= link_to t('.edit', :default => t("helpers.links.edit")), edit_bike_style_path(bike_style), :class => 'btn btn-mini'
|
||||||
|
= link_to t('.destroy', :default => t("helpers.links.destroy")), bike_style_path(bike_style), :method => :delete, :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')), :class => 'btn btn-mini btn-danger'
|
||||||
|
|
||||||
|
= link_to t('.new', :default => t("helpers.links.new")), new_bike_style_path, :class => 'btn btn-primary'
|
4
app/views/bike_styles/new.html.haml
Normal file
4
app/views/bike_styles/new.html.haml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
- model_class = bike_style.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"
|
13
app/views/bike_styles/show.html.haml
Normal file
13
app/views/bike_styles/show.html.haml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
- model_class = bike_style.class
|
||||||
|
.page-header
|
||||||
|
%h1=t '.title', :default => model_class.model_name.human
|
||||||
|
|
||||||
|
%p
|
||||||
|
%strong= model_class.human_attribute_name(:style) + ':'
|
||||||
|
%br
|
||||||
|
= bike_style.style
|
||||||
|
|
||||||
|
.form-actions
|
||||||
|
= link_to t('.back', :default => t("helpers.links.back")), bike_styles_path, :class => 'btn'
|
||||||
|
= link_to t('.edit', :default => t("helpers.links.edit")), edit_bike_style_path(bike_style), :class => 'btn'
|
||||||
|
= link_to t('.destroy', :default => t("helpers.links.destroy")), bike_style_path(bike_style), :method => "delete", :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')), :class => 'btn btn-danger'
|
@ -10,6 +10,7 @@ Velocipede::Application.routes.draw do
|
|||||||
resources :bike_brands, :except => [:edit, :delete]
|
resources :bike_brands, :except => [:edit, :delete]
|
||||||
resources :bike_models, :except => [:edit, :delete]
|
resources :bike_models, :except => [:edit, :delete]
|
||||||
resources :bike_statuses
|
resources :bike_statuses
|
||||||
|
resources :bike_styles
|
||||||
|
|
||||||
#resources :clues
|
#resources :clues
|
||||||
#resources :maps
|
#resources :maps
|
||||||
|
Loading…
x
Reference in New Issue
Block a user