Add user facebook images to supplier main board
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
Ember.Handlebars.registerHelper 'image_tag', (path, params..., options={})->
|
Ember.Handlebars.registerBoundHelper 'image_tag', (path, params..., options={})->
|
||||||
options.alt ||= ''
|
alt = options.hash.alt ||= ''
|
||||||
new Handlebars.SafeString "<img src=\"/assets/#{path}\" alt=\"#{options.alt}\" >"
|
image_path = if path.substring(0,4) == 'http' then path else "/assets/#{path}"
|
||||||
|
new Handlebars.SafeString "<img src=\"#{image_path}\" alt=\"#{alt}\" title=\"#{alt}\" >"
|
||||||
|
|||||||
@@ -2,6 +2,12 @@ attr = DS.attr
|
|||||||
Qsupplier.App.User= DS.Model.extend
|
Qsupplier.App.User= DS.Model.extend
|
||||||
facebook_id: attr('string')
|
facebook_id: attr('string')
|
||||||
email: attr('string')
|
email: attr('string')
|
||||||
|
name: attr('string')
|
||||||
list: DS.belongsTo('list') # in ember scope not many to many (yet)
|
list: DS.belongsTo('list') # in ember scope not many to many (yet)
|
||||||
join_requests: DS.hasMany('join_request')
|
join_requests: DS.hasMany('join_request')
|
||||||
facebook_image: (-> "http://graph.facebook.com/#{@get('facebook_id')}/picture?type=square").property('facebook_id')
|
facebook_image: (-> "http://graph.facebook.com/#{@get('facebook_id')}/picture?type=square").property('facebook_id')
|
||||||
|
facebook_image_tag: (->
|
||||||
|
name = @get('name')
|
||||||
|
url = @get('facebook_image')
|
||||||
|
new Handlebars.SafeString "<img src=\"#{url}\" alt=\"#{name}\" title=\"#{name}\" >"
|
||||||
|
).property('facebook_image', 'name')
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
td.user-info.show-for-large-up
|
||||||
|
each user in view.content.users
|
||||||
|
= user.facebook_image_tag
|
||||||
td.status-icons
|
td.status-icons
|
||||||
if view.content.needs_help
|
if view.content.needs_help
|
||||||
span.icon.needs-help
|
span.icon.needs-help
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
td.user-info.show-for-large-up
|
||||||
|
each user in view.content.list.users
|
||||||
|
= user.facebook_image_tag
|
||||||
td.status-icons
|
td.status-icons
|
||||||
span.active-order.fa.fa-check.fa-lg
|
span.active-order.fa.fa-check.fa-lg
|
||||||
td= view.content.display
|
td= view.content.display
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
table.active-lists-table.table
|
table.active-lists-table.table
|
||||||
thead
|
thead
|
||||||
tr
|
tr
|
||||||
|
th.user-info
|
||||||
th.status-icons
|
th.status-icons
|
||||||
th.numeric=t 'table_number'
|
th.numeric=t 'table_number'
|
||||||
th=t 'models.section'
|
th=t 'models.section'
|
||||||
@@ -20,6 +21,7 @@
|
|||||||
table.active-orders-table.table
|
table.active-orders-table.table
|
||||||
thead
|
thead
|
||||||
tr
|
tr
|
||||||
|
th.user-info
|
||||||
th.status-icons
|
th.status-icons
|
||||||
th=t 'models.order'
|
th=t 'models.order'
|
||||||
th.numeric=t 'table_number'
|
th.numeric=t 'table_number'
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
class SupplierUserSerializer < Qwaiter::Serializer
|
class SupplierUserSerializer < Qwaiter::Serializer
|
||||||
self.root = :user
|
self.root = :user
|
||||||
attributes :email, :facebook_id
|
attributes :email, :facebook_id, :name
|
||||||
|
|
||||||
|
def name
|
||||||
|
object.supplier_name
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe User do
|
||||||
|
let(:user){ build :user }
|
||||||
|
describe '#supplier_name' do
|
||||||
|
it "displays the auth data name if available" do
|
||||||
|
user.auth_data = {'info' => {'name' => 'Benji setup'}}
|
||||||
|
user.supplier_name.should == 'Benji setup'
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'falls back to unkown if not present' do
|
||||||
|
user.supplier_name.should == I18n.t('user.unknown_supplier_name')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user