Refactor Qsupplier.App to App

This commit is contained in:
2014-08-10 08:50:20 +02:00
parent 1a0f9b4ae5
commit 3451604dff
77 changed files with 200 additions and 197 deletions
@@ -1,4 +1,4 @@
Qsupplier.App = Ember.Application.create
@App = Ember.Application.create
LOG_TRANSITIONS: true
rootElement: '#ember-app-container'
store: -> @__container__.lookup('controller:application').store
@@ -1,4 +1,4 @@
Qsupplier.App.DropdownLink = Ember.Component.extend
App.DropdownLink = Ember.Component.extend
templateName: 'dropdown_link_view'
active: false
classNames: ['dropdown-container']
@@ -1,4 +1,4 @@
Qsupplier.App.ModalDialogComponent = Ember.Component.extend
App.ModalDialogComponent = Ember.Component.extend
actions:
close: ->
@sendAction()
@@ -1,4 +1,4 @@
Qsupplier.App.ApplicationController = Ember.Controller.extend
App.ApplicationController = Ember.Controller.extend
active_section: null
init: ->
#success = (supplier)=>
@@ -1,4 +1,4 @@
Qsupplier.App.IndexController = Ember.ObjectController.extend
App.IndexController = Ember.ObjectController.extend
needs: ['application']
lists: (-> @store.all('list')).property()
orders: (-> @store.all('order')).property()
@@ -21,7 +21,7 @@ Qsupplier.App.IndexController = Ember.ObjectController.extend
actions:
###
markListAsHelped: (id)->
if list = Qsupplier.App.List.findCached(id)
if list = App.List.findCached(id)
list.is_helped()
closeList: (list)->
@@ -31,12 +31,12 @@ Qsupplier.App.IndexController = Ember.ObjectController.extend
markOrderDelivered: (id)->
$.post('/supplier/order_is_delivered', order_id: id)
if order = Qsupplier.App.Order.findCached(id)
if order = App.Order.findCached(id)
order.set('state', 'delivered')
markOrderActive: (id)->
$.post('/supplier/mark_order_in_process', order_id: id)
if order = Qsupplier.App.Order.findCached(id)
if order = App.Order.findCached(id)
order.set('state', 'active')
cancelOrder: (order)->
$.post "/supplier/orders/#{order.id}/cancel"
@@ -1,4 +1,4 @@
Qsupplier.App.ListController = Ember.ObjectController.extend
App.ListController = Ember.ObjectController.extend
needs: ['application', 'lists', 'list'] #wtf? list, otherwise an Ember error
list: (-> @get('model')).property('model')
showTotal: (->
@@ -1,4 +1,4 @@
Qsupplier.App.ListsIndexController = Ember.ArrayController.extend
App.ListsIndexController = Ember.ArrayController.extend
loading: true
dateChanged: (->
@set 'loading', true
@@ -1,4 +1,4 @@
Qsupplier.App.ModalAddSectionController = Ember.ObjectController.extend
App.ModalAddSectionController = Ember.ObjectController.extend
alert_message: null
section_title: ''
section_width: 15
@@ -1,4 +1,4 @@
Qsupplier.App.ModalCloseListController = Ember.ObjectController.extend
App.ModalCloseListController = Ember.ObjectController.extend
actions:
close: ->
@send 'closeModal'
@@ -1,4 +1,4 @@
Qsupplier.App.ModalConfirmController = Ember.ObjectController.extend
App.ModalConfirmController = Ember.ObjectController.extend
actions:
close: ->
@get('model.cancel').call(@) if @get('model.cancel')
@@ -1,4 +1,4 @@
Qsupplier.App.ModalController = Ember.ObjectController.extend
App.ModalController = Ember.ObjectController.extend
modal_options: {}
actions:
close: ->
@@ -1,4 +1,4 @@
Qsupplier.App.ModalInfoController = Ember.ObjectController.extend
App.ModalInfoController = Ember.ObjectController.extend
actions:
close: ->
@get('model.cancel').call(@) if @get('model.cancel')
@@ -1,4 +1,4 @@
Qsupplier.App.ModalSectionAddTablesController = Ember.ObjectController.extend
App.ModalSectionAddTablesController = Ember.ObjectController.extend
number_start: 100
number_end: 110
actions:
@@ -1,4 +1,4 @@
Qsupplier.App.ModalSectionArrangeTablesController = Ember.ObjectController.extend
App.ModalSectionArrangeTablesController = Ember.ObjectController.extend
alert_message: null
arrange_type: 'distributed' # can be distributed, by_row or by_column
row_count: 2
@@ -1,4 +1,4 @@
Qsupplier.App.SectionController = Ember.ObjectController.extend
App.SectionController = Ember.ObjectController.extend
needs: ['application', 'sections', 'section'] #wtf? section, otherwise an Ember error
editmode: false
actions:
@@ -1,2 +1,2 @@
Qsupplier.App.SectionsController = Ember.ArrayController.extend
App.SectionsController = Ember.ArrayController.extend
needs: ['application']
@@ -1,4 +1,4 @@
Qsupplier.App.SectionsIndexController = Ember.ArrayController.extend
App.SectionsIndexController = Ember.ArrayController.extend
needs: ['application', 'sections', 'index']
sections: (-> @get('controllers.sections.model')).property('controllers.sections.model')
sectionQrCodesUrl: ((a,b,c)->
@@ -1,4 +1,4 @@
Qsupplier.App.SettingsController = Ember.ObjectController.extend
App.SettingsController = Ember.ObjectController.extend
needs: ['application']
model: (-> @get('controllers.application.supplier')).property('controllers.application.supplier')
time_zones: (-> window.time_zones ).property()
@@ -1,2 +1,2 @@
Qsupplier.App.TableController = Ember.ObjectController.extend
App.TableController = Ember.ObjectController.extend
table: (-> @get('model')).property('model')
@@ -1,4 +1,4 @@
Qsupplier.App.TablesIndexController = Ember.ArrayController.extend
App.TablesIndexController = Ember.ArrayController.extend
tables: (-> @get('model').sortBy('casted_number')).property('model.@each.number')
actions:
editTable: (table)->
@@ -1,4 +1,4 @@
attr = DS.attr
Qsupplier.App.JoinRequest= DS.Model.extend
App.JoinRequest= DS.Model.extend
list: DS.belongsTo('list')
user: DS.belongsTo('user')
@@ -1,5 +1,5 @@
attr = DS.attr
Qsupplier.App.List = DS.Model.extend
App.List = DS.Model.extend
state: attr 'string'
needs_help: attr 'boolean'
needs_payment: attr 'boolean'
@@ -1,5 +1,5 @@
attr = DS.attr
Qsupplier.App.Order = DS.Model.extend
App.Order = DS.Model.extend
state: attr('string')
list: DS.belongsTo('list')
price: attr('number')
@@ -1,5 +1,5 @@
attr = DS.attr
Qsupplier.App.Product = DS.Model.extend
App.Product = DS.Model.extend
name: attr 'string'
price: attr 'number'
product_category: DS.belongsTo('product_category')
@@ -1,4 +1,4 @@
attr = DS.attr
Qsupplier.App.ProductCategory = DS.Model.extend
App.ProductCategory = DS.Model.extend
name: attr('string')
products: DS.hasMany('product')
@@ -1,5 +1,5 @@
attr = DS.attr
Qsupplier.App.ProductOrder = DS.Model.extend
App.ProductOrder = DS.Model.extend
quantity: attr 'number', defaultValue: 1
price: attr 'number'
product: DS.belongsTo('product')
@@ -1,5 +1,5 @@
attr = DS.attr
Qsupplier.App.Section = DS.Model.extend
App.Section = DS.Model.extend
title: attr 'string'
width: attr 'number'
height: attr 'number'
@@ -1,5 +1,5 @@
attr = DS.attr
Qsupplier.App.Supplier = DS.Model.extend
App.Supplier = DS.Model.extend
name: attr 'string'
email: attr 'string'
time_zone: attr 'string'
@@ -1,5 +1,5 @@
attr = DS.attr
Qsupplier.App.Table = DS.Model.extend
App.Table = DS.Model.extend
number: attr 'number'
width: attr 'number'
height: attr 'number'
@@ -1,5 +1,5 @@
attr = DS.attr
Qsupplier.App.User= DS.Model.extend
App.User= DS.Model.extend
facebook_id: attr('string')
email: attr('string')
name: attr('string')
@@ -8,7 +8,7 @@ DS.Model.reopen
DS.Model.reopenClass
findCached: (id)->
return null unless id
@store.all(@toString()).findProperty('id', id)
@store.all(@typeKey).findProperty('id', id)
updateOrAdd: (attributes)->
if cached = @findCached(attributes.id)
@@ -45,7 +45,7 @@ DS.Model.reopenClass
nested_attributes = {}
nested_attributes[self_name] = attributes
# pushPayload makes association back references, just push not yet 2014-06-27
new_record = @store.pushPayload(@toString(), nested_attributes)
new_record = @store.pushPayload(nested_attributes)
#debugger if options.debug
@@ -1,10 +1,10 @@
# For more information see: http://emberjs.com/guides/routing/
# and for queryParams: https://github.com/alexspeller/website/blob/a96d9afe4506454b155cc64299e86e558ce3c9f1/source/guides/routing/query-params.md
Qsupplier.App.Router.reopen
App.Router.reopen
# location: 'history'
rootURL: '/supplier'
Qsupplier.App.Router.map ->
App.Router.map ->
@route '/', queryParams: ['section_id']
@resource 'sections', ->
@resource 'section', path: ':section_id'
@@ -1,4 +1,4 @@
Qsupplier.App.ApplicationRoute = Ember.Route.extend
App.ApplicationRoute = Ember.Route.extend
beforeModel: ->
# Preload only active lists and orders
@supplier = @store.push 'supplier', supplier_object
@@ -1,9 +1,9 @@
# Qsupplier.App.IndexRoute = Ember.Route.extend
# App.IndexRoute = Ember.Route.extend
# model: (params, queryParams)->
# Ember.Object.create
# # Find with condition does not work since the resulting array promise is not updated for newly created records
# #lists: Qsupplier.App.List.find({state: 'active'})
# #orders: Qsupplier.App.Order.find({state: 'active'})
# #lists: App.List.find({state: 'active'})
# #orders: App.Order.find({state: 'active'})
# #lists: @store.filter 'list', (l)-> l.get('state') == 'active' # DOES NOT WORK!!!! (yet)
# # use filter to create a scope on all the records
# #lists: @store.filter 'list', -> true
@@ -16,7 +16,7 @@
# controller.set('model', model)
# #$('#section_selector').on 'change', (-> controller.set('sectionId', $(this).val()))
# #controller.set 'lists', @store.all('list')
# #controller.set 'lists', Qsupplier.App.List.all() #.filterProperty('state', 'active')
# #controller.set 'orders', Qsupplier.App.Order.all()
# #controller.set 'lists', App.List.all() #.filterProperty('state', 'active')
# #controller.set 'orders', App.Order.all()
# #controller.set 'lists', model.get('lists')
# #controller.set 'orders', model.get('orders')
@@ -1,4 +1,4 @@
Qsupplier.App.ListsIndexRoute = Ember.Route.extend
App.ListsIndexRoute = Ember.Route.extend
#model: -> @store.find 'list'
setupController: (controller, model)->
controller.set 'date', (new Date()).toISOString().substr(0,10) unless controller.get('date')
@@ -1,4 +1,4 @@
Qsupplier.App.SectionRoute = Ember.Route.extend
App.SectionRoute = Ember.Route.extend
model: (params) -> @store.findById 'section', params.section_id
renderTemplate: ->
@render 'section'
@@ -1,4 +1,4 @@
Qsupplier.App.SectionsRoute = Ember.Route.extend
App.SectionsRoute = Ember.Route.extend
model: -> @store.all 'section'
# setupController: (controller, collection) ->
@@ -1,4 +1,4 @@
Qsupplier.App.SettingsRoute = Ember.Route.extend
App.SettingsRoute = Ember.Route.extend
model: ->
Em.RSVP.hash
supplier: @controllerFor('application').get('supplier')
@@ -1,2 +1,2 @@
Qsupplier.App.TablesIndexRoute = Ember.Route.extend
App.TablesIndexRoute = Ember.Route.extend
model: -> @store.all('table')
@@ -1,6 +1,6 @@
Qsupplier.App.ApplicationSerializer = DS.ActiveModelSerializer
App.ApplicationSerializer = DS.ActiveModelSerializer
Qsupplier.App.ApplicationStore = DS.Store.extend
App.ApplicationStore = DS.Store.extend
adapter: DS.RESTAdapter.extend
namespace: 'supplier'
# user underscored paths
@@ -11,7 +11,7 @@ if list.closed_at
=state 'list' list.state
.display-row
.display-label  
.display-field: Qsupplier.App.CloseListButtonView content=list
.display-field: App.CloseListButtonView content=list
.row
each user in list.users
img.facebook-image src="http://graph.facebook.com/#{unbound user.facebook_id}/picture?type=square" alt="f"
@@ -7,7 +7,7 @@ td.status-icons
if view.content.needs_payment
|
span.icon.needs-payment
td.numeric.table_number: Qsupplier.App.TableNumberWithInfoView contextBinding="view.content"
td.numeric.table_number: App.TableNumberWithInfoView contextBinding="view.content"
td.section_title: link-to 'section' view.content.section.id: span=view.content.section.title
td.currency.total_list_amount {{currency view.content.total}}
td.actions
@@ -16,7 +16,7 @@ td.actions
span.fa-stack.fa-2x.fa-stack-sized
i.fa.fa-bell.fa-stack-small
i.fa.fa-ban.revoke
Qsupplier.App.MarkListHelpedButtonView content=view.content
Qsupplier.App.CloseListButtonView content=view.content
App.MarkListHelpedButtonView content=view.content
App.CloseListButtonView content=view.content
button.show-list.button{action "showList" view.content.id}: span
@@ -4,7 +4,7 @@ td.user-info.show-for-large-up
td.status-icons
span.active-order.fa.fa-check.fa-lg
td= view.content.display
td.numeric.table_number: Qsupplier.App.TableNumberWithInfoView contextBinding="view.content.list"
td.numeric.table_number: App.TableNumberWithInfoView contextBinding="view.content.list"
td.section_title: link-to 'section' view.content.list.section.id: span=view.content.list.section.title
td.currency=currency view.content.total
td.actions
@@ -1,7 +1,7 @@
.page-header
div.dashboard-section-selection
Qsupplier.App.HomeSectionSelectorView selectionBinding="controller.controllers.application.active_section" content=controller.sections prompt=controllers.application.supplier.name
Qsupplier.App.HomeSectionJumperView
App.HomeSectionSelectorView selectionBinding="controller.controllers.application.active_section" content=controller.sections prompt=controllers.application.supplier.name
App.HomeSectionJumperView
h3=t 'active_lists.title'
.well
table.active-lists-table.table
@@ -14,7 +14,7 @@
th.currency=t 'active_lists.price'
th.actions
tbody
each list in controller.active_lists: Qsupplier.App.ActiveListView contentBinding="list"
each list in controller.active_lists: App.ActiveListView contentBinding="list"
.page-header
h3=t 'active_orders.title'
.well
@@ -29,4 +29,4 @@
th.currency=t 'active_orders.price'
th.actions
tbody
each order in controller.active_orders: Qsupplier.App.ActiveOrderView contentBinding="order"
each order in controller.active_orders: App.ActiveOrderView contentBinding="order"
@@ -1,5 +1,5 @@
h1=t 'models.plural.list'
Qsupplier.App.ListDisplayDateSelector valueBinding="date"
App.ListDisplayDateSelector valueBinding="date"
if sorted_lists
table.table
thead
@@ -12,12 +12,12 @@ modal-dialog action="close"
.form-label
label=t 'attributes.section.width'
.form-field
Qsupplier.App.NumberField valueBinding="section_width"
App.NumberField valueBinding="section_width"
.form-row
.form-label
label=t 'attributes.section.height'
.form-field
Qsupplier.App.NumberField valueBinding="section_height"
App.NumberField valueBinding="section_height"
.modal-footer
hr
button.confirm-cancel{action "close"}=t 'section.add_section.modal.close_button'
@@ -11,13 +11,13 @@ modal-dialog action="close"
label for='add-tables-number-start'
=t 'section.add_tables.modal.number_start'
.form-field
Qsupplier.App.NumberField valueBinding="number_start"
App.NumberField valueBinding="number_start"
.form-row
.form-label
label for='add-tables-number-end'
=t 'section.add_tables.modal.number_end'
.form-field
Qsupplier.App.NumberField valueBinding="number_end"
App.NumberField valueBinding="number_end"
.modal-footer
hr
button.confirm-cancel{action "close"}=t 'section.add_tables.modal.close_button'
@@ -23,11 +23,11 @@ modal-dialog action="close"
==t 'section.arrange_tables.modal.distributed.explanation'
if isByRow
==t 'section.arrange_tables.modal.by_row.before_field'
Qsupplier.App.NumberField valueBinding="row_count"
App.NumberField valueBinding="row_count"
==t 'section.arrange_tables.modal.by_row.after_field'
if isByColumn
==t 'section.arrange_tables.modal.by_column.before_field'
Qsupplier.App.NumberField valueBinding="column_count"
App.NumberField valueBinding="column_count"
==t 'section.arrange_tables.modal.by_column.after_field'
.modal-footer
hr
@@ -6,7 +6,7 @@ modal-dialog action="close"
p=t 'table.edit.modal.body_header'
.form-row
.form-label=t 'attributes.table.number'
.form-field: Qsupplier.App.NumberField valueBinding="model.number"
.form-field: App.NumberField valueBinding="model.number"
.form-row
.form-label=t 'models.section'
.form-field
@@ -1,7 +1,7 @@
.section-tabs-container
link-to 'sections' class="goto-sections-index-tab-header": span
each section in sections
Qsupplier.App.SectionTabHeaderView context=section
App.SectionTabHeaderView context=section
a.add-section{action "addSection"}: span
.section-manage-tables.pull-right
if editmode
@@ -17,7 +17,7 @@
/button.btn.dropdown-toggle data-toggle="dropdown"
span Action
span.caret
Qsupplier.App.DropdownLink title="Action"
App.DropdownLink title="Action"
ul
li
a{action "addTables"}: span.section-add-tables-icon=t 'section.add_tables.button_label'
@@ -28,10 +28,10 @@
li
a.section-destroy{action "destroySection"}: span.section-remove-icon=t 'helpers.links.destroy'
Ember.TextField valueBinding="title" class="section-edit-title-field"
Qsupplier.App.NumberField valueBinding="width" class="dimension section-edit-width-field"
App.NumberField valueBinding="width" class="dimension section-edit-width-field"
span.fa.fa-lg.fa-times
Qsupplier.App.NumberField valueBinding="height" class="dimension section-edit-height-field"
App.NumberField valueBinding="height" class="dimension section-edit-height-field"
a.section-normal-mode-button{ action "finishEditable" }: span
else
a.section-edit-mode-button{ action "makeEditable" }: span
Qsupplier.App.SectionTablesView contentBinding="tables"
App.SectionTablesView contentBinding="tables"
@@ -7,8 +7,8 @@ if table.active_list
div.table-actions
.title= table.number
.table-action-row
Qsupplier.App.MarkListHelpedButtonView contentBinding="table.active_list"
Qsupplier.App.CloseListButtonView contentBinding="table.active_list"
App.MarkListHelpedButtonView contentBinding="table.active_list"
App.CloseListButtonView contentBinding="table.active_list"
.table-action-row=currency table.active_list.total
/.table-action-row
a{action "editTable" table}: span.fa.fa-lg.fa-wrench
@@ -1,2 +1,2 @@
each table in tables
Qsupplier.App.SectionTableView content=table
App.SectionTableView content=table
@@ -4,7 +4,7 @@ h2=t 'settings.title'
.form-field: Ember.TextField valueBinding="controller.model.name"
.form-row
.form-label: label=t 'attributes.supplier.email'
.form-field: Qsupplier.App.EmailField valueBinding="controller.model.email" classNames="supplier-email"
.form-field: App.EmailField valueBinding="controller.model.email" classNames="supplier-email"
/input.location_picker name="location" type="text" valueBinding="location"
/.form-row
.location_picker_map
@@ -18,7 +18,7 @@ h2=t 'settings.title'
.row
.large-8.medium-8.columns: Ember.TextField valueBinding="controller.model.address"
.large-1.show-for-large-up.columns  
.large-2.medium-2.small-3.columns: Qsupplier.App.NumberField valueBinding="controller.model.house_number"
.large-2.medium-2.small-3.columns: App.NumberField valueBinding="controller.model.house_number"
.large-1.medium-2.small-2.columns: Ember.TextField valueBinding="controller.model.house_number_addition"
.form-row
.form-label: label=t 'attributes.supplier.postal_code'
@@ -33,7 +33,7 @@ if editIensProfile
.form-row
.form-label: label=t 'attributes.supplier.iens_profile'
.form-field
Qsupplier.App.NumberField valueBinding="controller.model.iens_profile"
App.NumberField valueBinding="controller.model.iens_profile"
= image_tag 'supplier/settings/iens-example.png'
span=t "settings.reviews.explanation"
.form-row.form-actions
@@ -1,4 +1,4 @@
Qsupplier.App.ActiveListView = Ember.View.extend
App.ActiveListView = Ember.View.extend
tagName: 'tr'
templateName: 'active_list'
classNameBindings: ['classIdentifier']
@@ -1,4 +1,4 @@
Qsupplier.App.ActiveOrderView = Ember.View.extend
App.ActiveOrderView = Ember.View.extend
tagName: 'tr'
templateName: 'active_order'
classNameBindings: ['content.active:active', 'content.delivered:delivered', 'classIdentifier']
@@ -1,4 +1,4 @@
Qsupplier.App.ApplicationView = Ember.View.extend
App.ApplicationView = Ember.View.extend
didInsertElement: ->
Qsupplier.watch_events()
selector_mappings =
@@ -1,4 +1,4 @@
Qsupplier.App.CloseListButtonView = Ember.View.extend
App.CloseListButtonView = Ember.View.extend
templateName: 'close_list_button'
classNames: ['close-list-button']
classNameBindings: ['content.active:show:hide']
@@ -1,3 +1,3 @@
Qsupplier.App.EmailField = Ember.TextField.extend
App.EmailField = Ember.TextField.extend
type: 'email'
#attributeBindings: ['min', 'max', 'step']
@@ -1,4 +1,4 @@
Qsupplier.App.HomeSectionJumperView = Ember.View.extend
App.HomeSectionJumperView = Ember.View.extend
tagName: 'a'
classNames: ['main-board-section-jumper']
href: '#'
@@ -1,7 +1,7 @@
HomeSectionOption = Ember.SelectOption.extend
select_label: (-> "- #{@get('content.title')}").property('content.title')
valueBinding: 'content.id'
Qsupplier.App.HomeSectionSelectorView = Ember.Select.extend
App.HomeSectionSelectorView = Ember.Select.extend
classNames: 'section_selector'
optionView: HomeSectionOption
#valueBinding: 'controller.active_section_id'
@@ -1,4 +1,4 @@
Qsupplier.App.ListDisplayDateSelector = Ember.TextField.extend
App.ListDisplayDateSelector = Ember.TextField.extend
classNames: 'datepicker'
didInsertElement: ->
setTranslations @$().hide()
@@ -1,4 +1,4 @@
Qsupplier.App.MarkListHelpedButtonView = Ember.View.extend
App.MarkListHelpedButtonView = Ember.View.extend
templateName: 'mark_list_helped_button'
classNames: ['mark_list_as_helped']
classNameBindings: ['content.needs_help:show:hide']
@@ -1,3 +1,3 @@
Qsupplier.App.NumberField = Ember.TextField.extend
App.NumberField = Ember.TextField.extend
type: 'number'
attributeBindings: ['min', 'max', 'step']
@@ -1,4 +1,4 @@
Qsupplier.App.SectionTabHeaderView = Ember.View.extend DragNDrop.Droppable,
App.SectionTabHeaderView = Ember.View.extend DragNDrop.Droppable,
templateName: 'section_tab_header'
classNames: ['section-tab-header']
classNameBindings: ['section_header_class', 'controller.controllers.application.isDragging:table-dragging', 'section_active']
@@ -1,4 +1,4 @@
Qsupplier.App.SectionTableView = Ember.View.extend DragNDrop.Draggable,
App.SectionTableView = Ember.View.extend DragNDrop.Draggable,
templateName: 'section_table'
classNames: ['section-table']
attributeBindings: ['style']
@@ -1,4 +1,4 @@
Qsupplier.App.SectionTablesView = Ember.View.extend DragNDrop.Droppable,
App.SectionTablesView = Ember.View.extend DragNDrop.Droppable,
classNames: ['well', 'section-tables-container', 'section-tables-active']
templateName: 'section_tables'
didInsertElement: ->
@@ -1,4 +1,4 @@
#Qsupplier.App.SectionView = Ember.View.extend {}
#App.SectionView = Ember.View.extend {}
#initFoundation: (->
#debugger
#@$().foundation()
@@ -1,4 +1,4 @@
Qsupplier.App.SettingsView = Ember.View.extend
App.SettingsView = Ember.View.extend
templateName: 'settings'
didInsertElement: ->
return
@@ -1,3 +1,3 @@
Qsupplier.App.TableActionsView = Ember.Component.extend
App.TableActionsView = Ember.Component.extend
tagName: 'ul'
templateName: 'table_actions'
@@ -1,4 +1,4 @@
Qsupplier.App.TableNumberWithInfoView = Ember.View.extend
App.TableNumberWithInfoView = Ember.View.extend
tagName: 'span'
templateName: 'table_number_with_info'
classNames: 'table-number-with-info'
@@ -6,11 +6,11 @@ root.Qsupplier=
console.log "Event: #{e.event}"
console.log e.data
if(e.event == 'new_order')
if Qsupplier.App
Qsupplier.App.store().pushPayload(e.data)
if App
App.store().pushPayload(e.data)
# Fix for ember pushPayload bug not creating the proper relations/triggers
setTimeout ->
if order = Qsupplier.App.store().all('order').findProperty('id', e.data.order.id)
if order = App.store().all('order').findProperty('id', e.data.order.id)
# console.log "Ugly ember fix for adding order #{e.data.order.id} as relation to its list"
list = order.get('list')
list.get('orders').addRecord order
@@ -20,35 +20,35 @@ root.Qsupplier=
table.set 'active_list', list if table_list isnt list
, 200
else if(e.event == 'list_needs_help')
if Qsupplier.App and list = Qsupplier.App.List.findCached(e.data.id)
if App and list = App.List.findCached(e.data.id)
list.markNeedsHelp()
# old stuff
# $('#list-needs-help-indicator-'+e.data.id).removeClass('hide')
# $('#list-is-helped-button-'+e.data.id).removeClass('hide')
# $('.section-table-list-'+e.data.id).addClass('needs_help')
else if(e.event == 'list_needs_payment')
if Qsupplier.App and list = Qsupplier.App.List.findCached(e.data.id)
if App and list = App.List.findCached(e.data.id)
list.markNeedsPayment()
# old stuff
$('#list-needs-payment-indicator-'+e.data.id).removeClass('hide')
$('.section-table-list-'+e.data.id).addClass('needs_payment')
else if(e.event == 'list_is_paid')
if list = Qsupplier.App.List.findCached(e.data.id)
if list = App.List.findCached(e.data.id)
list.markIsPaid()
else if e.event == 'list_update'
if Qsupplier.App
list = Qsupplier.App.List.updateOrAdd(e.data.list)
if App
list = App.List.updateOrAdd(e.data.list)
else if e.event == 'list_closed'
if Qsupplier.App and list = Qsupplier.App.List.findCached(e.data.id)
if App and list = App.List.findCached(e.data.id)
list.markClosed()
$('.list-row-'+e.data.id).remove()
$('.of-list-'+e.data.id).remove()
table_list_class = 'section-table-list-'+e.data.id
$('.'+table_list_class).removeClass('occupied needs_help needs_payment active_order').removeClass(table_list_class)
else if e.event == 'order_closed'
order.markClosed() if Qsupplier.App and order = Qsupplier.App.Order.findCached(e.data.id)
order.markClosed() if App and order = App.Order.findCached(e.data.id)
else if e.event == 'list_helped'
if Qsupplier.App and list = Qsupplier.App.List.findCached(e.data.id)
if App and list = App.List.findCached(e.data.id)
list.markHelped()
# list_id = e.data.id
@@ -56,12 +56,12 @@ root.Qsupplier=
# $('#list-is-helped-button-'+list_id).addClass('hide')
# $('.section-table-list-'+list_id).removeClass('needs_help')
else if e.event == 'order_being_processed'
if Qsupplier.App and order = Qsupplier.App.Order.findCached(e.data.id)
if App and order = App.Order.findCached(e.data.id)
order.markActive()
# $('#order-in-process-button-'+e.data.id).hide()
# $('.order-row-'+e.data.id).removeClass('placed').addClass('active')
else if e.event == 'order_being_delivered'
if Qsupplier.App and order = Qsupplier.App.Order.findCached(e.data.id)
if App and order = App.Order.findCached(e.data.id)
order.markDelivered()
# $('.order-row-'+e.data.id).remove()
# $('.section-table-list-'+e.data.list_id).removeClass('active_order')
@@ -70,9 +70,9 @@ root.Qsupplier=
else if e.event == 'orders_placed_count'
$('.supplier-orders-placed-count-number').text e.data.count
else if e.event == 'list_changed_table'
Qsupplier.App && Qsupplier.App.List.updateOrAdd(e.data.list)
App && App.List.updateOrAdd(e.data.list)
else if e.event == 'order_cancelled'
if Qsupplier.App and order = Qsupplier.App.Order.findCached(e.data.id)
if App and order = App.Order.findCached(e.data.id)
order.markCancelled()
$('.supplier-orders-placed-count-number').text(e.data.orders_placed_count) if e.data.orders_placed_count == 0 or e.data.orders_placed_count
$('.supplier-orders-in-process-count-number').text(e.data.orders_in_process_count) if e.data.orders_in_process_count == 0 or e.data.orders_in_process_count
+6 -2
View File
@@ -50,6 +50,10 @@ module ApplicationHelper
'mozo.bar'
end
def site_page_title
application_title
end
# Helper for displaying HTML currency values
def currency(amount, opts={})
amount ||= 0.0
@@ -102,10 +106,10 @@ module ApplicationHelper
end
def facebook_link
link_to 'Facebook', 'https://www.facebook.com/Qwaiter', target: :_blank
link_to 'Facebook', 'https://www.facebook.com/mozo.bar', target: :_blank
end
def twitter_link
link_to 'Twitter', 'https://www.twitter.com/Qwaiter', target: :_blank
link_to 'Twitter', 'https://www.twitter.com/mozo.bar', target: :_blank
end
# Add a script call to be executed when the dom is loaded.
+1 -1
View File
@@ -4,7 +4,7 @@ html lang="en"
meta charset="utf-8"
meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"
meta name="viewport" content="width=device-width, initial-scale=1.0"
title= content_for?(:title) ? yield(:title) : application_title
title= site_page_title
= csrf_meta_tags
/! Le HTML5 shim, for IE6-8 support of HTML elements
/[if lt IE 9]
+1 -1
View File
@@ -4,7 +4,7 @@ html lang="en"
meta charset="utf-8"
meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"
meta name="viewport" content="width=device-width, initial-scale=1.0"
title= content_for?(:title) ? yield(:title) : application_title
title= site_page_title
= csrf_meta_tags
/! Le HTML5 shim, for IE6-8 support of HTML elements
+57 -59
View File
@@ -14,8 +14,8 @@
height="318.89764"
id="svg2991"
version="1.1"
inkscape:version="0.48.2 r9819"
sodipodi:docname="table_qr_image2.svg">
inkscape:version="0.48.5 r10040"
sodipodi:docname="qr_container.svg">
<defs
id="defs3">
<filter
@@ -178,8 +178,8 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2.1440801"
inkscape:cx="80.481439"
inkscape:cy="209.05013"
inkscape:cx="99.137458"
inkscape:cy="246.36217"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
@@ -197,7 +197,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
@@ -219,82 +219,80 @@
x="277.10553"
y="160.40939"
id="tspan3801">#table_number</tspan></text>
<g
transform="translate(24.331912,-0.93280097)"
id="g13730">
<text
x="67.198868"
y="-103.47206"
id="text5"
style="font-size:29.77246857px;fill:#634227;font-family:HelveticaRounded-Bold">
<tspan
id="tspan3936"
style="font-family:Arial Rounded MT Bold;-inkscape-font-specification:Arial Rounded MT Bold">Q</tspan>
</text>
<text
x="91.433167"
y="-103.47206"
style="font-size:37.90859985px"
id="text7"
style="font-size:37.90859985px">
y="-104.40486"
x="81.717873">
<tspan
x="91.433167"
y="-103.47206"
style="font-size:29.77246857px;fill:#231f20;font-family:Arial Rounded MT Bold;-inkscape-font-specification:Arial Rounded MT Bold"
id="tspan9"
style="font-size:29.77246857px;fill:#231f20;font-family:Arial Rounded MT Bold;-inkscape-font-specification:Arial Rounded MT Bold">WAITE</tspan>
y="-104.40486"
x="81.717873">MOZO</tspan>
</text>
<text
x="187.71786"
y="-103.47206"
style="font-size:29.77246857px;fill:#634227;font-family:HelveticaRounded-Bold"
id="text19"
style="font-size:29.77246857px;fill:#634227;font-family:HelveticaRounded-Bold">
y="-104.40486"
x="170.18417">
<tspan
id="tspan3938"
style="font-family:Arial Rounded MT Bold;-inkscape-font-specification:Arial Rounded MT Bold">R</tspan>
style="font-family:Arial Rounded MT Bold;-inkscape-font-specification:Arial Rounded MT Bold"
id="tspan3938">.BAR</tspan>
</text>
<path
d="m 4239.495,4221.196 c 0,0 -5.676,0 -5.676,5.676 v 33.539 c 0,0 0,5.676 5.676,5.676 h 33.797 c 0,0 5.676,0 5.676,-5.676 v -33.539 c 0,0 0,-5.676 -5.676,-5.676 h -33.797 z"
transform="matrix(0.7293556,0,0,0.7293556,-3066.7086,-3211.2792)"
clip-path="url(#SVGID_2_-0)"
inkscape:connector-curvature="0"
style="fill:#ffffff"
id="path29"
style="fill:#ffffff" />
<path
d="m 4239.495,4221.196 c 0,0 -5.676,0 -5.676,5.676 v 33.539 c 0,0 0,5.676 5.676,5.676 h 33.797 c 0,0 5.676,0 5.676,-5.676 v -33.539 c 0,0 0,-5.676 -5.676,-5.676 h -33.797 z"
transform="matrix(0.7293556,0,0,0.7293556,-3066.7086,-3211.2792)"
clip-path="url(#SVGID_2_-0)"
transform="matrix(0.7293556,0,0,0.7293556,-3042.3767,-3212.212)"
d="m 4239.495,4221.196 c 0,0 -5.676,0 -5.676,5.676 v 33.539 c 0,0 0,5.676 5.676,5.676 h 33.797 c 0,0 5.676,0 5.676,-5.676 v -33.539 c 0,0 0,-5.676 -5.676,-5.676 h -33.797 z" />
<path
inkscape:connector-curvature="0"
style="fill:none;stroke:#634227;stroke-width:1.63800001"
id="path31"
style="fill:none;stroke:#634227;stroke-width:1.63800001" />
<path
d="m 4255.337,4249.788 c 0,0 0.091,12.386 -0.011,12.69 -0.18,0.539 -0.57,0.655 -1.942,0.671 -0.963,0.012 -2.048,0.077 -2.048,-1.073 0,-2.093 -0.01,-7.585 -0.022,-7.922 -0.013,-0.338 -1.305,-0.579 -1.305,0.079 0,1.5 0.077,7.812 -0.138,8.294 -0.24,0.87 -3.642,1.007 -4.057,-0.226 -0.435,-1.29 0,-12.284 0,-12.284 0,0 -0.902,-0.461 -0.902,-1.127 v -5.356 c -0.073,-0.544 -2.882,4.036 -3.287,4.484 -1.137,1.071 -3.071,0.437 -2.235,-1.946 0.121,-0.244 4.805,-7.985 5.635,-9.016 0.371,-0.461 1.658,-0.386 2.742,-0.271 0.714,0.077 1.315,3.538 1.991,5.343 0.677,1.803 0.677,1.803 1.466,0.225 0.789,-1.578 2.113,-4.957 2.254,-5.185 0.232,-0.376 1.69,-0.503 2.239,-0.165 0.989,0.607 3.96,3.434 3.96,3.434 l 2.367,-3.381 h -4.96 c 0,0 -1.467,-1.127 0.451,-1.014 1.916,0.111 15.666,0 15.666,0 0,0 0.9,1.014 0,1.014 h -6.988 l -4.846,6.478 c 0,0 -0.563,1.52 -2.48,0 -1.915,-1.519 -2.607,-2.068 -2.725,-1.97 0.02,0.257 0,6.763 0,6.763 0,0 0.076,1.236 -0.825,1.461"
transform="matrix(0.7293556,0,0,0.7293556,-3066.7086,-3211.2792)"
clip-path="url(#SVGID_2_-0)"
transform="matrix(0.7293556,0,0,0.7293556,-3042.3767,-3212.212)"
d="m 4239.495,4221.196 c 0,0 -5.676,0 -5.676,5.676 v 33.539 c 0,0 0,5.676 5.676,5.676 h 33.797 c 0,0 5.676,0 5.676,-5.676 v -33.539 c 0,0 0,-5.676 -5.676,-5.676 h -33.797 z" />
<path
inkscape:connector-curvature="0"
style="fill:#634227"
id="path33"
style="fill:#634227" />
<path
d="m 4255.833,4230.169 c 0,3.059 -2.479,5.536 -5.536,5.536 -3.057,0 -5.536,-2.478 -5.536,-5.536 0,-3.058 2.479,-5.535 5.536,-5.535 3.057,0 5.536,2.477 5.536,5.535"
transform="matrix(0.7293556,0,0,0.7293556,-3066.7086,-3211.2792)"
clip-path="url(#SVGID_2_-0)"
transform="matrix(0.7293556,0,0,0.7293556,-3042.3767,-3212.212)"
d="m 4255.337,4249.788 c 0,0 0.091,12.386 -0.011,12.69 -0.18,0.539 -0.57,0.655 -1.942,0.671 -0.963,0.012 -2.048,0.077 -2.048,-1.073 0,-2.093 -0.01,-7.585 -0.022,-7.922 -0.013,-0.338 -1.305,-0.579 -1.305,0.079 0,1.5 0.077,7.812 -0.138,8.294 -0.24,0.87 -3.642,1.007 -4.057,-0.226 -0.435,-1.29 0,-12.284 0,-12.284 0,0 -0.902,-0.461 -0.902,-1.127 v -5.356 c -0.073,-0.544 -2.882,4.036 -3.287,4.484 -1.137,1.071 -3.071,0.437 -2.235,-1.946 0.121,-0.244 4.805,-7.985 5.635,-9.016 0.371,-0.461 1.658,-0.386 2.742,-0.271 0.714,0.077 1.315,3.538 1.991,5.343 0.677,1.803 0.677,1.803 1.466,0.225 0.789,-1.578 2.113,-4.957 2.254,-5.185 0.232,-0.376 1.69,-0.503 2.239,-0.165 0.989,0.607 3.96,3.434 3.96,3.434 l 2.367,-3.381 h -4.96 c 0,0 -1.467,-1.127 0.451,-1.014 1.916,0.111 15.666,0 15.666,0 0,0 0.9,1.014 0,1.014 h -6.988 l -4.846,6.478 c 0,0 -0.563,1.52 -2.48,0 -1.915,-1.519 -2.607,-2.068 -2.725,-1.97 0.02,0.257 0,6.763 0,6.763 0,0 0.076,1.236 -0.825,1.461" />
<path
inkscape:connector-curvature="0"
style="fill:#634227"
id="path35"
style="fill:#634227" />
clip-path="url(#SVGID_2_-0)"
transform="matrix(0.7293556,0,0,0.7293556,-3042.3767,-3212.212)"
d="m 4255.833,4230.169 c 0,3.059 -2.479,5.536 -5.536,5.536 -3.057,0 -5.536,-2.478 -5.536,-5.536 0,-3.058 2.479,-5.535 5.536,-5.535 3.057,0 5.536,2.477 5.536,5.535" />
<circle
cx="4250.2969"
cy="4230.1689"
r="5.5359998"
transform="matrix(0.7293556,0,0,0.7293556,-3066.7086,-3211.2792)"
clip-path="url(#SVGID_2_-0)"
sodipodi:ry="5.5359998"
sodipodi:rx="5.5359998"
sodipodi:cy="4230.1689"
sodipodi:cx="4250.2969"
d="m 4255.8329,4230.1689 c 0,3.0575 -2.4786,5.536 -5.536,5.536 -3.0575,0 -5.536,-2.4785 -5.536,-5.536 0,-3.0574 2.4785,-5.536 5.536,-5.536 3.0574,0 5.536,2.4786 5.536,5.536 z"
style="fill:none;stroke:#634227;stroke-width:0.182;stroke-miterlimit:10"
id="circle37"
style="fill:none;stroke:#634227;stroke-width:0.182;stroke-miterlimit:10" />
<path
d="m 4250.515,4236.479 c 0.061,-0.155 2.532,-1.205 2.672,-1.102 0.139,0.104 0.434,2.063 0.228,2.369"
transform="matrix(0.7293556,0,0,0.7293556,-3066.7086,-3211.2792)"
clip-path="url(#SVGID_2_-0)"
transform="matrix(0.7293556,0,0,0.7293556,-3042.3767,-3212.212)"
r="5.5359998"
cy="4230.1689"
cx="4250.2969" />
<path
inkscape:connector-curvature="0"
style="fill:#231f20"
id="path39"
style="fill:#231f20" />
<path
d="m 4251.332,4236.363 c -0.096,-0.136 -2.748,-0.556 -2.858,-0.422 -0.111,0.134 0.076,2.106 0.351,2.354"
transform="matrix(0.7293556,0,0,0.7293556,-3066.7086,-3211.2792)"
clip-path="url(#SVGID_2_-0)"
transform="matrix(0.7293556,0,0,0.7293556,-3042.3767,-3212.212)"
d="m 4250.515,4236.479 c 0.061,-0.155 2.532,-1.205 2.672,-1.102 0.139,0.104 0.434,2.063 0.228,2.369" />
<path
inkscape:connector-curvature="0"
style="fill:#231f20"
id="path41"
style="fill:#231f20" />
</g>
clip-path="url(#SVGID_2_-0)"
transform="matrix(0.7293556,0,0,0.7293556,-3042.3767,-3212.212)"
d="m 4251.332,4236.363 c -0.096,-0.136 -2.748,-0.556 -2.858,-0.422 -0.111,0.134 0.076,2.106 0.351,2.354" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

+1 -1
View File
@@ -1,7 +1,7 @@
module SpecEmberHelpers
def ember_store
h = page.evaluate_script <<-SCRIPT
$s = Qsupplier.App.__container__.lookup('controller:application').store;
$s = App.__container__.lookup('controller:application').store;
JSON.stringify({
lists: $s.all('list').invoke('serialize'),
orders: $s.all('order').invoke('serialize'),
+1
View File
@@ -27,6 +27,7 @@ Supplier
- Settings checken
- Event stream to ember? (After release!!!)
- Add qr print functionality offering to send the stickers
- Supplier sidebar open/close message seems untranslated
User
----