Add supplier info popup

This commit is contained in:
2015-02-13 12:37:01 +01:00
parent 9176b6ac9b
commit de3f2f7cae
17 changed files with 133 additions and 99 deletions
@@ -24,3 +24,7 @@ App.ApplicationController = Ember.Controller.extend
markSupplierOpen: -> markSupplierOpen: ->
return unless supplier = @get('supplier') return unless supplier = @get('supplier')
supplier.open_the_place() supplier.open_the_place()
showSupplierStatusInfo: ->
@modal 'supplier_status_info',
model: @get('supplier')
title_path: 'supplier_status_info.title'
@@ -7,14 +7,15 @@
translation_params = {} translation_params = {}
if model = @get('model') if model = @get('model')
translation_params = model.serialize() if model.serialize translation_params = model.serialize() if model.serialize
return new Ember.Handlebars.SafeString(tspan(@title_path, translation_params)) if @title_path
return tspan(@title_path, translation_params).htmlSafe() if @title_path
# return translated title_path if directly set by options # return translated title_path if directly set by options
return new Ember.Handlebars.SafeString(tspan(@get('modal_options.title_path'), translation_params)) if @get('modal_options.title_path') return tspan(@get('modal_options.title_path'), translation_params).htmlSafe() if @get('modal_options.title_path')
# infer title path based on controller name App.modals.AddSectionController => add_section # infer title path based on controller name App.modals.AddSectionController => add_section
underscored = `this.constructor.toString().substr(11).replace(/Controller$/, '').underscore()` underscored = `this.constructor.toString().substr(11).replace(/Controller$/, '').underscore()`
# find translated title or humanize the controller name # find translated title or humanize the controller name
if convention_translation = ttry("modal.#{underscored}.title", translation_params) if convention_translation = ttry("modal.#{underscored}.title", translation_params)
new Ember.Handlebars.SafeString(tspan(@get("modal.#{underscored}.title"), translation_params)) tspan(@get("modal.#{underscored}.title"), translation_params).htmlSafe()
else else
underscored.capitalize().replace(/_/, ' ') underscored.capitalize().replace(/_/, ' ')
).property('model.id') ).property('model.id')
@@ -1,4 +1,5 @@
= partial "global/top_menu" = partial "global/top_menu"
= partial "global/side_menu"
.main-section= outlet .main-section= outlet
= view flash_message = view flash_message
= outlet modal = outlet modal
@@ -0,0 +1,11 @@
aside.side-menu
ul
li.title: h3 Menu
li.supplier-name= supplier.name
if supplier.open
li: a.supplier-close-shop{action "markSupplierClosed"}= t 'supplier.close_for_orders'
else
li: a.supplier-open-shop{action "markSupplierOpen"}= t 'supplier.open_for_orders'
= link-to "settings" class="supplier-settings-link"
= t 'supplier.settings'
li class="supplier-sign-out-link": a{action "signOut"}= t 'supplier.sign_out'
@@ -13,7 +13,7 @@ header.top-menu
= t 'models.plural.table' = t 'models.plural.table'
= link-to "lists" class="top-menu-lists" = link-to "lists" class="top-menu-lists"
= t 'models.plural.list' = t 'models.plural.list'
.extra-info .extra-info{action "showSupplierStatusInfo"}
.supplier-info-row .supplier-info-row
.counter.supplier-orders-placed-count .counter.supplier-orders-placed-count
span.supplier-orders-placed-count-number= supplier.orders_placed_count span.supplier-orders-placed-count-number= supplier.orders_placed_count
@@ -22,14 +22,3 @@ header.top-menu
.counter.supplier-orders-in-process-count .counter.supplier-orders-in-process-count
span.supplier-orders-in-process-count-number= supplier.orders_in_process_count span.supplier-orders-in-process-count-number= supplier.orders_in_process_count
span.orders-in-process-count-icon span.orders-in-process-count-icon
aside.side-menu
ul
li.title: h3 Menu
li.supplier-name= supplier.name
if supplier.open
li: a.supplier-close-shop{action "markSupplierClosed"}= t 'supplier.close_for_orders'
else
li: a.supplier-open-shop{action "markSupplierOpen"}= t 'supplier.open_for_orders'
= link-to "settings" class="supplier-settings-link"
= t 'supplier.settings'
li class="supplier-sign-out-link": a{action "signOut"}= t 'supplier.sign_out'
@@ -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,7 +6,7 @@
tr tr
th=t 'attributes.table.number' th=t 'attributes.table.number'
th.link=t 'models.section' th.link=t 'models.section'
th.timestamp= t 'attributes.table.created_at' /th.timestamp= t 'attributes.table.created_at'
th.actions=t 'helpers.actions.title' th.actions=t 'helpers.actions.title'
tbody tbody
each table in tables each table in tables
@@ -16,8 +16,11 @@
if table.section if table.section
= link-to 'section' table.section = link-to 'section' table.section
= table.section.title = table.section.title
td.numeric=time table.created_at /td.timestamp=time table.created_at
td.actions td.actions
a.table-edit{ action 'editTable' table }: span a.table-edit{ action 'editTable' table }: span
a.table-destroy{ action 'destroyTable' table }: span a.table-destroy{ action 'destroyTable' table }: span
a.button.new-table-button{action "newTable"}= t 'table.new_button' a.button.new-table-button{action "newTable"}= t 'table.new_button'
a.table-qr-codes{path qr_codes_suppliers_tables}
span
= t 'table.print_qr_codes'
@@ -21,6 +21,7 @@ $.extend($translations.en, <%= I18n.t('supplier', locale: :en).to_json %>);
$.extend($translations.nl, <%= I18n.t('supplier', locale: :nl).to_json %>); $.extend($translations.nl, <%= I18n.t('supplier', locale: :nl).to_json %>);
String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.slice(1); } String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.slice(1); }
window.time_zones = <%= ActiveSupport::TimeZone.all.map{|tz| {name: tz.name, formatted: "GMT#{tz.formatted_offset} #{tz.name}"}}.to_json.html_safe %>; window.time_zones = <%= ActiveSupport::TimeZone.all.map{|tz| {name: tz.name, formatted: "GMT#{tz.formatted_offset} #{tz.name}"}}.to_json.html_safe %>;
window.countries = <%= IsoCountryCodes.all.map{|cc| {name: cc.name}}.to_json.html_safe %>; window.countries = <%= IsoCountryCodes.all.map{|cc| {name: cc.name}}.to_json.html_safe %>;
@@ -81,7 +81,7 @@
selector = $( selector || document) selector = $( selector || document)
selector.find(".locale-select").show() selector.find(".locale-select").show()
selector.find(".locale-select-" + locale).hide() selector.find(".locale-select-" + locale).hide()
moment.lang locale moment.locale locale
if selector if selector
selector.find("[data-t]").each -> selector.find("[data-t]").each ->
$(this).html t($(this).data("t"), $(this).data("tAttributes")) $(this).html t($(this).data("t"), $(this).data("tAttributes"))
@@ -1,74 +1,5 @@
.top-menu = partial "global/top_menu"
.top-menu-bar = partial "global/side_menu"
.menu-content
section.main-buttons
if list.id
link-to 'index' class="top-menu-logo with-list"
= image_tag 'user/logo-small.png'
= view "menu-item" route="active_list"
= view "menu-item" route="table" route_param=list.table.id
= view "menu-item-list-needs-help"
= view "menu-item-list-needs-payment"
else
link-to 'index' class="top-menu-logo without-list"
= image_tag 'user/logo-small.png'
= view "menu-item-scan-qr"
= view "menu-item-product-orders"
if list
.extra-info{action "showSupplierStatusInfo"}
.supplier-info-row
/ .supplier-name= list.supplier.name
.table-number
|#&nbsp;
= list.table.number
.supplier-info-row
.counter.supplier-orders-placed-count
= list.supplier.orders_placed_count
span.orders-placed-count-icon
.supplier-info-row
.counter.supplier-orders-in-process-count
= list.supplier.orders_in_process_count
span.orders-in-process-count-icon
.side-menu
.toggle-side-menu: span
ul
li.title: h3 Menu
li
= link-to 'index'
span Home
li
a{action "scanQr" bubbles=false}
span.scan-qr-icon
span Scan QR
if list.id
li
=link-to 'table' list.table.id class="side-menu-list-products"
span.fa.fa-cutlery
span.fa.fa-glass
= t 'list_products.title'
li
=link-to 'active_list' class="side-menu-active-list"
span.active-list-icon
span= t 'active_list.title'
if list.join_requests
li
=link-to 'join_requests'
span= t 'models.plural.join_request'
li
=link-to 'lists' class="side-menu-lists"
span= t 'models.plural.list'
li
=link-to 'settings'
span.settings-icon
span= t 'settings.title'
li
=link-to 'about' class="side-menu-about"
span.about-mozo-icon
span=t 'about.title'
li.hide
a{action "openDebugger"}
span.fa.fa-wrench.fa-lg
span Debugger
.main-section .main-section
.main-section-content .main-section-content
if notice if notice
@@ -0,0 +1,40 @@
.side-menu
.toggle-side-menu: span
ul
li.title: h3 Menu
li
= link-to 'index'
span Home
li
a{action "scanQr" bubbles=false}
span.scan-qr-icon
span Scan QR
if list.id
li
=link-to 'table' list.table.id class="side-menu-list-products"
span.fa.fa-cutlery
span.fa.fa-glass
= t 'list_products.title'
li
=link-to 'active_list' class="side-menu-active-list"
span.active-list-icon
span= t 'active_list.title'
if list.join_requests
li
=link-to 'join_requests'
span= t 'models.plural.join_request'
li
=link-to 'lists' class="side-menu-lists"
span= t 'models.plural.list'
li
=link-to 'settings'
span.settings-icon
span= t 'settings.title'
li
=link-to 'about' class="side-menu-about"
span.about-mozo-icon
span=t 'about.title'
li.hide
a{action "openDebugger"}
span.fa.fa-wrench.fa-lg
span Debugger
@@ -0,0 +1,31 @@
.top-menu
.top-menu-bar
.menu-content
section.main-buttons
if list.id
link-to 'index' class="top-menu-logo with-list"
= image_tag 'user/logo-small.png'
= view "menu-item" route="active_list"
= view "menu-item" route="table" route_param=list.table.id
= view "menu-item-list-needs-help"
= view "menu-item-list-needs-payment"
else
link-to 'index' class="top-menu-logo without-list"
= image_tag 'user/logo-small.png'
= view "menu-item-scan-qr"
= view "menu-item-product-orders"
if list
.extra-info{action "showSupplierStatusInfo"}
.supplier-info-row
/ .supplier-name= list.supplier.name
.table-number
|#&nbsp;
= list.table.number
.supplier-info-row
.counter.supplier-orders-placed-count
= list.supplier.orders_placed_count
span.orders-placed-count-icon
.supplier-info-row
.counter.supplier-orders-in-process-count
= list.supplier.orders_in_process_count
span.orders-in-process-count-icon
@@ -16,6 +16,8 @@ table
text-align: right text-align: right
&.date &.date
text-align: right text-align: right
a.table-qr-codes
+button-icon-only
.table-edit .table-edit
+button($bg: $secondary-color) +button($bg: $secondary-color)
+button-icon-only +button-icon-only
@@ -24,7 +26,6 @@ table
@extend .fa-pencil @extend .fa-pencil
a.table-qr-codes a.table-qr-codes
+button($bg: $secondary-color) +button($bg: $secondary-color)
+button-icon-only
span span
@extend .fa @extend .fa
@extend .fa-qrcode @extend .fa-qrcode
+7 -4
View File
@@ -39,11 +39,8 @@ en:
settings: Settings settings: Settings
sign_out: Sign out sign_out: Sign out
table_number: Table table_number: Table
tables:
qr_codes:
link: Print Qr codes sheet
has_no_section: "Not placed"
table: table:
print_qr_codes: Print Qr codes
destroy: destroy:
modal: modal:
title: Are you sure you want to delete ${models.table} %{number} title: Are you sure you want to delete ${models.table} %{number}
@@ -183,3 +180,9 @@ en:
modal: modal:
info: info:
close: OK close: OK
supplier_status_info:
title: "%{name} info"
header: The icons at the top right corner contain information about the current orders
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
+7 -4
View File
@@ -38,11 +38,8 @@ nl:
settings: Instellingen settings: Instellingen
sign_out: Afmelden sign_out: Afmelden
table_number: Tafel table_number: Tafel
tables:
qr_codes:
link: Print Qr codes
has_no_section: "Niet geplaatst"
table: table:
print_qr_codes: Print Qr codes
destroy: destroy:
modal: modal:
title: Weet je zeker dat je ${models.table} %{number} wilt verwijderen title: Weet je zeker dat je ${models.table} %{number} wilt verwijderen
@@ -186,3 +183,9 @@ nl:
modal: modal:
info: info:
close: OK close: OK
supplier_status_info:
title: "%{name} info"
header: The icons at the top right corner contain information about the current orders
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
+1
View File
@@ -10,6 +10,7 @@ counters:
net: host net: host
volumes: volumes:
- config:/usr/src/app/config - config:/usr/src/app/config
command: development
faye: faye:
build: faye build: faye
net: host net: host
+2 -1
View File
@@ -23,7 +23,8 @@ User
- product variants - product variants
- remove active orders on list close - remove active orders on list close
- fix ajaxError duplicity - fix ajaxError duplicity
- rename "I am signed in as a user" to "there is a signed in user" - rename "I am signed in as a user" to "there is a signed in user" in
the specs
Bugs Bugs
---- ----