end of day commit

This commit is contained in:
2012-08-28 20:08:13 +02:00
parent 0b16614d41
commit 89700f36e9
43 changed files with 896 additions and 26 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

+159
View File
@@ -0,0 +1,159 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="365.19299"
height="356.44772"
id="svg2"
version="1.1"
inkscape:version="0.48.1 r9760"
sodipodi:docname="Yeni belge 1">
<title
id="title4033">Dining table</title>
<defs
id="defs4">
<filter
inkscape:collect="always"
id="filter3919"
x="-0.00602814"
width="1.0120564"
y="-1.2853113"
height="3.5706227"
color-interpolation-filters="sRGB">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="0.90633735"
id="feGaussianBlur3921" />
</filter>
<filter
inkscape:collect="always"
id="filter3933"
x="-0.0060926909"
width="1.0121855"
y="-0.39438713"
height="1.7887743"
color-interpolation-filters="sRGB">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="0.38549602"
id="feGaussianBlur3935" />
</filter>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.35355339"
inkscape:cx="21.876736"
inkscape:cy="553.42146"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1209"
inkscape:window-height="830"
inkscape:window-x="238"
inkscape:window-y="0"
inkscape:window-maximized="0" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>Dining table</dc:title>
<dc:date>17.02.2012</dc:date>
<dc:creator>
<cc:Agent>
<dc:title>Ozer Kavak</dc:title>
</cc:Agent>
</dc:creator>
<dc:publisher>
<cc:Agent>
<dc:title>http://www.nestingo.com</dc:title>
</cc:Agent>
</dc:publisher>
<dc:source>http://www.nestingo.com/masa-sandalye/masalar/14-mutfak-masasi-efes7070.html</dc:source>
<dc:subject>
<rdf:Bag>
<rdf:li>wood</rdf:li>
<rdf:li>dining</rdf:li>
<rdf:li>table</rdf:li>
</rdf:Bag>
</dc:subject>
<dc:description>Based on wooden dining table NestinGo - Efes7070 at: http://www.nestingo.com/masa-sandalye/masalar/14-mutfak-masasi-efes7070.html</dc:description>
<dc:contributor>
<cc:Agent>
<dc:title>Ozer Kavak</dc:title>
</cc:Agent>
</dc:contributor>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-8.4314067,-682.84287)">
<path
sodipodi:nodetypes="cssssccc"
inkscape:connector-curvature="0"
id="path3895"
d="m 266.93607,1033.075 -0.27679,4.143 c -0.0831,1.2444 -0.73616,2.0726 -1.98332,2.0726 l -147.36316,0 c -1.24716,0 -1.91591,-0.9612 -1.98332,-2.2065 l -0.20978,-3.8752 c 2.75643,0.3347 148.50327,-0.4083 151.81641,-0.1339 z"
style="fill:#000000;fill-opacity:1;stroke:none" />
<path
style="fill:#4d4d4d;fill-opacity:1;stroke:none"
d="m 125.34632,959.52917 131.36316,0 c 1.24716,0 2.11204,1.01181 2.25118,2.25117 l 8,71.25906 c 0.13914,1.2394 -1.00402,2.2512 -2.25118,2.2512 l -147.36316,0 c -1.24716,0 -2.39032,-1.0118 -2.25118,-2.2512 l 8,-71.25906 c 0.13914,-1.23936 1.00402,-2.25117 2.25118,-2.25117 z"
id="rect3892"
inkscape:connector-curvature="0"
sodipodi:nodetypes="sssssssss" />
<path
style="fill:#808080;fill-opacity:1;stroke:none;filter:url(#filter3933)"
d="m 266.95416,1033.075 c -0.007,0.4056 -0.16782,1.7977 -1.37623,2.175 l -148.81525,0 c -1.22062,-0.5054 -1.71465,-1.29 -1.65646,-2.3252 2.9774,0.019 148.50327,-0.1242 151.81641,0.1502 z"
id="path3931"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccc" />
<rect
style="fill:#1a1a1a;fill-opacity:1;stroke:none"
id="rect3890"
width="31.470152"
height="230.70157"
x="175.29283"
y="771.20813"
ry="3.855947"
rx="2.5253813" />
<path
style="fill:#ad751d;fill-opacity:1;stroke:none"
d="m 59.808785,682.84299 266.578125,2.8e-4 c 0.53593,0.0101 0.71238,0.23311 0.94457,0.52239 l 43.69642,75.19161 -359.999995,0 48.68005,-75.66108 c 0.0235,-0.0411 0.0629,-0.0548 0.10083,-0.0532 z"
id="rect3117"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccc" />
<path
sodipodi:nodetypes="ccccccccc"
inkscape:connector-curvature="0"
id="path3888"
d="m 10.966865,777.55727 359.999995,0 c 0.284,-0.21068 0.55237,-0.48385 0.52387,-1.00703 l -0.0328,-16.74297 -0.58577,-1.36049 -359.771365,-0.0234 -0.53572,1.51786 0.0216,16.60685 c -0.0139,0.38327 0.11284,0.89154 0.38019,1.00918 z"
style="fill:#975e30;fill-opacity:1;stroke:none" />
<path
style="fill:#ffccaa;fill-opacity:1;stroke:none;filter:url(#filter3919)"
d="m 10.734915,760.01479 359.939105,0.11735 0.65014,-0.18628 0.12503,-0.26486 -0.5542,-1.23422 -359.849495,-0.007 -0.36289,0.77507 c -0.18907,0.29674 0.0317,0.54177 0.0523,0.7996 z"
id="path3917"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1021 B

