From 901c9ac5c8a950e11fe9fde412e9612a6758ecca Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Wed, 28 May 2014 17:26:47 +0200 Subject: [PATCH] Mace moving table in supplier main board work and specced --- .../javascripts/supplier/app/models/list.js.coffee | 2 +- .../supplier/app/templates/active_list.emblem | 2 +- .../supplier/app/templates/active_order.emblem | 2 +- .../app/templates/active_order_table_number.emblem | 2 +- .../javascripts/supplier/app/templates/section.emblem | 6 ++---- .../supplier/foundation1/_qsections.css.sass | 10 ++++++++++ .../supplier/foundation1/application.css.sass | 1 + app/models/list.rb | 2 +- app/models/user.rb | 2 +- app/serializers/supplier_extended_list_serializer.rb | 2 +- spec/acceptance_steps/suppliers/main_board_steps.rb | 8 +++++--- wip.md | 9 +++++++++ 12 files changed, 34 insertions(+), 14 deletions(-) diff --git a/app/assets/javascripts/supplier/app/models/list.js.coffee b/app/assets/javascripts/supplier/app/models/list.js.coffee index 1a9521c8..9b4dc95b 100644 --- a/app/assets/javascripts/supplier/app/models/list.js.coffee +++ b/app/assets/javascripts/supplier/app/models/list.js.coffee @@ -9,7 +9,7 @@ Qsupplier.App.List = DS.Model.extend has_active_orders: attr 'boolean' price: attr 'number' closed_at: DS.attr('date') - table_number: attr 'number' + #table_number: attr 'number' table: DS.belongsTo('table', inverse: 'active_list') #users: DS.hasMany('user', inverse: 'active_list') orders: DS.hasMany('order') diff --git a/app/assets/javascripts/supplier/app/templates/active_list.emblem b/app/assets/javascripts/supplier/app/templates/active_list.emblem index ca6271ff..c9fd1c00 100644 --- a/app/assets/javascripts/supplier/app/templates/active_list.emblem +++ b/app/assets/javascripts/supplier/app/templates/active_list.emblem @@ -4,7 +4,7 @@ td.status-icons if view.content.needs_payment | span.icon.needs-payment -td.numeric.table_number {{view.content.table_number}} +td.numeric.table_number {{view.content.table.number}} td.section_title {{view.content.section.title}} td.currency.total_list_amount {{currency view.content.price}} td.actions diff --git a/app/assets/javascripts/supplier/app/templates/active_order.emblem b/app/assets/javascripts/supplier/app/templates/active_order.emblem index 94198146..ef441622 100644 --- a/app/assets/javascripts/supplier/app/templates/active_order.emblem +++ b/app/assets/javascripts/supplier/app/templates/active_order.emblem @@ -3,7 +3,7 @@ td.status-icons td {{view.content.display}} td.numeric.table_number view Qsupplier.App.ActiveOrderTableNumberView contextBinding="view.content" -td.section_title {{view.content.section.title}} +td.section_title {{view.content.list.section.title}} td.currency {{currency view.content.total }} td.actions if view.content.placed diff --git a/app/assets/javascripts/supplier/app/templates/active_order_table_number.emblem b/app/assets/javascripts/supplier/app/templates/active_order_table_number.emblem index 22eb4302..e48c45c9 100644 --- a/app/assets/javascripts/supplier/app/templates/active_order_table_number.emblem +++ b/app/assets/javascripts/supplier/app/templates/active_order_table_number.emblem @@ -1,3 +1,3 @@ -.number= list.table_number +.number= list.table.number .extra-list-info img.spinner src="/assets/spinner.gif" alt="" diff --git a/app/assets/javascripts/supplier/app/templates/section.emblem b/app/assets/javascripts/supplier/app/templates/section.emblem index 61f4d8a5..29e986e1 100644 --- a/app/assets/javascripts/supplier/app/templates/section.emblem +++ b/app/assets/javascripts/supplier/app/templates/section.emblem @@ -29,10 +29,8 @@ view Ember.TextField valueBinding="width" class="dimension section-edit-width-field" span x view Ember.TextField valueBinding="height" class="dimension section-edit-height-field" - a.btn.btn-mini.section-normal-mode-button{ action finishEditable } - span.icon-ok + a.section-normal-mode-button{ action finishEditable }: span else - a.btn.btn-mini.section-edit-mode-button{ action makeEditable } - span.icon-pencil + a.section-edit-mode-button{ action makeEditable }: span each table in tables view 'Qsupplier.App.SectionTableView' contentBinding="table" diff --git a/app/assets/stylesheets/supplier/foundation1/_qsections.css.sass b/app/assets/stylesheets/supplier/foundation1/_qsections.css.sass index e69de29b..b0b28a61 100644 --- a/app/assets/stylesheets/supplier/foundation1/_qsections.css.sass +++ b/app/assets/stylesheets/supplier/foundation1/_qsections.css.sass @@ -0,0 +1,10 @@ +.section-edit-mode-button + span + @extend .fa + @extend .fa-lg + @extend .fa-edit +.section-normal-mode-button + span + @extend .fa + @extend .fa-lg + @extend .fa-save diff --git a/app/assets/stylesheets/supplier/foundation1/application.css.sass b/app/assets/stylesheets/supplier/foundation1/application.css.sass index 8f859b6e..0fd94b43 100644 --- a/app/assets/stylesheets/supplier/foundation1/application.css.sass +++ b/app/assets/stylesheets/supplier/foundation1/application.css.sass @@ -11,6 +11,7 @@ @import ./qforms @import ./menu_main @import ./menu_side +@import ./qsections @import ./product_categories @import ./products_preview @import ./qtables diff --git a/app/models/list.rb b/app/models/list.rb index 89a3c6d1..8aa1f527 100644 --- a/app/models/list.rb +++ b/app/models/list.rb @@ -211,7 +211,7 @@ class List end # user performs a client side refresh broadcast_users 'list_changed_table', list_id: id #, from_table_id: from_table, to_table_id: to_table.id - broadcast_supplier supplier_id, 'list_changed_table', list: as_json, section_title: to_table.section.try(:title), from_table_id: from_table + broadcast_supplier supplier_id, 'list_changed_table', ListSerializer.new(list).as_json end end diff --git a/app/models/user.rb b/app/models/user.rb index a58a9cbe..f90ed362 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -47,7 +47,7 @@ class User end def self.from_omniauth(auth) - binding.pry + #binding.pry end def list_is_closed! diff --git a/app/serializers/supplier_extended_list_serializer.rb b/app/serializers/supplier_extended_list_serializer.rb index f8eba15f..71b7247d 100644 --- a/app/serializers/supplier_extended_list_serializer.rb +++ b/app/serializers/supplier_extended_list_serializer.rb @@ -2,7 +2,7 @@ class SupplierExtendedListSerializer < Qwaiter::Serializer # user ids for facebook pictures embed :ids, include: true root 'list' - attributes :state, :needs_help, :needs_payment, :user_requests_closing, :is_paid, :price, :table_id, :table_number, :section_id, :supplier_id, :closed_at #, :has_active_orders + attributes :state, :needs_help, :needs_payment, :user_requests_closing, :is_paid, :price, :table_id, :section_id, :supplier_id, :closed_at #, :has_active_orders #def has_active_orders #object.has_active_orders? diff --git a/spec/acceptance_steps/suppliers/main_board_steps.rb b/spec/acceptance_steps/suppliers/main_board_steps.rb index c5f83a9b..72009ae9 100644 --- a/spec/acceptance_steps/suppliers/main_board_steps.rb +++ b/spec/acceptance_steps/suppliers/main_board_steps.rb @@ -128,15 +128,17 @@ step "I click on the section main board section jumper" do end step "the active list changes to another table in another section" do - @other_section = create :section, supplier: @supplier + @other_section = create :section, supplier: @supplier, title: 'New Section' @other_table = create :table, section: @other_section, supplier: @supplier, number: 65 @list.move_to_table! @other_table end step "the supplier main board table number should be updated to the new table number" do - binding.pry + expect( find(".list-row-#{@list.id} .table_number").text ).to eq "65" + expect( find(".order-row-#{@list.orders.first.id} .table_number").text ).to eq "65" end step "the supplier main board section name should be updated to the new section" do - + expect( find(".list-row-#{@list.id} .section_title").text ).to eq "New Section" + expect( find(".order-row-#{@list.orders.first.id} .section_title").text ).to eq "New Section" end diff --git a/wip.md b/wip.md index a9990921..7535aefa 100644 --- a/wip.md +++ b/wip.md @@ -20,6 +20,11 @@ Release - Add list link - List - Translate and prettify got to lists link helpers.links.index + - Section table view + - click on table side menu buttons + - Do not show side menu if there is no active list + - Edit mode section is out of order and styling + - Add border around a section - Settings - html structure - styling @@ -35,6 +40,10 @@ Release - lists#show goto list button better - side menu cleaner +General: +- search for class btn and replace with font awesome correct styling if + needed + Post release ------------