initial commit

This commit is contained in:
2012-08-22 18:15:37 +02:00
commit 0856528f5e
120 changed files with 3048 additions and 0 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

+16
View File
@@ -0,0 +1,16 @@
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require_tree .
@@ -0,0 +1,4 @@
jQuery ->
$("a[rel=popover]").popover()
$(".tooltip").tooltip()
$("a[rel=tooltip]").tooltip()
+13
View File
@@ -0,0 +1,13 @@
/*
* 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_self
*= require_tree .
*/
+32
View File
@@ -0,0 +1,32 @@
@import "twitter/bootstrap/bootstrap";
body {
padding-top: 60px;
}
@import "twitter/bootstrap/responsive";
// Set the correct sprite paths
@iconSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings.png');
@iconWhiteSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings-white.png');
// 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';
// Font Awesome
@import "fontawesome";
// Your custom LESS stylesheets goes here
//
// Since bootstrap was imported above you have access to its mixins which
// you may use and inherit here
//
// If you'd like to override bootstrap's own variables, you can do so here as well
// See http://twitter.github.com/bootstrap/less.html for their names and documentation
//
// Example:
// @linkColor: #ff0000;
+3
View File
@@ -0,0 +1,3 @@
// Place all the styles related to the Users controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
+10
View File
@@ -0,0 +1,10 @@
class ApplicationController < ActionController::Base
protect_from_forgery
private
def active_list
List.find(session[:list_id])
end
helper_method :active_list
end
+30
View File
@@ -0,0 +1,30 @@
class DashboardController < ApplicationController
def home
end
# Testing action
def select_qrcode
@tables = Table.all
end
def create_list
@table = Table.find(params[:table_id])
if @table.occupied?
redirect_to root_path, alert: t('table.is_occupied')
else
@list = List.new(table: @table)
#@list.add_user(current_user)
@list.save
session[:list_id] = @list.id
redirect_to root_path
end
end
def show_products
@supplier = Supplier.first
end
end
+90
View File
@@ -0,0 +1,90 @@
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
end
end
@@ -0,0 +1,102 @@
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
@@ -0,0 +1,91 @@
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
+106
View File
@@ -0,0 +1,106 @@
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
# GET /suppliers/1/product_list
# GET /suppliers/1/product_list.json
def product_list
@supplier = Supplier.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json do
products = @supplier.products
products.include_relation(:product_categories)
h = products.inject({}){|h, p| n = p.product_category.try(:name) || 'other'; h[n] ||= []; h[n] << p; h}
render json: h
end
end
end
private
def set_relation_options
@suppliers = Supplier.all
@lists = List.all
end
end
+102
View File
@@ -0,0 +1,102 @@
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
# GET /tables/qrcode
# GET /tables/qrcode.png
# GET /tables/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
+83
View File
@@ -0,0 +1,83 @@
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
+28
View File
@@ -0,0 +1,28 @@
module ApplicationHelper
def title(*args)
content_tag :h1 do
if args.first.is_a?(Symbol) && (args[1].respond_to?(:model_name) || args[1].class.respond_to?(:model_name))
model = args[1].respond_to?(:model_name) ? args[1] : args[1].class
if args.first == :index
t('action.index.label', models: model.model_name.human_plural)
else
t("action.#{args.first}.label", model: model.model_name.human)
end
else
args.first
end
end
end
def are_you_sure?
t('helpers.links.are_you_sure')
end
def list_open?
session[:list_id].present?
end
def no_content_given(model)
t('helpers.list.no_records')
end
end
View File
View File
+21
View File
@@ -0,0 +1,21 @@
class List
include SimplyStored::Couch
property :state
property :closed_at, type: Time
has_many :orders
belongs_to :table
has_and_belongs_to_many :users, storing_keys: true
validates :table_id, presence: true
def close!
self.state = 'closed'
self.closed_at = Time.now
save
end
def supplier
table.supplier
end
end
+9
View File
@@ -0,0 +1,9 @@
class Order
include SimplyStored::Couch
belongs_to :list
belongs_to :user
has_many :product_orders
has_many :products, through: :product_orders
end
+14
View File
@@ -0,0 +1,14 @@
class Product
include SimplyStored::Couch
property :name
property :code
property :price
belongs_to :product_category
belongs_to :supplier # direct! category is an aid
has_many :product_orders
validates :supplier_id, presence: true
end
+7
View File
@@ -0,0 +1,7 @@
class ProductCategory
include SimplyStored::Couch
property :name
belongs_to :supplier
has_many :products
end
+6
View File
@@ -0,0 +1,6 @@
class ProductOrder
include SimplyStored::Couch
belongs_to :product
belongs_to :order
end
+10
View File
@@ -0,0 +1,10 @@
class Supplier
include SimplyStored::Couch
property :name
has_many :lists
has_many :orders, through: :lists
has_many :products
has_many :product_categories
has_many :tables
end
+23
View File
@@ -0,0 +1,23 @@
class Table
include SimplyStored::Couch
property :number, type: Fixnum, default: 1
belongs_to :supplier
has_many :lists
validates :supplier_id, presence: true
#validates :list_id, presence: true
validates :number, numericality: {greater_than: 0}
view :active_lists, type: :custom, map_function: %|function(doc){
if(doc.ruby_class == 'List' && doc.state == 'active'){
emit(doc._id, 1);
}
}|, reduce_function: '_sum'
def occupied?
not self.class.database.view(self.class.active_lists(key: list_id, reduce: true)).zero?
end
end
+10
View File
@@ -0,0 +1,10 @@
class User
include SimplyStored::Couch
include Devise::Orm::SimplyStored
devise :database_authenticatable, :recoverable, :rememberable, :trackable
has_and_belongs_to_many :lists, storing_keys: false
has_many :orders
validates_uniqueness_of :email
end
@@ -0,0 +1,7 @@
-if target.errors.any?
#error_explanation
.errors-content
%h2= t('helpers.forms.errors.title', :count => target.errors.count)
%ul
- for message in target.errors.full_messages
%li= message
+15
View File
@@ -0,0 +1,15 @@
.page-header= title 'Home'
ul.nav.nav-tabs.nav-stacked
- if list_open?
li.active= link_to '&euro; 23,45'.html_safe, '#'
li= link_to 'Place order', '/show_products?supplier_id=' + active_list.supplier.id
li= link_to 'Active list', '#'
li= link_to 'Request bill', '#'
li= link_to 'I have a question', '#'
- else
li= link_to 'Place order', '/select_qrcode'
li= link_to 'Subscribe to list', '#'
ul.nav.nav-tabs.nav-stacked
li= link_to 'View history', '#'
@@ -0,0 +1,4 @@
.page-header= title 'Select Qr code'
ul
- for table in @tables
li= link_to image_tag(url_for(qrcode_table_path(table, format: :png))), {action: :create_list, table_id: table.id}
@@ -0,0 +1,17 @@
table#products-table.table.table-striped.table-hover
tbody
- content_for :footer do
javascript:
jQuery(function(){
$.get('#{product_list_supplier_path(@supplier, format: :json).html_safe}', function(res){
window.products = res
body = $('#products-table tbody')
for(category in window.products){
body.append('<tr><td><h3>'+category+'<h3></td></tr>')
for(iproduct in window.products[category]){
body.append('<tr><td>'+window.products[category][iproduct].name+'</td></tr>')
}
}
})
})
+68
View File
@@ -0,0 +1,68 @@
doctype html
html lang="en"
head
meta charset="utf-8"
meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"
meta name="viewport" content="width=device-width, initial-scale=1.0"
title= content_for?(:title) ? yield(:title) : "Qrammer"
= csrf_meta_tags
/! 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"
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"
link href="images/apple-touch-icon.png" rel="apple-touch-icon-precomposed"
link href="images/favicon.ico" rel="shortcut icon"
body
.navbar.navbar-fixed-top
.navbar-inner
.container
a.btn.btn-navbar data-target=".nav-collapse" data-toggle="collapse"
span.icon-bar
span.icon-bar
span.icon-bar
a.brand href=root_path Qrammer
.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 ProductCategory.model_name.human_plural, product_categories_path
.container
.content
- if flash[:alert].present?
.alert.alert-error
a.close data-dismiss="alert" &#215;
div= flash[:alert]
- if flash[:notice].present?
.alert.alert-success
a.close data-dismiss="alert" &#215;
div= flash[:notice]
.row
.span9
= yield
.span3
.well.sidebar-nav
h3 Sidebar
ul.nav.nav-list
li.nav-header Sidebar
li= link_to "Link 1", "/path1"
li= link_to "Link 2", "/path2"
li= link_to "Link 3", "/path3"
footer
p &copy; Companytools 2012
/!
Javascripts
\==================================================
/! Placed at the end of the document so the pages load faster
= javascript_include_tag "application"
= yield :footer
+18
View File
@@ -0,0 +1,18 @@
= form_for @list, html: {class: 'form-horizontal' } do |f|
= render 'error_messages', target: @list
.control-group class=(@list.errors[:state].any? ? 'error' : nil)
= f.label :state, class: 'control-label'
.controls
= f.text_field :state, class: 'text_field'
.control-group class=(@list.errors[:closed_at].any? ? 'error' : nil)
= f.label :closed_at, class: 'control-label'
.controls
= f.text_field :closed_at, class: 'text_field'
.control-group class=(@list.errors[:table_id].any? ? 'error' : nil)
= f.label :table_id, Table.model_name.human, class: 'control-label'
.controls
= f.select :table_id, options_for_select(@tables.map{|a| [a.number, a.id]}), include_blank: nil
.form-actions
= f.submit nil, class: 'btn btn-primary'
'
= link_to t("helpers.links.cancel"), lists_path, class: 'btn'
+4
View File
@@ -0,0 +1,4 @@
- model_class = List
.page-header
= title :edit, model_class
= render 'form'
+26
View File
@@ -0,0 +1,26 @@
- model_class = List
div.page-header= title :index, model_class
- if @lists.any?
table.table.table-striped
thead
tr
th= model_class.human_attribute_name(:state)
th= model_class.human_attribute_name(:closed_at)
th= Table.model_name.human
th= model_class.human_attribute_name(:created_at)
th=t 'helpers.actions'
tbody
- @lists.each do |list|
tr
td= link_to list.state, list
td= list.closed_at
td= link_to list.table.number, list.table
td=l list.created_at, format: :short
td
= link_to t('helpers.links.edit'), [:edit, list], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), list, 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_list_path, class: 'btn btn-primary'
+4
View File
@@ -0,0 +1,4 @@
- model_class = List
.page-header
= title :new, model_class
= render 'form'
+18
View File
@@ -0,0 +1,18 @@
- model_class = List
.page-header= title :show, @list
dl.dl-horizontal.show-list
dt= model_class.human_attribute_name(:state)
dd= @list.state
dt= model_class.human_attribute_name(:closed_at)
dd= @list.closed_at
- if @list.table.present?
dt= Table.model_name.human
dd= link_to @list.table.number, @list.table
.form-actions
= link_to t("helpers.links.back"), lists_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, @list], class: 'btn'
'
= link_to t("helpers.links.destroy"), @list, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
@@ -0,0 +1,14 @@
= form_for @product_category, html: {class: 'form-horizontal' } do |f|
= render 'error_messages', target: @product_category
.control-group class=(@product_category.errors[:name].any? ? 'error' : nil)
= f.label :name, class: 'control-label'
.controls
= f.text_field :name, class: 'text_field'
.control-group class=(@product_category.errors[:supplier_id].any? ? 'error' : nil)
= f.label :supplier_id, Supplier.model_name.human, class: 'control-label'
.controls
= f.select :supplier_id, options_for_select(@suppliers.map{|a| [a.name, a.id]}), include_blank: nil
.form-actions
= f.submit nil, class: 'btn btn-primary'
'
= link_to t("helpers.links.cancel"), product_categories_path, class: 'btn'
@@ -0,0 +1,4 @@
- model_class = ProductCategory
.page-header
= title :edit, model_class
= render 'form'
@@ -0,0 +1,24 @@
- model_class = ProductCategory
div.page-header= title :index, model_class
- if @product_categories.any?
table.table.table-striped
thead
tr
th= model_class.human_attribute_name(:name)
th= Supplier.model_name.human
th= model_class.human_attribute_name(:created_at)
th=t 'helpers.actions'
tbody
- @product_categories.each do |product_category|
tr
td= link_to product_category.name, product_category
td= link_to product_category.supplier.name, product_category.supplier
td=l product_category.created_at, format: :short
td
= link_to t('helpers.links.edit'), [:edit, product_category], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), product_category, 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_category_path, class: 'btn btn-primary'
@@ -0,0 +1,4 @@
- model_class = ProductCategory
.page-header
= title :new, model_class
= render 'form'
@@ -0,0 +1,15 @@
- model_class = ProductCategory
.page-header= title :show, @product_category
dl.dl-horizontal.show-list
dt= model_class.human_attribute_name(:name)
dd= @product_category.name
dt= Supplier.model_name.human
dd= link_to @product_category.supplier.name, @product_category.supplier
.form-actions
= link_to t("helpers.links.back"), product_categories_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, @product_category], class: 'btn'
'
= link_to t("helpers.links.destroy"), @product_category, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
+26
View File
@@ -0,0 +1,26 @@
= 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.select :product_category_id, options_for_select(@product_categories.map{|a| [a.name, a.id]}), 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.select :supplier_id, options_for_select(@suppliers.map{|a| [a.name, a.id]}), 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
@@ -0,0 +1,4 @@
- model_class = Product
.page-header
= title :edit, model_class
= render 'form'
+30
View File
@@ -0,0 +1,30 @@
- model_class = Product
div.page-header= title :index, model_class
- if @products.any?
table.table.table-striped
thead
tr
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= model_class.human_attribute_name(:created_at)
th=t 'helpers.actions'
tbody
- @products.each do |product|
tr
td= link_to product.name, product
td= product.code
td= product.price
td= link_to product.product_category.name, product.product_category
td= link_to product.supplier.name, product.supplier
td=l product.created_at, format: :short
td
= link_to t('helpers.links.edit'), [:edit, 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'
- else
= no_content_given model_class
= link_to t("helpers.links.new"), new_product_path, class: 'btn btn-primary'
+4
View File
@@ -0,0 +1,4 @@
- model_class = Product
.page-header
= title :new, model_class
= render 'form'
+23
View File
@@ -0,0 +1,23 @@
- 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'
+10
View File
@@ -0,0 +1,10 @@
= form_for @supplier, html: {class: 'form-horizontal' } do |f|
= render 'error_messages', target: @supplier
.control-group class=(@supplier.errors[:name].any? ? 'error' : nil)
= f.label :name, class: 'control-label'
.controls
= f.text_field :name, class: 'text_field'
.form-actions
= f.submit nil, class: 'btn btn-primary'
'
= link_to t("helpers.links.cancel"), suppliers_path, class: 'btn'
+4
View File
@@ -0,0 +1,4 @@
- model_class = Supplier
.page-header
= title :edit, model_class
= render 'form'
+22
View File
@@ -0,0 +1,22 @@
- 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(:name)
th= model_class.human_attribute_name(:created_at)
th=t 'helpers.actions'
tbody
- @suppliers.each do |supplier|
tr
td= link_to supplier.name, supplier
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
@@ -0,0 +1,4 @@
- model_class = Supplier
.page-header
= title :new, model_class
= render 'form'
+14
View File
@@ -0,0 +1,14 @@
- model_class = Supplier
.page-header
= title :show, @supplier
dl.dl-horizontal.show-list
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.edit'), [:edit, @supplier], class: 'btn'
'
= link_to t("helpers.links.destroy"), @supplier, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
+14
View File
@@ -0,0 +1,14 @@
= form_for @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'
.control-group class=(@table.errors[:supplier_id].any? ? 'error' : nil)
= f.label :supplier_id, Supplier.model_name.human, class: 'control-label'
.controls
= f.select :supplier_id, options_for_select(@suppliers.map{|a| [a.name, a.id]}), include_blank: nil
.form-actions
= f.submit nil, class: 'btn btn-primary'
'
= link_to t("helpers.links.cancel"), tables_path, class: 'btn'
+4
View File
@@ -0,0 +1,4 @@
- model_class = Table
.page-header
= title :edit, model_class
= render 'form'
+24
View File
@@ -0,0 +1,24 @@
- model_class = Table
div.page-header= title :index, model_class
- if @tables.any?
table.table.table-striped
thead
tr
th= model_class.human_attribute_name(:number)
th= Supplier.model_name.human
th= model_class.human_attribute_name(:created_at)
th=t 'helpers.actions'
tbody
- @tables.each do |table|
tr
td= link_to table.number, table
td= link_to table.supplier.name, 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.destroy"), 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'
+4
View File
@@ -0,0 +1,4 @@
- model_class = Table
.page-header
= title :new, model_class
= render 'form'
+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, @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'
+45
View File
@@ -0,0 +1,45 @@
= form_for @user, html: {class: 'form-horizontal' } do |f|
.control-group
= f.label :email, class: 'control-label'
.controls
= f.text_field :email, class: 'text_field'
.control-group
= f.label :encrypted_password, class: 'control-label'
.controls
= f.text_field :encrypted_password, class: 'text_field'
.control-group
= f.label :remember_token, class: 'control-label'
.controls
= f.text_field :remember_token, class: 'text_field'
.control-group
= f.label :remember_created_at, class: 'control-label'
.controls
= f.text_field :remember_created_at, class: 'text_field'
.control-group
= f.label :reset_password_token, class: 'control-label'
.controls
= f.text_field :reset_password_token, class: 'text_field'
.control-group
= f.label :sign_in_count, class: 'control-label'
.controls
= f.text_field :sign_in_count, class: 'text_field'
.control-group
= f.label :current_sign_in_at, class: 'control-label'
.controls
= f.text_field :current_sign_in_at, class: 'text_field'
.control-group
= f.label :last_sign_in_at, class: 'control-label'
.controls
= f.text_field :last_sign_in_at, class: 'text_field'
.control-group
= f.label :current_sign_in_ip, class: 'control-label'
.controls
= f.text_field :current_sign_in_ip, class: 'text_field'
.control-group
= 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
@@ -0,0 +1,4 @@
- model_class = User
.page-header
= title :edit, model_class
= render 'form'
+38
View File
@@ -0,0 +1,38 @@
- model_class = User
div class="page-header"= title :index, model_class
table class="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_token)
th= model_class.human_attribute_name(:remember_created_at)
th= model_class.human_attribute_name(:reset_password_token)
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(:created_at)
th=t 'helpers.actions'
tbody
- @users.each do |user|
tr
td= link_to user.email, user
td= user.encrypted_password
td= user.remember_token
td= user.remember_created_at
td= user.reset_password_token
td= user.sign_in_count
td= user.current_sign_in_at
td= user.last_sign_in_at
td= user.current_sign_in_ip
td= user.last_sign_in_ip
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.destroy"), user, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
= link_to t("helpers.links.new"), new_user_path, class: 'btn btn-primary'
+4
View File
@@ -0,0 +1,4 @@
- model_class = User
.page-header
= title :new, model_class
= render 'form'
+32
View File
@@ -0,0 +1,32 @@
- model_class = User
.page-header
= title :show, @user
dl.dl-horizontal.show-list
dt= model_class.human_attribute_name(:email) + ':'
dd= @user.email
dt= model_class.human_attribute_name(:encrypted_password) + ':'
dd= @user.encrypted_password
dt= model_class.human_attribute_name(:remember_token) + ':'
dd= @user.remember_token
dt= model_class.human_attribute_name(:remember_created_at) + ':'
dd= @user.remember_created_at
dt= model_class.human_attribute_name(:reset_password_token) + ':'
dd= @user.reset_password_token
dt= model_class.human_attribute_name(:sign_in_count) + ':'
dd= @user.sign_in_count
dt= model_class.human_attribute_name(:current_sign_in_at) + ':'
dd= @user.current_sign_in_at
dt= model_class.human_attribute_name(:last_sign_in_at) + ':'
dd= @user.last_sign_in_at
dt= model_class.human_attribute_name(:current_sign_in_ip) + ':'
dd= @user.current_sign_in_ip
dt= model_class.human_attribute_name(:last_sign_in_ip) + ':'
dd= @user.last_sign_in_ip
.form-actions
= link_to t("helpers.links.back"), users_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, @user], class: 'btn'
'
= link_to t("helpers.links.destroy"), @user, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'