From 89700f36e9ffbc0890e283733706ac261393b3cd Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Tue, 28 Aug 2012 20:08:13 +0200 Subject: [PATCH] end of day commit --- Models.dia | Bin 3530 -> 3955 bytes app/assets/images/icons/section-table.png | Bin 0 -> 1037 bytes app/assets/images/icons/section-table.svg | 159 ++++++++++++++++++ app/assets/images/textures/wood1.jpg | Bin 0 -> 2780 bytes app/assets/images/textures/wood2.jpg | Bin 0 -> 2519 bytes app/assets/images/textures/wood3.jpg | Bin 0 -> 1358 bytes app/assets/images/textures/wood4.jpg | Bin 0 -> 1021 bytes app/assets/javascripts/application.js | 1 + app/assets/javascripts/qsupplier.js.coffee | 54 ++++++ app/assets/stylesheets/structure.css.sass | 2 + .../stylesheets/tablet/structure.css.sass | 25 +++ app/controllers/dashboard_controller.rb | 4 + app/controllers/sections_controller.rb | 90 ++++++++++ .../suppliers/application_controller.rb | 6 + .../suppliers/sections_controller.rb | 87 ++++++++++ .../suppliers/tables_controller.rb | 89 ++++++++++ app/models/section.rb | 40 +++++ app/models/supplier.rb | 13 ++ app/models/table.rb | 10 ++ app/views/dashboard/demo_both.html.slim | 5 + app/views/dashboard/home.html.slim | 7 +- app/views/layouts/tablet.html.slim | 4 + app/views/sections/_form.html.slim | 18 ++ app/views/sections/edit.html.slim | 4 + app/views/sections/index.html.slim | 26 +++ app/views/sections/new.html.slim | 4 + app/views/sections/show.html.slim | 18 ++ app/views/suppliers/sections/_form.html.slim | 18 ++ app/views/suppliers/sections/edit.html.slim | 4 + app/views/suppliers/sections/index.html.slim | 25 +++ app/views/suppliers/sections/new.html.slim | 4 + app/views/suppliers/sections/show.html.slim | 41 +++++ app/views/suppliers/tables/_form.html.slim | 14 ++ app/views/suppliers/tables/edit.html.slim | 4 + app/views/suppliers/tables/index.html.slim | 24 +++ app/views/suppliers/tables/new.html.slim | 4 + app/views/suppliers/tables/show.html.slim | 16 ++ app/views/users/index.html.slim | 2 +- config/locales/en.yml | 5 + config/routes.rb | 34 ++-- .../themed/templates/index.html.slim | 14 +- spec/factories/section_factory.rb | 5 + spec/models/section_spec.rb | 42 +++++ 43 files changed, 896 insertions(+), 26 deletions(-) create mode 100644 app/assets/images/icons/section-table.png create mode 100644 app/assets/images/icons/section-table.svg create mode 100644 app/assets/images/textures/wood1.jpg create mode 100644 app/assets/images/textures/wood2.jpg create mode 100644 app/assets/images/textures/wood3.jpg create mode 100644 app/assets/images/textures/wood4.jpg create mode 100644 app/assets/javascripts/qsupplier.js.coffee create mode 100644 app/controllers/sections_controller.rb create mode 100644 app/controllers/suppliers/application_controller.rb create mode 100644 app/controllers/suppliers/sections_controller.rb create mode 100644 app/controllers/suppliers/tables_controller.rb create mode 100644 app/models/section.rb create mode 100644 app/views/dashboard/demo_both.html.slim create mode 100644 app/views/sections/_form.html.slim create mode 100644 app/views/sections/edit.html.slim create mode 100644 app/views/sections/index.html.slim create mode 100644 app/views/sections/new.html.slim create mode 100644 app/views/sections/show.html.slim create mode 100644 app/views/suppliers/sections/_form.html.slim create mode 100644 app/views/suppliers/sections/edit.html.slim create mode 100644 app/views/suppliers/sections/index.html.slim create mode 100644 app/views/suppliers/sections/new.html.slim create mode 100644 app/views/suppliers/sections/show.html.slim create mode 100644 app/views/suppliers/tables/_form.html.slim create mode 100644 app/views/suppliers/tables/edit.html.slim create mode 100644 app/views/suppliers/tables/index.html.slim create mode 100644 app/views/suppliers/tables/new.html.slim create mode 100644 app/views/suppliers/tables/show.html.slim create mode 100644 spec/factories/section_factory.rb create mode 100644 spec/models/section_spec.rb diff --git a/Models.dia b/Models.dia index c3269c3a92bff3bffa193f6e08e24cd5e4957477..8b46d74c83cdc275f7b04bee31f51f8da0f35033 100644 GIT binary patch literal 3955 zcmZ|SWmFRk+Xryz5Cma3K$?LA$uS8jNw*QgDCv-zbTgzux}@|bq(NeWpn!D4q(Mqz zNOvQn-`nTQ`=0Zj=lY#pK!whz{|&UpK`p}dPSW~vyN?il?{av& z@XVq{M$=BhfcSU$$L#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RDZDOi=C4mxYel4o%zbW0*GsR{&S>PFPmS$Ns43VJ$%C{Tp-3 zdB>AXS0{LzylxK5Nl#14Sbml(z9vnUl|f^0_u98cWItqZUC=T5pXb?!lv434V+$AVIJnZCpn9gqwp`C8JkBF1q>`pE=sz`8Cy=-aITz1OFstt zM3d4x8LTWmt9=;{a7|zYw29NhqzX~|tU$f|0#DRE7dhr-l&Te~*F`8V;`ygrE>?UP z4AaYxxHlgK$e)~}G%DN041AIK`(sVUMHZUk z*g)tlhv<~By8}ta7Xq)hiRh$351Pv}X?VAW+1gP9F0?|YiF)Fb_^RwiU&VZ&wnK4VpYQ+RwJw6SV;?>5KYF;@ro#q{%pm6XEE!gs1p#6`D!G6#P`IJ`T4 zK^^~r#%HS(v2c}IzFd*@y-`#tR<7X^%e{>A0XERd`y9#W2XZHEmh0XXb_NJ<`YZnj z^kuUsctX}^LI*)b#6=ZqsZ1VBcDR4Xs-p+L1VE^YXATGJa$Ks3#Cl==Nzm92mD-Hz zKj!WlwqC=hap89?r|$LSaN5bwQAsVeF;*>)>EzKdt<})zT|GD?EzZux%3ISRllA5c zsc0$B(XwnDxKc}T`tU;YYsBg6g9CTo(txR9aBZE7A}|WsLE>B*$oVZ)p1U7 zzi-~&+09>mUjJ4|uOxB|pXwGE_(D2by4jDDxVmLgje{Je`IDO9KhDch_3rE5V^G^* zJY@F*+^u>zn3W=7LLjha5|PD3nB^7aR8>(Tl!+`k9ypnw=VMp;hwW3n^1v`Gh@XD z{on^#8%4#(T4x%ob3G{DsBO~xcWGB$rFdUT1Udxi#@*?ft!#MO_eF=#_d0eKMl;lC z_*1cAM$_QZLn4Wf`~GfreTl07S^3wGYjzgFn^O~@(g<AZLC$p)s)X9s$3S@|gs`B&3j&C74mF5j(7(`xHl<6Zye-FRe8D4t~ ePzpLb99?^P{II~Heh7PZIqX);>Px=!=l%l^Lf6;; diff --git a/app/assets/images/icons/section-table.png b/app/assets/images/icons/section-table.png new file mode 100644 index 0000000000000000000000000000000000000000..a757154c2e28fa83cd12d284cd64c16a417e276a GIT binary patch literal 1037 zcmeAS@N?(olHy`uVBq!ia0vp^xgcyqV(DCY@~pSgg}Zy zGD~t&8C){+GV{_EN)nTDQrF&9x(bvP1j#yG^ue`MLVJiN%S!#ff<-i8+<2U|vpQk-njcZf7vQc{}9UDn%o z?p2*W5Hqc4u|fiOPJBev?>F2G24z*NFYE9y@K`Lk-_O`!7Up+8_(U#4*|E6C2Yhy9 zNzGWz-EEheYpj=eqTKiW>~Pis&Fq<+AAFOl4jC}&8b&Jon)!&Om=38X#(UvjX zzig`fgYQ$my!~iD<@D3vE+!S-hM$YJ-;VX)?DlB;@hyv&hAza76#tsXt-cz^Xdx~C z-A4cZ%aX3Zn3W-af>wSpRy;aAZ1q-+;M-FopX^%4P+*(6S3pTloKfWQXNEb&vEe3C zy#<$k1--qPx7~Zfo(GC&>MPaUysUT*2OGVdBdA@z`v9 + + + + Dining table + + + + + + + + + + + + + image/svg+xml + + Dining table + 17.02.2012 + + + Ozer Kavak + + + + + http://www.nestingo.com + + + http://www.nestingo.com/masa-sandalye/masalar/14-mutfak-masasi-efes7070.html + + + wood + dining + table + + + Based on wooden dining table NestinGo - Efes7070 at: http://www.nestingo.com/masa-sandalye/masalar/14-mutfak-masasi-efes7070.html + + + Ozer Kavak + + + + + + + + + + + + + + + diff --git a/app/assets/images/textures/wood1.jpg b/app/assets/images/textures/wood1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e0f2d683e837f4747b08328016b53868a6bad338 GIT binary patch literal 2780 zcmbu+c{tSj9tZH>7_wEzo^UjlWE)$e>`P-AYEZV3gF*H++hB4idt^BcLpk=bYZzOq zLl_3-W;b?bh$uvMb9K*s&V8Qy*M08!e4g)L-_Q5`Jg?7}K2DzlIN%1x1^@^I0HD(b z=qG@Nz6DJ8F2X_$;^qSN^mlcGgeb}>KqP}7c=)pEvaz2IG;jb6ATXGL5zNHI$ap%9IlTuMIhnXb6m`#Vn>#U!2Jk3Frx&n@ z=@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sW@94B4T4X3 zJXN;DBgOQ{Z1eoQ3QBR;rH}`-PsEL^n5qTQFXDu~bUgf5p8(#{-z)5@SZw4Kne2iB zo|HKj`%6dgr_<0`|VEQhLXpK-g+#x4cTil(e3LU%e8efp6K&*k6W{*HGY zA%{}ns&;-6$koxwn+%AmTW%VosoyFoeV1Ehg;6@y;B1_e&Yn@Ug_!xfQee*9a;Nru zw*;ZmC=!NY#oRvbhu8ZgGz=G$TAe2wt`dC~!Kso}=#?nths!kD@}Abax^IWG`#A#r zb(AnK^OsGj3oL7Ls6SNEDP6-{VR717vP(f&grnkV-CJH^ zWAG=SB*PbV)bh+A9Y;r~-{%WTNLg$M0ogz*Ivaj(sKC<0acJR{N!hN7B{kI!S68CK zq#;wYWRIE>b49C~8#mPSa=opr@Tn#ByS@qQz+(~@vyW@%GVab_j(PuEMq3)8dLm(tBG&c@klghKGO!)W<23ZW zL^zSFV>9wt`&Cz`;8NR999^RD*1!VcRRpvR9Lr2)C{<0eYaE)kFD-sCQd?<`$(k)g z?ai9n6gIRrL~Y-ao+Kf2rChfbl98(1GW$k&Y2-NSCI3igS2b3I@o?LHHA%#H_60K zy^M)!PHslIpf5-N=6f%rdkHv?Ckia9=?RiPLrK%{8(3Xj9?+qv_pP>>1&*Blfl zf6r|-tMv>B9U-q*7#kRCt&?|0XPo@ByTa)}+mWi8Lj!U;s<+aRuohn|*F-2=9wQxw9H=t#+HdFp z?%L4Rl}j8W<8{Zm?Y9~dotjtUp^wrtr*@PFIE-k@ZgRBlP+jM}P4h-ET!NR}t#m-5g?x#BJ8Tc6D1bH&qMgp}4x;}jIkNVoI0LqNy z=4~3eBdQC=zaOvP27bOR{A_UV4eoci6{=4zx(3ISVWoeZ9ysA27L|QwzrKgLjK^Gm iZ~o*49azst|D3MvOr+9*ZsN}aM_X{o!qztW#6JOpll8R# literal 0 HcmV?d00001 diff --git a/app/assets/images/textures/wood2.jpg b/app/assets/images/textures/wood2.jpg new file mode 100644 index 0000000000000000000000000000000000000000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^Zbs*zQ>YOC#22I=U;Bp#c=7K zCF^+uH-G--bA0icd%hX|x-pRo;GSP6@j_}GbUEZRIZrlhaPKR4j$tv3l4=Ka#xp^t z){tdAkZ(7*Or9mXW)yy|I{~!LniZ7R)|W08ay>;dvkWJOnZgQphF?vo}{f zLQTEf^9u7NhuXXzf`%8}q@q=CbL!QL1X)HovD;p^P)KSuEb(&MC2W|TSb+$!<%_8VBqS7ZA zyZRrqf4(bud%JbLXtwFrBkk`&zZZ#xS)+mL>1x9%J{EgZ7LPk*kYz(8bj%Vu2+@n$ z5p<4}l5T7=rextoS&4<(qdP|k{20CT=L?Q3 z%qR2x4#JGJb(LUpIFOleC&9l#wE>+)?JRDJWhMTk7<^@4ZtF49m2Jo z&gdOLCH902r&eBJ9`{uM-saj<%d)YyWzjuZhGETdp!)kI{;^aBh{Ad|(!iP@Y_wQ5g5Q~w z1AJP&sDc?iDbopNGl)M}^J-m8+E(j7F!`e88W-YDW$ZWbfgIll@ongWuUDv&g=&d( zd-naQa-Hs3$|?2?{DNh$8OoJV0hwCp& zL1jOX4;;Rb!pm#LzVQn4%nyLBh1TM;9YYQx;G(Kk2OnKWd7H_AI3;CpS=cllLrK*m zPG@-9Q}Kb668k5%Go}5{@(=%*yPLOUa)Z+AgKDe{K7%;yA4fctNsByk udArnp+`dSTr8_{~wT6E#=_V~Mb@kTarB8I$`a|n{=%-GYSE`jMp8o@{AZ9H9 literal 0 HcmV?d00001 diff --git a/app/assets/images/textures/wood3.jpg b/app/assets/images/textures/wood3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a77b45aace3cc43756c74f6503cb1755ae44e365 GIT binary patch literal 1358 zcmex=^(PF6}rMnOeST|r4lSw=>~TvNxu(8R<lI!ycvzVZmLzXK7m*~u1dE&yorse}|x0b$cSNdou%6I4D>GT)N zKC+3q-|Rl8v~XI+^A1+g&tcxDoLJi=a-zzWC+%G3ecCMTvO3?Yt0$&q>v;q|U$~TY zTlz*WtIp^viU-(QekOYUc(^~H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%|_mM@xYpr)aOS&*hI5=Qyhmw@Y%g z6v|k>c4vM384}`5Z1xO-kU&N-85x11ujkIZ(*XgUe{_FkPuIS@Jt@iT^6TCE=4W=! zS_J~T^t!h($ literal 0 HcmV?d00001 diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 8819730e..4dbf3ebb 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -12,6 +12,7 @@ // //= require jquery //= require jquery_ujs +//= require jquery-ui //= require twitter/bootstrap //= require_directory . //= require_self diff --git a/app/assets/javascripts/qsupplier.js.coffee b/app/assets/javascripts/qsupplier.js.coffee new file mode 100644 index 00000000..a205f602 --- /dev/null +++ b/app/assets/javascripts/qsupplier.js.coffee @@ -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($('').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($('').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' + ) diff --git a/app/assets/stylesheets/structure.css.sass b/app/assets/stylesheets/structure.css.sass index 89ce440d..13699164 100644 --- a/app/assets/stylesheets/structure.css.sass +++ b/app/assets/stylesheets/structure.css.sass @@ -3,6 +3,8 @@ table th &.currency text-align: right + &.numeric + text-align: right tbody td &.status-icons diff --git a/app/assets/stylesheets/tablet/structure.css.sass b/app/assets/stylesheets/tablet/structure.css.sass index e2a448ee..75dfc0e6 100644 --- a/app/assets/stylesheets/tablet/structure.css.sass +++ b/app/assets/stylesheets/tablet/structure.css.sass @@ -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 diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 59ebb86a..f2e427f6 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -5,6 +5,10 @@ class DashboardController < ApplicationController end + + def demo_both + end + # Testing action def select_qrcode @tables = Table.all diff --git a/app/controllers/sections_controller.rb b/app/controllers/sections_controller.rb new file mode 100644 index 00000000..400a7e0e --- /dev/null +++ b/app/controllers/sections_controller.rb @@ -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 diff --git a/app/controllers/suppliers/application_controller.rb b/app/controllers/suppliers/application_controller.rb new file mode 100644 index 00000000..9440529a --- /dev/null +++ b/app/controllers/suppliers/application_controller.rb @@ -0,0 +1,6 @@ +module Suppliers + class ApplicationController < ::ApplicationController + layout 'tablet' + + end +end diff --git a/app/controllers/suppliers/sections_controller.rb b/app/controllers/suppliers/sections_controller.rb new file mode 100644 index 00000000..e13ef6af --- /dev/null +++ b/app/controllers/suppliers/sections_controller.rb @@ -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 diff --git a/app/controllers/suppliers/tables_controller.rb b/app/controllers/suppliers/tables_controller.rb new file mode 100644 index 00000000..73cfe474 --- /dev/null +++ b/app/controllers/suppliers/tables_controller.rb @@ -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 diff --git a/app/models/section.rb b/app/models/section.rb new file mode 100644 index 00000000..08f05ad5 --- /dev/null +++ b/app/models/section.rb @@ -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 diff --git a/app/models/supplier.rb b/app/models/supplier.rb index d7f17b4f..89f834db 100644 --- a/app/models/supplier.rb +++ b/app/models/supplier.rb @@ -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 diff --git a/app/models/table.rb b/app/models/table.rb index ec0d0d64..5042c97a 100644 --- a/app/models/table.rb +++ b/app/models/table.rb @@ -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 diff --git a/app/views/dashboard/demo_both.html.slim b/app/views/dashboard/demo_both.html.slim new file mode 100644 index 00000000..83590aa8 --- /dev/null +++ b/app/views/dashboard/demo_both.html.slim @@ -0,0 +1,5 @@ +.phone-wrapper +iframe.phone-content-frame src=user_root_path + +.tablet-wrapper +iframe.tablet-content-frame src=supplier_root_path diff --git a/app/views/dashboard/home.html.slim b/app/views/dashboard/home.html.slim index 83590aa8..efa0e27d 100644 --- a/app/views/dashboard/home.html.slim +++ b/app/views/dashboard/home.html.slim @@ -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 diff --git a/app/views/layouts/tablet.html.slim b/app/views/layouts/tablet.html.slim index de96211b..223ae452 100644 --- a/app/views/layouts/tablet.html.slim +++ b/app/views/layouts/tablet.html.slim @@ -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 \================================================== diff --git a/app/views/sections/_form.html.slim b/app/views/sections/_form.html.slim new file mode 100644 index 00000000..f7566f60 --- /dev/null +++ b/app/views/sections/_form.html.slim @@ -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' diff --git a/app/views/sections/edit.html.slim b/app/views/sections/edit.html.slim new file mode 100644 index 00000000..3499adda --- /dev/null +++ b/app/views/sections/edit.html.slim @@ -0,0 +1,4 @@ +- model_class = Section +.page-header + = title :edit, model_class += render 'form' diff --git a/app/views/sections/index.html.slim b/app/views/sections/index.html.slim new file mode 100644 index 00000000..55b82051 --- /dev/null +++ b/app/views/sections/index.html.slim @@ -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' + diff --git a/app/views/sections/new.html.slim b/app/views/sections/new.html.slim new file mode 100644 index 00000000..0838474a --- /dev/null +++ b/app/views/sections/new.html.slim @@ -0,0 +1,4 @@ +- model_class = Section +.page-header + = title :new, model_class += render 'form' diff --git a/app/views/sections/show.html.slim b/app/views/sections/show.html.slim new file mode 100644 index 00000000..c4eca468 --- /dev/null +++ b/app/views/sections/show.html.slim @@ -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' diff --git a/app/views/suppliers/sections/_form.html.slim b/app/views/suppliers/sections/_form.html.slim new file mode 100644 index 00000000..f87b8bd5 --- /dev/null +++ b/app/views/suppliers/sections/_form.html.slim @@ -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' diff --git a/app/views/suppliers/sections/edit.html.slim b/app/views/suppliers/sections/edit.html.slim new file mode 100644 index 00000000..3499adda --- /dev/null +++ b/app/views/suppliers/sections/edit.html.slim @@ -0,0 +1,4 @@ +- model_class = Section +.page-header + = title :edit, model_class += render 'form' diff --git a/app/views/suppliers/sections/index.html.slim b/app/views/suppliers/sections/index.html.slim new file mode 100644 index 00000000..ba31fbcd --- /dev/null +++ b/app/views/suppliers/sections/index.html.slim @@ -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' diff --git a/app/views/suppliers/sections/new.html.slim b/app/views/suppliers/sections/new.html.slim new file mode 100644 index 00000000..0838474a --- /dev/null +++ b/app/views/suppliers/sections/new.html.slim @@ -0,0 +1,4 @@ +- model_class = Section +.page-header + = title :new, model_class += render 'form' diff --git a/app/views/suppliers/sections/show.html.slim b/app/views/suppliers/sections/show.html.slim new file mode 100644 index 00000000..300033ab --- /dev/null +++ b/app/views/suppliers/sections/show.html.slim @@ -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)); + }); + }); diff --git a/app/views/suppliers/tables/_form.html.slim b/app/views/suppliers/tables/_form.html.slim new file mode 100644 index 00000000..67a124f6 --- /dev/null +++ b/app/views/suppliers/tables/_form.html.slim @@ -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' diff --git a/app/views/suppliers/tables/edit.html.slim b/app/views/suppliers/tables/edit.html.slim new file mode 100644 index 00000000..0f403e2a --- /dev/null +++ b/app/views/suppliers/tables/edit.html.slim @@ -0,0 +1,4 @@ +- model_class = Table +.page-header + = title :edit, model_class += render 'form' diff --git a/app/views/suppliers/tables/index.html.slim b/app/views/suppliers/tables/index.html.slim new file mode 100644 index 00000000..769f4c47 --- /dev/null +++ b/app/views/suppliers/tables/index.html.slim @@ -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' + diff --git a/app/views/suppliers/tables/new.html.slim b/app/views/suppliers/tables/new.html.slim new file mode 100644 index 00000000..e30c254c --- /dev/null +++ b/app/views/suppliers/tables/new.html.slim @@ -0,0 +1,4 @@ +- model_class = Table +.page-header + = title :new, model_class += render 'form' diff --git a/app/views/suppliers/tables/show.html.slim b/app/views/suppliers/tables/show.html.slim new file mode 100644 index 00000000..9969c9c0 --- /dev/null +++ b/app/views/suppliers/tables/show.html.slim @@ -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' diff --git a/app/views/users/index.html.slim b/app/views/users/index.html.slim index 669c9c8f..686c150f 100644 --- a/app/views/users/index.html.slim +++ b/app/views/users/index.html.slim @@ -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 diff --git a/config/locales/en.yml b/config/locales/en.yml index c570e8ab..93d85b16 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -33,6 +33,7 @@ en: successfull: '%{model} is successfully destroyed' table: is_occupied: This table is occupied + has_no_section: "Not placed" activemodel: models: user: User @@ -42,6 +43,7 @@ en: product: Product order: Order product_category: Product category + section: Section plural: user: Users supplier: Restaurants @@ -50,6 +52,7 @@ en: product: Products order: Orders product_category: Product categories + section: Sections attributes: product: price: Price @@ -65,3 +68,5 @@ en: show_products: # The title gets products: Product.model_name.human_plural that can be used: e.g.: Showing %{products} title: Menu + section: + first_section_title: Room diff --git a/config/routes.rb b/config/routes.rb index 8cef3713..1fff0649 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,22 +1,24 @@ Qrammer::Application.routes.draw do devise_for :users devise_for :suppliers - resources :users - resources :tables do - member do - get :qrcode + authenticate :supplier do + resources :users + resources :tables do + member do + get :qrcode + end end - end - resources :orders do - member do - post :is_being_processed - post :is_delivered + resources :orders do + member do + post :is_being_processed + post :is_delivered + end end + resources :suppliers + resources :lists + resources :products + resources :product_categories end - resources :suppliers - resources :lists - resources :products - resources :product_categories get '/supplier' => 'supplier#home', as: :supplier_root get '/supplier/active_orders' => 'supplier#active_orders', as: :supplier_active_orders @@ -43,6 +45,12 @@ Qrammer::Application.routes.draw do match '/show_products' => 'dashboard#show_products', as: :user_products + namespace :suppliers, path: '/supplier' do + resources :sections + resources :tables + root to: 'sections#index' + end + match "/:action", controller: 'dashboard' # The priority is based upon order of creation: diff --git a/lib/generators/bootstrap/themed/templates/index.html.slim b/lib/generators/bootstrap/themed/templates/index.html.slim index e32c195d..3371ae83 100644 --- a/lib/generators/bootstrap/themed/templates/index.html.slim +++ b/lib/generators/bootstrap/themed/templates/index.html.slim @@ -1,5 +1,5 @@ - model_class = <%= resource_name.classify %> -div.page-header= title :index, model_class +.page-header= title :index, model_class - if @<%= plural_resource_name %>.any? table.table.table-striped thead @@ -10,22 +10,22 @@ div.page-header= title :index, model_class <%- belongs_to_associations.each do |association| -%> th= <%= association.options[:class_name] %>.model_name.human <%- end -%> - th= model_class.human_attribute_name(:created_at) - th=t 'helpers.actions' + th.timestamp= model_class.human_attribute_name(:created_at) + th.actions=t 'helpers.actions' tbody - @<%= plural_resource_name %>.each do |<%= resource_name %>| tr <%- columns.each.with_index do |column, index| -%> <%- if index.zero? -%> - td= link_to <%= resource_name %>.<%= column.name %>, <%= resource_name %> + td.link= link_to <%= resource_name %>.<%= column.name %>, <%= resource_name %> <%- else -%> td= <%= resource_name %>.<%= column.name %> <%- end end -%> <%- belongs_to_associations.each do |association| -%> - td= link_to_if <%= resource_name %>.<%= association.name %>.present?, <%= resource_name %>.<%= association.name %>.try(:<%= association.name_property %>), <%= resource_name %>.<%= association.name %> + td.link= link_to_if <%= resource_name %>.<%= association.name %>.present?, <%= resource_name %>.<%= association.name %>.try(:<%= association.name_property %>), <%= resource_name %>.<%= association.name %> <%- end -%> - td=l <%= resource_name %>.created_at, format: :short - td + td.timestamp=l <%= resource_name %>.created_at, format: :short + td.actions = link_to t('helpers.links.edit'), [:edit, <%= resource_name %>], class: 'btn btn-mini' ' = link_to t("helpers.links.destroy"), <%= resource_name %>, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger' diff --git a/spec/factories/section_factory.rb b/spec/factories/section_factory.rb new file mode 100644 index 00000000..ff8ab951 --- /dev/null +++ b/spec/factories/section_factory.rb @@ -0,0 +1,5 @@ +FactoryGirl.define do + factory :section do + association :supplier + end +end diff --git a/spec/models/section_spec.rb b/spec/models/section_spec.rb new file mode 100644 index 00000000..44327820 --- /dev/null +++ b/spec/models/section_spec.rb @@ -0,0 +1,42 @@ +require 'spec_helper' + +describe :section do + before :each do + @section = build :section + end + + describe :path do + describe :width do + it "should have zero width when initialized" do + Section.new.width.should be_zero + end + it "should have new width when it is defined using a setter" do + @section.width = 3.2 + @section.width.should == 3.2 + end + it "should persist width property through database" do + @section.width = 3.2 + @section.save + @reloaded_section = Section.find(@section.id) + @reloaded_section.width.should == 3.2 + end + end + describe :height do + it "should have zero height when initialized" do + Section.new.height.should be_zero + end + it "should have new height when it is defined using a setter" do + @section.height = 3.2 + @section.height.should == 3.2 + end + it "should persist height property through database" do + @section.height = 3.2 + @section.save + @reloaded_section = Section.find(@section.id) + @reloaded_section.height.should == 3.2 + end + + end + end + +end