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: ->
return unless supplier = @get('supplier')
supplier.open_the_place()
showSupplierStatusInfo: ->
@modal 'supplier_status_info',
model: @get('supplier')
title_path: 'supplier_status_info.title'
@@ -7,14 +7,15 @@
translation_params = {}
if model = @get('model')
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 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
underscored = `this.constructor.toString().substr(11).replace(/Controller$/, '').underscore()`
# find translated title or humanize the controller name
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
underscored.capitalize().replace(/_/, ' ')
).property('model.id')
@@ -1,4 +1,5 @@
= partial "global/top_menu"
= partial "global/side_menu"
.main-section= outlet
= view flash_message
= 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'
= link-to "lists" class="top-menu-lists"
= t 'models.plural.list'
.extra-info
.extra-info{action "showSupplierStatusInfo"}
.supplier-info-row
.counter.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
span.supplier-orders-in-process-count-number= supplier.orders_in_process_count
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
th=t 'attributes.table.number'
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'
tbody
each table in tables
@@ -16,8 +16,11 @@
if table.section
= link-to 'section' table.section
= table.section.title
td.numeric=time table.created_at
/td.timestamp=time table.created_at
td.actions
a.table-edit{ action 'editTable' table }: span
a.table-destroy{ action 'destroyTable' table }: span
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 %>);
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.countries = <%= IsoCountryCodes.all.map{|cc| {name: cc.name}}.to_json.html_safe %>;