Dynamic tables

This commit is contained in:
2015-03-01 18:34:57 +01:00
parent d172b28850
commit 119ee7ddc8
9 changed files with 44 additions and 42 deletions
@@ -20,9 +20,13 @@ App.SectionTableView = Ember.View.extend DragNDrop.Draggable,
(@get('dpm') || 0) * (@get('content.position_y') || 0)
).property('dpm', 'content.position_y')
style: (->
"position:absolute;width:83px;height:48px;left:#{@get('offsetX')}px;top:#{@get('offsetY')}px"
).property('offsetX', 'offsetY')
myHeight: (-> Math.max((@get('dpm') || 0 ) * @get('content.height'), 60)).property('dpm', 'content.height')
myWidth: (-> Math.max((@get('dpm') || 0 ) * @get('content.width'), 60)).property('dpm', 'content.width')
#style: (->
#"position:absolute;width:83px;height:48px;left:#{@get('offsetX')}px;top:#{@get('offsetY')}px"
#).property('offsetX', 'offsetY')
style: Ember.computed 'offsetX', 'offsetY', 'myWidth', 'myHeight', ->
"position:absolute;width:#{@get('myWidth')}px;height:#{@get('myHeight')}px;left:#{@get('offsetX')}px;top:#{@get('offsetY')}px"
draggable: (-> if @get('controller.editmode') then 'true' else 'false' ).property('controller.editmode')
placeInSection: ->
@@ -42,4 +46,7 @@ App.SectionTableView = Ember.View.extend DragNDrop.Draggable,
@$('.table-actions').hide()
@$el.on 'click', =>
# duplication of .table-actions because variable gets unshadowed
@$('.table-actions').toggle() if @$el.hasClass('occupied') and not @get('controller.editmode')
if @get('controller.editmode')
@get('controller').send 'editTable', @get('content')
else
@$('.table-actions').toggle() if @$el.hasClass('occupied')