summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/parking_stalls_controller.rb41
-rw-r--r--app/helpers/parking_stalls_helper.rb2
-rw-r--r--app/models/parking_stall.rb3
-rw-r--r--app/views/parking_stalls/_form.html.haml7
-rw-r--r--app/views/parking_stalls/_form_core.html.haml6
-rw-r--r--app/views/parking_stalls/_index_core.html.haml17
-rw-r--r--app/views/parking_stalls/edit.html.haml3
-rw-r--r--app/views/parking_stalls/index.html.haml6
-rw-r--r--app/views/parking_stalls/new.html.haml3
-rw-r--r--app/views/parking_stalls/show.html.haml19
10 files changed, 107 insertions, 0 deletions
diff --git a/app/controllers/parking_stalls_controller.rb b/app/controllers/parking_stalls_controller.rb
new file mode 100644
index 0000000..42931ed
--- /dev/null
+++ b/app/controllers/parking_stalls_controller.rb
@@ -0,0 +1,41 @@
+class ParkingStallsController < ApplicationController
+ def index
+ @parking_stalls = ParkingStall.all
+ end
+
+ def show
+ @parking_stall = ParkingStall.find(params[:id])
+ end
+
+ def new
+ @parking_stall = ParkingStall.new
+ end
+
+ def create
+ @parking_stall = ParkingStall.new(params[:parking_stall])
+ if @parking_stall.save
+ redirect_to @parking_stall, :notice => t('parking_stalls.controller.successfuly_created')
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @parking_stall = ParkingStall.find(params[:id])
+ end
+
+ def update
+ @parking_stall = ParkingStall.find(params[:id])
+ if @parking_stall.update_attributes(params[:parking_stall])
+ redirect_to @parking_stall, :notice => t('parking_stalls.controller.successfuly_updated')
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @parking_stall = ParkingStall.find(params[:id])
+ @parking_stall.destroy
+ redirect_to parking_stalls_url, :notice => t('parking_stalls.controller.successfuly_destroyed')
+ end
+end
diff --git a/app/helpers/parking_stalls_helper.rb b/app/helpers/parking_stalls_helper.rb
new file mode 100644
index 0000000..135bfee
--- /dev/null
+++ b/app/helpers/parking_stalls_helper.rb
@@ -0,0 +1,2 @@
+module ParkingStallsHelper
+end
diff --git a/app/models/parking_stall.rb b/app/models/parking_stall.rb
new file mode 100644
index 0000000..52223a8
--- /dev/null
+++ b/app/models/parking_stall.rb
@@ -0,0 +1,3 @@
+class ParkingStall < ActiveRecord::Base
+ attr_accessible :name, :lot, :parking_stallable_id, :parking_stallable_type, :comment
+end
diff --git a/app/views/parking_stalls/_form.html.haml b/app/views/parking_stalls/_form.html.haml
new file mode 100644
index 0000000..5b1523b
--- /dev/null
+++ b/app/views/parking_stalls/_form.html.haml
@@ -0,0 +1,7 @@
+= simple_form_for(@parking_stall) do |f|
+ = f.error_notification
+
+ = render "form_core", :f => f
+
+ .actions
+ = f.button :submit, conditional_t('parking_stalls.form.submit') \ No newline at end of file
diff --git a/app/views/parking_stalls/_form_core.html.haml b/app/views/parking_stalls/_form_core.html.haml
new file mode 100644
index 0000000..db68f99
--- /dev/null
+++ b/app/views/parking_stalls/_form_core.html.haml
@@ -0,0 +1,6 @@
+.inputs
+ = f.input :name, :label => t('parking_stalls.form.name.label'), :hint => conditional_hint('parking_stalls.form.name.hint')
+ = f.input :lot, :label => t('parking_stalls.form.lot.label'), :hint => conditional_hint('parking_stalls.form.lot.hint')
+ = f.input :parking_stallable_id, :label => t('parking_stalls.form.parking_stallable_id.label'), :hint => conditional_hint('parking_stalls.form.parking_stallable_id.hint')
+ = f.input :parking_stallable_type, :label => t('parking_stalls.form.parking_stallable_type.label'), :hint => conditional_hint('parking_stalls.form.parking_stallable_type.hint')
+ = f.input :comment, :label => t('parking_stalls.form.comment.label'), :hint => conditional_hint('parking_stalls.form.comment.hint')
diff --git a/app/views/parking_stalls/_index_core.html.haml b/app/views/parking_stalls/_index_core.html.haml
new file mode 100644
index 0000000..fb317a0
--- /dev/null
+++ b/app/views/parking_stalls/_index_core.html.haml
@@ -0,0 +1,17 @@
+%table.table.table-striped
+ %tr
+ %th= t('parking_stalls.index.name')
+ %th= t('parking_stalls.index.lot')
+ %th= t('parking_stalls.index.parking_stallable_id')
+ %th= t('parking_stalls.index.parking_stallable_type')
+ %th= t('parking_stalls.index.comment')
+
+
+ - for parking_stall in parking_stalls
+ %tr
+ %td= parking_stall.name
+ %td= parking_stall.lot
+ %td= parking_stall.parking_stallable_id
+ %td= parking_stall.parking_stallable_type
+ %td= parking_stall.comment
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => parking_stall} \ No newline at end of file
diff --git a/app/views/parking_stalls/edit.html.haml b/app/views/parking_stalls/edit.html.haml
new file mode 100644
index 0000000..ec5d97f
--- /dev/null
+++ b/app/views/parking_stalls/edit.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("parking_stalls.edit.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/parking_stalls/index.html.haml b/app/views/parking_stalls/index.html.haml
new file mode 100644
index 0000000..9472ff0
--- /dev/null
+++ b/app/views/parking_stalls/index.html.haml
@@ -0,0 +1,6 @@
+- content_for :title, t("parking_stalls.index.page_title")
+
+- if @parking_stalls && @parking_stalls.count > 0
+ = render "index_core", :parking_stalls => @parking_stalls
+
+= render :partial => 'shared/create_link', :locals => {:child_class => ParkingStall} \ No newline at end of file
diff --git a/app/views/parking_stalls/new.html.haml b/app/views/parking_stalls/new.html.haml
new file mode 100644
index 0000000..c068e52
--- /dev/null
+++ b/app/views/parking_stalls/new.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("parking_stalls.new.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/parking_stalls/show.html.haml b/app/views/parking_stalls/show.html.haml
new file mode 100644
index 0000000..a95c111
--- /dev/null
+++ b/app/views/parking_stalls/show.html.haml
@@ -0,0 +1,19 @@
+- content_for :title, t("parking_stalls.show.page_title")
+
+%p
+ %strong= t('parking_stalls.show.name') + ":"
+ = @parking_stall.name
+%p
+ %strong= t('parking_stalls.show.lot') + ":"
+ = @parking_stall.lot
+%p
+ %strong= t('parking_stalls.show.parking_stallable_id') + ":"
+ = @parking_stall.parking_stallable_id
+%p
+ %strong= t('parking_stalls.show.parking_stallable_type') + ":"
+ = @parking_stall.parking_stallable_type
+%p
+ %strong= t('parking_stalls.show.comment') + ":"
+ = @parking_stall.comment
+
+= render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @parking_stall } \ No newline at end of file