End of week commit
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
Qsupplier.App.ListsController = Ember.ArrayController.extend
|
||||
dateChanged: (->
|
||||
@set('model', @store.find('list', date: @get('date')))
|
||||
).observes('date')
|
||||
@@ -1,5 +1,5 @@
|
||||
Qsupplier.App.SectionController = Ember.ObjectController.extend
|
||||
needs: ['application']
|
||||
needs: ['application', 'sections', 'section'] #wtf? section, otherwise an Ember error
|
||||
editmode: false
|
||||
makeEditable: -> @set('editmode', true)
|
||||
finishEditable: ->
|
||||
@@ -14,3 +14,4 @@ Qsupplier.App.SectionController = Ember.ObjectController.extend
|
||||
closeList: (list)-> list.close() if list
|
||||
textures: ['wood1', 'wood2']
|
||||
|
||||
sections: (-> @get('controllers.sections.model')).property('controllers.sections.model')
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
Qsupplier.App.SectionsController = Ember.ArrayController.extend
|
||||
needs: ['application', 'section']
|
||||
needs: ['application']
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
Qsupplier.App.SectionsIndexController = Ember.ArrayController.extend
|
||||
needs: ['application', 'sections']
|
||||
sections: (-> @get('controllers.sections.model')).property('controllers.sections.model')
|
||||
sectionQrCodesUrl: ((a,b,c)->
|
||||
debugger
|
||||
Routes.qr_codes_suppliers_tables_path()
|
||||
).property()
|
||||
newPath: Routes.new_suppliers_section_path()
|
||||
qrPath: (section_id)->
|
||||
Routes.qr_codes_suppliers_tables_path section_id: section_id
|
||||
@@ -0,0 +1,12 @@
|
||||
Ember.Handlebars.registerHelper 'path', (route, params..., options)->
|
||||
route_method = Routes["#{route}_path"]
|
||||
throw "Route #{route} cannout be found" unless route_method
|
||||
|
||||
mapped_options = {}
|
||||
|
||||
for k, v of options.hash
|
||||
mapped_options[k] = Ember.Handlebars.get(this, v, options) || v
|
||||
params.push mapped_options
|
||||
|
||||
path = route_method.apply(this, params)
|
||||
new Handlebars.SafeString("href='#{path}'")
|
||||
@@ -7,6 +7,7 @@ Qsupplier.App.List = DS.Model.extend
|
||||
is_paid: attr 'boolean'
|
||||
has_active_orders: attr 'boolean'
|
||||
price: attr 'number'
|
||||
closed_at: DS.attr('date')
|
||||
table_number: attr 'number'
|
||||
table: DS.belongsTo('table', inverse: 'active_list')
|
||||
#users: DS.hasMany('user', inverse: 'active_list')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
DS.Model.reopen
|
||||
created_at: DS.attr('string')
|
||||
updated_at: DS.attr('string')
|
||||
created_at: DS.attr('date')
|
||||
updated_at: DS.attr('date')
|
||||
DS.Model.reopenClass
|
||||
findCached: (id)->
|
||||
return null unless id
|
||||
|
||||
@@ -8,4 +8,6 @@ Qsupplier.App.Router.map ->
|
||||
@route '/', queryParams: ['section_id']
|
||||
@resource 'sections', ->
|
||||
@resource 'section', path: ':section_id'
|
||||
@resource 'lists', ->
|
||||
@resource 'list', path: ':list_id'
|
||||
#@resource 'lists', queryParams: ['state']
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
Qsupplier.App.ListsRoute = Ember.Route.extend
|
||||
#model: -> @store.find 'list'
|
||||
setupController: (controller, model)->
|
||||
controller.set 'date', (new Date()).toISOString().substr(0,10)
|
||||
@@ -0,0 +1,26 @@
|
||||
h1=t 'models.plural.list'
|
||||
Qsupplier.App.ListDisplayDateSelector valueBinding=date
|
||||
if controller.model
|
||||
table.table
|
||||
thead
|
||||
tr
|
||||
th.state=t 'attributes.list.state'
|
||||
th.boolean=t 'attributes.list.needs_help'
|
||||
th.boolean=t 'attributes.list.needs_payment'
|
||||
th.timestamp=t 'attributes.list.closed_at'
|
||||
th.table_number=t 'models.table'
|
||||
th.currentcy=t 'attributes.list.price'
|
||||
th.timestamp=t 'attributes.list.created_at'
|
||||
tbody
|
||||
each list in controller
|
||||
tr
|
||||
td.state=state 'list' list.state
|
||||
td.boolean.needs_help=boolean list.needs_help
|
||||
td.boolean.needs_payment=boolean list.needs_payment
|
||||
td.timestamp=time list.closed_at
|
||||
td.table_number 7
|
||||
td.currency=currency list.price
|
||||
td.timestamp=time list.created_at
|
||||
else
|
||||
.row
|
||||
.panel=t 'list.none_found'
|
||||
@@ -1,3 +1,7 @@
|
||||
.section-tabs-container
|
||||
link-to 'sections' | b
|
||||
each section in sections
|
||||
view Qsupplier.App.SectionTabHeaderView context=section
|
||||
.section-manage-tables.pull-right
|
||||
if editmode
|
||||
.btn-group
|
||||
|
||||
@@ -1,4 +1 @@
|
||||
.section-tabs-container
|
||||
each section in controller
|
||||
view Qsupplier.App.SectionTabHeaderView context=section
|
||||
= outlet
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
h1=t 'models.plural.section'
|
||||
if sections
|
||||
table.table
|
||||
thead
|
||||
tr
|
||||
th=t 'attributes.section.title'
|
||||
th=t 'models.plural.table'
|
||||
th.numeric=t 'attributes.section.width'
|
||||
th.numeric=t 'attributes.section.height'
|
||||
/th.boolean=t 'attributes.list.needs_help'
|
||||
/th.boolean=t 'attributes.list.needs_payment'
|
||||
/th.timestamp=t 'attributes.list.closed_at'
|
||||
/th.table_number=t 'models.table'
|
||||
/th.currentcy=t 'attributes.list.price'
|
||||
/th.timestamp=t 'attributes.list.created_at'
|
||||
th.actions=t 'helpers.actions.title'
|
||||
tbody
|
||||
each section in sections
|
||||
tr
|
||||
td
|
||||
link-to 'section' section
|
||||
=section.title
|
||||
td
|
||||
span.table-count= section.tables.length
|
||||
td.numeric= section.width
|
||||
td.numeric= section.height
|
||||
/td.boolean.needs_help=boolean list.needs_help
|
||||
/td.boolean.needs_payment=boolean list.needs_payment
|
||||
/td.timestamp=time list.closed_at
|
||||
/td.table_number 7
|
||||
/td.currency=currency list.price
|
||||
/td.timestamp=time list.created_at
|
||||
td.actions
|
||||
a.table-qr-codes{path qr_codes_suppliers_tables section_id=section.id}
|
||||
span
|
||||
else
|
||||
.row
|
||||
.panel=t 'section.none_found'
|
||||
.form-actions
|
||||
a.form-action-new{path new_suppliers_section}=t 'helpers.links.new'
|
||||
@@ -0,0 +1,4 @@
|
||||
Qsupplier.App.ListDisplayDateSelector = Ember.TextField.extend
|
||||
classNames: 'datepicker'
|
||||
didInsertElement: ->
|
||||
setTranslations @$().hide()
|
||||
@@ -17,9 +17,11 @@ var Qstorage = localStorage;
|
||||
|
||||
$.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);
|
||||
}
|
||||
|
||||
var path_mapping = {
|
||||
user_root: '/user',
|
||||
join_occupied_table: '/user/join_occupied_table',
|
||||
|
||||
@@ -126,6 +126,9 @@ $ ->
|
||||
menu.show().animate left: 0
|
||||
toggle.animate left: 222 - 30, -> $(@).addClass('open')
|
||||
|
||||
$('[data-boolean]').each ->
|
||||
$(@).addClass(if $(@).data('boolean') then 'boolean-true' else 'boolean-false')
|
||||
|
||||
# Hide alert boxes on click
|
||||
$(document).on 'click', '.general-alerts .alert-box', -> $(@).slideUp()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user