summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
-rw-r--r--config/locales/views/parking_stalls/de.yml60
-rw-r--r--config/locales/views/parking_stalls/en.yml60
-rw-r--r--db/migrate/20130212120729_create_parking_stalls.rb16
-rw-r--r--test/functional/parking_stalls_controller_test.rb49
-rw-r--r--test/unit/parking_stall_test.rb7
15 files changed, 299 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
diff --git a/config/locales/views/parking_stalls/de.yml b/config/locales/views/parking_stalls/de.yml
new file mode 100644
index 0000000..44e31c8
--- /dev/null
+++ b/config/locales/views/parking_stalls/de.yml
@@ -0,0 +1,60 @@
+de:
+ parking_stalls:
+ name: 'Parkingstall'
+ controller:
+ successfuly_created: 'Parkingstall wurde angelegt.'
+ successfuly_updated: 'Parkingstall wurde aktualisiert.'
+ successfuly_destroyed: 'Parkingstall wurde gelöscht.'
+ index:
+ page_title: 'Übersicht von Parkingstall'
+ name: 'Name'
+ lot: 'Lot'
+ parking_stallable_id: 'Parking stallable'
+ parking_stallable_type: 'Parking stallable type'
+ comment: 'Comment'
+ actions:
+ confirm_destroy: 'Sind Sie sicher, dass Sie folgendes löschen möchten: Parkingstall'
+ destroy: 'Löschen'
+ edit: 'Bearbeiten'
+ show: 'Anzeigen'
+ create: 'Neu anlegen'
+ create_for: 'Parkingstall neu anlegen für %{resource}'
+ show:
+ page_title: 'Parkingstall bearbeiten'
+ name: 'Name'
+ lot: 'Lot'
+ parking_stallable_id: 'Parking stallable'
+ parking_stallable_type: 'Parking stallable type'
+ comment: 'Comment'
+ actions:
+ confirm_destroy: 'Sind Sie sicher, dass die dieses Element löschen möchten?'
+ destroy: 'Löschen'
+ edit: 'Bearbeiten'
+ view_all: 'Alle anzeigen'
+ new:
+ page_title: 'Parkingstall neu anlegen'
+ actions:
+ back_to_list: 'Zurück zur Übersicht'
+ edit:
+ page_title: 'Parkingstall bearbeiten'
+ actions:
+ back_to_list: 'Zurück zur Übersicht'
+ edit: 'Bearbeiten'
+ view_all: 'Alle anzeigen'
+ form:
+ name:
+ label: 'Name'
+ hint: ''
+ lot:
+ label: 'Lot'
+ hint: ''
+ parking_stallable_id:
+ label: 'Parking stallable'
+ hint: ''
+ parking_stallable_type:
+ label: 'Parking stallable type'
+ hint: ''
+ comment:
+ label: 'Comment'
+ hint: ''
+ submit: 'Absenden' \ No newline at end of file
diff --git a/config/locales/views/parking_stalls/en.yml b/config/locales/views/parking_stalls/en.yml
new file mode 100644
index 0000000..6d30b87
--- /dev/null
+++ b/config/locales/views/parking_stalls/en.yml
@@ -0,0 +1,60 @@
+en:
+ parking_stalls:
+ name: 'Parkingstall'
+ controller:
+ successfuly_created: 'Successfully created Parkingstall.'
+ successfuly_updated: 'Successfully updated Parkingstall.'
+ successfuly_destroyed: 'Successfully destroyed Parkingstall.'
+ index:
+ page_title: 'Listing Parkingstall'
+ name: 'Name'
+ lot: 'Lot'
+ parking_stallable_id: 'Parking stallable'
+ parking_stallable_type: 'Parking stallable type'
+ comment: 'Comment'
+ actions:
+ confirm_destroy: 'Are you sure you want to delete this Parkingstall?'
+ destroy: 'Delete'
+ edit: 'Edit'
+ show: 'View'
+ create: 'New'
+ create_for: 'New Parkingstall for %{resource}'
+ show:
+ page_title: 'Show Parkingstall'
+ name: 'Name'
+ lot: 'Lot'
+ parking_stallable_id: 'Parking stallable'
+ parking_stallable_type: 'Parking stallable type'
+ comment: 'Comment'
+ actions:
+ confirm_destroy: 'Are you sure you want to delete this element?'
+ destroy: 'Delete'
+ edit: 'Edit'
+ view_all: 'View All'
+ new:
+ page_title: 'New Parkingstall'
+ actions:
+ back_to_list: 'Back to Index'
+ edit:
+ page_title: 'Editing Parkingstall'
+ actions:
+ back_to_list: 'Back to Index'
+ edit: 'Edit'
+ view_all: 'View All'
+ form:
+ name:
+ label: 'Name'
+ hint: ''
+ lot:
+ label: 'Lot'
+ hint: ''
+ parking_stallable_id:
+ label: 'Parking stallable'
+ hint: ''
+ parking_stallable_type:
+ label: 'Parking stallable type'
+ hint: ''
+ comment:
+ label: 'Comment'
+ hint: ''
+ submit: 'Submit' \ No newline at end of file
diff --git a/db/migrate/20130212120729_create_parking_stalls.rb b/db/migrate/20130212120729_create_parking_stalls.rb
new file mode 100644
index 0000000..7620942
--- /dev/null
+++ b/db/migrate/20130212120729_create_parking_stalls.rb
@@ -0,0 +1,16 @@
+class CreateParkingStalls < ActiveRecord::Migration
+ def self.up
+ create_table :parking_stalls do |t|
+ t.string :name
+ t.string :lot
+ t.integer :parking_stallable_id
+ t.string :parking_stallable_type
+ t.string :comment
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :parking_stalls
+ end
+end
diff --git a/test/functional/parking_stalls_controller_test.rb b/test/functional/parking_stalls_controller_test.rb
new file mode 100644
index 0000000..8596a48
--- /dev/null
+++ b/test/functional/parking_stalls_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class ParkingStallsControllerTest < ActionController::TestCase
+ setup do
+ @parking_stall = parking_stalls(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:parking_stalls)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create parking_stall" do
+ assert_difference('ParkingStall.count') do
+ post :create, parking_stall: @parking_stall.attributes
+ end
+
+ assert_redirected_to parking_stall_path(assigns(:parking_stall))
+ end
+
+ test "should show parking_stall" do
+ get :show, id: @parking_stall.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @parking_stall.to_param
+ assert_response :success
+ end
+
+ test "should update parking_stall" do
+ put :update, id: @parking_stall.to_param, parking_stall: @parking_stall.attributes
+ assert_redirected_to parking_stall_path(assigns(:parking_stall))
+ end
+
+ test "should destroy parking_stall" do
+ assert_difference('ParkingStall.count', -1) do
+ delete :destroy, id: @parking_stall.to_param
+ end
+
+ assert_redirected_to parking_stalls_path
+ end
+end
diff --git a/test/unit/parking_stall_test.rb b/test/unit/parking_stall_test.rb
new file mode 100644
index 0000000..db3bcf3
--- /dev/null
+++ b/test/unit/parking_stall_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class ParkingStallTest < ActiveSupport::TestCase
+ def test_should_be_valid
+ assert ParkingStall.new.valid?
+ end
+end