small refactor for ember actions
This commit is contained in:
@@ -12,7 +12,7 @@ td.section_title: link-to 'section' view.content.section.id: span=view.content.s
|
||||
td.currency.total_list_amount {{currency view.content.total}}
|
||||
td.actions
|
||||
/ if view.content.needs_help
|
||||
button.mark_list_as_helped{ action markListAsHelped view.content.id}
|
||||
button.mark_list_as_helped{ action "markListAsHelped" view.content.id}
|
||||
span.fa-stack.fa-2x.fa-stack-sized
|
||||
i.fa.fa-bell.fa-stack-small
|
||||
i.fa.fa-ban.revoke
|
||||
|
||||
@@ -9,18 +9,18 @@ td.section_title: link-to 'section' view.content.list.section.id: span=view.cont
|
||||
td.currency=currency view.content.total
|
||||
td.actions
|
||||
if view.content.placed
|
||||
button.mark_order_active{ action markOrderActive view.content.id}
|
||||
button.mark_order_active{ action "markOrderActive" view.content.id}
|
||||
span.fa.fa-check.fa-2x
|
||||
/span.button-text=t 'order.being_processed'
|
||||
/button.hide.mark-order-active{ action markOrderActive view.content.id}
|
||||
/button.hide.mark-order-active{ action "markOrderActive" view.content.id}
|
||||
span.button-icon
|
||||
span.button-text=t 'order.being_processed'
|
||||
button.mark_order_delivered{ action markOrderDelivered view.content.id }
|
||||
button.mark_order_delivered{ action "markOrderDelivered" view.content.id }
|
||||
span.fa.fa-2x.fa-shifted-stack
|
||||
span.fa-shifted.fa-check
|
||||
span.fa-shifted.fa-check
|
||||
/span.button-text= t 'order.being_served'
|
||||
/button.hide.mark-order-delivered{ action markOrderDelivered view.content.id}
|
||||
/button.hide.mark-order-delivered{ action "markOrderDelivered" view.content.id}
|
||||
span.button-icon
|
||||
span.button-text= t 'order.being_served'
|
||||
button.remove-order{ action "cancelOrder" view.content }: span
|
||||
|
||||
@@ -3,4 +3,4 @@ modal-dialog action="close"
|
||||
p=body
|
||||
hr
|
||||
button.confirm-cancel{action "close"}= t 'confirm.cancel'
|
||||
button.confirm-ok.right{action 'confirm'}= t 'confirm.confirm'
|
||||
button.confirm-ok.right{action "confirm"}= t 'confirm.confirm'
|
||||
|
||||
@@ -2,4 +2,4 @@ modal-dialog action="close"
|
||||
h3.flush--top= title
|
||||
p==body
|
||||
hr
|
||||
button{action 'close'}= t 'modal.info.close'
|
||||
button{action "close"}= t 'modal.info.close'
|
||||
|
||||
@@ -9,15 +9,15 @@ modal-dialog action="close"
|
||||
if isDistributed
|
||||
span.arrange-tables-current-type.distributed=t 'section.arrange_tables.modal.distributed.title'
|
||||
else
|
||||
button.arrange-tables-type-button.distributed{action 'makeDistributed'}=t 'section.arrange_tables.modal.distributed.title'
|
||||
button.arrange-tables-type-button.distributed{action "makeDistributed"}=t 'section.arrange_tables.modal.distributed.title'
|
||||
if isByRow
|
||||
span.arrange-tables-current-type.by_row=t 'section.arrange_tables.modal.by_row.title'
|
||||
else
|
||||
button.arrange-tables-type-button.by_row{action 'makeByRow'}=t 'section.arrange_tables.modal.by_row.title'
|
||||
button.arrange-tables-type-button.by_row{action "makeByRow"}=t 'section.arrange_tables.modal.by_row.title'
|
||||
if isByColumn
|
||||
span.arrange-tables-current-type.by_column=t 'section.arrange_tables.modal.by_column.title'
|
||||
else
|
||||
button.arrange-tables-type-button.by_column{action 'makeByColumn'}=t 'section.arrange_tables.modal.by_column.title'
|
||||
button.arrange-tables-type-button.by_column{action "makeByColumn"}=t 'section.arrange_tables.modal.by_column.title'
|
||||
.arrange-content
|
||||
if isDistributed
|
||||
==t 'section.arrange_tables.modal.distributed.explanation'
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
ul#section-background.dropdown-menu
|
||||
each texture in textures
|
||||
li
|
||||
a{ action setTexture texture } {{texture}}
|
||||
a{ action "setTexture" texture }= texture
|
||||
/a.tiny.button.dropdown.section-actions-menu-header href="#" data-dropdown="section-action-list" Action
|
||||
/button.btn.dropdown-toggle data-toggle="dropdown"
|
||||
span Action
|
||||
|
||||
@@ -2,5 +2,13 @@ attr = DS.attr
|
||||
App.User = DS.Model.extend
|
||||
facebook_id: attr('string')
|
||||
email: attr('string')
|
||||
name: attr('string')
|
||||
list: DS.belongsTo('list') # in ember scope not many to many (yet)
|
||||
join_requests: DS.hasMany('join_request')
|
||||
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')
|
||||
new Handlebars.SafeString "<img src=\"#{url}\" alt=\"#{name}\" title=\"#{name}\" class=\"user-facebook-image\">"
|
||||
).property('facebook_id', 'name')
|
||||
|
||||
@@ -59,7 +59,7 @@ aside.side-menu
|
||||
main.main-section
|
||||
.main-section-content
|
||||
if notice
|
||||
#notice.alert-box{action clearNotice} data-alert=true
|
||||
#notice.alert-box{action "clearNotice"} data-alert=true
|
||||
a.right href="#"
|
||||
span.fa.fa-times.fa-lg
|
||||
span= notice
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
h2= t 'join_request.existing_user.title'
|
||||
each join_request in join_requests
|
||||
.join-request-container
|
||||
img.facebook-image src="http://graph.facebook.com/#{unbound join_request.user.facebook_id}/picture?type=square"
|
||||
= join_request.user.facebook_image_tag
|
||||
span.user-email= join_request.user.email
|
||||
.right
|
||||
button.join-request-reject{action rejectRequest join_request}=t 'join_request.existing_user.reject_request'
|
||||
button.join-request-approve{action approveRequest join_request}=t 'join_request.existing_user.approve_request'
|
||||
button.join-request-reject{action "rejectRequest" join_request}=t 'join_request.existing_user.reject_request'
|
||||
button.join-request-approve{action "approveRequest" join_request}=t 'join_request.existing_user.approve_request'
|
||||
else
|
||||
p=t 'join_request.existing_user.no_join_requests_message'
|
||||
|
||||
@@ -3,4 +3,4 @@ modal-dialog action="close"
|
||||
p=body
|
||||
hr
|
||||
button.confirm-cancel{action "close"}= t 'confirm.cancel'
|
||||
button.confirm-ok.right{action 'confirm'}= t 'confirm.confirm'
|
||||
button.confirm-ok.right{action "confirm"}= t 'confirm.confirm'
|
||||
|
||||
@@ -2,4 +2,4 @@ modal-dialog action="close"
|
||||
h3.flush--top= title
|
||||
p==body
|
||||
hr
|
||||
button{action 'close'}= t 'modal.info.close'
|
||||
button{action "close"}= t 'modal.info.close'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
.row
|
||||
h2
|
||||
=t 'models.table'
|
||||
|
|
||||
|
|
||||
= number
|
||||
if showJoinButton
|
||||
if join_request_sent
|
||||
@@ -9,13 +9,13 @@
|
||||
span.fa.fa-spinner.fa-spin.fa-lg
|
||||
span=t 'join_request.requestor.waiting_for_approval'
|
||||
else
|
||||
button.join-table-button{action joinOccupiedTable}=t 'join_request.requestor.join_this_table'
|
||||
button.join-table-button{action "joinOccupiedTable"}=t 'join_request.requestor.join_this_table'
|
||||
if tableCanTakeOrders
|
||||
.large-6.columns
|
||||
each product_category in supplier.product_categories
|
||||
if product_category.products
|
||||
hr
|
||||
h4.product_category-title{action toggleProductCategory product_category}
|
||||
h4.product_category-title{action "toggleProductCategory" product_category}
|
||||
if product_category.collapsed
|
||||
span.icon.collapsed
|
||||
else
|
||||
@@ -27,12 +27,12 @@
|
||||
each product in product_category.products
|
||||
li class="order-product-#{unbound product.id}"
|
||||
if product.description
|
||||
button.show-product-description{action showProductDescription product}
|
||||
button.show-product-description{action "showProductDescription" product}
|
||||
span
|
||||
else
|
||||
span.no-product-description
|
||||
a{action addProduct product}= product.name
|
||||
button.add-product-to-list{action addProduct product}
|
||||
a{action "addProduct" product}= product.name
|
||||
button.add-product-to-list{action "addProduct" product}
|
||||
span
|
||||
span.product-price.currency=currency product.price
|
||||
.large-6.columns= render 'product_orders'
|
||||
@@ -47,7 +47,7 @@
|
||||
each product in product_category.products
|
||||
li class="order-product-#{unbound product.id}"
|
||||
if product.description
|
||||
button.show-product-description{action showProductDescription product}
|
||||
button.show-product-description{action "showProductDescription" product}
|
||||
span
|
||||
span= product.name
|
||||
span.right.currency=currency product.price
|
||||
|
||||
@@ -60,6 +60,11 @@ class User
|
||||
auth_data['info']['name'] rescue I18n.t('user.unknown_supplier_name')
|
||||
end
|
||||
|
||||
# This is the user name as it is shown to other users
|
||||
def friends_name
|
||||
auth_data['info']['nickname'] rescue ''
|
||||
end
|
||||
|
||||
def has_active_list?
|
||||
active_list_id.present?
|
||||
end
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
class UserUserSerializer < Qwaiter::Serializer
|
||||
self.root = :user
|
||||
attributes :email, :facebook_id
|
||||
attributes :email, :facebook_id, :name
|
||||
|
||||
def name
|
||||
object.friends_name
|
||||
end
|
||||
end
|
||||
|
||||
@@ -37,6 +37,7 @@ Feature: Supplier section view
|
||||
And I wait 1 second
|
||||
Then the section table should not have any active list markings anymore
|
||||
And the list should be marked as closed
|
||||
And I wait 3 seconds
|
||||
|
||||
@javascript
|
||||
Scenario: Selecting a specific section limits the result to the lists and orders of those sections
|
||||
|
||||
@@ -12,4 +12,15 @@ describe User do
|
||||
user.supplier_name.should == I18n.t('user.unknown_supplier_name')
|
||||
end
|
||||
end
|
||||
|
||||
describe '#friends_name' do
|
||||
it "displays the auth data nickname if available" do
|
||||
user.auth_data = {'info' => {'name' => 'Benji setup', 'nickname' => 'Benji'}}
|
||||
user.friends_name.should == 'Benji'
|
||||
end
|
||||
|
||||
it 'falls back to unkown if not present' do
|
||||
user.friends_name.should == ''
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user