Style upgrades and emberified supplier lists
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
Qsupplier.App.IndexController = Ember.ObjectController.extend
|
||||
needs: ['application']
|
||||
active_lists: (->
|
||||
if @get('active_section_id')
|
||||
@get('lists').filter (l)=>( l.get('section.id') == @get('active_section_id') && l.get('state') == 'active' )
|
||||
if @get('active_section.id')
|
||||
@get('lists').filter (l)=>( l.get('section.id') == @get('active_section.id') && l.get('state') == 'active' )
|
||||
else
|
||||
@get('lists').filterProperty('state', 'active')
|
||||
).property('lists.@each.state', 'active_section_id')
|
||||
).property('lists.@each.state', 'active_section.id')
|
||||
|
||||
active_orders: (->
|
||||
if @get('active_section_id')
|
||||
@get('orders').filter (o)=>( o.get('section.id') == @get('active_section_id') && o.get('needs_supplier_attention') )
|
||||
if @get('active_section.id')
|
||||
@get('orders').filter (o)=>( o.get('section.id') == @get('active_section.id') && o.get('needs_supplier_attention') )
|
||||
else
|
||||
@get('orders').filter (o)->( o.get('needs_supplier_attention') )
|
||||
).property('orders.@each.state', 'active_section_id')
|
||||
).property('orders.@each.state', 'active_section.id')
|
||||
|
||||
markListAsHelped: (id)->
|
||||
if list = Qsupplier.App.List.findCached(id)
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
Qsupplier.App.ListController = Ember.ObjectController.extend
|
||||
needs: ['application', 'lists', 'list'] #wtf? list, otherwise an Ember error
|
||||
list: (-> @get('model')).property('model')
|
||||
showTotal: (->
|
||||
if @get('list.orders.length') && @get('list.orders.length') > 1 then true else false
|
||||
).property('list.orders.length')
|
||||
@@ -1,4 +0,0 @@
|
||||
Qsupplier.App.ListsController = Ember.ArrayController.extend
|
||||
dateChanged: (->
|
||||
@set('model', @store.find('list', date: @get('date')))
|
||||
).observes('date')
|
||||
@@ -0,0 +1,8 @@
|
||||
Qsupplier.App.ListsIndexController = Ember.ArrayController.extend
|
||||
dateChanged: (->
|
||||
if @get('date')
|
||||
@set('model', @store.find('list', date: @get('date')))
|
||||
else
|
||||
@set('model', @store.find('list'))
|
||||
).observes('date')
|
||||
lists: (-> @get('model')).property('model')
|
||||
@@ -1,5 +1,5 @@
|
||||
Qsupplier.App.SectionsIndexController = Ember.ArrayController.extend
|
||||
needs: ['application', 'sections']
|
||||
needs: ['application', 'sections', 'index']
|
||||
sections: (-> @get('controllers.sections.model')).property('controllers.sections.model')
|
||||
sectionQrCodesUrl: ((a,b,c)->
|
||||
debugger
|
||||
@@ -8,3 +8,7 @@ Qsupplier.App.SectionsIndexController = Ember.ArrayController.extend
|
||||
newPath: Routes.new_suppliers_section_path()
|
||||
qrPath: (section_id)->
|
||||
Routes.qr_codes_suppliers_tables_path section_id: section_id
|
||||
actions:
|
||||
showDashboardOrders: (section)->
|
||||
@transitionToRoute('index').then =>
|
||||
@get('controllers.index').set 'active_section', section
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
attr = DS.attr
|
||||
Qsupplier.App.JoinRequest= DS.Model.extend
|
||||
list: DS.belongsTo('list')
|
||||
user: DS.belongsTo('user')
|
||||
@@ -4,6 +4,7 @@ Qsupplier.App.List = DS.Model.extend
|
||||
needs_help: attr 'boolean'
|
||||
needs_payment: attr 'boolean'
|
||||
user_requests_closing: attr('boolean')
|
||||
users: DS.hasMany('user')
|
||||
is_paid: attr 'boolean'
|
||||
has_active_orders: attr 'boolean'
|
||||
price: attr 'number'
|
||||
@@ -28,6 +29,9 @@ Qsupplier.App.List = DS.Model.extend
|
||||
@set 'needs_payment', true
|
||||
markIsPaid: ->
|
||||
@set 'needs_payment', false
|
||||
total: (->
|
||||
@get('orders').getEach('total').reduce(((sum, total) -> sum + total), 0)
|
||||
).property('orders.@each.total')
|
||||
|
||||
close: ->
|
||||
@markClosed()
|
||||
@@ -36,3 +40,4 @@ Qsupplier.App.List = DS.Model.extend
|
||||
is_helped: ->
|
||||
@markHelped()
|
||||
$.post Routes.supplier_mark_list_as_helped_path(), list_id: @id
|
||||
sorted_orders: (-> @get('orders').sortBy('created_at').reverseObjects()).property('orders.@each.isLoaded')
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
attr = DS.attr
|
||||
Qsupplier.App.User= DS.Model.extend
|
||||
uid: attr 'string'
|
||||
#active_list: DS.belongsTo('list')
|
||||
facebook_id: attr('string')
|
||||
email: attr('string')
|
||||
list: DS.belongsTo('list') # in ember scope not many to many (yet)
|
||||
join_requests: DS.hasMany('join_request')
|
||||
|
||||
@@ -10,6 +10,7 @@ Qsupplier.App.IndexRoute = Ember.Route.extend
|
||||
#lists: @store.filter 'list', (l)-> l.get('state') == 'active' # DOES NOT WORK!!!! (yet)
|
||||
# use filter to create a scope on all the records
|
||||
lists: @store.filter 'list', -> true
|
||||
# mayby @store.all 'list' will work better!!!! (2014-04-24 a more experienced benjamin :)
|
||||
orders: @store.filter 'order', -> true
|
||||
sections: @store.find 'section'
|
||||
setupController: (controller, model)->
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
Qsupplier.App.ListsRoute = Ember.Route.extend
|
||||
Qsupplier.App.ListsIndexRoute = Ember.Route.extend
|
||||
#model: -> @store.find 'list'
|
||||
setupController: (controller, model)->
|
||||
controller.set 'date', (new Date()).toISOString().substr(0,10)
|
||||
controller.set 'date', (new Date()).toISOString().substr(0,10) unless controller.get('date')
|
||||
@@ -0,0 +1,19 @@
|
||||
.display-row
|
||||
.display-label=t 'attributes.list.created_at'
|
||||
.display-field=time list.created_at
|
||||
each user in list.users
|
||||
img.facebook-image src="http://graph.facebook.com/#{unbound user.facebook_id}/picture?type=square" alt="f"
|
||||
if list.orders
|
||||
.list-orders-container
|
||||
each order in list.sorted_orders
|
||||
.list-order-container class=order.state
|
||||
= order.display
|
||||
span.currency= currency order.total
|
||||
span.created_at= time order.created_at
|
||||
if showTotal
|
||||
.list-orders-total.total
|
||||
= t 'total'
|
||||
span.currency= currency list.total
|
||||
else
|
||||
p
|
||||
span=t 'active_list.no_orders_explanation'
|
||||
@@ -1,6 +1,6 @@
|
||||
.page-header
|
||||
div.pull-right
|
||||
'{{view 'Qsupplier.App.HomeSectionSelectorView' content=controller.sections prompt=controllers.application.supplier.name}}
|
||||
div.dashboard-section-selection
|
||||
'{{view 'Qsupplier.App.HomeSectionSelectorView' selectionBinding="controller.active_section" content=controller.sections prompt=controllers.application.supplier.name}}
|
||||
'{{view 'Qsupplier.App.HomeSectionJumperView'}}
|
||||
h3 {{t 'active_lists.title'}}
|
||||
.well
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
.row
|
||||
h2=t 'models.list'
|
||||
partial "list_content"
|
||||
link-to 'lists'
|
||||
span Go to lists
|
||||
@@ -1,26 +1 @@
|
||||
h1=t 'models.plural.list'
|
||||
Qsupplier.App.ListDisplayDateSelector valueBinding=date
|
||||
if controller.model
|
||||
table.table
|
||||
thead
|
||||
tr
|
||||
th.state=t 'attributes.list.state'
|
||||
th.boolean=t 'attributes.list.needs_help'
|
||||
th.boolean=t 'attributes.list.needs_payment'
|
||||
th.timestamp=t 'attributes.list.closed_at'
|
||||
th.table_number=t 'models.table'
|
||||
th.currentcy=t 'attributes.list.price'
|
||||
th.timestamp=t 'attributes.list.created_at'
|
||||
tbody
|
||||
each list in controller
|
||||
tr
|
||||
td.state=state 'list' list.state
|
||||
td.boolean.needs_help=boolean list.needs_help
|
||||
td.boolean.needs_payment=boolean list.needs_payment
|
||||
td.timestamp=time list.closed_at
|
||||
td.table_number 7
|
||||
td.currency=currency list.price
|
||||
td.timestamp=time list.created_at
|
||||
else
|
||||
.row
|
||||
.panel=t 'list.none_found'
|
||||
= outlet
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
h1=t 'models.plural.list'
|
||||
Qsupplier.App.ListDisplayDateSelector valueBinding="date"
|
||||
if lists
|
||||
table.table
|
||||
thead
|
||||
tr
|
||||
th.state=t 'attributes.list.state'
|
||||
th.boolean=t 'attributes.list.needs_help'
|
||||
th.boolean=t 'attributes.list.needs_payment'
|
||||
th.timestamp=t 'attributes.list.closed_at'
|
||||
th.table_number=t 'models.table'
|
||||
th.currentcy=t 'attributes.list.price'
|
||||
th.timestamp=t 'attributes.list.created_at'
|
||||
tbody
|
||||
each list in lists
|
||||
tr
|
||||
td.state
|
||||
link-to 'list' list.id
|
||||
= state 'list' list.state
|
||||
td.boolean.needs_help=boolean list.needs_help
|
||||
td.boolean.needs_payment=boolean list.needs_payment
|
||||
td.timestamp=time list.closed_at
|
||||
td.table_number 7
|
||||
td.currency=currency list.price
|
||||
td.timestamp=time list.created_at
|
||||
else
|
||||
.row
|
||||
.panel=t 'list.none_found'
|
||||
@@ -1,5 +1,5 @@
|
||||
.section-tabs-container
|
||||
link-to 'sections' | b
|
||||
link-to 'sections' class="goto-sections-index-tab-header": span
|
||||
each section in sections
|
||||
view Qsupplier.App.SectionTabHeaderView context=section
|
||||
.section-manage-tables.pull-right
|
||||
|
||||
@@ -31,6 +31,7 @@ if sections
|
||||
/td.currency=currency list.price
|
||||
/td.timestamp=time list.created_at
|
||||
td.actions
|
||||
a.section-dashboard-orders{action showDashboardOrders section}: span
|
||||
a.table-qr-codes{path qr_codes_suppliers_tables section_id=section.id}
|
||||
span
|
||||
else
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
Qsupplier.App.HomeSectionJumperView = Ember.View.extend
|
||||
tagName: 'a'
|
||||
classNames: ['main-board-section-jumper']
|
||||
attributeBindings: ['href']
|
||||
#href: (-> Routes.suppliers_section_path(@get('controller.active_section_id') || 'nothing')).property('controller.active_section_id')
|
||||
href: '#'
|
||||
isVisible: (-> !!@get('controller.active_section_id') ).property('controller.active_section_id')
|
||||
template: Ember.Handlebars.compile('=>')
|
||||
isVisible: (-> !!@get('controller.active_section.id') ).property('controller.active_section.id')
|
||||
template: Ember.Handlebars.compile('<span class="fa fa-lg fa-chevron-circle-right"></span>')
|
||||
click: (e)->
|
||||
e.preventDefault()
|
||||
@get('controller').transitionToRoute 'section', @get('controller.active_section_id')
|
||||
@get('controller').transitionToRoute 'section', @get('controller.active_section.id')
|
||||
|
||||
@@ -3,6 +3,6 @@ HomeSectionOption = Ember.SelectOption.extend
|
||||
Qsupplier.App.HomeSectionSelectorView = Ember.Select.extend
|
||||
classNames: 'section_selector'
|
||||
optionView: HomeSectionOption
|
||||
valueBinding: 'controller.active_section_id'
|
||||
#valueBinding: 'controller.active_section_id'
|
||||
optionValuePath: 'content.id'
|
||||
optionLabelPath: 'select_label'
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
App.ListController = Ember.ObjectController.extend
|
||||
list: (-> @get('model')).property('model')
|
||||
showTotal: (->
|
||||
if @get('list.orders.length') && @get('list.orders.length') > 1 then true else false
|
||||
).property('list.orders.length')
|
||||
|
||||
@@ -4,6 +4,8 @@ App.ProductOrdersController = Ember.ArrayController.extend
|
||||
#Math.round(Math.random()*100)
|
||||
@get('model').getEach('total').reduce(((sum, total) -> sum + total), 0)
|
||||
).property('model.@each.quantity')
|
||||
product_orders: (->@get('model')).property('model')
|
||||
showTotal: (-> if @get('model.length') && @get('model.length') > 1 then true else false ).property('model.length')
|
||||
actions:
|
||||
clearProductOrders: ->
|
||||
#TODO: make clearing of unpersisted product orders
|
||||
|
||||
@@ -7,7 +7,7 @@ if list.orders
|
||||
= order.display
|
||||
span.currency= currency order.total
|
||||
span.created_at= time order.created_at
|
||||
if displayTotal
|
||||
if showTotal
|
||||
.list-orders-total.total
|
||||
= t 'total'
|
||||
span.currency= currency model.total
|
||||
|
||||
@@ -4,7 +4,7 @@ if modelDisabled
|
||||
.clearfix
|
||||
.panel
|
||||
ul.product-orders
|
||||
each product_order in controller
|
||||
each product_order in product_orders
|
||||
li.product_order
|
||||
= product_order.quantity
|
||||
| x
|
||||
@@ -14,8 +14,9 @@ if modelDisabled
|
||||
span.currency=currency product_order.total
|
||||
else
|
||||
li= t 'product_orders.no_orders'
|
||||
li.total
|
||||
= t 'product_orders.total'
|
||||
span.right.currency=currency orderTotal
|
||||
if model
|
||||
a.tiny.button.right{action orderProducts} href="#"= t 'product_orders.order_button'
|
||||
if showTotal
|
||||
li.total
|
||||
= t 'product_orders.total'
|
||||
span.right.currency=currency orderTotal
|
||||
if product_orders
|
||||
a.order-selected-products-button{action orderProducts} href="#"= t 'product_orders.order_button'
|
||||
|
||||
-2
@@ -1,5 +1,3 @@
|
||||
@import font-awesome
|
||||
@import ./foundation_and_overrides
|
||||
.form-actions
|
||||
.form-action-submit
|
||||
+button($bg: $button-submit-color, $padding: $button-sml)
|
||||
-3
@@ -1,6 +1,3 @@
|
||||
@import constants
|
||||
@import font-awesome
|
||||
@import foundation_and_overrides
|
||||
header.top-menu
|
||||
height: 90px
|
||||
background-color: transparent
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
@import constants
|
||||
aside.side-menu
|
||||
background-color: #444
|
||||
position: fixed
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
@import font-awesome
|
||||
#product-category-list
|
||||
list-style: none
|
||||
li
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
@import ./foundation_and_overrides
|
||||
.products_preview-date
|
||||
.products_preview-time-container
|
||||
float: left
|
||||
@@ -0,0 +1,7 @@
|
||||
//$qbrown: #634227
|
||||
$qbrown: #853d15
|
||||
$qbrown-active: lighten($qbrown, 20%)
|
||||
$green: #7BB459 //Heineken
|
||||
//$wood: image-url('textures/wood001-vertical.jpg')
|
||||
$wood: image-url('textures/theme1.jpg')
|
||||
$background-brown: #57351f
|
||||
+3
-2
@@ -1,5 +1,6 @@
|
||||
@import foundation_and_overrides
|
||||
|
||||
.dashboard-section-selection
|
||||
float: right
|
||||
white-space: nowrap
|
||||
.active-lists-table
|
||||
width: 100%
|
||||
.mark_list_as_helped
|
||||
-2
@@ -1,5 +1,3 @@
|
||||
@import ./foundation_and_overrides
|
||||
|
||||
.display-row
|
||||
@extend .row
|
||||
.display-label
|
||||
-2
@@ -1,5 +1,3 @@
|
||||
@import ./foundation_and_overrides
|
||||
|
||||
.form-row
|
||||
@extend .row
|
||||
.form-label
|
||||
@@ -0,0 +1,36 @@
|
||||
td.boolean
|
||||
+table-fit
|
||||
&.needs_help
|
||||
.boolean-true
|
||||
@extend .fa
|
||||
@extend .fa-exclamation
|
||||
&.needs_payment
|
||||
.boolean-true
|
||||
@extend .fa
|
||||
@extend .fa-money
|
||||
.list-orders-container
|
||||
.currency
|
||||
float: right
|
||||
list-style: none
|
||||
$padding: 6px 0 6px 35px
|
||||
.list-order-container
|
||||
background-position: left center
|
||||
background-repeat: no-repeat
|
||||
+grid-column(12)
|
||||
padding: $padding
|
||||
border-bottom: 1px solid #eee
|
||||
&.active
|
||||
background-image: image-url('icons/order-check.png')
|
||||
&.delivered
|
||||
background-image: image-url('icons/order-doublecheck.png')
|
||||
.created_at
|
||||
float: right
|
||||
padding-right: 20px
|
||||
padding-left: 10px
|
||||
.list-orders-total
|
||||
+grid-column(12)
|
||||
padding: $padding
|
||||
border-top: 2px solid #444
|
||||
font-weight: bold
|
||||
|
||||
|
||||
-3
@@ -1,7 +1,4 @@
|
||||
$side-spacing: 0px
|
||||
@import constants
|
||||
@import ./foundation_and_overrides
|
||||
@import font-awesome
|
||||
.supplier-is-closed
|
||||
+alert($bg: $secondary-color)
|
||||
.close
|
||||
+7
-3
@@ -1,6 +1,3 @@
|
||||
@import constants
|
||||
@import ./foundation_and_overrides
|
||||
@import font-awesome
|
||||
table
|
||||
&.table
|
||||
// Bootstrap behaviour
|
||||
@@ -36,3 +33,10 @@ table
|
||||
span
|
||||
@extend .fa
|
||||
@extend .fa-times
|
||||
.section-dashboard-orders
|
||||
+button($bg: $secondary-color)
|
||||
+button-icon-only
|
||||
margin-right: 0.7rem
|
||||
span
|
||||
@extend .fa
|
||||
@extend .fa-list-alt
|
||||
+7
@@ -24,3 +24,10 @@
|
||||
content: ''
|
||||
display: block
|
||||
clear: left
|
||||
.goto-sections-index-tab-header
|
||||
float: left
|
||||
span
|
||||
@extend .fa
|
||||
@extend .fa-share
|
||||
@extend .fa-lg
|
||||
@extend .fa-rotate-270
|
||||
@@ -1,9 +0,0 @@
|
||||
/*
|
||||
*= require ./foundation_and_overrides
|
||||
*= require 'jquery-ui-1.8.23.custom.css'
|
||||
*= require qtip
|
||||
*= require_directory ../base1-shared
|
||||
*= require pickdate
|
||||
*= require_directory .
|
||||
*= require_self
|
||||
*/
|
||||
@@ -0,0 +1,18 @@
|
||||
//= require qtip
|
||||
//= require_directory ../base1-shared
|
||||
//= require pickdate
|
||||
@import ./qconstants
|
||||
@import ./foundation_and_overrides
|
||||
@import ./qstructure
|
||||
@import ./qicons
|
||||
@import ./qdashboard
|
||||
@import ./qdisplays
|
||||
@import ./form_actions
|
||||
@import ./qforms
|
||||
@import ./menu_main
|
||||
@import ./menu_side
|
||||
@import ./product_categories
|
||||
@import ./products_preview
|
||||
@import ./qtables
|
||||
@import ./section_tab_headers
|
||||
@import ./qlists
|
||||
@@ -1,12 +0,0 @@
|
||||
@import font-awesome
|
||||
@import ./foundation_and_overrides
|
||||
td.boolean
|
||||
+table-fit
|
||||
&.needs_help
|
||||
.boolean-true
|
||||
@extend .fa
|
||||
@extend .fa-exclamation
|
||||
&.needs_payment
|
||||
.boolean-true
|
||||
@extend .fa
|
||||
@extend .fa-money
|
||||
@@ -15,3 +15,6 @@ ul.product-orders
|
||||
.icon
|
||||
@extend .fa
|
||||
@extend .fa-times
|
||||
.order-selected-products-button
|
||||
float: right
|
||||
+button($padding: $button-tny)
|
||||
|
||||
@@ -21,7 +21,7 @@ module Suppliers
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @lists, each_serializer: ListSerializer }
|
||||
format.json { render json: @lists, each_serializer: SupplierListSerializer }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -64,7 +64,7 @@ module Suppliers
|
||||
if params[:old_style] then
|
||||
render json: @list.with_orders_as_json
|
||||
else
|
||||
render json: @list
|
||||
render json: @list, serializer: SupplierListSerializer
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
class SupplierListSerializer < Qwaiter::Serializer
|
||||
# user ids for facebook pictures
|
||||
self.root = :list
|
||||
embed :ids, include: true
|
||||
attributes :extended_version, :state, :needs_help, :needs_payment, :user_requests_closing, :is_paid, :price,
|
||||
:table_id, :table_number, :section_id, :user_ids, :supplier_id, :closed_at
|
||||
has_many :orders
|
||||
#has_many :product_categories
|
||||
has_one :table, serializer: SupplierTableSerializer
|
||||
has_many :join_requests
|
||||
has_many :users, serializer: SupplierUserSerializer
|
||||
|
||||
#def has_active_orders
|
||||
#object.has_active_orders?
|
||||
#end
|
||||
def extended_version
|
||||
true
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
class SupplierSupplierSerializer < Qwaiter::Serializer
|
||||
self.root = :supplier
|
||||
attributes :extended_version, :open, :name
|
||||
|
||||
def extended_version
|
||||
false
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
class SupplierTableSerializer < Qwaiter::Serializer
|
||||
self.root = :table
|
||||
embed :ids, include: true
|
||||
attributes :number, :width, :height, :position_x, :position_y, :section_id, :occupied, :needs_help
|
||||
has_one :supplier, serializer: SupplierSupplierSerializer
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
class SupplierUserSerializer < Qwaiter::Serializer
|
||||
self.root = :user
|
||||
attributes :email, :facebook_id
|
||||
end
|
||||
@@ -1,7 +1,7 @@
|
||||
class UserListSerializer < Qwaiter::Serializer
|
||||
# user ids for facebook pictures
|
||||
#embed :ids
|
||||
attributes :state, :needs_help, :needs_payment, :user_requests_closing, :is_paid, :price, :table_id, :table_number, :section_id, :user_ids, :supplier_name, :closed_at
|
||||
attributes :state, :needs_help, :needs_payment, :user_requests_closing, :is_paid, :price, :table_id, :table_number, :section_id, :user_ids, :supplier_name, :closed_at, :supplier_id
|
||||
|
||||
#def has_active_orders
|
||||
#object.has_active_orders?
|
||||
|
||||
@@ -1,35 +1,37 @@
|
||||
.page-header= title t('supplier.lists.show.title', list: List.model_name.human)
|
||||
dl.dl-horizontal
|
||||
dt= List.human_attribute_name(:created_at)
|
||||
dd= l @list.created_at, format: :short
|
||||
dt= t('supplier.lists.show.users')
|
||||
dd= @list.users.map(&:supplier_name).join(', ')
|
||||
.display-row
|
||||
.display-label
|
||||
span data-t='attributes.list.created_at'
|
||||
.display-field
|
||||
span data-time=@list.created_at.iso8601
|
||||
.well
|
||||
table#list-table.table.list-table
|
||||
thead
|
||||
tr
|
||||
th= Order.model_name.human
|
||||
th.currency= Product.human_attribute_name(:price)
|
||||
tbody
|
||||
tr
|
||||
td colspan=2 = slider_image
|
||||
tfoot
|
||||
tr
|
||||
td
|
||||
td.currency
|
||||
strong.list-total
|
||||
script#list-order-template[type="text/html"]= render 'supplier/list_order.mustache'
|
||||
.form-actions
|
||||
= link_to t("helpers.links.back"), suppliers_lists_path(date: @list.created_at.strftime('%Y-%m-%d')), class: 'btn'
|
||||
'
|
||||
= link_to t('helpers.links.edit'), [:edit, :suppliers, @list], class: 'btn btn-info'
|
||||
- content_for :footer do
|
||||
javascript:
|
||||
jQuery(function(){
|
||||
Qsupplier.load_list('#{@list.id}');
|
||||
})
|
||||
- content_for :head do
|
||||
= javascript_include_tag 'supplier/app/application'
|
||||
/.page-header= title t('supplier.lists.show.title', list: List.model_name.human)
|
||||
/dl.dl-horizontal
|
||||
/dt= List.human_attribute_name(:created_at)
|
||||
/dd= l @list.created_at, format: :short
|
||||
/dt= t('supplier.lists.show.users')
|
||||
/dd= @list.users.map(&:supplier_name).join(', ')
|
||||
/.display-row
|
||||
/.display-label
|
||||
/span data-t='attributes.list.created_at'
|
||||
/.display-field
|
||||
/span data-time=@list.created_at.iso8601
|
||||
/.well
|
||||
/table#list-table.table.list-table
|
||||
/thead
|
||||
/tr
|
||||
/th= Order.model_name.human
|
||||
/th.currency= Product.human_attribute_name(:price)
|
||||
/tbody
|
||||
/tr
|
||||
/td colspan=2 = slider_image
|
||||
/tfoot
|
||||
/tr
|
||||
/td
|
||||
/td.currency
|
||||
/strong.list-total
|
||||
/script#list-order-template[type="text/html"]= render 'supplier/list_order.mustache'
|
||||
/.form-actions
|
||||
/= link_to t("helpers.links.back"), suppliers_lists_path(date: @list.created_at.strftime('%Y-%m-%d')), class: 'btn'
|
||||
/'
|
||||
/= link_to t('helpers.links.edit'), [:edit, :suppliers, @list], class: 'btn btn-info'
|
||||
/- content_for :footer do
|
||||
/javascript:
|
||||
/jQuery(function(){
|
||||
/Qsupplier.load_list('#{@list.id}');
|
||||
/})
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
class Symbol
|
||||
def to_json(*)
|
||||
to_s
|
||||
end
|
||||
|
||||
def as_json(*)
|
||||
to_s
|
||||
end
|
||||
end
|
||||
@@ -1,5 +1,6 @@
|
||||
en:
|
||||
user:
|
||||
total: Total
|
||||
messages:
|
||||
cannot_order_on_non_active_list: You cannot place an order on a closed list
|
||||
no_active_list: There is no active list
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
nl:
|
||||
user:
|
||||
total: Totaal
|
||||
messages:
|
||||
cannot_order_on_non_active_list: Je kan niet bestellen op een gesloten lijst
|
||||
no_active_list: Er is momenteel geen lijst actief
|
||||
|
||||
@@ -7,12 +7,12 @@ end
|
||||
|
||||
step "the user clicks on the order product button :product_name" do |product_name|
|
||||
@last_product = instance_variable_get product_name.underscore.gsub(/\s/, '_').prepend('@')
|
||||
button = find ".order-product-#{@last_product.id}"
|
||||
button = find ".order-product-#{@last_product.id} .add-product-to-list"
|
||||
button.click
|
||||
end
|
||||
|
||||
step "the user clicks on the user order button" do
|
||||
find('#active-order-table .btn-primary').click
|
||||
find('.order-selected-products-button').click
|
||||
sleep 1
|
||||
end
|
||||
|
||||
|
||||
@@ -1,14 +1,36 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe ProductCategory do
|
||||
let(:all_week){ Array.new(7, 1) }
|
||||
let(:show_saturday){ [0,0,0,0,0,0,1] }
|
||||
let(:show_sunday){ [1,0,0,0,0,0,0] }
|
||||
|
||||
describe '#week_days' do
|
||||
let(:product_category) { create :product_category }
|
||||
subject { product_category }
|
||||
let(:default) { Array.new(7, 1) }
|
||||
let(:default) { all_week }
|
||||
its(:week_days) { should == default }
|
||||
it "typecasts strings into integers" do
|
||||
subject.week_days = Array.new(7, "0")
|
||||
subject.week_days.should == Array.new(7, 0)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#for_supplier_in_time' do
|
||||
subject{ described_class }
|
||||
let(:supplier){ create :supplier, time_zone: 'Tijuana', night_offset: 150 }
|
||||
|
||||
it 'works for a normal product category' do
|
||||
c1 = create :product_category, supplier: supplier, name: 'Lunch', full_day: true, week_days: all_week
|
||||
c2 = create :product_category, supplier: supplier, name: 'Happy hour', full_day: false, week_days: all_week, start_from: 1320, end_on: 1380 # from 22 to 23 hour
|
||||
subject.for_supplier_in_time(supplier, Time.now.beginning_of_day + 1300.minutes).should == [c1]
|
||||
subject.for_supplier_in_time(supplier, Time.now.beginning_of_day + 1350.minutes).should == [c1, c2]
|
||||
end
|
||||
|
||||
it 'finds sunday morning products on saturday categories' do
|
||||
c1 = create :product_category, supplier: supplier, name: 'Lunch', full_day: true, week_days: show_saturday
|
||||
c2 = create :product_category, supplier: supplier, name: 'Sunday special', full_day: true, week_days: show_sunday
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Symbol do
|
||||
it 'to_json becomes a string in json format' do
|
||||
:abc.to_json.should == 'abc'
|
||||
end
|
||||
|
||||
it 'as_json becomes a string in json format' do
|
||||
:abc.as_json.should == 'abc'
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user