Major usability improvements
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#= require_self
|
||||
#= require md5
|
||||
#= require handlebars
|
||||
#= require ember
|
||||
#= require ember-data
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
App.SuppliersSwitcherComponent = Ember.Component.extend
|
||||
classNames: ['suppliers-switcher-container']
|
||||
suppliers: (-> @get('targetObject.store').all 'supplier').property()
|
||||
other_suppliers: ( -> @get('suppliers').rejectBy 'id', @get('current_supplier.id')).property('suppliers.@each')
|
||||
current_supplier: Ember.computed.alias 'targetObject.controllers.application.supplier'
|
||||
suppliers: (-> @get('targetObject.store').peekAll 'supplier').property()
|
||||
other_suppliers: ( -> @get('suppliers').rejectBy 'id', @get('globals.current_supplier.id')).property('suppliers.@each')
|
||||
actions:
|
||||
switchTo: (locale)->
|
||||
setLocale locale
|
||||
|
||||
@@ -21,5 +21,5 @@ App.ApplicationController = Ember.Controller.extend
|
||||
window.location = Routes.destroy_employee_session_path()
|
||||
showSupplierStatusInfo: ->
|
||||
@modal 'supplier_status_info',
|
||||
model: @get('supplier')
|
||||
model: @get('globals.current_supplier')
|
||||
title_path: 'supplier_status_info.title'
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
Ember.Handlebars.registerHelper 'can', (permission, resource, options)->
|
||||
if options.types[1] is "ID" and options.data.view
|
||||
resource = options.data.view.get(resource)
|
||||
if employee = App.__container__.lookup('global:variables').get('current_employee')
|
||||
if permission is "read" or (permission is "manage" and employee.isManager())
|
||||
options.fn @
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
Ember.Handlebars.helper 'gravatar-image', (email, options={})->
|
||||
size = options.hash.size || 48
|
||||
gravatar_hash = md5(String(email).trim().toLowerCase())
|
||||
"<img src='http://www.gravatar.com/avatar/#{gravatar_hash}?s=#{size}' />".htmlSafe()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
Globals = Ember.Object.extend
|
||||
current_employee: null
|
||||
current_supplier: null
|
||||
isDragging: false
|
||||
App.initializer
|
||||
name: 'injectCurrent'
|
||||
|
||||
@@ -14,3 +14,4 @@ ControllerExtensions = Ember.Mixin.create
|
||||
#current_employee: (-> @get('controllers.application.employee') ).property('controllers.application.employee')
|
||||
|
||||
Ember.Controller.reopen ControllerExtensions
|
||||
Ember.ArrayController.reopen ControllerExtensions # Added for auto generated employeesController Ember 1,13.5
|
||||
|
||||
@@ -19,6 +19,7 @@ App.Router.map ->
|
||||
@route 'orders_display' # chromecast etc
|
||||
@route 'menu'
|
||||
@route 'settings'
|
||||
@route 'my_account'
|
||||
@route 'schedule'
|
||||
@route 'empty'
|
||||
#@resource 'lists', queryParams: ['state']
|
||||
|
||||
@@ -12,7 +12,7 @@ App.ApplicationRoute = Ember.Route.extend
|
||||
# product_categories = controller.set 'product_categories', @store.all('product_category')
|
||||
#@store.find 'order', state: 'active' included in list
|
||||
setupController: (controller)->
|
||||
controller.set 'supplier', @supplier
|
||||
controller.set 'globals.current_supplier', @supplier
|
||||
controller.set 'globals.current_employee', @employee
|
||||
# @set 'supplier', @store.find('supplier', supplier_id)
|
||||
#controller.set 'sections', @sections
|
||||
@@ -20,8 +20,8 @@ App.ApplicationRoute = Ember.Route.extend
|
||||
|
||||
faye = new Faye.Client(event_host)
|
||||
faye.subscribe "/supplier/#{supplier_object.id}", (e)=>
|
||||
@set('supplier.orders_placed_count', e.data.supplier_orders_placed_count) if e.data.supplier_orders_placed_count?
|
||||
@set('supplier.orders_in_process_count', e.data.supplier_orders_in_process_count) if e.data.supplier_orders_in_process_count?
|
||||
@set('globals.current_supplier.orders_placed_count', e.data.supplier_orders_placed_count) if e.data.supplier_orders_placed_count?
|
||||
@set('globals.current_supplier.orders_in_process_count', e.data.supplier_orders_in_process_count) if e.data.supplier_orders_in_process_count?
|
||||
@events[e.event].call(@, e.data) if @events[e.event]
|
||||
<% if Rails.env.test? %>
|
||||
window.faye_log ||= []
|
||||
@@ -33,6 +33,11 @@ App.ApplicationRoute = Ember.Route.extend
|
||||
console.log e.data
|
||||
<% end %>
|
||||
|
||||
# Fetch suppliers for current_employee
|
||||
$.getJSON(Routes.employees_suppliers_path()).then (result) =>
|
||||
@store.pushPayload result
|
||||
|
||||
|
||||
actions:
|
||||
# openModal: (modalName, model, options={})->
|
||||
# controller_name = options.controller || modalName
|
||||
@@ -85,14 +90,16 @@ App.ApplicationRoute = Ember.Route.extend
|
||||
@controllerFor('application').set 'active_section', section
|
||||
@transitionTo 'index'
|
||||
markSupplierClosed: ->
|
||||
return unless @get('globals.current_employee.manager')
|
||||
controller = @controllerFor('application')
|
||||
return unless supplier = controller.get('supplier')
|
||||
return unless supplier = @get('globals.current_supplier')
|
||||
controller.modal 'confirm',
|
||||
title_path: 'supplier.close_for_orders_confirmation'
|
||||
model: supplier
|
||||
ok: -> supplier.close()
|
||||
markSupplierOpen: ->
|
||||
return unless supplier = @controllerFor('application').get('supplier')
|
||||
return unless @get('globals.current_employee.manager')
|
||||
return unless supplier = @get('globals.current_supplier')
|
||||
supplier.open_the_place()
|
||||
rotateLeft: (record)->
|
||||
new_rotation = -90 + record.get('rotation')
|
||||
@@ -136,8 +143,8 @@ App.ApplicationRoute = Ember.Route.extend
|
||||
order_being_processed: (data) -> order.isActive() if order = @store.getById('order', data.id)
|
||||
order_being_delivered: (data) -> order.isDelivered() if order = @store.getById('order', data.id)
|
||||
order_cancelled: (data) -> order.isCancelled() if order = @store.getById('order', data.id)
|
||||
orders_in_process_count: (data) -> @set('supplier.orders_in_process_count', data.count)
|
||||
orders_placed_count: (data) -> @set('supplier.orders_placed_count', data.count)
|
||||
orders_in_process_count: (data) -> @set('globals.current_supplier.orders_in_process_count', data.count)
|
||||
orders_placed_count: (data) -> @set('globals.current_supplier.orders_placed_count', data.count)
|
||||
|
||||
#return new Ember.Handlebars.SafeString('<span class="highlight">' + escaped + '</span>');
|
||||
#"<span class='highlight'>#{escaped}</span>".htmlSafe()
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
App.MyAccountRoute = Ember.Route.extend
|
||||
model: -> @get('globals.current_employee')
|
||||
@@ -1,8 +1,5 @@
|
||||
App.SettingsRoute = Ember.Route.extend
|
||||
beforeModel: ->
|
||||
$.getJSON(Routes.employees_suppliers_path()).then (result) =>
|
||||
@store.pushPayload result
|
||||
model: -> @container.lookup('route:application').supplier
|
||||
model: -> @get('globals.current_supplier')
|
||||
# setupController: (controller, model)->
|
||||
# #controller.set 'model', controller.get('controllers.application.supplier')
|
||||
# controller.set 'model', model.supplier
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
span.dropdown-trigger.button.tiny.dropdown
|
||||
span.dropdown-trigger-text= view.title
|
||||
/span.dropdown-trigger-icon
|
||||
if gravatar
|
||||
span.dropdown-trigger.gravatar= gravatar-image gravatar
|
||||
else
|
||||
span.dropdown-trigger.button.tiny.dropdown
|
||||
span.dropdown-trigger-text= view.title
|
||||
/span.dropdown-trigger-icon
|
||||
.dropdown-list-container
|
||||
= yield
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
td.boolean= boolean employee.active
|
||||
td.colorbox= colorbox employee.color
|
||||
td.actions
|
||||
can manage sections
|
||||
can "manage" "sections"
|
||||
a.table-edit{ action 'editEmployee' employee }: span
|
||||
a.table-destroy{ action 'destroyEmployee' employee }: span
|
||||
.form-actions
|
||||
can manage employees
|
||||
can "manage" "employees"
|
||||
a.form-action-new.new-employee-button{action "newEmployee"}= t 'employee.new_button'
|
||||
|
||||
@@ -1,15 +1,6 @@
|
||||
.side-menu
|
||||
ul
|
||||
li.title: h3= supplier.name
|
||||
can manage supplier
|
||||
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'
|
||||
li
|
||||
=link-to 'settings' class="supplier-settings-link"
|
||||
span.settings-icon
|
||||
span= t 'supplier.settings'
|
||||
li.title: h3= globals.current_supplier.name
|
||||
li
|
||||
= link-to 'index'
|
||||
span.fa.fa-list-alt
|
||||
@@ -34,7 +25,12 @@
|
||||
= link-to 'schedule'
|
||||
span.fa.fa-calendar
|
||||
= t 'top_menu.schedule'
|
||||
li.supplier-sign-out-link
|
||||
a{action "signOut"}
|
||||
span.sign-out-icon
|
||||
= t 'supplier.sign_out'
|
||||
can "manage" globals.current_supplier
|
||||
li
|
||||
=link-to 'settings' class="supplier-settings-link"
|
||||
span.settings-icon
|
||||
span= t 'supplier.settings'
|
||||
if globals.current_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'
|
||||
|
||||
@@ -17,20 +17,27 @@ header.top-menu
|
||||
= t 'models.plural.employee'
|
||||
= link-to "schedule" class="top-menu-schedule"
|
||||
= t 'top_menu.schedule'
|
||||
if supplier.open
|
||||
a.supplier-is-closed-indication.is-open{ action "markSupplierClosed" }: span.fa.fa-beer.fa-2x
|
||||
= dropdown-link gravatar=globals.current_employee.email classNames="current-employee-nav"
|
||||
ul
|
||||
li
|
||||
li= link-to 'my_account': span.current-employee-my-account-icon= t 'current_employee.my_account.link'
|
||||
li: a{action "signOut"}: span.sign-out-icon= t 'supplier.sign_out'
|
||||
if globals.current_supplier.open
|
||||
/a.supplier-is-closed-indication.is-open{ action "markSupplierClosed" }: span.fa.fa-beer.fa-2x
|
||||
a.supplier-availability.currently-open{ action "markSupplierClosed" }: span Open
|
||||
else
|
||||
a.supplier-is-closed-indication.is-closed{ action "markSupplierOpen" }
|
||||
span.fa-stack.fa-lg
|
||||
i.fa.fa-beer.fa-stack-1x
|
||||
i.fa.fa-ban.fa-stack-2x.text-alert
|
||||
.supplier-name= supplier.name
|
||||
a.supplier-availability.currently-closed{ action "markSupplierOpen" }: span Closed
|
||||
/a.supplier-is-closed-indication.is-closed{ action "markSupplierOpen" }
|
||||
/span.fa-stack.fa-lg
|
||||
/i.fa.fa-beer.fa-stack-1x
|
||||
/i.fa.fa-ban.fa-stack-2x.text-alert
|
||||
.supplier-name= globals.current_supplier.name
|
||||
.extra-info{action "showSupplierStatusInfo"}
|
||||
.supplier-info-row
|
||||
.counter.supplier-orders-placed-count
|
||||
span.supplier-orders-placed-count-number= supplier.orders_placed_count
|
||||
span.supplier-orders-placed-count-number= globals.current_supplier.orders_placed_count
|
||||
span.orders-placed-count-icon
|
||||
.supplier-info-row
|
||||
.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= globals.current_supplier.orders_in_process_count
|
||||
span.orders-in-process-count-icon
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
.row: .small-12.columns
|
||||
= sections-header sectionBinding="controller.controllers.application.active_section"
|
||||
unless controllers.application.supplier.open
|
||||
.alert-box.alert.radius data-alert=true
|
||||
= t 'supplier.you_are_currently_closed_alert'
|
||||
a{ action "markSupplierOpen" }= t 'supplier.open_for_orders'
|
||||
can "manage" globals.current_supplier
|
||||
unless globals.current_supplier.open
|
||||
.alert-box.alert.radius data-alert=true
|
||||
= t 'supplier.you_are_currently_closed_alert'
|
||||
a{ action "markSupplierOpen" }= t 'supplier.open_for_orders'
|
||||
.page-header
|
||||
div.dashboard-section-selection
|
||||
/App.HomeSectionSelectorView selectionBinding="controller.controllers.application.active_section" content=controller.sections prompt=controllers.application.supplier.name
|
||||
/App.HomeSectionSelectorView selectionBinding="controller.controllers.application.active_section" content=controller.sections prompt=globals.current_supplier.name
|
||||
/= home-section-selector sectionBinding="controller.controllers.application.active_section"
|
||||
/= view "home-section-jumper"
|
||||
if active_lists.length
|
||||
|
||||
@@ -6,16 +6,16 @@
|
||||
each product_category in sorted_product_categories
|
||||
.row.product_category-container: .small-12.columns
|
||||
.product_category-header
|
||||
can manage menu
|
||||
can "manage" "menu"
|
||||
a.move{action "moveProductCategory" product_category} href="#"
|
||||
span.title= product_category.name
|
||||
span.availability= product_category.availability_text
|
||||
can manage menu
|
||||
can "manage" "menu"
|
||||
a.edit-product-category-button{action "editProductCategory" product_category} href="#": span
|
||||
a.add-product-product_category-button{action "addProduct" product_category} href="#": span
|
||||
each product in product_category.sorted_products
|
||||
= menu-product product=product code_filter=product_code_filter
|
||||
can manage menu
|
||||
can "manage" "menu"
|
||||
.row
|
||||
.small-12.columns
|
||||
a.new-product_category-button{action "newProductCategory"} href="#" = t 'product_category.new_button'
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
.row: .small-12.columns: h2=t 'current_employee.my_account.title'
|
||||
.form-row
|
||||
.form-label: label=t 'attributes.employee.email'
|
||||
.form-field= input value=globals.current_employee.email type="email" classNames="supplier-email" disabled=true
|
||||
.row: .small-12.columns= language-switcher
|
||||
.row: .small-12.columns= suppliers-switcher
|
||||
@@ -2,11 +2,11 @@
|
||||
= link-to 'sections' class="goto-sections-index-tab-header": span
|
||||
each section in sections
|
||||
= view "section-tab-header" context=section
|
||||
can manage sections
|
||||
can "manage" "sections"
|
||||
a.add-section{action "addSection"}: span
|
||||
.section-manage-tables.pull-right
|
||||
a.go-to-orders-list{ action "showDashboardOrders" model }: span
|
||||
can manage sections
|
||||
can "manage" "sections"
|
||||
if editmode
|
||||
= input type="text" value=model.title class="section-edit-title-field"
|
||||
= number-field numericValue=model.width class="dimension section-edit-width-field"
|
||||
|
||||
@@ -36,6 +36,6 @@
|
||||
else
|
||||
.row: .small-12.columns
|
||||
.panel=t 'section.none_found'
|
||||
can manage sections
|
||||
can "manage" "sections"
|
||||
.form-actions
|
||||
a.form-action-new{action "addSection"}=t 'helpers.links.new'
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
= table.section.title
|
||||
/td.timestamp=time table.created_at
|
||||
td.actions
|
||||
can manage tables
|
||||
can "manage" "tables"
|
||||
a.table-edit{ action 'editTable' table }: span
|
||||
a.table-destroy{ action 'destroyTable' table }: span
|
||||
.form-actions
|
||||
can manage tables
|
||||
can "manage" "tables"
|
||||
a.form-action-new.new-table-button{action "newTable"}= t 'table.new_button'
|
||||
= qr-codes-link
|
||||
|
||||
@@ -14,7 +14,6 @@ App.SectionTableView = Ember.View.extend DragNDrop.Draggable,
|
||||
"section-table-#{@get('content.id')}"
|
||||
).property('content.id')
|
||||
offsetX: (->
|
||||
debugger unless @get('dpm')
|
||||
(@get('dpm') || 0) * (@get('content.position_x') || 0)
|
||||
).property('dpm', 'content.position_x')
|
||||
offsetY: (->
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
//= require pickdate
|
||||
//= require_directory .
|
||||
//= require_self
|
||||
|
||||
if(!Modernizr.cssanimations){
|
||||
window.location = "/unsupported-browser";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user