rspec seems to behave now
This commit is contained in:
@@ -5,9 +5,10 @@ App.User= DS.Model.extend
|
||||
name: 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')
|
||||
facebook_image_tag: (->
|
||||
facebook_id = @get('facebook_id')
|
||||
return '' unless facebook_id
|
||||
url = "http://graph.facebook.com/#{facebook_id}/picture?type=square"
|
||||
name = @get('name')
|
||||
url = @get('facebook_image')
|
||||
new Handlebars.SafeString "<img src=\"#{url}\" alt=\"#{name}\" title=\"#{name}\" >"
|
||||
).property('facebook_image', 'name')
|
||||
).property('facebook_id', 'name')
|
||||
|
||||
@@ -13,7 +13,7 @@ if table.active_list
|
||||
/.table-action-row
|
||||
a{action "editTable" table}: span.fa.fa-lg.fa-wrench
|
||||
each user in table.active_list.users
|
||||
img src=user.facebook_image
|
||||
span= user.facebook_image_tag
|
||||
if editmodedisabled
|
||||
.table-settings
|
||||
select
|
||||
|
||||
@@ -3,10 +3,6 @@ root.Qsupplier=
|
||||
watch_events: ->
|
||||
faye = new Faye.Client(event_host)
|
||||
faye.subscribe "/supplier/#{supplier_object.id}", (e)=>
|
||||
<% if Rails.env.development? %>
|
||||
console.log "Event: #{e.event}"
|
||||
console.log e.data
|
||||
<% end %>
|
||||
if(e.event == 'new_order')
|
||||
if App
|
||||
App.store().pushPayload(e.data)
|
||||
|
||||
@@ -19,7 +19,7 @@ module Suppliers
|
||||
else
|
||||
@lists = List.for_supplier(current_supplier, page: params[:page], per_page: params[:per_page] || 25)
|
||||
end
|
||||
@lists.include_relation(:table)
|
||||
@lists.include_relation(:table, :users, orders: {product_orders: :product})
|
||||
|
||||
render json: @lists, each_serializer: SupplierListSerializer
|
||||
end
|
||||
|
||||
@@ -2,17 +2,5 @@ class OrderSerializer < Qwaiter::Serializer
|
||||
embed :ids, include: true
|
||||
attributes :state, :list_id, :section_id, :table_id #, :price
|
||||
|
||||
# todo, put this logic in Ember
|
||||
#def product_orders
|
||||
#@product_orders ||= object.product_orders.include_relation(:product) .map do |product_order|
|
||||
#{product_name: product_order.product.name, id: product_order.id, quantity: product_order.quantity, price: product_order.price}
|
||||
#end
|
||||
#end
|
||||
|
||||
# todo, put this logic in Ember
|
||||
#def price
|
||||
#product_orders.inject(0){|sum, po| sum + po[:quantity] * po[:price]}.round(2)
|
||||
#end
|
||||
|
||||
has_many :product_orders
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user