diff --git a/app/abilities/suppliers/ability.rb b/app/abilities/suppliers/ability.rb
index 157c0b38..37e71cf8 100644
--- a/app/abilities/suppliers/ability.rb
+++ b/app/abilities/suppliers/ability.rb
@@ -14,6 +14,7 @@ class Suppliers::Ability
can :mark_in_process, Order
can :mark_delivered, Order
can :cancel, Order
+ can :switch_to, Supplier
end
end
end
diff --git a/app/assets/javascripts/supplier/app/application.js.coffee b/app/assets/javascripts/supplier/app/application.js.coffee
index a4293631..c9bdd393 100644
--- a/app/assets/javascripts/supplier/app/application.js.coffee
+++ b/app/assets/javascripts/supplier/app/application.js.coffee
@@ -1,4 +1,5 @@
#= require_self
+#= require md5
#= require handlebars
#= require ember
#= require ember-data
diff --git a/app/assets/javascripts/supplier/app/components/suppliers-switcher.js.coffee b/app/assets/javascripts/supplier/app/components/suppliers-switcher.js.coffee
index 71afdacc..667d1dd7 100644
--- a/app/assets/javascripts/supplier/app/components/suppliers-switcher.js.coffee
+++ b/app/assets/javascripts/supplier/app/components/suppliers-switcher.js.coffee
@@ -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
diff --git a/app/assets/javascripts/supplier/app/controllers/application_controller.js.coffee b/app/assets/javascripts/supplier/app/controllers/application_controller.js.coffee
index e2464728..cb195733 100644
--- a/app/assets/javascripts/supplier/app/controllers/application_controller.js.coffee
+++ b/app/assets/javascripts/supplier/app/controllers/application_controller.js.coffee
@@ -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'
diff --git a/app/assets/javascripts/supplier/app/helpers/can.js.coffee b/app/assets/javascripts/supplier/app/helpers/can.js.coffee
index 60b25419..04b07fe2 100644
--- a/app/assets/javascripts/supplier/app/helpers/can.js.coffee
+++ b/app/assets/javascripts/supplier/app/helpers/can.js.coffee
@@ -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 @
diff --git a/app/assets/javascripts/supplier/app/helpers/gravatar-image.js.coffee b/app/assets/javascripts/supplier/app/helpers/gravatar-image.js.coffee
new file mode 100644
index 00000000..de02ec6a
--- /dev/null
+++ b/app/assets/javascripts/supplier/app/helpers/gravatar-image.js.coffee
@@ -0,0 +1,5 @@
+Ember.Handlebars.helper 'gravatar-image', (email, options={})->
+ size = options.hash.size || 48
+ gravatar_hash = md5(String(email).trim().toLowerCase())
+ "
".htmlSafe()
+
diff --git a/app/assets/javascripts/supplier/app/initializers/globals.js.coffee b/app/assets/javascripts/supplier/app/initializers/globals.js.coffee
index 671ff22f..74480eac 100644
--- a/app/assets/javascripts/supplier/app/initializers/globals.js.coffee
+++ b/app/assets/javascripts/supplier/app/initializers/globals.js.coffee
@@ -1,5 +1,6 @@
Globals = Ember.Object.extend
current_employee: null
+ current_supplier: null
isDragging: false
App.initializer
name: 'injectCurrent'
diff --git a/app/assets/javascripts/supplier/app/modifications/controller_modifications.js.coffee b/app/assets/javascripts/supplier/app/modifications/controller_modifications.js.coffee
index b02268b8..db5304f9 100644
--- a/app/assets/javascripts/supplier/app/modifications/controller_modifications.js.coffee
+++ b/app/assets/javascripts/supplier/app/modifications/controller_modifications.js.coffee
@@ -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
diff --git a/app/assets/javascripts/supplier/app/router.js.coffee b/app/assets/javascripts/supplier/app/router.js.coffee
index cffb579f..13ac490a 100644
--- a/app/assets/javascripts/supplier/app/router.js.coffee
+++ b/app/assets/javascripts/supplier/app/router.js.coffee
@@ -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']
diff --git a/app/assets/javascripts/supplier/app/routes/application_route.js.coffee.erb b/app/assets/javascripts/supplier/app/routes/application_route.js.coffee.erb
index 350002e6..c68ff2b6 100644
--- a/app/assets/javascripts/supplier/app/routes/application_route.js.coffee.erb
+++ b/app/assets/javascripts/supplier/app/routes/application_route.js.coffee.erb
@@ -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('' + escaped + '');
#"#{escaped}".htmlSafe()
diff --git a/app/assets/javascripts/supplier/app/routes/my-account.js.coffee b/app/assets/javascripts/supplier/app/routes/my-account.js.coffee
new file mode 100644
index 00000000..1c1bdde8
--- /dev/null
+++ b/app/assets/javascripts/supplier/app/routes/my-account.js.coffee
@@ -0,0 +1,2 @@
+App.MyAccountRoute = Ember.Route.extend
+ model: -> @get('globals.current_employee')
diff --git a/app/assets/javascripts/supplier/app/routes/settings_route.js.coffee b/app/assets/javascripts/supplier/app/routes/settings_route.js.coffee
index 28e97e3a..145b55f0 100644
--- a/app/assets/javascripts/supplier/app/routes/settings_route.js.coffee
+++ b/app/assets/javascripts/supplier/app/routes/settings_route.js.coffee
@@ -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
diff --git a/app/assets/javascripts/supplier/app/templates/components/dropdown-link.emblem b/app/assets/javascripts/supplier/app/templates/components/dropdown-link.emblem
index a4f9c853..cd049aeb 100644
--- a/app/assets/javascripts/supplier/app/templates/components/dropdown-link.emblem
+++ b/app/assets/javascripts/supplier/app/templates/components/dropdown-link.emblem
@@ -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
diff --git a/app/assets/javascripts/supplier/app/templates/employees/index.emblem b/app/assets/javascripts/supplier/app/templates/employees/index.emblem
index 564e5769..7ceb1903 100644
--- a/app/assets/javascripts/supplier/app/templates/employees/index.emblem
+++ b/app/assets/javascripts/supplier/app/templates/employees/index.emblem
@@ -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'
diff --git a/app/assets/javascripts/supplier/app/templates/global/_side_menu.emblem b/app/assets/javascripts/supplier/app/templates/global/_side_menu.emblem
index 0c5e64a3..261c9aae 100644
--- a/app/assets/javascripts/supplier/app/templates/global/_side_menu.emblem
+++ b/app/assets/javascripts/supplier/app/templates/global/_side_menu.emblem
@@ -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'
diff --git a/app/assets/javascripts/supplier/app/templates/global/_top_menu.emblem b/app/assets/javascripts/supplier/app/templates/global/_top_menu.emblem
index d3f31e55..854f582e 100644
--- a/app/assets/javascripts/supplier/app/templates/global/_top_menu.emblem
+++ b/app/assets/javascripts/supplier/app/templates/global/_top_menu.emblem
@@ -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
diff --git a/app/assets/javascripts/supplier/app/templates/index.emblem b/app/assets/javascripts/supplier/app/templates/index.emblem
index 13686d41..65b5bdb7 100644
--- a/app/assets/javascripts/supplier/app/templates/index.emblem
+++ b/app/assets/javascripts/supplier/app/templates/index.emblem
@@ -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
diff --git a/app/assets/javascripts/supplier/app/templates/menu.emblem b/app/assets/javascripts/supplier/app/templates/menu.emblem
index abcfe282..e368a56f 100644
--- a/app/assets/javascripts/supplier/app/templates/menu.emblem
+++ b/app/assets/javascripts/supplier/app/templates/menu.emblem
@@ -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'
diff --git a/app/assets/javascripts/supplier/app/templates/my_account.emblem b/app/assets/javascripts/supplier/app/templates/my_account.emblem
new file mode 100644
index 00000000..4dd4357d
--- /dev/null
+++ b/app/assets/javascripts/supplier/app/templates/my_account.emblem
@@ -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
diff --git a/app/assets/javascripts/supplier/app/templates/section.emblem b/app/assets/javascripts/supplier/app/templates/section.emblem
index a0891b03..5b5569f6 100644
--- a/app/assets/javascripts/supplier/app/templates/section.emblem
+++ b/app/assets/javascripts/supplier/app/templates/section.emblem
@@ -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"
diff --git a/app/assets/javascripts/supplier/app/templates/sections/index.emblem b/app/assets/javascripts/supplier/app/templates/sections/index.emblem
index 4cdd7077..d51acc67 100644
--- a/app/assets/javascripts/supplier/app/templates/sections/index.emblem
+++ b/app/assets/javascripts/supplier/app/templates/sections/index.emblem
@@ -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'
diff --git a/app/assets/javascripts/supplier/app/templates/tables/index.emblem b/app/assets/javascripts/supplier/app/templates/tables/index.emblem
index 2853f431..1f64bea0 100644
--- a/app/assets/javascripts/supplier/app/templates/tables/index.emblem
+++ b/app/assets/javascripts/supplier/app/templates/tables/index.emblem
@@ -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
diff --git a/app/assets/javascripts/supplier/app/views/section/table_view.js.coffee b/app/assets/javascripts/supplier/app/views/section/table_view.js.coffee
index 8762a557..259ccd54 100644
--- a/app/assets/javascripts/supplier/app/views/section/table_view.js.coffee
+++ b/app/assets/javascripts/supplier/app/views/section/table_view.js.coffee
@@ -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: (->
diff --git a/app/assets/javascripts/supplier/foundation1/application.js.erb b/app/assets/javascripts/supplier/foundation1/application.js.erb
index 714541c0..6f3d053b 100644
--- a/app/assets/javascripts/supplier/foundation1/application.js.erb
+++ b/app/assets/javascripts/supplier/foundation1/application.js.erb
@@ -13,7 +13,6 @@
//= require pickdate
//= require_directory .
//= require_self
-
if(!Modernizr.cssanimations){
window.location = "/unsupported-browser";
}
diff --git a/app/assets/stylesheets/supplier/foundation1/_ember_dropdown.sass b/app/assets/stylesheets/supplier/foundation1/_ember_dropdown.sass
index dce24abb..b27b9c07 100644
--- a/app/assets/stylesheets/supplier/foundation1/_ember_dropdown.sass
+++ b/app/assets/stylesheets/supplier/foundation1/_ember_dropdown.sass
@@ -13,9 +13,14 @@
margin-right: 6px
.dropdown-list-container
+ $border-size: 1px
+ $arrow-size: 7px
+ $border-color: #333
+ $background-color: white
+ $right-offset: 16px
display: none
text-align: left
- background-color: white
+ background-color: $background-color
position: absolute
right: 0
margin: 0
@@ -23,18 +28,75 @@
z-index: 542
margin-top: 7px
border-radius: 4px
+ border: $border-size solid $border-color
+ box-shadow: 5px 5px 5px #888888
- &:after
+ // Arrow
+ &:before, &:after
border: solid transparent
content: " "
height: 0
width: 0
position: absolute
pointer-events: none
- border-width: 6px
- border-bottom-color: white
bottom: 100%
- right: 30px
+ &:after
+ border-width: $arrow-size
+ margin-left: -$arrow-size
+ border-bottom-color: $background-color
+ right: $right-offset + $border-size
+ &:before
+ border-bottom-color: $border-color
+ border-width: $arrow-size + $border-size
+ margin-left: -($arrow-size + $border-size)
+ right: $right-offset
+
+ ul
+ list-style: none
+ margin: 0
+ padding: 0
+ li
+ border-bottom: 1px solid #bbb
+ a
+ font-size: 0.8em
+ display: block
+ padding: 4px 7px
+ &:hover
+ background-color: #ddd
+ span.section-add-tables-icon
+ @extend .fa
+ @extend .fa-plus-square
+ span
+ padding-left: 7px
+ span.section-arrange-tables-icon
+ @extend .fa
+ @extend .fa-th
+ span
+ padding-left: 7px
+ span.section-remove-icon
+ @extend .fa, .fa-trash-o
+ span
+ padding-left: 7px
+ span.section-add-section-element-icon
+ @extend .fa, .fa-image
+ span
+ padding-left: 7px
+ span.section-add-section-area-icon
+ @extend .fa, .fa-square
+ span
+ padding-left: 7px
+ span.settings-icon
+ @extend .fa, .fa-gear
+ span
+ padding-left: 7px
+ span.sign-out-icon
+ @extend .fa, .fa-sign-out
+ span
+ padding-left: 7px
+ span.current-employee-my-account-icon
+ @extend .fa, .fa-user
+ span
+ padding-left: 7px
&.active
.dropdown-list-container
display: block
diff --git a/app/assets/stylesheets/supplier/foundation1/_qsections.sass b/app/assets/stylesheets/supplier/foundation1/_qsections.sass
index 71595c23..c36fa350 100644
--- a/app/assets/stylesheets/supplier/foundation1/_qsections.sass
+++ b/app/assets/stylesheets/supplier/foundation1/_qsections.sass
@@ -32,45 +32,8 @@
.section-manage-tables
.dropdown-container
margin-right: 10px
- $icon-right-margin: 16px
- ul
- list-style: none
- margin: 0
- padding: 0
- li
- border-bottom: 1px solid #bbb
- a
- font-size: 0.8em
- display: block
- padding: 4px 7px
- &:hover
- background-color: #ddd
- span.qr-icon
- margin-right: $icon-right-margin
.section-destroy
color: $alert-color
- span.section-add-tables-icon
- @extend .fa
- @extend .fa-plus-square
- span
- padding-left: 7px
- span.section-arrange-tables-icon
- @extend .fa
- @extend .fa-th
- span
- padding-left: 7px
- span.section-remove-icon
- @extend .fa, .fa-trash-o
- span
- padding-left: 7px
- span.section-add-section-element-icon
- @extend .fa, .fa-image
- span
- padding-left: 7px
- span.section-add-section-area-icon
- @extend .fa, .fa-square
- span
- padding-left: 7px
input
height: auto
padding-top: 4px
diff --git a/app/assets/stylesheets/supplier/foundation1/components/_nav_main.sass b/app/assets/stylesheets/supplier/foundation1/components/_nav_main.sass
index 671d3687..a64d6a79 100644
--- a/app/assets/stylesheets/supplier/foundation1/components/_nav_main.sass
+++ b/app/assets/stylesheets/supplier/foundation1/components/_nav_main.sass
@@ -98,3 +98,28 @@ header.top-menu
@extend .fa
@extend .fa-bars
@extend .fa-lg
+
+// CURRENT EMPOYEE NAV
+.current-employee-nav
+ float: right
+ margin-right: 10px
+.dropdown-trigger.gravatar
+ display: inline-block
+ overflow: hidden
+ border-radius: $global-rounded
+
+// SUPPLIER AVAILABILITY
+.supplier-availability
+ border: 2px solid #555
+ border-radius: 4px
+ padding: 5px 3px
+ font-weight: bold
+ font-size: 0.9em
+ float: right
+ margin-right: 8px
+ text-transform: uppercase
+ margin-top: 10px
+ &.currently-open
+ color: #5f5
+ &.currently-closed
+ color: #f55
diff --git a/app/assets/stylesheets/supplier/foundation1/components/suppliers-switcher.sass b/app/assets/stylesheets/supplier/foundation1/components/suppliers-switcher.sass
new file mode 100644
index 00000000..09c08ced
--- /dev/null
+++ b/app/assets/stylesheets/supplier/foundation1/components/suppliers-switcher.sass
@@ -0,0 +1,2 @@
+.suppliers-switcher-container
+ margin-top: 12px
diff --git a/app/controllers/suppliers/suppliers_controller.rb b/app/controllers/suppliers/suppliers_controller.rb
index 797e969a..a442bfc7 100644
--- a/app/controllers/suppliers/suppliers_controller.rb
+++ b/app/controllers/suppliers/suppliers_controller.rb
@@ -18,7 +18,7 @@ module Suppliers
def switch_to
@switch_supplier = Supplier.find(params[:id])
session[:supplier_id] = params[:id] if @switch_supplier.employee_ids.include? current_employee.id
- redirect_to supplier_root_path(anchor: '/settings')
+ redirect_to supplier_root_path(anchor: '/my_account')
end
def mark_as_open
diff --git a/config/locales/supplier.en.yml b/config/locales/supplier.en.yml
index 90b6169f..edbd87ba 100644
--- a/config/locales/supplier.en.yml
+++ b/config/locales/supplier.en.yml
@@ -234,3 +234,8 @@ en:
save_button: Save
close_button: Close
destroy_button: Delete
+ current_employee:
+ my_account:
+ link: My account
+ title: My account
+
diff --git a/config/locales/supplier.nl.yml b/config/locales/supplier.nl.yml
index 9fcf07ee..ea66c152 100644
--- a/config/locales/supplier.nl.yml
+++ b/config/locales/supplier.nl.yml
@@ -3,7 +3,7 @@ nl:
page:
cannot_compile: There is an error in the page that prevented it from being displayed.
confirm:
- cancel: Sluit
+ cancel: Cancel
confirm: Ja
general:
destroy:
@@ -237,3 +237,7 @@ nl:
save_button: Save
close_button: Close
destroy_button: Verwijderen
+ current_employee:
+ my_account:
+ link: Mijn account
+ title: Mijn account
diff --git a/spec/javascript/components/suppliers-switcher_test.coffee b/spec/javascript/components/suppliers-switcher_test.coffee
index 0129d8ef..ff7087c7 100644
--- a/spec/javascript/components/suppliers-switcher_test.coffee
+++ b/spec/javascript/components/suppliers-switcher_test.coffee
@@ -7,7 +7,7 @@ test "Triggers switch", ->
controller.store.createRecord 'supplier',
id: 'other-supplier'
name: 'Other supplier1'
- component.set 'targetObject', controller
+ #component.set 'targetObject', controller
@render()
equal find('ul').text(), "Switch to Other supplier1"
diff --git a/vendor/assets/javascripts/md5.js b/vendor/assets/javascripts/md5.js
new file mode 100644
index 00000000..f92ba37a
--- /dev/null
+++ b/vendor/assets/javascripts/md5.js
@@ -0,0 +1,274 @@
+/*
+ * JavaScript MD5 1.0.1
+ * https://github.com/blueimp/JavaScript-MD5
+ *
+ * Copyright 2011, Sebastian Tschan
+ * https://blueimp.net
+ *
+ * Licensed under the MIT license:
+ * http://www.opensource.org/licenses/MIT
+ *
+ * Based on
+ * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
+ * Digest Algorithm, as defined in RFC 1321.
+ * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
+ * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
+ * Distributed under the BSD License
+ * See http://pajhome.org.uk/crypt/md5 for more info.
+ */
+
+/*jslint bitwise: true */
+/*global unescape, define */
+
+(function ($) {
+ 'use strict';
+
+ /*
+ * Add integers, wrapping at 2^32. This uses 16-bit operations internally
+ * to work around bugs in some JS interpreters.
+ */
+ function safe_add(x, y) {
+ var lsw = (x & 0xFFFF) + (y & 0xFFFF),
+ msw = (x >> 16) + (y >> 16) + (lsw >> 16);
+ return (msw << 16) | (lsw & 0xFFFF);
+ }
+
+ /*
+ * Bitwise rotate a 32-bit number to the left.
+ */
+ function bit_rol(num, cnt) {
+ return (num << cnt) | (num >>> (32 - cnt));
+ }
+
+ /*
+ * These functions implement the four basic operations the algorithm uses.
+ */
+ function md5_cmn(q, a, b, x, s, t) {
+ return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b);
+ }
+ function md5_ff(a, b, c, d, x, s, t) {
+ return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
+ }
+ function md5_gg(a, b, c, d, x, s, t) {
+ return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
+ }
+ function md5_hh(a, b, c, d, x, s, t) {
+ return md5_cmn(b ^ c ^ d, a, b, x, s, t);
+ }
+ function md5_ii(a, b, c, d, x, s, t) {
+ return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
+ }
+
+ /*
+ * Calculate the MD5 of an array of little-endian words, and a bit length.
+ */
+ function binl_md5(x, len) {
+ /* append padding */
+ x[len >> 5] |= 0x80 << (len % 32);
+ x[(((len + 64) >>> 9) << 4) + 14] = len;
+
+ var i, olda, oldb, oldc, oldd,
+ a = 1732584193,
+ b = -271733879,
+ c = -1732584194,
+ d = 271733878;
+
+ for (i = 0; i < x.length; i += 16) {
+ olda = a;
+ oldb = b;
+ oldc = c;
+ oldd = d;
+
+ a = md5_ff(a, b, c, d, x[i], 7, -680876936);
+ d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586);
+ c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819);
+ b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330);
+ a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897);
+ d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426);
+ c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341);
+ b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983);
+ a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416);
+ d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417);
+ c = md5_ff(c, d, a, b, x[i + 10], 17, -42063);
+ b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162);
+ a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682);
+ d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101);
+ c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290);
+ b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329);
+
+ a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510);
+ d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632);
+ c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713);
+ b = md5_gg(b, c, d, a, x[i], 20, -373897302);
+ a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691);
+ d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083);
+ c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335);
+ b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848);
+ a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438);
+ d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690);
+ c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961);
+ b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501);
+ a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467);
+ d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784);
+ c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473);
+ b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734);
+
+ a = md5_hh(a, b, c, d, x[i + 5], 4, -378558);
+ d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463);
+ c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562);
+ b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556);
+ a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060);
+ d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353);
+ c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632);
+ b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640);
+ a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174);
+ d = md5_hh(d, a, b, c, x[i], 11, -358537222);
+ c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979);
+ b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189);
+ a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487);
+ d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835);
+ c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520);
+ b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651);
+
+ a = md5_ii(a, b, c, d, x[i], 6, -198630844);
+ d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415);
+ c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905);
+ b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055);
+ a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571);
+ d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606);
+ c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523);
+ b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799);
+ a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359);
+ d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744);
+ c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380);
+ b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649);
+ a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070);
+ d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379);
+ c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259);
+ b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551);
+
+ a = safe_add(a, olda);
+ b = safe_add(b, oldb);
+ c = safe_add(c, oldc);
+ d = safe_add(d, oldd);
+ }
+ return [a, b, c, d];
+ }
+
+ /*
+ * Convert an array of little-endian words to a string
+ */
+ function binl2rstr(input) {
+ var i,
+ output = '';
+ for (i = 0; i < input.length * 32; i += 8) {
+ output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xFF);
+ }
+ return output;
+ }
+
+ /*
+ * Convert a raw string to an array of little-endian words
+ * Characters >255 have their high-byte silently ignored.
+ */
+ function rstr2binl(input) {
+ var i,
+ output = [];
+ output[(input.length >> 2) - 1] = undefined;
+ for (i = 0; i < output.length; i += 1) {
+ output[i] = 0;
+ }
+ for (i = 0; i < input.length * 8; i += 8) {
+ output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << (i % 32);
+ }
+ return output;
+ }
+
+ /*
+ * Calculate the MD5 of a raw string
+ */
+ function rstr_md5(s) {
+ return binl2rstr(binl_md5(rstr2binl(s), s.length * 8));
+ }
+
+ /*
+ * Calculate the HMAC-MD5, of a key and some data (raw strings)
+ */
+ function rstr_hmac_md5(key, data) {
+ var i,
+ bkey = rstr2binl(key),
+ ipad = [],
+ opad = [],
+ hash;
+ ipad[15] = opad[15] = undefined;
+ if (bkey.length > 16) {
+ bkey = binl_md5(bkey, key.length * 8);
+ }
+ for (i = 0; i < 16; i += 1) {
+ ipad[i] = bkey[i] ^ 0x36363636;
+ opad[i] = bkey[i] ^ 0x5C5C5C5C;
+ }
+ hash = binl_md5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);
+ return binl2rstr(binl_md5(opad.concat(hash), 512 + 128));
+ }
+
+ /*
+ * Convert a raw string to a hex string
+ */
+ function rstr2hex(input) {
+ var hex_tab = '0123456789abcdef',
+ output = '',
+ x,
+ i;
+ for (i = 0; i < input.length; i += 1) {
+ x = input.charCodeAt(i);
+ output += hex_tab.charAt((x >>> 4) & 0x0F) +
+ hex_tab.charAt(x & 0x0F);
+ }
+ return output;
+ }
+
+ /*
+ * Encode a string as utf-8
+ */
+ function str2rstr_utf8(input) {
+ return unescape(encodeURIComponent(input));
+ }
+
+ /*
+ * Take string arguments and return either raw or hex encoded strings
+ */
+ function raw_md5(s) {
+ return rstr_md5(str2rstr_utf8(s));
+ }
+ function hex_md5(s) {
+ return rstr2hex(raw_md5(s));
+ }
+ function raw_hmac_md5(k, d) {
+ return rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d));
+ }
+ function hex_hmac_md5(k, d) {
+ return rstr2hex(raw_hmac_md5(k, d));
+ }
+
+ function md5(string, key, raw) {
+ if (!key) {
+ if (!raw) {
+ return hex_md5(string);
+ }
+ return raw_md5(string);
+ }
+ if (!raw) {
+ return hex_hmac_md5(key, string);
+ }
+ return raw_hmac_md5(key, string);
+ }
+
+ if (typeof define === 'function' && define.amd) {
+ define(function () {
+ return md5;
+ });
+ } else {
+ $.md5 = md5;
+ }
+}(this));
diff --git a/wip.md b/wip.md
index ea868a25..f3ff0ab9 100644
--- a/wip.md
+++ b/wip.md
@@ -19,6 +19,7 @@ Supplier
- Add qr-print button to tables
- Order product buttons to views
- Use modernizr svg to determine svg handling capabilities
+- Add spec for switching from non-manager supplier to other supplier
User