Flow fixes

This commit is contained in:
2014-05-28 16:29:03 +02:00
parent e9554ea3e7
commit 8faf5f3c0a
9 changed files with 63 additions and 8 deletions
@@ -4,3 +4,4 @@ Qsupplier.App.User= DS.Model.extend
email: attr('string')
list: DS.belongsTo('list') # in ember scope not many to many (yet)
join_requests: DS.hasMany('join_request')
facebook_image: (-> "http://graph.facebook.com/#{@get('facebook_id')}/picture?type=square").property('facebook_id')
@@ -14,7 +14,7 @@ div class="table-actions table-actions-#{unbound table.id}"
/.table-action-row
a href="suppliers_table_path(@table)" {{t 'section.tables_view.table_actions.got_to_table'}}
each user in table.active_list.users
img src="http://graph.facebook.com/#{user.uid}/picture?type=square"
img src=user.facebook_image
if editmode
.table-settings
select
@@ -30,9 +30,6 @@ Qsupplier.App.SectionTableView = Ember.View.extend DragNDrop.Draggable,
placeInSection: ->
@$el.css 'left', @offsetX()
@$el.css 'top', @offsetY()
didInsertElement: ->
@$el = $ @get('element')
#@placeInSection()
positionChange: (position)->
#@$el.css 'left', position.left
#@$el.css 'top', position.top
@@ -19,7 +19,7 @@ module Suppliers
respond_to do |format|
format.html # index.html.erb
format.json { render json: @sections }
format.json { render json: @sections, each_serializer: SupplierExtendedSectionSerializer }
end
end
@@ -0,0 +1,11 @@
class SupplierExtendedListSerializer < Qwaiter::Serializer
# user ids for facebook pictures
embed :ids, include: true
root 'list'
attributes :state, :needs_help, :needs_payment, :user_requests_closing, :is_paid, :price, :table_id, :table_number, :section_id, :supplier_id, :closed_at #, :has_active_orders
#def has_active_orders
#object.has_active_orders?
#end
has_many :users, serializer: SupplierUserSerializer
end
@@ -0,0 +1,6 @@
class SupplierExtendedSectionSerializer < Qwaiter::Serializer
root 'section'
embed :ids, include: true
attributes :title, :path, :width, :height
has_many :tables, serializer: SupplierExtendedTableSerializer
end
@@ -0,0 +1,19 @@
class SupplierExtendedTableSerializer < Qwaiter::Serializer
root 'table'
embed :ids, include: true
attributes :number, :width, :height, :position_x, :position_y, :section_id, :occupied #, :alist_id
#def list_id
#object.active_list_id || object.active_list.try(:id)
#end
#def list
#object.active_list
#end
def list
object.active_list
end
has_one :list, key: :active_list_id, serializer: SupplierExtendedListSerializer
end