Add supplier info popup

This commit is contained in:
2015-01-13 13:38:52 +01:00
parent a774b2fd90
commit 2f812ad52e
12 changed files with 68 additions and 24 deletions
@@ -1,4 +1,4 @@
Ember.Handlebars.helper 't', (path, params..., options)-> Ember.Handlebars.helper 't', (path, params..., options)->
text = t(path) text = t(path, options.hash)
tag = if options.hash.bare then text else "<span data-t='#{path}' data-t-attributes='{}'>#{text}</span>" tag = if options.hash.bare then text else "<span data-t='#{path}' data-t-attributes='#{JSON.stringify(options.hash)}'>#{text}</span>"
tag.htmlSafe() tag.htmlSafe()
@@ -12,6 +12,7 @@ App.ApplicationController = Ember.Controller.extend
showSupplierStatusInfo: -> showSupplierStatusInfo: ->
@modal 'supplier_status_info', @modal 'supplier_status_info',
model: @get('list.supplier') model: @get('list.supplier')
title_path: 'supplier_status_info.title'
openDebugger: -> openDebugger: ->
debugger debugger
@@ -3,6 +3,6 @@
.modal-header .modal-header
h3.flush--top= title h3.flush--top= title
hr hr
.modal-body .modal-body.clearfix
.modal-alert== alert_message .modal-alert== alert_message
= yield = yield
@@ -0,0 +1,13 @@
p== t 'supplier_status_info.header'
.row: .small-12.columns
.counter.supplier-orders-placed-count
= model.orders_placed_count
span.orders-placed-count-icon
= t 'supplier_status_info.orders_placed_count_explanation' count=model.orders_placed_count
.row: .small-12.columns
.counter.supplier-orders-in-process-count
= model.orders_in_process_count
span.orders-in-process-count-icon
= t 'supplier_status_info.orders_in_process_count_explanation' count=model.orders_in_process_count
hr
button.modal-confirm.right{action "close"}= t 'supplier_status_info.close'
@@ -6,6 +6,7 @@
#= require_self #= require_self
@Qstorage = localStorage @Qstorage = localStorage
$.extend($translations.en, <%= I18n.t('user', locale: :en).to_json %>); $.extend($translations.en, <%= I18n.t('user', locale: :en).to_json %>);
$.extend($translations.nl, <%= I18n.t('user', locale: :nl).to_json %>); $.extend($translations.nl, <%= I18n.t('user', locale: :nl).to_json %>);
@@ -55,11 +55,6 @@
//text-transform: lowercase //text-transform: lowercase
.supplier-name .supplier-name
display: inline-block display: inline-block
.supplier-orders-placed-count
display: inline-block
// margin-right: 15px
.supplier-orders-in-process-count
display: inline-block
.menu-list-item .menu-list-item
margin-left: 20px margin-left: 20px
cursor: pointer cursor: pointer
@@ -80,11 +75,17 @@
margin-left: 8px margin-left: 8px
@media #{$small-only} @media #{$small-only}
margin-left: 5px margin-left: 5px
.supplier-orders-placed-count
display: inline-block
// margin-right: 15px
.orders-placed-count-icon .orders-placed-count-icon
@extend .fa @extend .fa
@extend .fa-clock-o @extend .fa-clock-o
@extend .fa-lg @extend .fa-lg
margin-left: 3px margin-left: 3px
.supplier-orders-in-process-count
display: inline-block
.orders-in-process-count-icon .orders-in-process-count-icon
@extend .fa @extend .fa
@extend .fa-check @extend .fa-check
+8
View File
@@ -132,3 +132,11 @@ en:
with external parties. with external parties.
<br> <br>
footer: <br> footer: <br>
supplier_status_info:
title: "%{name} info"
header: |
The icons at the top right corner contain information about the place where you
are currently ordering. The number prefixed with &#35; is your table number.
orders_placed_count_explanation: "&nbsp; means that there are %{count} orders placed and not yet processing or finished"
orders_in_process_count_explanation: "&nbsp; means that there are %{count} orders currently processing"
close: Got it
+8
View File
@@ -132,3 +132,11 @@ nl:
horeca onderneming waar je wat bestelt. horeca onderneming waar je wat bestelt.
<br> <br>
footer: <br> footer: <br>
supplier_status_info:
title: "%{name} info"
header: |
De icoontjes rechtsboven geven informatie over de plek waar je aan het bestellen bent.
Het getal met &#35; is je tafelnummer.
orders_placed_count_explanation: "&nbsp; betekent dat er %{count} nog niet in behandeling of afgesloten bestellingen zijn"
orders_in_process_count_explanation: "&nbsp; betekent dat er %{count} bestellingen in behandeling zijn"
close: Got it
+3 -2
View File
@@ -3,7 +3,8 @@ Feature: A signed in uses sees supplier info in the top right corner
@javascript @javascript
Scenario: Clicking on the table number opens the supplier info popup Scenario: Clicking on the table number opens the supplier info popup
Given there is a confirmed and open supplier Given there is a confirmed and open supplier
And there is a facebook user And I am signed in as a user
And the user has an active order And the user has an active order
When the user clicks on the table number info in the top right corner When I am on the user homepage
And the user clicks on the table number info in the top right corner
Then the user sees the supplier information popup Then the user sees the supplier information popup
@@ -7,20 +7,6 @@ step "the list is marked as in need of payment" do
@list.needs_payment! @list.needs_payment!
end end
step "the user has an active list with a/an :order_status order" do |order_status|
@list = create :list, supplier: @supplier, table: @table, user_ids: [@user.id]
@product ||= create :product, supplier: @supplier, name: 'Beer', price: 2.34
@order = create :order, order_status.to_sym, supplier: @supplier, list: @list, user: @user
@product_order = create :product_order, order: @order, product: @product, quantity: 2, price: 2.34
@user.reload
@user.active_list_id = @list.id
@user.save
case order_status.to_sym
when :placed then @supplier.increment_orders_placed_count!
when :active then @supplier.increment_orders_in_process_count!
end
end
step "the list changes to another table" do step "the list changes to another table" do
@list.move_to_table! @other_table @list.move_to_table! @other_table
end end
@@ -113,3 +113,19 @@ step "the user has an older list for the same supplier" do
@older_list = create :list, supplier: @supplier, table: @table, user_ids: [@user.id] @older_list = create :list, supplier: @supplier, table: @table, user_ids: [@user.id]
end end
step "the user has an active list with a/an :order_status order" do |order_status|
@list = create :list, supplier: @supplier, table: @table, user_ids: [@user.id]
@product_category ||= create :product_category, supplier: @supplier
@product ||= create :product, supplier: @supplier, name: 'Beer', price: 2.34, product_category: @product_category
@order = create :order, order_status.to_sym, supplier: @supplier, list: @list, user: @user
@product_order = create :product_order, order: @order, product: @product, quantity: 2, price: 2.34
@user.reload
@user.active_list_id = @list.id
@user.save
case order_status.to_sym
when :placed then @supplier.increment_orders_placed_count!
when :active then @supplier.increment_orders_in_process_count!
end
end
@@ -0,0 +1,9 @@
step "the user clicks on the table number info in the top right corner" do
find('.top-menu .table-number').click
end
step "the user sees the supplier information popup" do
within '.modal' do
page.should have_content @supplier.name
end
end