intermediate commit

This commit is contained in:
2015-08-27 14:36:10 +02:00
parent bb22dffef2
commit e71580f349
19 changed files with 37 additions and 35 deletions
@@ -0,0 +1,4 @@
App.ApplicationAdapter = DS.ActiveModelAdapter.extend
namespace: 'supplier'
headers:
"Accept": "application/json, text/javascript; q=0.01"
@@ -3,6 +3,7 @@
#= require handlebars
#= require ember
#= require ember-data
#= require active-model-adapter
#= require ember-validations
#= require ember-template-compiler
#= require_directory ./modifications
@@ -2,12 +2,14 @@ App.NumberFieldComponent = Ember.TextField.extend
type: 'number'
attributeBindings: ['min', 'max', 'step']
focusIn: -> @$().select()
numericValue: Ember.computed 'value', (key, value) ->
if arguments.length > 1
numericValue: Ember.computed 'value',
get: ->
value = @get 'value'
if value? then String(value) else ''
set: (key, value)->
if value?
setValue = parseFloat(value)
@set "value", if isFinite(setValue) then setValue else null
else
@set 'value', null
value = @get 'value'
if value? then String(value) else ''
value
@@ -1,3 +1,2 @@
App.EmployeesIndexController = Ember.Controller.extend
needs: ['application']
employees: (-> @get('model').sortBy('name')).property('model.@each.name')
@@ -1,5 +1,4 @@
App.IndexController = Ember.Controller.extend
needs: ['application']
show_lists: true
show_orders: true
lists: (-> @store.peekAll('list')).property()
@@ -1,5 +1,4 @@
App.ListController = Ember.Controller.extend
needs: ['application', 'lists', 'list'] #wtf? list, otherwise an Ember error
list: (-> @get('model')).property('model')
showTotal: (->
if @get('list.orders.length') && @get('list.orders.length') > 1 then true else false
@@ -1,5 +1,4 @@
App.MenuController = Ember.Controller.extend
needs: ['application']
product_code_filter: ''
product_categories: (-> @store.peekAll('product_category')).property()
filter: null
@@ -1,5 +1,4 @@
@App.modals.BaseController = Ember.Controller.extend
needs: ['application']
alert_message: ""
modal_options: {}
title: (->
@@ -1,5 +1,4 @@
App.OrdersDisplayController = Ember.Controller.extend
needs: ['application']
active_section: null
sections: (-> @store.peekAll('section') ).property()
orders: Ember.computed 'model.[]', 'active_section.id', ->
@@ -1,5 +1,5 @@
App.SectionController = Ember.Controller.extend
needs: ['application', 'sections', 'section'] #wtf? section, otherwise an Ember error
#needs: ['application', 'sections', 'section'] #wtf? section, otherwise an Ember error
actions:
makeEditable: -> @set('model.editmode', true)
finishEditable: ->
@@ -54,4 +54,6 @@ App.SectionController = Ember.Controller.extend
section_area.rollback()
textures: ['wood1', 'wood2']
sections: (-> @get('controllers.sections.model')).property('controllers.sections.model')
#sections: (-> @get('controllers.sections.model')).property('controllers.sections.model')
sections_controller: Ember.inject.controller('sections')
sections: Ember.computed.alias 'sections_controller.model'
@@ -1,2 +1 @@
App.SectionsController = Ember.Controller.extend
needs: ['application']
App.SectionsController = Ember.Controller.extend {}
@@ -1,12 +1,9 @@
App.SectionsIndexController = Ember.Controller.extend
needs: ['application', 'sections', 'index']
sections: (-> @get('controllers.sections.model')).property('controllers.sections.model')
sectionQrCodesUrl: ((a,b,c)->
Routes.qr_codes_suppliers_tables_path()
).property()
#needs: ['application', 'sections', 'index']
#sections: Ember.computed.alias 'controllers.sections.model'
sections_controller: Ember.inject.controller('sections')
sections: Ember.computed.alias 'sections_controller.model'
newPath: Routes.new_suppliers_section_path()
qrPath: (section_id)->
Routes.qr_codes_suppliers_tables_path section_id: section_id
actions:
addSection: -> @modal 'add_section', model: @get('model')
goToSection: (section)->
@@ -1,7 +1,5 @@
App.SettingsController = Ember.Controller.extend
needs: ['application']
supplier: Ember.computed.alias 'globals.current_supplier'
# model: (-> @get('controllers.application.supplier')).property('controllers.application.supplier')
time_zones: (-> window.time_zones ).property()
countries: (-> window.countries ).property()
saving: false
@@ -1,5 +1,4 @@
App.TablesIndexController = Ember.Controller.extend
needs: ['application']
tables: (-> @get('model').sortBy('casted_number')).property('model.@each.number')
actions:
newTable: ->
@@ -11,7 +11,6 @@ ControllerExtensions = Ember.Mixin.create
@send "openModal", name, options
all_sections: (-> @store.peekAll('section')).property()
#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
@@ -1,8 +1,16 @@
App.ApplicationRoute = Ember.Route.extend
beforeModel: ->
# Preload only active lists and orders
@supplier = @store.push 'supplier', supplier_object
@employee = @store.push 'employee', employee_object
@supplier = @store.push
data:
id: supplier_object.id
type: 'supplier'
attributes: supplier_object
@employee = @store.push
data:
id: employee_object.id
type: 'employee'
attributes: employee_object
#@product_categories = @store.findAll 'product_category'
#@sections = @store.findAll 'section'
#Ember.RSVP.all([@product_categories, @sections]).then (results)=>
@@ -1,12 +1,12 @@
App.ApplicationSerializer = DS.ActiveModelSerializer
App.ApplicationStore = DS.Store
#App.ApplicationStore = DS.Store
#adapter: DS.ActiveModelAdapter.extend
#namespace: 'supplier'
## user underscored paths
#pathForType: (type)->
#Ember.String.pluralize(Ember.String.decamelize(type))
App.ApplicationAdapter = DS.ActiveModelAdapter.extend
namespace: 'supplier'
headers:
"Accept": "application/json, text/javascript; q=0.01"
#App.ApplicationAdapter = DS.ActiveModelAdapter.extend
# namespace: 'supplier'
# headers:
# "Accept": "application/json, text/javascript; q=0.01"
@@ -5,12 +5,12 @@ form.form-horizontal
.form-label
label for='add-tables-number-start'
=t 'section.add_tables.modal.number_start'
.form-field= number-field value=number_start
.form-field= number-field numericValue=number_start
.form-row
.form-label
label for='add-tables-number-end'
=t 'section.add_tables.modal.number_end'
.form-field= number-field value=number_end
.form-field= number-field numericValue=number_end
hr
button.modal-close{action "close"}=t 'section.add_tables.modal.close_button'
button.modal-confirm.right{action "addTables"}=t 'section.add_tables.modal.add_button'