big refactor for test and admin namespace

This commit is contained in:
2012-12-04 18:45:18 +01:00
parent 7d64ab2022
commit d8eef4a047
85 changed files with 1403 additions and 1272 deletions
@@ -16,6 +16,7 @@
//= require mustache
//= require faye
//= require supplier/base
//= require qwaiter
//= require_directory .
//= require_self
var path_mapping = {
@@ -0,0 +1,14 @@
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_directory .
* require 'bootstrap-devise-rails'
*= require_self
*/
@@ -0,0 +1,3 @@
@import bootstrap
body
padding-top: 60px !important
@@ -12,13 +12,13 @@ body {
// Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines)
// Note: If you use asset_path() here, your compiled boostrap_and_overrides.css will not
// have the proper paths. So for now we use the absolute path.
@fontAwesomeEotPath: '/assets/fontawesome-webfont.eot';
@fontAwesomeWoffPath: '/assets/fontawesome-webfont.woff';
@fontAwesomeTtfPath: '/assets/fontawesome-webfont.ttf';
@fontAwesomeSvgPath: '/assets/fontawesome-webfont.svg';
//@fontAwesomeEotPath: '/assets/fontawesome-webfont.eot';
//@fontAwesomeWoffPath: '/assets/fontawesome-webfont.woff';
//@fontAwesomeTtfPath: '/assets/fontawesome-webfont.ttf';
//@fontAwesomeSvgPath: '/assets/fontawesome-webfont.svg';
// Font Awesome
@import "fontawesome";
//@import "fontawesome";
// Your custom LESS stylesheets goes here
//
@@ -0,0 +1,6 @@
module Admin
class ApplicationController < ::ApplicationController
before_filter :authenticate_administrator!
layout 'administrator'
end
end
+94
View File
@@ -0,0 +1,94 @@
# encoding: UTF-8
module Admin
class ListsController < Admin::ApplicationController
before_filter :set_relation_options, only: [:new, :edit, :create, :update]
# GET /lists
# GET /lists.json
def index
@lists = List.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @lists }
end
end
# GET /lists/1
# GET /lists/1.json
def show
@list = List.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @list }
end
end
# GET /lists/new
# GET /lists/new.json
def new
@list = List.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @list }
end
end
# GET /lists/1/edit
def edit
@list = List.find(params[:id])
end
# POST /lists
# POST /lists.json
def create
@list = List.new(params[:list])
respond_to do |format|
if @list.save
format.html { redirect_to [:admin, @list], notice: t('action.create.successfull', model: List.model_name.human) }
format.json { render json: @list, status: :created, location: @list }
else
format.html { render action: "new" }
format.json { render json: @list.errors, status: :unprocessable_entity }
end
end
end
# PUT /lists/1
# PUT /lists/1.json
def update
@list = List.find(params[:id])
respond_to do |format|
if @list.update_attributes(params[:list])
format.html { redirect_to [:admin, @list], notice: t('action.update.successfull', model: List.model_name.human) }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @list.errors, status: :unprocessable_entity }
end
end
end
# DELETE /lists/1
# DELETE /lists/1.json
def destroy
@list = List.find(params[:id])
@list.destroy
respond_to do |format|
format.html { redirect_to admin_lists_path, notice: t('action.destroy.successfull', model: List.model_name.human) }
format.json { head :no_content }
end
end
private
def set_relation_options
@tables = Table.all
@suppliers = Supplier.all
end
end
end
@@ -0,0 +1,94 @@
# encoding: UTF-8
module Admin
class OrdersController < Admin::ApplicationController
before_filter :set_relation_options, only: [:new, :edit, :create, :update]
# GET /orders
# GET /orders.json
def index
@orders = Order.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @orders }
end
end
# GET /orders/1
# GET /orders/1.json
def show
@order = Order.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @order }
end
end
# GET /orders/new
# GET /orders/new.json
def new
@order = Order.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @order }
end
end
# GET /orders/1/edit
def edit
@order = Order.find(params[:id])
end
# POST /orders
# POST /orders.json
def create
@order = Order.new(params[:order])
respond_to do |format|
if @order.save
format.html { redirect_to [:admin, @order], notice: t('action.create.successfull', model: Order.model_name.human) }
format.json { render json: @order, status: :created, location: @order }
else
format.html { render action: "new" }
format.json { render json: @order.errors, status: :unprocessable_entity }
end
end
end
# PUT /orders/1
# PUT /orders/1.json
def update
@order = Order.find(params[:id])
respond_to do |format|
if @order.update_attributes(params[:order])
format.html { redirect_to [:admin, @order], notice: t('action.update.successfull', model: Order.model_name.human) }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @order.errors, status: :unprocessable_entity }
end
end
end
# DELETE /orders/1
# DELETE /orders/1.json
def destroy
@order = Order.find(params[:id])
@order.destroy
respond_to do |format|
format.html { redirect_to admin_orders_url, notice: t('action.destroy.successfull', model: Order.model_name.human) }
format.json { head :no_content }
end
end
private
def set_relation_options
@lists = List.all
@suppliers = Supplier.all
end
end
end
@@ -0,0 +1,105 @@
# encoding: UTF-8
module Admin
class ProductCategoriesController < Admin::ApplicationController
before_filter :set_relation_options, only: [:new, :edit, :create, :update]
# GET /product_categories
# GET /product_categories.json
def index
@product_categories = ProductCategory.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @product_categories }
end
end
# GET /product_categories/1
# GET /product_categories/1.json
def show
@product_category = ProductCategory.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @product_category }
end
end
# GET /product_categories/new
# GET /product_categories/new.json
def new
@product_category = ProductCategory.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @product_category }
end
end
# GET /product_categories/1/edit
def edit
@product_category = ProductCategory.find(params[:id])
end
# POST /product_categories
# POST /product_categories.json
def create
@product_category = ProductCategory.new(params[:product_category])
respond_to do |format|
if @product_category.save
format.html { redirect_to [:admin, @product_category], notice: t('action.create.successfull', model: ProductCategory.model_name.human) }
format.json { render json: @product_category, status: :created, location: @product_category }
else
format.html { render action: "new" }
format.json { render json: @product_category.errors, status: :unprocessable_entity }
end
end
end
# PUT /product_categories/1
# PUT /product_categories/1.json
def update
@product_category = ProductCategory.find(params[:id])
respond_to do |format|
if @product_category.update_attributes(params[:product_category])
format.html { redirect_to [:admin, @product_category], notice: t('action.update.successfull', model: ProductCategory.model_name.human) }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @product_category.errors, status: :unprocessable_entity }
end
end
end
# DELETE /product_categories/1
# DELETE /product_categories/1.json
def destroy
@product_category = ProductCategory.find(params[:id])
@product_category.destroy
respond_to do |format|
format.html { redirect_to admin_product_categories_path, notice: t('action.destroy.successfull', model: ProductCategory.model_name.human) }
format.json { head :no_content }
end
end
# GET /product_categories/qrcode
# GET /product_categories/qrcode.png
# GET /product_categories/qrcode.svg
def qrcode
respond_to do |format|
format.html
format.svg { render :qrcode => request.url, :level => :l, :unit => 10 }
format.png { render qrcode: request.url }
end
end
private
def set_relation_options
@suppliers = Supplier.all
@lists = List.all
end
end
end
@@ -0,0 +1,94 @@
# encoding: UTF-8
module Admin
class ProductsController < Admin::ApplicationController
before_filter :set_relation_options, only: [:new, :edit, :create, :update]
# GET /products
# GET /products.json
def index
@products = Product.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @products }
end
end
# GET /products/1
# GET /products/1.json
def show
@product = Product.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @product }
end
end
# GET /products/new
# GET /products/new.json
def new
@product = Product.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @product }
end
end
# GET /products/1/edit
def edit
@product = Product.find(params[:id])
end
# POST /products
# POST /products.json
def create
@product = Product.new(params[:product])
respond_to do |format|
if @product.save
format.html { redirect_to [:admin, @product], notice: t('action.create.successfull', model: Product.model_name.human) }
format.json { render json: @product, status: :created, location: @product }
else
format.html { render action: "new" }
format.json { render json: @product.errors, status: :unprocessable_entity }
end
end
end
# PUT /products/1
# PUT /products/1.json
def update
@product = Product.find(params[:id])
respond_to do |format|
if @product.update_attributes(params[:product])
format.html { redirect_to [:admin, @product], notice: t('action.update.successfull', model: Product.model_name.human) }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @product.errors, status: :unprocessable_entity }
end
end
end
# DELETE /products/1
# DELETE /products/1.json
def destroy
@product = Product.find(params[:id])
@product.destroy
respond_to do |format|
format.html { redirect_to admin_products_path, notice: t('action.destroy.successfull', model: Product.model_name.human) }
format.json { head :no_content }
end
end
private
def set_relation_options
@suppliers = Supplier.all
@product_categories = ProductCategory.all
end
end
end
@@ -0,0 +1,93 @@
# encoding: UTF-8
module Admin
class SectionsController < Admin::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 [:admin, @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 [:admin, @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 admin_sections_path, 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
end
@@ -0,0 +1,93 @@
module Admin
class SuppliersController < Admin::ApplicationController
before_filter :set_relation_options, only: [:new, :edit, :create, :update]
# GET /suppliers
# GET /suppliers.json
def index
@suppliers = Supplier.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @suppliers }
end
end
# GET /suppliers/1
# GET /suppliers/1.json
def show
@supplier = Supplier.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @supplier }
end
end
# GET /suppliers/new
# GET /suppliers/new.json
def new
@supplier = Supplier.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @supplier }
end
end
# GET /suppliers/1/edit
def edit
@supplier = Supplier.find(params[:id])
end
# POST /suppliers
# POST /suppliers.json
def create
@supplier = Supplier.new(params[:supplier])
respond_to do |format|
if @supplier.save
format.html { redirect_to [:admin, @supplier], notice: t('action.create.successfull', model: Supplier.model_name.human) }
format.json { render json: @supplier, status: :created, location: @supplier }
else
format.html { render action: "new" }
format.json { render json: @supplier.errors, status: :unprocessable_entity }
end
end
end
# PUT /suppliers/1
# PUT /suppliers/1.json
def update
@supplier = Supplier.find(params[:id])
respond_to do |format|
if @supplier.update_attributes(params[:supplier])
format.html { redirect_to [:admin, @supplier], notice: t('action.update.successfull', model: Supplier.model_name.human) }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @supplier.errors, status: :unprocessable_entity }
end
end
end
# DELETE /suppliers/1
# DELETE /suppliers/1.json
def destroy
@supplier = Supplier.find(params[:id])
@supplier.destroy
respond_to do |format|
format.html { redirect_to admin_suppliers_path, notice: t('action.destroy.successfull', model: Supplier.model_name.human) }
format.json { head :no_content }
end
end
private
def set_relation_options
@suppliers = Supplier.all
@lists = List.all
end
end
end
@@ -0,0 +1,94 @@
# encoding: UTF-8
module Admin
class TablesController < Admin::ApplicationController
before_filter :set_relation_options, only: [:new, :edit, :create, :update]
# GET /tables
# GET /tables.json
def index
@tables = Table.all
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
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])
respond_to do |format|
if @table.save
format.html { redirect_to [:admin, @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 [:admin, @table], notice: t('action.update.successfull', model: Table.model_name.human) }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @table.errors, status: :unprocessable_entity }
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 admin_tables_url, notice: t('action.destroy.successfull', model: Table.model_name.human) }
format.json { head :no_content }
end
end
private
def set_relation_options
@suppliers = Supplier.all
@lists = List.all
end
end
end
+85
View File
@@ -0,0 +1,85 @@
module Admin
class UsersController < Admin::ApplicationController
# GET /users
# GET /users.json
def index
@users = User.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @users }
end
end
# GET /users/1
# GET /users/1.json
def show
@user = User.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @user }
end
end
# GET /users/new
# GET /users/new.json
def new
@user = User.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @user }
end
end
# GET /users/1/edit
def edit
@user = User.find(params[:id])
end
# POST /users
# POST /users.json
def create
@user = User.new(params[:user])
respond_to do |format|
if @user.save
format.html { redirect_to [:admin, @user], notice: t('action.create.successfull', model: User.model_name.human) }
format.json { render json: @user, status: :created, location: @user }
else
format.html { render action: "new" }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end
# PUT /users/1
# PUT /users/1.json
def update
@user = User.find(params[:id])
respond_to do |format|
if @user.update_attributes(params[:user])
format.html { redirect_to [:admin, @user], notice: t('action.update.successfull', model: User.model_name.human) }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end
# DELETE /users/1
# DELETE /users/1.json
def destroy
@user = User.find(params[:id])
@user.destroy
respond_to do |format|
format.html { redirect_to admin_users_url, notice: t('action.destroy.successfull', model: User.model_name.human) }
format.json { head :no_content }
end
end
end
end
-91
View File
@@ -1,91 +0,0 @@
class ListsController < ApplicationController
before_filter :set_relation_options, only: [:new, :edit, :create, :update]
# GET /lists
# GET /lists.json
def index
@lists = List.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @lists }
end
end
# GET /lists/1
# GET /lists/1.json
def show
@list = List.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @list }
end
end
# GET /lists/new
# GET /lists/new.json
def new
@list = List.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @list }
end
end
# GET /lists/1/edit
def edit
@list = List.find(params[:id])
end
# POST /lists
# POST /lists.json
def create
@list = List.new(params[:list])
respond_to do |format|
if @list.save
format.html { redirect_to @list, notice: t('action.create.successfull', model: List.model_name.human) }
format.json { render json: @list, status: :created, location: @list }
else
format.html { render action: "new" }
format.json { render json: @list.errors, status: :unprocessable_entity }
end
end
end
# PUT /lists/1
# PUT /lists/1.json
def update
@list = List.find(params[:id])
respond_to do |format|
if @list.update_attributes(params[:list])
format.html { redirect_to @list, notice: t('action.update.successfull', model: List.model_name.human) }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @list.errors, status: :unprocessable_entity }
end
end
end
# DELETE /lists/1
# DELETE /lists/1.json
def destroy
@list = List.find(params[:id])
@list.destroy
respond_to do |format|
format.html { redirect_to lists_url, notice: t('action.destroy.successfull', model: List.model_name.human) }
format.json { head :no_content }
end
end
private
def set_relation_options
@tables = Table.all
@suppliers = Supplier.all
end
end
-91
View File
@@ -1,91 +0,0 @@
class OrdersController < ApplicationController
before_filter :set_relation_options, only: [:new, :edit, :create, :update]
# GET /orders
# GET /orders.json
def index
@orders = Order.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @orders }
end
end
# GET /orders/1
# GET /orders/1.json
def show
@order = Order.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @order }
end
end
# GET /orders/new
# GET /orders/new.json
def new
@order = Order.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @order }
end
end
# GET /orders/1/edit
def edit
@order = Order.find(params[:id])
end
# POST /orders
# POST /orders.json
def create
@order = Order.new(params[:order])
respond_to do |format|
if @order.save
format.html { redirect_to @order, notice: t('action.create.successfull', model: Order.model_name.human) }
format.json { render json: @order, status: :created, location: @order }
else
format.html { render action: "new" }
format.json { render json: @order.errors, status: :unprocessable_entity }
end
end
end
# PUT /orders/1
# PUT /orders/1.json
def update
@order = Order.find(params[:id])
respond_to do |format|
if @order.update_attributes(params[:order])
format.html { redirect_to @order, notice: t('action.update.successfull', model: Order.model_name.human) }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @order.errors, status: :unprocessable_entity }
end
end
end
# DELETE /orders/1
# DELETE /orders/1.json
def destroy
@order = Order.find(params[:id])
@order.destroy
respond_to do |format|
format.html { redirect_to orders_url, notice: t('action.destroy.successfull', model: Order.model_name.human) }
format.json { head :no_content }
end
end
private
def set_relation_options
@lists = List.all
@suppliers = Supplier.all
end
end
@@ -1,102 +0,0 @@
class ProductCategoriesController < ApplicationController
before_filter :set_relation_options, only: [:new, :edit, :create, :update]
# GET /product_categories
# GET /product_categories.json
def index
@product_categories = ProductCategory.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @product_categories }
end
end
# GET /product_categories/1
# GET /product_categories/1.json
def show
@product_category = ProductCategory.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @product_category }
end
end
# GET /product_categories/new
# GET /product_categories/new.json
def new
@product_category = ProductCategory.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @product_category }
end
end
# GET /product_categories/1/edit
def edit
@product_category = ProductCategory.find(params[:id])
end
# POST /product_categories
# POST /product_categories.json
def create
@product_category = ProductCategory.new(params[:product_category])
respond_to do |format|
if @product_category.save
format.html { redirect_to @product_category, notice: t('action.create.successfull', model: ProductCategory.model_name.human) }
format.json { render json: @product_category, status: :created, location: @product_category }
else
format.html { render action: "new" }
format.json { render json: @product_category.errors, status: :unprocessable_entity }
end
end
end
# PUT /product_categories/1
# PUT /product_categories/1.json
def update
@product_category = ProductCategory.find(params[:id])
respond_to do |format|
if @product_category.update_attributes(params[:product_category])
format.html { redirect_to @product_category, notice: t('action.update.successfull', model: ProductCategory.model_name.human) }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @product_category.errors, status: :unprocessable_entity }
end
end
end
# DELETE /product_categories/1
# DELETE /product_categories/1.json
def destroy
@product_category = ProductCategory.find(params[:id])
@product_category.destroy
respond_to do |format|
format.html { redirect_to product_categories_url, notice: t('action.destroy.successfull', model: ProductCategory.model_name.human) }
format.json { head :no_content }
end
end
# GET /product_categories/qrcode
# GET /product_categories/qrcode.png
# GET /product_categories/qrcode.svg
def qrcode
respond_to do |format|
format.html
format.svg { render :qrcode => request.url, :level => :l, :unit => 10 }
format.png { render qrcode: request.url }
end
end
private
def set_relation_options
@suppliers = Supplier.all
@lists = List.all
end
end
-91
View File
@@ -1,91 +0,0 @@
class ProductsController < ApplicationController
before_filter :set_relation_options, only: [:new, :edit, :create, :update]
# GET /products
# GET /products.json
def index
@products = Product.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @products }
end
end
# GET /products/1
# GET /products/1.json
def show
@product = Product.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @product }
end
end
# GET /products/new
# GET /products/new.json
def new
@product = Product.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @product }
end
end
# GET /products/1/edit
def edit
@product = Product.find(params[:id])
end
# POST /products
# POST /products.json
def create
@product = Product.new(params[:product])
respond_to do |format|
if @product.save
format.html { redirect_to @product, notice: t('action.create.successfull', model: Product.model_name.human) }
format.json { render json: @product, status: :created, location: @product }
else
format.html { render action: "new" }
format.json { render json: @product.errors, status: :unprocessable_entity }
end
end
end
# PUT /products/1
# PUT /products/1.json
def update
@product = Product.find(params[:id])
respond_to do |format|
if @product.update_attributes(params[:product])
format.html { redirect_to @product, notice: t('action.update.successfull', model: Product.model_name.human) }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @product.errors, status: :unprocessable_entity }
end
end
end
# DELETE /products/1
# DELETE /products/1.json
def destroy
@product = Product.find(params[:id])
@product.destroy
respond_to do |format|
format.html { redirect_to products_url, notice: t('action.destroy.successfull', model: Product.model_name.human) }
format.json { head :no_content }
end
end
private
def set_relation_options
@suppliers = Supplier.all
@product_categories = ProductCategory.all
end
end
-90
View File
@@ -1,90 +0,0 @@
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
-91
View File
@@ -1,91 +0,0 @@
class SuppliersController < ApplicationController
before_filter :set_relation_options, only: [:new, :edit, :create, :update]
# GET /suppliers
# GET /suppliers.json
def index
@suppliers = Supplier.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @suppliers }
end
end
# GET /suppliers/1
# GET /suppliers/1.json
def show
@supplier = Supplier.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @supplier }
end
end
# GET /suppliers/new
# GET /suppliers/new.json
def new
@supplier = Supplier.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @supplier }
end
end
# GET /suppliers/1/edit
def edit
@supplier = Supplier.find(params[:id])
end
# POST /suppliers
# POST /suppliers.json
def create
@supplier = Supplier.new(params[:supplier])
respond_to do |format|
if @supplier.save
format.html { redirect_to @supplier, notice: t('action.create.successfull', model: Supplier.model_name.human) }
format.json { render json: @supplier, status: :created, location: @supplier }
else
format.html { render action: "new" }
format.json { render json: @supplier.errors, status: :unprocessable_entity }
end
end
end
# PUT /suppliers/1
# PUT /suppliers/1.json
def update
@supplier = Supplier.find(params[:id])
respond_to do |format|
if @supplier.update_attributes(params[:supplier])
format.html { redirect_to @supplier, notice: t('action.update.successfull', model: Supplier.model_name.human) }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @supplier.errors, status: :unprocessable_entity }
end
end
end
# DELETE /suppliers/1
# DELETE /suppliers/1.json
def destroy
@supplier = Supplier.find(params[:id])
@supplier.destroy
respond_to do |format|
format.html { redirect_to suppliers_url, notice: t('action.destroy.successfull', model: Supplier.model_name.human) }
format.json { head :no_content }
end
end
private
def set_relation_options
@suppliers = Supplier.all
@lists = List.all
end
end
-91
View File
@@ -1,91 +0,0 @@
class TablesController < ApplicationController
before_filter :set_relation_options, only: [:new, :edit, :create, :update]
# GET /tables
# GET /tables.json
def index
@tables = Table.all
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
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])
respond_to do |format|
if @table.save
format.html { redirect_to @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 @table, notice: t('action.update.successfull', model: Table.model_name.human) }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @table.errors, status: :unprocessable_entity }
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 tables_url, notice: t('action.destroy.successfull', model: Table.model_name.human) }
format.json { head :no_content }
end
end
private
def set_relation_options
@suppliers = Supplier.all
@lists = List.all
end
end
-83
View File
@@ -1,83 +0,0 @@
class UsersController < ApplicationController
# GET /users
# GET /users.json
def index
@users = User.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @users }
end
end
# GET /users/1
# GET /users/1.json
def show
@user = User.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @user }
end
end
# GET /users/new
# GET /users/new.json
def new
@user = User.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @user }
end
end
# GET /users/1/edit
def edit
@user = User.find(params[:id])
end
# POST /users
# POST /users.json
def create
@user = User.new(params[:user])
respond_to do |format|
if @user.save
format.html { redirect_to @user, notice: t('action.create.successfull', model: User.model_name.human) }
format.json { render json: @user, status: :created, location: @user }
else
format.html { render action: "new" }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end
# PUT /users/1
# PUT /users/1.json
def update
@user = User.find(params[:id])
respond_to do |format|
if @user.update_attributes(params[:user])
format.html { redirect_to @user, notice: t('action.update.successfull', model: User.model_name.human) }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end
# DELETE /users/1
# DELETE /users/1.json
def destroy
@user = User.find(params[:id])
@user.destroy
respond_to do |format|
format.html { redirect_to users_url, notice: t('action.destroy.successfull', model: User.model_name.human) }
format.json { head :no_content }
end
end
end
+4
View File
@@ -93,4 +93,8 @@ module ApplicationHelper
script.present? ? (@onload_javascripts ||= []) << script : (@onload_javascripts || []).join(';')
end
def mustache_template(template)
render(template, handlers: [:mustache])
end
end
+1
View File
@@ -24,6 +24,7 @@ class Order
}
}], reduce_function: '_sum'
view :by_supplier_id_and_id, key: [:supplier_id, :_id]
view :by_list_id, key: :list_id
# Return all currently active orders for a given supplier
def self.active_for_supplier(supplier_id)
+2
View File
@@ -11,6 +11,8 @@ class Product
has_many :product_orders
validates :supplier_id, presence: true
validates :price, presence: true, numericality: true
after_save :persist_product_category_ids
def product_category_ids=(ids)
+2
View File
@@ -7,4 +7,6 @@ class ProductOrder
belongs_to :product
belongs_to :order
view :by_product_id, key: :product_id
end
+3 -1
View File
@@ -26,6 +26,8 @@ class Supplier
after_create :add_section_on_create
view :by_email, key: :email
def location=(val)
lat, lng = val.strip.split(/[ ,]+/).map(&:to_f)
self.lat = lat
@@ -45,7 +47,7 @@ class Supplier
end
def active_lists(options = {})
return @active_lists if @active_lists.present?
return @active_lists if @active_lists.present?
@active_lists = List.active_for_supplier(id)
@active_lists.include_relations(table: :section, orders: {product_orders: :product})
@active_lists
+3 -1
View File
@@ -14,7 +14,9 @@ class Table
validates :supplier_id, presence: true
#validates :list_id, presence: true
validates :number, numericality: {greater_than: 0}
validates_uniqueness_of :number
#validates_uniqueness_of :number
#view :by_number, key: :number # For uniqueness validation
def occupied?
return @is_occupied if instance_variable_defined?(:'@is_occupied')
+1
View File
@@ -12,6 +12,7 @@ class User
before_save :ensure_authentication_token
view :by_authentication_token, key: :authentication_token
view :by_email, key: :email
def list_is_closed!
self.active_list_id = nil
@@ -1,4 +1,4 @@
= form_for @order, html: {class: 'form-horizontal' } do |f|
= simple_form_for [:admin, @order], html: {class: 'form-horizontal' } do |f|
= render 'error_messages', target: @order
.control-group class=(@order.errors[:state].any? ? 'error' : nil)
= f.label :state, class: 'control-label'
@@ -11,4 +11,4 @@
.form-actions
= f.submit nil, class: 'btn btn-primary'
'
= link_to t("helpers.links.cancel"), orders_path, class: 'btn'
= link_to t("helpers.links.cancel"), admin_orders_path, class: 'btn'
@@ -11,14 +11,14 @@ div.page-header= title :index, model_class
tbody
- @orders.each do |order|
tr
td= link_to order.state, order
td= link_to_if order.supplier.present?, order.supplier.try(:name), order.supplier
td= link_to order.state, [:admin, order]
td= link_to_if order.supplier.present?, order.supplier.try(:name), [:admin, order.supplier]
td=l order.created_at, format: :short
td
= link_to t('helpers.links.edit'), [:edit, order], class: 'btn btn-mini'
= link_to t('helpers.links.edit'), [:edit, :admin, order], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), order, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
= link_to t("helpers.links.destroy"), [:admin, order], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
- else
= no_content_given model_class
= link_to t("helpers.links.new"), new_order_path, class: 'btn btn-primary'
= link_to t("helpers.links.new"), new_admin_order_path, class: 'btn btn-primary'
+16
View File
@@ -0,0 +1,16 @@
- model_class = Order
.page-header= title :show, @order
dl.dl-horizontal.show-list
dt= model_class.human_attribute_name(:state)
dd= @order.state
- if @order.supplier.present?
dt= Supplier.model_name.human
dd= link_to @order.supplier.name, [:admin, @order.supplier]
.form-actions
= link_to t("helpers.links.back"), admin_orders_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, :admin, @order], class: 'btn'
'
= link_to t("helpers.links.destroy"), [:admin, @order], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
+13
View File
@@ -0,0 +1,13 @@
= simple_form_for [:admin, @product], html: {class: 'form-horizontal' } do |f|
= render 'error_messages', target: @product
= f.input :name
= f.input :code
= f.input :price
.control-group class=(@product.errors[:supplier_id].any? ? 'error' : nil)
= f.label :supplier_id, Supplier.model_name.human, class: 'control-label'
.controls
= f.collection_select :supplier_id, @suppliers, :id, :name, include_blank: nil
.form-actions
= f.submit nil, class: 'btn btn-primary'
'
= link_to t("helpers.links.cancel"), admin_products_path, class: 'btn'
+3
View File
@@ -0,0 +1,3 @@
- model_class = Product
.page-header= title :edit, model_class
= render 'form'
@@ -7,24 +7,22 @@
th= model_class.human_attribute_name(:name)
th= model_class.human_attribute_name(:code)
th= model_class.human_attribute_name(:price)
th= ProductCategory.model_name.human
th= Supplier.model_name.human
th.timestamp= model_class.human_attribute_name(:created_at)
th.actions=t 'helpers.actions'
tbody
- @products.each do |product|
tr
td.link= link_to product.name, product
td.link= link_to product.name, [:admin, product]
td= product.code
td= product.price
td.link= link_to_if product.product_category.present?, product.product_category.try(:name), product.product_category
td.link= link_to_if product.supplier.present?, product.supplier.try(:name), product.supplier
td.link= link_to_if product.supplier.present?, product.supplier.try(:name), [:admin, product.supplier]
td.timestamp=l product.created_at, format: :short
td.actions
= link_to t('helpers.links.edit'), [:edit, product], class: 'btn btn-mini'
= link_to t('helpers.links.edit'), [:edit, :admin, product], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), product, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
= link_to t("helpers.links.destroy"), [:admin, product], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
- else
= no_content_given model_class
= link_to t("helpers.links.new"), new_product_path, class: 'btn btn-primary'
= link_to t("helpers.links.new"), new_admin_product_path, class: 'btn btn-primary'
+20
View File
@@ -0,0 +1,20 @@
- model_class = Product
.page-header= title :show, @product
dl.dl-horizontal.show-list
dt= model_class.human_attribute_name(:name)
dd= @product.name
dt= model_class.human_attribute_name(:code)
dd= @product.code
dt= model_class.human_attribute_name(:price)
dd= @product.price
- if @product.supplier.present?
dt= Supplier.model_name.human
dd= link_to @product.supplier.name, [:admin, @product.supplier]
.form-actions
= link_to t("helpers.links.back"), admin_products_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, :admin, @product], class: 'btn'
'
= link_to t("helpers.links.destroy"), [:admin, @product], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
+24
View File
@@ -0,0 +1,24 @@
- model_class = Supplier
.page-header= title :index, model_class
- if @suppliers.any?
table.table.table-striped.table-hover
thead
tr
th= model_class.human_attribute_name(:email)
th= model_class.human_attribute_name(:name)
th= model_class.human_attribute_name(:created_at)
th=t 'helpers.actions'
tbody
- @suppliers.each do |supplier|
tr
td= link_to supplier.email, [:admin, supplier]
td= supplier.name
td=l supplier.created_at, format: :short
td
= link_to t('helpers.links.edit'), [:edit, :admin, supplier], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), [:admin, supplier], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
- else
= no_content_given model_class
= link_to t("helpers.links.new"), new_admin_supplier_path, class: 'btn btn-primary'
@@ -2,6 +2,8 @@
.page-header= title :show, @supplier
dl.dl-horizontal.show-list
dt= model_class.human_attribute_name(:name)
dd= @supplier.name
dt= model_class.human_attribute_name(:email)
dd= @supplier.email
dt= model_class.human_attribute_name(:encrypted_password)
@@ -22,12 +24,10 @@ dl.dl-horizontal.show-list
dd= @supplier.current_sign_in_ip
dt= model_class.human_attribute_name(:last_sign_in_ip)
dd= @supplier.last_sign_in_ip
dt= model_class.human_attribute_name(:name)
dd= @supplier.name
.form-actions
= link_to t("helpers.links.back"), suppliers_path, class: 'btn'
= link_to t("helpers.links.back"), admin_suppliers_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, @supplier], class: 'btn'
= link_to t('helpers.links.edit'), [:edit, :admin, @supplier], class: 'btn'
'
= link_to t("helpers.links.destroy"), @supplier, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
= link_to t("helpers.links.destroy"), [:admin, @supplier], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
@@ -1,9 +1,6 @@
= form_for @table, html: {class: 'form-horizontal' } do |f|
= simple_form_for [:admin, @table], html: {class: 'form-horizontal' } do |f|
= render 'error_messages', target: @table
.control-group class=(@table.errors[:number].any? ? 'error' : nil)
= f.label :number, class: 'control-label'
.controls
= f.text_field :number, class: 'text_field'
= f.input :number
.control-group class=(@table.errors[:supplier_id].any? ? 'error' : nil)
= f.label :supplier_id, Supplier.model_name.human, class: 'control-label'
.controls
@@ -11,4 +8,4 @@
.form-actions
= f.submit nil, class: 'btn btn-primary'
'
= link_to t("helpers.links.cancel"), tables_path, class: 'btn'
= link_to t("helpers.links.cancel"), admin_tables_path, class: 'btn'
+3
View File
@@ -0,0 +1,3 @@
- model_class = Table
.page-header= title :edit, model_class
= render 'form'
@@ -11,14 +11,14 @@ div.page-header= title :index, model_class
tbody
- @tables.each do |table|
tr
td= link_to table.number, table
td= link_to table.supplier.name, table.supplier
td= link_to table.number, [:admin, table]
td= link_to table.supplier.name, [:admin, table.supplier]
td=l table.created_at, format: :short
td
= link_to t('helpers.links.edit'), [:edit, table], class: 'btn btn-mini'
= link_to t('helpers.links.edit'), [:edit, :admin, table], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), table, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
= link_to t("helpers.links.destroy"), [:admin, table], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
- else
= no_content_given model_class
= link_to t("helpers.links.new"), new_table_path, class: 'btn btn-primary'
= link_to t("helpers.links.new"), new_admin_table_path, class: 'btn btn-primary'
+16
View File
@@ -0,0 +1,16 @@
- model_class = Table
.page-header= title :show, @table
dl.dl-horizontal.show-list
dt= model_class.human_attribute_name(:number)
dd= @table.number
- if @table.supplier.present?
dt= Supplier.model_name.human
dd= link_to @table.supplier.name, [:admin, @table.supplier]
.form-actions
= link_to t("helpers.links.back"), admin_tables_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, :admin, @table], class: 'btn'
'
= link_to t("helpers.links.destroy"), [:admin, @table], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
+7
View File
@@ -0,0 +1,7 @@
= simple_form_for [:admin, @user], html: {class: 'form-horizontal' } do |f|
= render 'error_messages', target: @user
= f.input :email
.form-actions
= f.submit nil, class: 'btn btn-primary'
'
= link_to t("helpers.links.cancel"), admin_users_path, class: 'btn'
+3
View File
@@ -0,0 +1,3 @@
- model_class = User
.page-header= title :edit, model_class
= render 'form'
@@ -10,13 +10,13 @@
tbody
- @users.each do |user|
tr
td= link_to user.email, user
td= link_to user.email, [:admin, user]
td=l user.created_at, format: :short
td
= link_to t('helpers.links.edit'), [:edit, user], class: 'btn btn-mini'
= link_to t('helpers.links.edit'), [:edit, :admin, user], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), user, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
= link_to t("helpers.links.destroy"), [:admin, user], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
- else
= no_content_given model_class
= link_to t("helpers.links.new"), new_user_path, class: 'btn btn-primary'
= link_to t("helpers.links.new"), new_admin_user_path, class: 'btn btn-primary'
@@ -24,8 +24,8 @@ dl.dl-horizontal.show-list
dd= @user.last_sign_in_ip
.form-actions
= link_to t("helpers.links.back"), users_path, class: 'btn'
= link_to t("helpers.links.back"), admin_users_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, @user], class: 'btn'
= link_to t('helpers.links.edit'), [:edit, :admin, @user], class: 'btn'
'
= link_to t("helpers.links.destroy"), @user, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
= link_to t("helpers.links.destroy"), [:admin, @user], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
+23 -10
View File
@@ -10,7 +10,7 @@ html lang="en"
/! Le HTML5 shim, for IE6-8 support of HTML elements
/[if lt IE 9]
= javascript_include_tag "http://html5shim.googlecode.com/svn/trunk/html5.js"
= stylesheet_link_tag "application", :media => "all"
= stylesheet_link_tag "admin/application", :media => "all"
link href="images/apple-touch-icon-144x144.png" rel="apple-touch-icon-precomposed" sizes="144x144"
link href="images/apple-touch-icon-114x114.png" rel="apple-touch-icon-precomposed" sizes="114x114"
link href="images/apple-touch-icon-72x72.png" rel="apple-touch-icon-precomposed" sizes="72x72"
@@ -25,16 +25,29 @@ html lang="en"
span.icon-bar
span.icon-bar
span.icon-bar
a.brand href=root_path = application_title
a.brand href=admin_root_path = application_title
.container.nav-collapse
ul.nav
li= link_to User.model_name.human_plural, users_path
li= link_to Supplier.model_name.human_plural, suppliers_path
li= link_to Table.model_name.human_plural, tables_path
li= link_to Product.model_name.human_plural, products_path
li= link_to List.model_name.human_plural, lists_path
li= link_to Order.model_name.human_plural, orders_path
li= link_to ProductCategory.model_name.human_plural, product_categories_path
li= link_to User.model_name.human_plural, admin_users_path
li.dropdown
a.dropdown-toggle href="#" data-toggle="dropdown"
span = Supplier.model_name.human_plural
b.caret
ul.child-menu.dropdown-menu
li= link_to Supplier.model_name.human_plural, admin_suppliers_path
li= link_to Table.model_name.human_plural, admin_tables_path
li= link_to Product.model_name.human_plural, admin_products_path
li= link_to List.model_name.human_plural, admin_lists_path
li= link_to Order.model_name.human_plural, admin_orders_path
li= link_to ProductCategory.model_name.human_plural, admin_product_categories_path
- if administrator_signed_in?
.btn-group.pull-right
a.btn.dropdown-toggle[data-toggle="dropdown" href="#"]
i.icon-user
= current_administrator.email
span.caret
ul.dropdown-menu
li.log-out= link_to t('helpers.links.logout'), destroy_administrator_session_path
.container
@@ -55,7 +68,7 @@ html lang="en"
h3= application_title
ul.nav.nav-list
li.nav-header Links
li= link_to "Home", root_path
li= link_to "Qwaiter website", root_path
li= link_to "Companytools", 'http://www.companytools.nl/'
= yield :sidebar
-16
View File
@@ -1,16 +0,0 @@
- model_class = Order
.page-header= title :show, @order
dl.dl-horizontal.show-list
dt= model_class.human_attribute_name(:state)
dd= @order.state
- if @order.supplier.present?
dt= Supplier.model_name.human
dd= link_to @order.supplier.name, @order.supplier
.form-actions
= link_to t("helpers.links.back"), orders_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, @order], class: 'btn'
'
= link_to t("helpers.links.destroy"), @order, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
-26
View File
@@ -1,26 +0,0 @@
= form_for @product, html: {class: 'form-horizontal' } do |f|
= render 'error_messages', target: @product
.control-group class=(@product.errors[:name].any? ? 'error' : nil)
= f.label :name, class: 'control-label'
.controls
= f.text_field :name, class: 'text_field'
.control-group class=(@product.errors[:code].any? ? 'error' : nil)
= f.label :code, class: 'control-label'
.controls
= f.text_field :code, class: 'text_field'
.control-group class=(@product.errors[:price].any? ? 'error' : nil)
= f.label :price, class: 'control-label'
.controls
= f.text_field :price, class: 'text_field'
/.control-group class=(@product.errors[:product_category_id].any? ? 'error' : nil)
= f.label :product_category_id, ProductCategory.model_name.human, class: 'control-label'
.controls
= f.collection_select :product_category_id, @product_categories, :id, :name, include_blank: ''
.control-group class=(@product.errors[:supplier_id].any? ? 'error' : nil)
= f.label :supplier_id, Supplier.model_name.human, class: 'control-label'
.controls
= f.collection_select :supplier_id, @suppliers, :id, :name, include_blank: nil
.form-actions
= f.submit nil, class: 'btn btn-primary'
'
= link_to t("helpers.links.cancel"), products_path, class: 'btn'
-4
View File
@@ -1,4 +0,0 @@
- model_class = Product
.page-header
= title :edit, model_class
= render 'form'
-23
View File
@@ -1,23 +0,0 @@
- model_class = Product
.page-header= title :show, @product
dl.dl-horizontal.show-list
dt= model_class.human_attribute_name(:name)
dd= @product.name
dt= model_class.human_attribute_name(:code)
dd= @product.code
dt= model_class.human_attribute_name(:price)
dd= @product.price
- if @product.product_category.present?
dt= ProductCategory.model_name.human
dd= link_to @product.product_category.name, @product.product_category
- if @product.supplier.present?
dt= Supplier.model_name.human
dd= link_to @product.supplier.name, @product.supplier
.form-actions
= link_to t("helpers.links.back"), products_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, @product], class: 'btn'
'
= link_to t("helpers.links.destroy"), @product, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
+1 -2
View File
@@ -10,5 +10,4 @@
th.currency= t('supplier.active_lists.price')
th.actions
tbody
script#active-list-template[type="text/html"]= render 'active_list.mustache'
script#active-list-template[type="text/html"]= mustache_template 'active_list'
+1 -1
View File
@@ -10,4 +10,4 @@
th.currency= t('supplier.active_orders.price')
th.actions
tbody
script#active-order-template[type="text/html"]= render 'active_order.mustache'
script#active-order-template[type="text/html"]= mustache_template 'active_order'
-42
View File
@@ -1,42 +0,0 @@
- model_class = Supplier
div.page-header= title :index, model_class
- if @suppliers.any?
table.table.table-striped
thead
tr
th= model_class.human_attribute_name(:email)
th= model_class.human_attribute_name(:encrypted_password)
th= model_class.human_attribute_name(:remember_created_at)
th= model_class.human_attribute_name(:reset_password_token)
th= model_class.human_attribute_name(:reset_password_sent_at)
th= model_class.human_attribute_name(:sign_in_count)
th= model_class.human_attribute_name(:current_sign_in_at)
th= model_class.human_attribute_name(:last_sign_in_at)
th= model_class.human_attribute_name(:current_sign_in_ip)
th= model_class.human_attribute_name(:last_sign_in_ip)
th= model_class.human_attribute_name(:name)
th= model_class.human_attribute_name(:created_at)
th=t 'helpers.actions'
tbody
- @suppliers.each do |supplier|
tr
td= link_to supplier.email, supplier
td= supplier.encrypted_password
td= supplier.remember_created_at
td= supplier.reset_password_token
td= supplier.reset_password_sent_at
td= supplier.sign_in_count
td= supplier.current_sign_in_at
td= supplier.last_sign_in_at
td= supplier.current_sign_in_ip
td= supplier.last_sign_in_ip
td= supplier.name
td=l supplier.created_at, format: :short
td
= link_to t('helpers.links.edit'), [:edit, supplier], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), supplier, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
- else
= no_content_given model_class
= link_to t("helpers.links.new"), new_supplier_path, class: 'btn btn-primary'
-4
View File
@@ -1,4 +0,0 @@
- model_class = Table
.page-header
= title :edit, model_class
= render 'form'
-16
View File
@@ -1,16 +0,0 @@
- model_class = Table
.page-header= title :show, @table
dl.dl-horizontal.show-list
dt= model_class.human_attribute_name(:number)
dd= @table.number
- if @table.supplier.present?
dt= Supplier.model_name.human
dd= link_to @table.supplier.name, @table.supplier
.form-actions
= link_to t("helpers.links.back"), tables_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, @table], class: 'btn'
'
= link_to t("helpers.links.destroy"), @table, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
-46
View File
@@ -1,46 +0,0 @@
= form_for @user, html: {class: 'form-horizontal' } do |f|
= render 'error_messages', target: @user
.control-group class=(@user.errors[:email].any? ? 'error' : nil)
= f.label :email, class: 'control-label'
.controls
= f.text_field :email, class: 'text_field'
.control-group class=(@user.errors[:encrypted_password].any? ? 'error' : nil)
= f.label :encrypted_password, class: 'control-label'
.controls
= f.text_field :encrypted_password, class: 'text_field'
.control-group class=(@user.errors[:remember_created_at].any? ? 'error' : nil)
= f.label :remember_created_at, class: 'control-label'
.controls
= f.text_field :remember_created_at, class: 'text_field'
.control-group class=(@user.errors[:reset_password_token].any? ? 'error' : nil)
= f.label :reset_password_token, class: 'control-label'
.controls
= f.text_field :reset_password_token, class: 'text_field'
.control-group class=(@user.errors[:reset_password_sent_at].any? ? 'error' : nil)
= f.label :reset_password_sent_at, class: 'control-label'
.controls
= f.text_field :reset_password_sent_at, class: 'text_field'
.control-group class=(@user.errors[:sign_in_count].any? ? 'error' : nil)
= f.label :sign_in_count, class: 'control-label'
.controls
= f.text_field :sign_in_count, class: 'text_field'
.control-group class=(@user.errors[:current_sign_in_at].any? ? 'error' : nil)
= f.label :current_sign_in_at, class: 'control-label'
.controls
= f.text_field :current_sign_in_at, class: 'text_field'
.control-group class=(@user.errors[:last_sign_in_at].any? ? 'error' : nil)
= f.label :last_sign_in_at, class: 'control-label'
.controls
= f.text_field :last_sign_in_at, class: 'text_field'
.control-group class=(@user.errors[:current_sign_in_ip].any? ? 'error' : nil)
= f.label :current_sign_in_ip, class: 'control-label'
.controls
= f.text_field :current_sign_in_ip, class: 'text_field'
.control-group class=(@user.errors[:last_sign_in_ip].any? ? 'error' : nil)
= f.label :last_sign_in_ip, class: 'control-label'
.controls
= f.text_field :last_sign_in_ip, class: 'text_field'
.form-actions
= f.submit nil, class: 'btn btn-primary'
'
= link_to t("helpers.links.cancel"), users_path, class: 'btn'
-4
View File
@@ -1,4 +0,0 @@
- model_class = User
.page-header
= title :edit, model_class
= render 'form'