+1
View File
@@ -12,6 +12,7 @@
//
//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require twitter/bootstrap
//= require_directory .
//= require_self
@@ -0,0 +1,54 @@
root = exports ? this
root.Qsupplier=
move_table_to_active_section: (table_id)->
table_container = $('#section-table-'+table_id)
section_container = $('.section-tables-active')
section_container.append(table_container)
Qsupplier.position_table_in_active_section(section_container, table_container)
position_table_in_active_section: (section_container, table_container)->
button_container = table_container.find('.action-button-container')
button_container.html('')
button_container.append($('<button class="btn btn-warning btn-mini">x</button>').click( -> Qsupplier.move_table_to_inactive_section(table_container.data('table-id')) ))
position_x = parseFloat(table_container.data('position-x'))
position_y = parseFloat(table_container.data('position-y'))
table_container.css('left', section_container.width()*position_x/current_section_width)
table_container.css('top', section_container.height()*position_y/current_section_height)
#TODO place element at 0.0 if it happens to be outside the region
table_container.show()
table_container.draggable(
containment: section_container,
stop: ->
position_x = current_section_width * $(this).position().left / section_container.width()
position_y = current_section_height * $(this).position().top / section_container.height()
table_container.data('position-x', position_x)
table_container.data('position-y', position_y)
$.ajax(
type: 'PUT',
url: '/supplier/tables/'+table_container.data('table-id'),
data: {table: {position_x: position_x, position_y: position_y}},
dataType: 'json'
)
)
#TODO make ajax call safe
$.ajax(
type: 'PUT',
url: '/supplier/tables/'+table_container.data('table-id'),
data: {table: {section_id: current_section_id}},
dataType: 'json'
)
move_table_to_inactive_section: (table_id)->
table_container = $('#section-table-'+table_id)
table_container.css('left', 'auto')
table_container.css('top', 'auto')
section_container = $('.section-tables-inactive')
section_container.prepend(table_container)
button_container = table_container.find('.action-button-container')
button_container.html('')
button_container.append($('<button class="btn btn-primary btn-mini">+</button>').click( -> Qsupplier.move_table_to_active_section(table_container.data('table-id')) ))
#TODO make ajax call safe
$.ajax(
type: 'PUT',
url: '/supplier/tables/'+table_container.data('table-id'),
data: {table: {section_id: ''}},
dataType: 'json'
)
@@ -3,6 +3,8 @@ table
th
&.currency
text-align: right
&.numeric
text-align: right
tbody
td
&.status-icons
@@ -11,3 +11,28 @@ body
margin-top: 4px
margin-bottom: 6px
padding-bottom: 0
.section-tables-container
.section-table
background-color: #ccc
height: 44px
background-repeat: no-repeat
width: 45px
background-image: image-url('icons/section-table.png')
.table-number
margin-top: -45px
.action-button-container
margin-right: -20px
&.section-tables-active
position: relative
padding: 0
height: 400px
background-image: image-url('textures/wood4.jpg')
.section-table
position: absolute
cursor: move
&.section-tables-inactive
.section-table
margin-top: 10px
margin-bottom: 30px
float: left
margin-right: 30px
+4
View File
@@ -5,6 +5,10 @@ class DashboardController < ApplicationController
end
def demo_both
end
# Testing action
def select_qrcode
@tables = Table.all
+90
View File
@@ -0,0 +1,90 @@
class SectionsController < ApplicationController
before_filter :set_relation_options, only: [:new, :edit, :create, :update]
# GET /sections
# GET /sections.json
def index
@sections = Section.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @sections }
end
end
# GET /sections/1
# GET /sections/1.json
def show
@section = Section.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @section }
end
end
# GET /sections/new
# GET /sections/new.json
def new
@section = Section.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @section }
end
end
# GET /sections/1/edit
def edit
@section = Section.find(params[:id])
end
# POST /sections
# POST /sections.json
def create
@section = Section.new(params[:section])
respond_to do |format|
if @section.save
format.html { redirect_to @section, notice: t('action.create.successfull', model: Section.model_name.human) }
format.json { render json: @section, status: :created, location: @section }
else
format.html { render action: "new" }
format.json { render json: @section.errors, status: :unprocessable_entity }
end
end
end
# PUT /sections/1
# PUT /sections/1.json
def update
@section = Section.find(params[:id])
respond_to do |format|
if @section.update_attributes(params[:section])
format.html { redirect_to @section, notice: t('action.update.successfull', model: Section.model_name.human) }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @section.errors, status: :unprocessable_entity }
end
end
end
# DELETE /sections/1
# DELETE /sections/1.json
def destroy
@section = Section.find(params[:id])
@section.destroy
respond_to do |format|
format.html { redirect_to sections_url, notice: t('action.destroy.successfull', model: Section.model_name.human) }
format.json { head :no_content }
end
end
private
def set_relation_options
@suppliers = Supplier.all
end
end
@@ -0,0 +1,6 @@
module Suppliers
class ApplicationController < ::ApplicationController
layout 'tablet'
end
end
@@ -0,0 +1,87 @@
module Suppliers
class SectionsController < Suppliers::ApplicationController
# GET /sections
# GET /sections.json
def index
@sections = current_supplier.sections
respond_to do |format|
format.html # index.html.erb
format.json { render json: @sections }
end
end
# GET /sections/1
# GET /sections/1.json
def show
@section = Section.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @section }
end
end
# GET /sections/new
# GET /sections/new.json
def new
@section = Section.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @section }
end
end
# GET /sections/1/edit
def edit
@section = Section.find(params[:id])
end
# POST /sections
# POST /sections.json
def create
@section = Section.new(params[:section])
@section.supplier = current_supplier
respond_to do |format|
if @section.save
format.html { redirect_to [:suppliers, @section], notice: t('action.create.successfull', model: Section.model_name.human) }
format.json { render json: @section, status: :created, location: @section }
else
format.html { render action: "new" }
format.json { render json: @section.errors, status: :unprocessable_entity }
end
end
end
# PUT /sections/1
# PUT /sections/1.json
def update
@section = Section.find(params[:id])
respond_to do |format|
if @section.update_attributes(params[:section])
format.html { redirect_to [:suppliers, @section], notice: t('action.update.successfull', model: Section.model_name.human) }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @section.errors, status: :unprocessable_entity }
end
end
end
# DELETE /sections/1
# DELETE /sections/1.json
def destroy
@section = Section.find(params[:id])
@section.destroy
respond_to do |format|
format.html { redirect_to suppliers_sections_url, notice: t('action.destroy.successfull', model: Section.model_name.human) }
format.json { head :no_content }
end
end
end
end
@@ -0,0 +1,89 @@
module Suppliers
class TablesController < Suppliers::ApplicationController
# GET /tables
# GET /tables.json
def index
@tables = current_supplier.tables
respond_to do |format|
format.html # index.html.erb
format.json { render json: @tables }
end
end
# GET /tables/1
# GET /tables/1.json
def show
@table = Table.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @table }
end
end
# GET /tables/new
# GET /tables/new.json
def new
@table = Table.new
@table.section_id = params[:section_id].presence
respond_to do |format|
format.html # new.html.erb
format.json { render json: @table }
end
end
# GET /tables/1/edit
def edit
@table = Table.find(params[:id])
end
# POST /tables
# POST /tables.json
def create
@table = Table.new(params[:table])
@table.supplier = current_supplier
respond_to do |format|
if @table.save
format.html { redirect_to [:suppliers, @table.section || @table], notice: t('action.create.successfull', model: Table.model_name.human) }
format.json { render json: @table, status: :created, location: @table }
else
format.html { render action: "new" }
format.json { render json: @table.errors, status: :unprocessable_entity }
end
end
end
# PUT /tables/1
# PUT /tables/1.json
def update
@table = Table.find(params[:id])
respond_to do |format|
if @table.update_attributes(params[:table])
format.html { redirect_to [:suppliers, @table], notice: t('action.update.successfull', model: Table.model_name.human) }
format.json { head :no_content }
format.js { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @table.errors, status: :unprocessable_entity }
format.js { head :no_content }
end
end
end
# DELETE /tables/1
# DELETE /tables/1.json
def destroy
@table = Table.find(params[:id])
@table.destroy
respond_to do |format|
format.html { redirect_to suppliers_tables_url, notice: t('action.destroy.successfull', model: Table.model_name.human) }
format.json { head :no_content }
end
end
end
end
+40
View File
@@ -0,0 +1,40 @@
class Section
include SimplyStored::Couch
property :title
property :path, type: Array, default: []
belongs_to :supplier
has_many :tables
attr_protected :supplier_id
validates :supplier_id, presence: true
def width
self.path.last.try(:first).to_f - self.path.first.try(:first).to_f
end
def height
self.path.last.try(:last).to_f - self.path.first.try(:last).to_f
end
def width=(val)
val = val.to_f
self.path[0] ||= [0.0, 0.0]
self.path[1] ||= [0.0, 0.0]
unless path[1][0] == val
self.path[1][0] = val
path_will_change!
end
end
def height=(val)
val = val.to_f
self.path[0] ||= [0.0, 0.0]
self.path[1] ||= [0.0, 0.0]
unless path[1][1] == val
self.path[1][1] = val
path_will_change!
end
end
end
+13
View File
@@ -10,6 +10,9 @@ class Supplier
has_many :tables, dependent: :destroy
#has_many :lists, through: :tables
has_many :orders
has_many :sections, dependent: :destroy
after_create :add_section_on_create
def active_orders
return @active_orders if @active_orders
@@ -31,4 +34,14 @@ class Supplier
tables
end
def non_placed_tables
tables.reject{|t| t.section_id.present? }
end
private
def add_section_on_create
@section = Section.create supplier: self, title: I18n.t('section.first_section_title')
end
end
+10
View File
@@ -2,13 +2,19 @@ class Table
include SimplyStored::Couch
property :number, type: Fixnum, default: 1
property :position_x, type: Float
property :position_y, type: Float
belongs_to :supplier
belongs_to :section
has_many :lists
attr_protected :supplier_id
validates :supplier_id, presence: true
#validates :list_id, presence: true
validates :number, numericality: {greater_than: 0}
validates_uniqueness_of :number
view :active_lists, type: :custom, map_function: %|function(doc){
if(doc.ruby_class == 'List' && doc.state == 'active'){
@@ -20,4 +26,8 @@ class Table
not self.class.database.view(self.class.active_lists(key: id, reduce: true)).zero?
end
def name
number
end
end
+5
View File
@@ -0,0 +1,5 @@
.phone-wrapper
iframe.phone-content-frame src=user_root_path
.tablet-wrapper
iframe.tablet-content-frame src=supplier_root_path
+2 -5
View File
@@ -1,5 +1,2 @@
.phone-wrapper
iframe.phone-content-frame src=user_root_path
.tablet-wrapper
iframe.tablet-content-frame src=supplier_root_path
.page-header
h1 Home
+4
View File
@@ -32,6 +32,8 @@ html lang="en"
ul.nav#top-navigation-list
li= link_to t('supplier.menu.active_orders', orders: Order.model_name.human_plural), supplier_active_orders_path
li= link_to t('supplier.menu.active_lists', lists: List.model_name.human_plural), supplier_active_lists_path
li= link_to Section.model_name.human_plural, suppliers_sections_path
li= link_to Table.model_name.human_plural, suppliers_tables_path
.container.nav-collapse
.container
@@ -48,6 +50,8 @@ html lang="en"
.row
.span12
= content_for?(:content) ? yield(:content) : yield
- if content_for?(:row)
.row= yield :row
/!
Javascripts
\==================================================
+18
View File
@@ -0,0 +1,18 @@
= form_for @section, html: {class: 'form-horizontal' } do |f|
= render 'error_messages', target: @section
.control-group class=(@section.errors[:title].any? ? 'error' : nil)
= f.label :title, class: 'control-label'
.controls
= f.text_field :title, class: 'text_field'
.control-group class=(@section.errors[:path].any? ? 'error' : nil)
= f.label :path, class: 'control-label'
.controls
= f.text_field :path, class: 'text_field'
.control-group class=(@section.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"), sections_path, class: 'btn'
+4
View File
@@ -0,0 +1,4 @@
- model_class = Section
.page-header
= title :edit, model_class
= render 'form'
+26
View File
@@ -0,0 +1,26 @@
- model_class = Section
.page-header= title :index, model_class
- if @sections.any?
table.table.table-striped
thead
tr
th= model_class.human_attribute_name(:title)
th= model_class.human_attribute_name(:path)
th= Supplier.model_name.human
th= model_class.human_attribute_name(:created_at)
th=t 'helpers.actions'
tbody
- @sections.each do |section|
tr
td= link_to section.title, section
td= section.path
td= link_to_if section.supplier.present?, section.supplier.try(:name), section.supplier
td=l section.created_at, format: :short
td
= link_to t('helpers.links.edit'), [:edit, section], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), section, 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_section_path, class: 'btn btn-primary'
+4
View File
@@ -0,0 +1,4 @@
- model_class = Section
.page-header
= title :new, model_class
= render 'form'
+18
View File
@@ -0,0 +1,18 @@
- model_class = Section
.page-header= title :show, @section
dl.dl-horizontal.show-list
dt= model_class.human_attribute_name(:title)
dd= @section.title
dt= model_class.human_attribute_name(:path)
dd= @section.path
- if @section.supplier.present?
dt= Supplier.model_name.human
dd= link_to @section.supplier.name, @section.supplier
.form-actions
= link_to t("helpers.links.back"), sections_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, @section], class: 'btn'
'
= link_to t("helpers.links.destroy"), @section, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
@@ -0,0 +1,18 @@
= form_for [:suppliers, @section], html: {class: 'form-horizontal' } do |f|
= render 'error_messages', target: @section
.control-group class=(@section.errors[:title].any? ? 'error' : nil)
= f.label :title, class: 'control-label'
.controls
= f.text_field :title, class: 'text_field'
.control-group class=(@section.errors[:width].any? ? 'error' : nil)
= f.label :width, class: 'control-label'
.controls
= f.text_field :width, class: ['text_field', :numeric]
.control-group class=(@section.errors[:height].any? ? 'error' : nil)
= f.label :height, class: 'control-label'
.controls
= f.text_field :height, class: ['text_field', :numeric]
.form-actions
= f.submit nil, class: 'btn btn-primary'
'
= link_to t("helpers.links.cancel"), suppliers_sections_path, class: 'btn'
@@ -0,0 +1,4 @@
- model_class = Section
.page-header
= title :edit, model_class
= render 'form'
@@ -0,0 +1,25 @@
- model_class = Section
.page-header= title :index, model_class
- if @sections.any?
table.table.table-striped
thead
tr
th.link= model_class.human_attribute_name(:title)
th.numeric= model_class.human_attribute_name(:width)
th.numeric= model_class.human_attribute_name(:height)
th.timestamp= model_class.human_attribute_name(:created_at)
th.actions=t 'helpers.actions'
tbody
- @sections.each do |section|
tr
td.link= link_to section.title, [:suppliers, section]
td.numeric= section.width
td.numeric= section.height
td.timestamp=l section.created_at, format: :short
td.actions
= link_to t('helpers.links.edit'), [:edit, :suppliers, section], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), [:suppliers, section], 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_suppliers_section_path, class: 'btn btn-primary'
@@ -0,0 +1,4 @@
- model_class = Section
.page-header
= title :new, model_class
= render 'form'
@@ -0,0 +1,41 @@
- model_class = Section
.page-header= title :show, @section
.form-actions
= link_to t("helpers.links.back"), suppliers_sections_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, :suppliers, @section], class: 'btn'
'
= link_to t("helpers.links.destroy"), [:suppliers, @section], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
- content_for :row do
ul.nav.nav-pills
- for section in @section.supplier.sections
li class=(section == @section ? 'active' : nil) = link_to section.title, [:suppliers, section]
.span9
.well.section-tables-container.section-tables-active
- for table in @section.tables
.section-table.hide{ id="section-table-#{table.id}" data-position-x=table.position_x data-position-y=table.position_y data-table-id=table.id}
.pull-right.action-button-container
= link_to table.number, [:suppliers, table], class: 'btn btn-mini table-number'
.span3
h3= t('table.has_no_section')
.well.section-tables-container.section-tables-inactive
- for table in @section.supplier.non_placed_tables
.section-table{ id="section-table-#{table.id}" data-position-x=table.position_x data-position-y=table.position_y data-table-id=table.id}
.pull-right.action-button-container
button.btn.btn-primary.btn-mini onClick="Qsupplier.move_table_to_active_section('#{table.id}')" +
= link_to table.number, [:suppliers, table], class: 'btn btn-mini table-number'
.clearfix
- content_for :footer do
javascript:
var current_section_id = '#{@section.id}';
var current_section_width = #{@section.width};
var current_section_height = #{@section.height};
$(function(){
var active_section_container = $('.section-tables-active')
active_section_container.css('width', active_section_container.width()); // break fluid layout
active_section_container.css('height', #{@section.height/@section.width}*active_section_container.width());
active_section_container.find('.section-table').each(function(){
Qsupplier.position_table_in_active_section(active_section_container, $(this));
});
});
@@ -0,0 +1,14 @@
= form_for [:suppliers, @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[:section_id].any? ? 'error' : nil)
= f.label :section_id, Supplier.model_name.human, class: 'control-label'
.controls
= f.collection_select :section_id, current_supplier.sections, :id, :title, include_blank: "[#{t('table.has_no_section')}]"
.form-actions
= f.submit nil, class: 'btn btn-primary'
'
= link_to t("helpers.links.cancel"), tables_path, class: 'btn'
@@ -0,0 +1,4 @@
- model_class = Table
.page-header
= title :edit, model_class
= render 'form'
@@ -0,0 +1,24 @@
- model_class = Table
div.page-header= title :index, model_class
- if @tables.any?
table.table.table-striped
thead
tr
th.link= model_class.human_attribute_name(:number)
th.link= Section.model_name.human
th.timestamp= model_class.human_attribute_name(:created_at)
th.actions=t 'helpers.actions'
tbody
- @tables.each do |table|
tr
td.link= link_to table.number, [:suppliers, table]
td.link= link_to_if table.section.present?, table.section.try(:title), [:suppliers, table.section]
td.timestamp=l table.created_at, format: :short
td.actions
= link_to t('helpers.links.edit'), [:edit, :suppliers, table], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), [:suppliers, 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_suppliers_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.section.present?
dt= Section.model_name.human
dd= link_to @table.section.title, [:suppliers, @table.section]
.form-actions
= link_to t("helpers.links.back"), suppliers_tables_path, class: 'btn'
'
= link_to t('helpers.links.edit'), [:edit, :suppliers, @table], class: 'btn'
'
= link_to t("helpers.links.destroy"), [:suppliers, @table], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
+1 -1
View File
@@ -1,5 +1,5 @@
- model_class = User
div.page-header= title :index, model_class
.page-header= title :index, model_class
- if @users.any?
table.table.table-striped
thead