end of day commit

This commit is contained in:
2012-08-28 20:08:13 +02:00
parent 0b16614d41
commit 89700f36e9
43 changed files with 896 additions and 26 deletions
+4
View File
@@ -5,6 +5,10 @@ class DashboardController < ApplicationController
end
def demo_both
end
# Testing action
def select_qrcode
@tables = Table.all
+90
View File
@@ -0,0 +1,90 @@
class SectionsController < ApplicationController
before_filter :set_relation_options, only: [:new, :edit, :create, :update]
# GET /sections
# GET /sections.json
def index
@sections = Section.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @sections }
end
end
# GET /sections/1
# GET /sections/1.json
def show
@section = Section.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @section }
end
end
# GET /sections/new
# GET /sections/new.json
def new
@section = Section.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @section }
end
end
# GET /sections/1/edit
def edit
@section = Section.find(params[:id])
end
# POST /sections
# POST /sections.json
def create
@section = Section.new(params[:section])
respond_to do |format|
if @section.save
format.html { redirect_to @section, notice: t('action.create.successfull', model: Section.model_name.human) }
format.json { render json: @section, status: :created, location: @section }
else
format.html { render action: "new" }
format.json { render json: @section.errors, status: :unprocessable_entity }
end
end
end
# PUT /sections/1
# PUT /sections/1.json
def update
@section = Section.find(params[:id])
respond_to do |format|
if @section.update_attributes(params[:section])
format.html { redirect_to @section, notice: t('action.update.successfull', model: Section.model_name.human) }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @section.errors, status: :unprocessable_entity }
end
end
end
# DELETE /sections/1
# DELETE /sections/1.json
def destroy
@section = Section.find(params[:id])
@section.destroy
respond_to do |format|
format.html { redirect_to sections_url, notice: t('action.destroy.successfull', model: Section.model_name.human) }
format.json { head :no_content }
end
end
private
def set_relation_options
@suppliers = Supplier.all
end
end
@@ -0,0 +1,6 @@
module Suppliers
class ApplicationController < ::ApplicationController
layout 'tablet'
end
end
@@ -0,0 +1,87 @@
module Suppliers
class SectionsController < Suppliers::ApplicationController
# GET /sections
# GET /sections.json
def index
@sections = current_supplier.sections
respond_to do |format|
format.html # index.html.erb
format.json { render json: @sections }
end
end
# GET /sections/1
# GET /sections/1.json
def show
@section = Section.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @section }
end
end
# GET /sections/new
# GET /sections/new.json
def new
@section = Section.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @section }
end
end
# GET /sections/1/edit
def edit
@section = Section.find(params[:id])
end
# POST /sections
# POST /sections.json
def create
@section = Section.new(params[:section])
@section.supplier = current_supplier
respond_to do |format|
if @section.save
format.html { redirect_to [:suppliers, @section], notice: t('action.create.successfull', model: Section.model_name.human) }
format.json { render json: @section, status: :created, location: @section }
else
format.html { render action: "new" }
format.json { render json: @section.errors, status: :unprocessable_entity }
end
end
end
# PUT /sections/1
# PUT /sections/1.json
def update
@section = Section.find(params[:id])
respond_to do |format|
if @section.update_attributes(params[:section])
format.html { redirect_to [:suppliers, @section], notice: t('action.update.successfull', model: Section.model_name.human) }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @section.errors, status: :unprocessable_entity }
end
end
end
# DELETE /sections/1
# DELETE /sections/1.json
def destroy
@section = Section.find(params[:id])
@section.destroy
respond_to do |format|
format.html { redirect_to suppliers_sections_url, notice: t('action.destroy.successfull', model: Section.model_name.human) }
format.json { head :no_content }
end
end
end
end
@@ -0,0 +1,89 @@
module Suppliers
class TablesController < Suppliers::ApplicationController
# GET /tables
# GET /tables.json
def index
@tables = current_supplier.tables
respond_to do |format|
format.html # index.html.erb
format.json { render json: @tables }
end
end
# GET /tables/1
# GET /tables/1.json
def show
@table = Table.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @table }
end
end
# GET /tables/new
# GET /tables/new.json
def new
@table = Table.new
@table.section_id = params[:section_id].presence
respond_to do |format|
format.html # new.html.erb
format.json { render json: @table }
end
end
# GET /tables/1/edit
def edit
@table = Table.find(params[:id])
end
# POST /tables
# POST /tables.json
def create
@table = Table.new(params[:table])
@table.supplier = current_supplier
respond_to do |format|
if @table.save
format.html { redirect_to [:suppliers, @table.section || @table], notice: t('action.create.successfull', model: Table.model_name.human) }
format.json { render json: @table, status: :created, location: @table }
else
format.html { render action: "new" }
format.json { render json: @table.errors, status: :unprocessable_entity }
end
end
end
# PUT /tables/1
# PUT /tables/1.json
def update
@table = Table.find(params[:id])
respond_to do |format|
if @table.update_attributes(params[:table])
format.html { redirect_to [:suppliers, @table], notice: t('action.update.successfull', model: Table.model_name.human) }
format.json { head :no_content }
format.js { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @table.errors, status: :unprocessable_entity }
format.js { head :no_content }
end
end
end
# DELETE /tables/1
# DELETE /tables/1.json
def destroy
@table = Table.find(params[:id])
@table.destroy
respond_to do |format|
format.html { redirect_to suppliers_tables_url, notice: t('action.destroy.successfull', model: Table.model_name.human) }
format.json { head :no_content }
end
end
end
end