diff --git a/app/controllers/bike_conditions_controller.rb b/app/controllers/bike_conditions_controller.rb new file mode 100644 index 0000000..6716c74 --- /dev/null +++ b/app/controllers/bike_conditions_controller.rb @@ -0,0 +1,35 @@ +class BikeConditionsController < AuthenticatedController + expose(:bike_condition) + + expose(:bike_conditions) { BikeCondition.order('id').paginate(:page => params[:page]) } + + def index + end + + def show + end + + def new + end + + def create + if bike_condition.save + redirect_to bike_conditions_url + else + render :new + end + end + + def update + if bike_condition.save + redirect_to bike_conditions_url + else + render :edit + end + end + + def destroy + bike_condition.destroy + redirect_to bike_conditions_url + end +end diff --git a/app/views/bike_conditions/_form.html.haml b/app/views/bike_conditions/_form.html.haml new file mode 100644 index 0000000..e6387fd --- /dev/null +++ b/app/views/bike_conditions/_form.html.haml @@ -0,0 +1,8 @@ += form_for bike_condition, :html => { :class => 'form-horizontal' } do |f| + .control-group + = f.label :condition, :class => 'control-label' + .controls + = f.text_field :condition, :class => 'text_field' + .form-actions + = f.submit nil, :class => 'btn btn-primary' + = link_to t('.cancel', :default => t("helpers.links.cancel")), bike_conditions_path, :class => 'btn' diff --git a/app/views/bike_conditions/edit.html.haml b/app/views/bike_conditions/edit.html.haml new file mode 100644 index 0000000..2bda300 --- /dev/null +++ b/app/views/bike_conditions/edit.html.haml @@ -0,0 +1,4 @@ +- model_class = bike_condition.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" diff --git a/app/views/bike_conditions/index.html.haml b/app/views/bike_conditions/index.html.haml new file mode 100644 index 0000000..9c00c0b --- /dev/null +++ b/app/views/bike_conditions/index.html.haml @@ -0,0 +1,21 @@ +- model_class = BikeCondition.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(:condition) + %th= model_class.human_attribute_name(:created_at) + %th=t '.actions', :default => t("helpers.actions") + %tbody + - bike_conditions.each do |bike_condition| + %tr + %td= link_to bike_condition.id, bike_condition_path(bike_condition) + %td= bike_condition.condition + %td=l bike_condition.created_at + %td + = link_to t('.edit', :default => t("helpers.links.edit")), edit_bike_condition_path(bike_condition), :class => 'btn btn-mini' + = link_to t('.destroy', :default => t("helpers.links.destroy")), bike_condition_path(bike_condition), :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_condition_path, :class => 'btn btn-primary' diff --git a/app/views/bike_conditions/new.html.haml b/app/views/bike_conditions/new.html.haml new file mode 100644 index 0000000..74b7afc --- /dev/null +++ b/app/views/bike_conditions/new.html.haml @@ -0,0 +1,4 @@ +- model_class = bike_condition.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" diff --git a/app/views/bike_conditions/show.html.haml b/app/views/bike_conditions/show.html.haml new file mode 100644 index 0000000..ed8524f --- /dev/null +++ b/app/views/bike_conditions/show.html.haml @@ -0,0 +1,13 @@ +- model_class = bike_condition.class +.page-header + %h1=t '.title', :default => model_class.model_name.human + +%p + %strong= model_class.human_attribute_name(:condition) + ':' + %br + = bike_condition.condition + +.form-actions + = link_to t('.back', :default => t("helpers.links.back")), bike_conditions_path, :class => 'btn' + = link_to t('.edit', :default => t("helpers.links.edit")), edit_bike_condition_path(bike_condition), :class => 'btn' + = link_to t('.destroy', :default => t("helpers.links.destroy")), bike_condition_path(bike_condition), :method => "delete", :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')), :class => 'btn btn-danger' diff --git a/config/routes.rb b/config/routes.rb index 1d20f46..276bec2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -11,6 +11,7 @@ Velocipede::Application.routes.draw do resources :bike_models, :except => [:edit, :delete] resources :bike_statuses resources :bike_styles + resources :bike_conditions resources :bikes namespace :acts_as_loggable do