working ember... again
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
Qsupplier.App.SectionTableView = Ember.View.extend DragNDrop.Draggable,
|
||||
templateName: 'table'
|
||||
classNames: ['section-table']
|
||||
attributeBindings: ['style']
|
||||
classNameBindings: [
|
||||
'content.active_list:occupied',
|
||||
'controller.editmode:draggable',
|
||||
@@ -8,33 +9,36 @@ Qsupplier.App.SectionTableView = Ember.View.extend DragNDrop.Draggable,
|
||||
'content.active_list.needs_payment:needs_payment',
|
||||
'content.active_list.has_active_orders:active_order'
|
||||
]
|
||||
offsetX: ->
|
||||
(@content.get('position_x') || 0) * @containerWidth() / (@content.get('section').get('width') || 1)
|
||||
offsetX: (->
|
||||
return 0 unless section_width = @get('content.section.width')
|
||||
(@content.get('position_x') || 0) * @containerWidth() / section_width
|
||||
).property('content.section.width', 'content.position_x')
|
||||
offsetY: (->
|
||||
(@content.get('position_y') || 0) * @containerHeight() / (@content.get('section').get('height') || 1)
|
||||
)
|
||||
activeList: (->
|
||||
!!@get('content.active_list_id')
|
||||
).property('content.active_list_id')
|
||||
attributeBindings: ['style']
|
||||
return 0 unless section_height = @get('content.section.height')
|
||||
(@content.get('position_y') || 0) * @containerHeight() / section_height
|
||||
).property('content.section.height', 'content.position_y')
|
||||
|
||||
style: (->
|
||||
"position:absolute;width:83px;height:48px"
|
||||
).property()
|
||||
"position:absolute;width:83px;height:48px;left:#{@get('offsetX')}px;top:#{@get('offsetY')}px"
|
||||
).property('offsetX', 'offsetY')
|
||||
|
||||
draggable: (-> if @get('controller.editmode') then 'true' else 'false' ).property('controller.editmode')
|
||||
placeInSection: ->
|
||||
@$el.css 'left', @offsetX()
|
||||
@$el.css 'top', @offsetY()
|
||||
didInsertElement: ->
|
||||
@$el = $ @get('element')
|
||||
@placeInSection()
|
||||
#@placeInSection()
|
||||
positionChange: (position)->
|
||||
@$el.css 'left', position.left
|
||||
@$el.css 'top', position.top
|
||||
#@$el.css 'left', position.left
|
||||
#@$el.css 'top', position.top
|
||||
@content.setProperties
|
||||
position_x: position.left*@content.get('section').get('width') / @containerWidth()
|
||||
position_y: position.top *@content.get('section').get('height') / @containerHeight()
|
||||
@content.get('transaction').commit()
|
||||
#@content.get('transaction').commit()
|
||||
@content.save()
|
||||
containerWidth: ->
|
||||
$(@get('parentView.element')).width()
|
||||
containerHeight: ->
|
||||
$(@get('parentView.element')).height()
|
||||
click: ->
|
||||
|
||||
Reference in New Issue
Block a user