small refactor for ember actions

This commit is contained in:
2014-08-13 17:07:26 +02:00
parent a675999d01
commit 446cf08afb
17 changed files with 54 additions and 30 deletions
@@ -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.currency.total_list_amount {{currency view.content.total}}
td.actions td.actions
/ if view.content.needs_help / 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 span.fa-stack.fa-2x.fa-stack-sized
i.fa.fa-bell.fa-stack-small i.fa.fa-bell.fa-stack-small
i.fa.fa-ban.revoke 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.currency=currency view.content.total
td.actions td.actions
if view.content.placed 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.fa.fa-check.fa-2x
/span.button-text=t 'order.being_processed' /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-icon
span.button-text=t 'order.being_processed' 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.fa-2x.fa-shifted-stack
span.fa-shifted.fa-check span.fa-shifted.fa-check
span.fa-shifted.fa-check span.fa-shifted.fa-check
/span.button-text= t 'order.being_served' /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-icon
span.button-text= t 'order.being_served' span.button-text= t 'order.being_served'
button.remove-order{ action "cancelOrder" view.content }: span button.remove-order{ action "cancelOrder" view.content }: span
@@ -3,4 +3,4 @@ modal-dialog action="close"
p=body p=body
hr hr
button.confirm-cancel{action "close"}= t 'confirm.cancel' 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 h3.flush--top= title
p==body p==body
hr 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 if isDistributed
span.arrange-tables-current-type.distributed=t 'section.arrange_tables.modal.distributed.title' span.arrange-tables-current-type.distributed=t 'section.arrange_tables.modal.distributed.title'
else 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 if isByRow
span.arrange-tables-current-type.by_row=t 'section.arrange_tables.modal.by_row.title' span.arrange-tables-current-type.by_row=t 'section.arrange_tables.modal.by_row.title'
else 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 if isByColumn
span.arrange-tables-current-type.by_column=t 'section.arrange_tables.modal.by_column.title' span.arrange-tables-current-type.by_column=t 'section.arrange_tables.modal.by_column.title'
else 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 .arrange-content
if isDistributed if isDistributed
==t 'section.arrange_tables.modal.distributed.explanation' ==t 'section.arrange_tables.modal.distributed.explanation'
@@ -12,7 +12,7 @@
ul#section-background.dropdown-menu ul#section-background.dropdown-menu
each texture in textures each texture in textures
li 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 /a.tiny.button.dropdown.section-actions-menu-header href="#" data-dropdown="section-action-list" Action
/button.btn.dropdown-toggle data-toggle="dropdown" /button.btn.dropdown-toggle data-toggle="dropdown"
span Action span Action
@@ -2,5 +2,13 @@ attr = DS.attr
App.User = DS.Model.extend 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_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.main-section
.main-section-content .main-section-content
if notice if notice
#notice.alert-box{action clearNotice} data-alert=true #notice.alert-box{action "clearNotice"} data-alert=true
a.right href="#" a.right href="#"
span.fa.fa-times.fa-lg span.fa.fa-times.fa-lg
span= notice span= notice
@@ -2,10 +2,10 @@
h2= t 'join_request.existing_user.title' h2= t 'join_request.existing_user.title'
each join_request in join_requests each join_request in join_requests
.join-request-container .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 span.user-email= join_request.user.email
.right .right
button.join-request-reject{action rejectRequest join_request}=t 'join_request.existing_user.reject_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' button.join-request-approve{action "approveRequest" join_request}=t 'join_request.existing_user.approve_request'
else else
p=t 'join_request.existing_user.no_join_requests_message' p=t 'join_request.existing_user.no_join_requests_message'
@@ -3,4 +3,4 @@ modal-dialog action="close"
p=body p=body
hr hr
button.confirm-cancel{action "close"}= t 'confirm.cancel' 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 h3.flush--top= title
p==body p==body
hr hr
button{action 'close'}= t 'modal.info.close' button{action "close"}= t 'modal.info.close'
@@ -1,7 +1,7 @@
.row .row
h2 h2
=t 'models.table' =t 'models.table'
| |
= number = number
if showJoinButton if showJoinButton
if join_request_sent if join_request_sent
@@ -9,13 +9,13 @@
span.fa.fa-spinner.fa-spin.fa-lg span.fa.fa-spinner.fa-spin.fa-lg
span=t 'join_request.requestor.waiting_for_approval' span=t 'join_request.requestor.waiting_for_approval'
else 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 if tableCanTakeOrders
.large-6.columns .large-6.columns
each product_category in supplier.product_categories each product_category in supplier.product_categories
if product_category.products if product_category.products
hr hr
h4.product_category-title{action toggleProductCategory product_category} h4.product_category-title{action "toggleProductCategory" product_category}
if product_category.collapsed if product_category.collapsed
span.icon.collapsed span.icon.collapsed
else else
@@ -27,12 +27,12 @@
each product in product_category.products each product in product_category.products
li class="order-product-#{unbound product.id}" li class="order-product-#{unbound product.id}"
if product.description if product.description
button.show-product-description{action showProductDescription product} button.show-product-description{action "showProductDescription" product}
span span
else else
span.no-product-description span.no-product-description
a{action addProduct product}= product.name a{action "addProduct" product}= product.name
button.add-product-to-list{action addProduct product} button.add-product-to-list{action "addProduct" product}
span span
span.product-price.currency=currency product.price span.product-price.currency=currency product.price
.large-6.columns= render 'product_orders' .large-6.columns= render 'product_orders'
@@ -47,7 +47,7 @@
each product in product_category.products each product in product_category.products
li class="order-product-#{unbound product.id}" li class="order-product-#{unbound product.id}"
if product.description if product.description
button.show-product-description{action showProductDescription product} button.show-product-description{action "showProductDescription" product}
span span
span= product.name span= product.name
span.right.currency=currency product.price span.right.currency=currency product.price
+5
View File
@@ -60,6 +60,11 @@ class User
auth_data['info']['name'] rescue I18n.t('user.unknown_supplier_name') auth_data['info']['name'] rescue I18n.t('user.unknown_supplier_name')
end 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? def has_active_list?
active_list_id.present? active_list_id.present?
end end
+5 -1
View File
@@ -1,4 +1,8 @@
class UserUserSerializer < Qwaiter::Serializer class UserUserSerializer < Qwaiter::Serializer
self.root = :user self.root = :user
attributes :email, :facebook_id attributes :email, :facebook_id, :name
def name
object.friends_name
end
end end
@@ -37,6 +37,7 @@ Feature: Supplier section view
And I wait 1 second And I wait 1 second
Then the section table should not have any active list markings anymore Then the section table should not have any active list markings anymore
And the list should be marked as closed And the list should be marked as closed
And I wait 3 seconds
@javascript @javascript
Scenario: Selecting a specific section limits the result to the lists and orders of those sections Scenario: Selecting a specific section limits the result to the lists and orders of those sections
+11
View File
@@ -12,4 +12,15 @@ describe User do
user.supplier_name.should == I18n.t('user.unknown_supplier_name') user.supplier_name.should == I18n.t('user.unknown_supplier_name')
end end
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 end
-5
View File
@@ -32,12 +32,7 @@ User
---- ----
- Cleanup UserController - Cleanup UserController
- translate join table strings
- test met veel producten - test met veel producten
- side menu cleaner
- Title zichtbaar
- Icons before texts
- remove debugger link
General General
------- -------