consitency refactor

This commit is contained in:
2014-11-27 19:42:51 +01:00
parent 5453837880
commit 3bc1e5685c
37 changed files with 338 additions and 235 deletions
@@ -1,6 +1,6 @@
App.ApplicationController = Ember.Controller.extend App.ApplicationController = Ember.Controller.extend
active_section: null active_section: null
init: -> #init: ->
#success = (supplier)=> #success = (supplier)=>
## A supplier record with id current and with the content of the returned supplier is created ## A supplier record with id current and with the content of the returned supplier is created
## at the moment remove the dummy supplier, this should be resolved by Ember eventually ## at the moment remove the dummy supplier, this should be resolved by Ember eventually
@@ -14,3 +14,12 @@ App.ApplicationController = Ember.Controller.extend
#@set 'supplier', null #@set 'supplier', null
#@store.find('supplier', 'current').then success, error #@store.find('supplier', 'current').then success, error
# @set 'supplier', @store.find('supplier', supplier_id) # @set 'supplier', @store.find('supplier', supplier_id)
actions:
signOut: ->
window.location = Routes.destroy_supplier_session_path()
markSupplierClosed: ->
return unless supplier = @get('supplier')
supplier.close()
markSupplierOpen: ->
return unless supplier = @get('supplier')
supplier.open_the_place()
@@ -1,6 +1,6 @@
@App.modals.BaseController = Ember.ObjectController.extend @App.modals.BaseController = Ember.ObjectController.extend
alert_message: "" alert_message: ""
title: ~> title: (->
# return title if directly set by options # return title if directly set by options
return @get('modal_options.title') if @get('modal_options.title') return @get('modal_options.title') if @get('modal_options.title')
# return translated title_path if directly set by controller # return translated title_path if directly set by controller
@@ -17,6 +17,7 @@
new Ember.Handlebars.SafeString(tspan(@get("modal.#{underscored}.title"), translation_params)) new Ember.Handlebars.SafeString(tspan(@get("modal.#{underscored}.title"), translation_params))
else else
underscored.capitalize().replace(/_/, ' ') underscored.capitalize().replace(/_/, ' ')
).property('model.id')
actions: actions:
close: -> close: ->
if close = @get('modal_options.close') if close = @get('modal_options.close')
@@ -0,0 +1,13 @@
App.modals.TableEditController = App.modals.BaseController.extend
title_path: 'table.edit.modal.title'
sections: (-> @store.all('section')).property()
#setSelectedSection: (-> @set 'selectedSection', @get('model.section')).on('init')
actions:
confirm: ->
@get('model').then (l)->l.close()
@send 'closeModal'
saveTable: ->
#@set 'model.section', @get('selectedSection')
@set 'model.section', @get('model.section')
#debugger
@send 'save'
@@ -2,14 +2,11 @@ App.TablesIndexController = Ember.ArrayController.extend
tables: (-> @get('model').sortBy('casted_number')).property('model.@each.number') tables: (-> @get('model').sortBy('casted_number')).property('model.@each.number')
actions: actions:
editTable: (table)-> editTable: (table)->
@modal 'edit_table', @modal 'table_edit',
model: table model: table
title_path: 'table.edit.modal.title'
ok: ->
table.save()
close: -> close: ->
table.rollback() table.rollback()
destroyTable: (table)-> destroyTable: (table)->
@send 'confirm', @modal 'confirm',
title: t('table.destroy.modal.title', number: table.get('number')) title: t('table.destroy.modal.title', number: table.get('number'))
ok: -> table.destroyRecord() ok: -> table.destroyRecord()
@@ -8,6 +8,7 @@ App.Supplier = DS.Model.extend
house_number_addition: attr 'string' house_number_addition: attr 'string'
postal_code: attr 'string' postal_code: attr 'string'
city: attr 'string' city: attr 'string'
open: attr 'boolean'
country: attr 'string' country: attr 'string'
facebook_promotion_url: attr 'string' facebook_promotion_url: attr 'string'
iens_profile: attr 'string' iens_profile: attr 'string'
@@ -15,3 +16,11 @@ App.Supplier = DS.Model.extend
lng: attr 'number' lng: attr 'number'
week_starts_on_monday: attr 'boolean' week_starts_on_monday: attr 'boolean'
product_categories: DS.hasMany 'product_category' product_categories: DS.hasMany 'product_category'
close: ->
$.post Routes.supplier_mark_as_closed_path(), =>
@set 'open', false
open_the_place: ->
$.post Routes.supplier_mark_as_open_path(), =>
@set 'open', true
@@ -1,10 +1,11 @@
DS.Model.reopen DS.Model.reopen
created_at: DS.attr('date') created_at: DS.attr('date')
updated_at: DS.attr('date') updated_at: DS.attr('date')
#TODO: at the moment deleteRecord might work as expected, check this
eraseRecord: -> eraseRecord: ->
@clearRelationships() @clearRelationships()
@transitionTo('deleted.saved') @transitionTo('deleted.saved')
then: (callback) -> callback.call(@, @) #then: (callback) -> callback.call(@, @) DO NOT USE SINCE THERE IS TYPECHECKING ON .then in ember data https://github.com/emberjs/data/issues/2523
DS.Model.reopenClass DS.Model.reopenClass
findCached: (id)-> findCached: (id)->
return null unless id return null unless id
@@ -11,7 +11,7 @@ if list.closed_at
=state 'list' list.state =state 'list' list.state
.display-row .display-row
.display-label   .display-label  
.display-field: App.CloseListButtonView content=list .display-field= view "close-list-button" content=list
.user-info-container .user-info-container
each user in list.users each user in list.users
=user.facebook_image_tag =user.facebook_image_tag
@@ -7,7 +7,7 @@ td.status-icons
if view.content.needs_payment if view.content.needs_payment
| |
span.icon.needs-payment span.icon.needs-payment
td.numeric.table_number: App.TableNumberWithInfoView contextBinding="view.content" td.numeric.table_number= view "table-number-with-info" contextBinding="view.content"
td.section_title: link-to 'section' view.content.table.section.id: span=view.content.table.section.title td.section_title: link-to 'section' view.content.table.section.id: span=view.content.table.section.title
td.currency.total_list_amount=currency view.content.total td.currency.total_list_amount=currency view.content.total
td.actions td.actions
@@ -16,8 +16,8 @@ td.actions
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
App.MarkListHelpedButtonView content=view.content = view "mark-list-helped-button" content=view.content
/App.RemoveListNeedsPaymentView content=view.content /= view "remove-list-needs-payment" content=view.content
App.CloseListButtonView content=view.content = view "close-list-button" content=view.content
button.show-list.button{action "showList" view.content.id}: span button.show-list.button{action "showList" view.content.id}: span
@@ -5,8 +5,8 @@ td.status-icons
if view.content.active if view.content.active
span.active-order.fa.fa-check.fa-lg span.active-order.fa.fa-check.fa-lg
td= view.content.display td= view.content.display
td.numeric.table_number: App.TableNumberWithInfoView contextBinding="view.content.list" td.numeric.table_number= view "table-number-with-info" contextBinding="view.content.list"
td.section_title: link-to 'section' view.content.list.table.section.id: span=view.content.list.table.section.title td.section_title= link-to 'section' view.content.list.table.section.id: span=view.content.list.table.section.title
td.currency=currency view.content.total td.currency=currency view.content.total
td.time= time view.content.created_at format="HH:mm" td.time= time view.content.created_at format="HH:mm"
td.actions td.actions
@@ -1,2 +1,3 @@
= outlet = partial "global/top_menu"
.main-section= outlet
= outlet modal = outlet modal
@@ -0,0 +1,36 @@
header.top-menu
.toggle-side-menu
span
.menu-content
section.main-buttons
= link-to 'index' class="top-menu-root"
= image_tag "icons/logo-small.png"
= link-to "menu" class="top-menu-menu"
= t 'supplier.top_menu.menu'
= link-to "sections" class="top-menu-sections"
= t 'models.plural.section'
= link-to "tables" class="top-menu-tables"
= t 'models.plural.table'
= link-to "lists" class="top-menu-lists"
= t 'models.plural.list'
section.extra-info
.supplier-info-row
.supplier-name= supplier.name
.table-number
.supplier-info-row
.counter.supplier-orders-placed-count
span.supplier-orders-placed-count-number= supplier.orders_placed_count
span.supplier-orders-placed-count-icon
.counter.supplier-orders-in-process-count
span.supplier-orders-in-process-count-number= supplier.orders_in_process_count
span.supplier-orders-in-process-count-icon
aside.side-menu
ul
li.title: h3 Menu
if supplier.open
li: a.supplier-close-shop{action "markSupplierClosed"}= t 'supplier.close_for_orders'
else
li: a.supplier-open-shop{action "markSupplierOpen"}= t 'supplier.open_for_orders'
= link-to "settings" class="supplier-settings-link"
= t 'supplier.settings'
li class="supplier-sign-out-link": a{action "signOut"}= t 'supplier.sign_out'
@@ -1,53 +1,56 @@
= sections-header sectionBinding="controller.controllers.application.active_section" .row: .small-12.columns
.page-header = sections-header sectionBinding="controller.controllers.application.active_section"
div.dashboard-section-selection .page-header
/App.HomeSectionSelectorView selectionBinding="controller.controllers.application.active_section" content=controller.sections prompt=controllers.application.supplier.name div.dashboard-section-selection
/= home-section-selector sectionBinding="controller.controllers.application.active_section" /App.HomeSectionSelectorView selectionBinding="controller.controllers.application.active_section" content=controller.sections prompt=controllers.application.supplier.name
/= view "home-section-jumper" /= home-section-selector sectionBinding="controller.controllers.application.active_section"
if active_lists.length /= view "home-section-jumper"
h3.dashboard-lists-header{action "toggleDashboardLists"} if active_lists.length
if show_lists h3.dashboard-lists-header{action "toggleDashboardLists"}
span.icon if show_lists
else span.icon
span.icon.collapsed else
=t 'active_lists.title' span.icon.collapsed
span= list_number_info =t 'active_lists.title'
else span= list_number_info
h3=t 'dashboard.active_lists.no_lists' else
if show_lists_table h3=t 'dashboard.active_lists.no_lists'
table.active-lists-table.table if show_lists_table
thead table.active-lists-table.table
tr thead
th.user-info.show-for-large-up tr
th.status-icons th.user-info.show-for-large-up
th.numeric=t 'table_number' th.status-icons
th=t 'models.section' th.numeric=t 'table_number'
th.currency=t 'active_lists.price' th=t 'models.section'
th.actions th.currency=t 'active_lists.price'
tbody th.actions
each list in active_lists: App.ActiveListView contentBinding="list" tbody
.page-header each list in active_lists
if active_orders.length = view "active-list" contentBinding="list"
h3.dashboard-orders-header{action "toggleDashboardOrders"} .page-header
if show_orders if active_orders.length
span.icon h3.dashboard-orders-header{action "toggleDashboardOrders"}
else if show_orders
span.icon.collapsed span.icon
=t 'active_orders.title' else
span= order_number_info span.icon.collapsed
else =t 'active_orders.title'
h3= t 'dashboard.active_orders.no_orders' span= order_number_info
if show_orders_table else
table.active-orders-table.table h3= t 'dashboard.active_orders.no_orders'
thead if show_orders_table
tr table.active-orders-table.table
th.user-info.show-for-large-up thead
th.status-icons tr
th=t 'models.order' th.user-info.show-for-large-up
th.numeric=t 'table_number' th.status-icons
th=t 'models.section' th=t 'models.order'
th.currency=t 'active_orders.price' th.numeric=t 'table_number'
th.time th=t 'models.section'
th.actions th.currency=t 'active_orders.price'
tbody th.time
each order in active_orders: App.ActiveOrderView contentBinding="order" th.actions
tbody
each order in active_orders
= view "active-order" contentBinding="order"
@@ -1,4 +1,5 @@
h2=t 'models.list' .row: .small-12.columns
partial "list_content" h2=t 'models.list'
link-to 'lists' class="button" partial "list_content"
span=t 'list.go_to_lists' link-to 'lists' class="button"
span=t 'list.go_to_lists'
@@ -1,32 +1,33 @@
h1=t 'models.plural.list' .row: .small-12.columns
App.ListDisplayDateSelector valueBinding="date" h1=t 'models.plural.list'
if sorted_lists = view "list-display-date-selector" valueBinding="date"
table.table if sorted_lists
thead table.table
tr thead
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 sorted_lists
tr tr
td.state th.state=t 'attributes.list.state'
link-to 'list' list.id th.boolean=t 'attributes.list.needs_help'
= state 'list' list.state th.boolean=t 'attributes.list.needs_payment'
td.boolean.needs_help=boolean list.needs_help th.timestamp=t 'attributes.list.closed_at'
td.boolean.needs_payment=boolean list.needs_payment th.table_number=t 'models.table'
td.timestamp=time list.closed_at th.currentcy=t 'attributes.list.price'
td.table_number= list.table.number th.timestamp=t 'attributes.list.created_at'
td.currency=currency list.price tbody
td.timestamp=time list.created_at each list in sorted_lists
else tr
.row td.state
.panel link-to 'list' list.id
if loading = state 'list' list.state
span.loading td.boolean.needs_help=boolean list.needs_help
else td.boolean.needs_payment=boolean list.needs_payment
=t 'list.none_found' td.timestamp=time list.closed_at
td.table_number= list.table.number
td.currency=currency list.price
td.timestamp=time list.created_at
else
.row: .small-12.columns
.panel
if loading
span.loading
else
=t 'list.none_found'
@@ -1,6 +1,7 @@
.products-menu-filters-container .row: .small-12.columns
= input value=product_code_filter type="search" placeholder=product_code_filter_placeholder .products-menu-filters-container
h2 Menu = input value=product_code_filter type="search" placeholder=product_code_filter_placeholder
h2 Menu
each product_category in sorted_product_categories each product_category in sorted_product_categories
.row.product_category-container: .small-12.columns .row.product_category-container: .small-12.columns
.product_category-header .product_category-header
@@ -1,11 +0,0 @@
p=t 'table.edit.modal.body_header'
.form-row
.form-label=t 'attributes.table.number'
.form-field: App.NumberField valueBinding="model.number"
.form-row
.form-label=t 'models.section'
.form-field
Ember.Select content=all_sections valueBinding="model.section" optionLabelPath="content.title"
hr
button.modal-close{action "close"}=t 'section.add_tables.modal.close_button'
button.modal-confirm.right{action "ok"}=t 'section.add_tables.modal.add_button'
@@ -0,0 +1,12 @@
p=t 'table.edit.modal.body_header'
.form-row
.form-label=t 'attributes.table.number'
.form-field= input type="number" valueBinding="model.number"
.form-row
.form-label=t 'models.section'
.form-field
= view "select" content=sections selectionBinding="model.section" optionLabelPath="content.title" optionValuePath="content.id"
= model.section.title
hr
button.modal-close{action "close"}=t 'section.add_tables.modal.close_button'
button.modal-confirm.right{action "save"}=t 'section.add_tables.modal.add_button'
@@ -1,7 +1,7 @@
.section-tabs-container .section-tabs-container
link-to 'sections' class="goto-sections-index-tab-header": span = link-to 'sections' class="goto-sections-index-tab-header": span
each section in sections each section in sections
App.SectionTabHeaderView context=section = view "section-tab-header" context=section
a.add-section{action "addSection"}: span a.add-section{action "addSection"}: span
.section-manage-tables.pull-right .section-manage-tables.pull-right
if editmode if editmode
@@ -27,11 +27,12 @@
a href="{{route 'qr_codes_suppliers_tables_path' section_id=id}}": span.table-qr-codes=t 'tables.qr_codes.link' a href="{{route 'qr_codes_suppliers_tables_path' section_id=id}}": span.table-qr-codes=t 'tables.qr_codes.link'
li li
a.section-destroy{action "destroySection"}: span.section-remove-icon=t 'helpers.links.destroy' a.section-destroy{action "destroySection"}: span.section-remove-icon=t 'helpers.links.destroy'
Ember.TextField valueBinding="title" class="section-edit-title-field" = input type="text" valueBinding="title" class="section-edit-title-field"
App.NumberField valueBinding="width" class="dimension section-edit-width-field" App.NumberField valueBinding="width" class="dimension section-edit-width-field"
span.fa.fa-lg.fa-times span.fa.fa-lg.fa-times
App.NumberField valueBinding="height" class="dimension section-edit-height-field" App.NumberField valueBinding="height" class="dimension section-edit-height-field"
a.section-normal-mode-button{ action "finishEditable" }: span a.section-normal-mode-button{ action "finishEditable" }: span
else else
a.section-edit-mode-button{ action "makeEditable" }: span a.section-edit-mode-button{ action "makeEditable" }: span
App.SectionTablesView contentBinding="tables" = view "section-tables" contentBinding="tables"
@@ -7,8 +7,8 @@ if table.active_list
div.table-actions div.table-actions
.title= table.number .title= table.number
.table-action-row .table-action-row
App.MarkListHelpedButtonView contentBinding="table.active_list" = view "mark-list-helped-button" contentBinding="table.active_list"
App.CloseListButtonView contentBinding="table.active_list" = view "close-list-button" contentBinding="table.active_list"
.table-action-row=currency table.active_list.total .table-action-row=currency table.active_list.total
/.table-action-row /.table-action-row
a{action "editTable" table}: span.fa.fa-lg.fa-wrench a{action "editTable" table}: span.fa.fa-lg.fa-wrench
@@ -1,2 +1,2 @@
each table in tables each table in tables
App.SectionTableView content=table = view "section-table" content=table
@@ -1,40 +1,41 @@
h1=t 'models.plural.section' .row: .small-12.columns
if sections h1=t 'models.plural.section'
table.table if sections
thead table.table
tr thead
th=t 'attributes.section.title'
th=t 'models.plural.table'
th.numeric=t 'attributes.section.width'
th.numeric=t 'attributes.section.height'
/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'
th.actions=t 'helpers.actions.title'
tbody
each section in sections
tr tr
td th=t 'attributes.section.title'
a{ action "goToSection" section}= section.title th=t 'models.plural.table'
td th.numeric=t 'attributes.section.width'
span.table-count= section.tables.length th.numeric=t 'attributes.section.height'
td.numeric= section.width /th.boolean=t 'attributes.list.needs_help'
td.numeric= section.height /th.boolean=t 'attributes.list.needs_payment'
/td.boolean.needs_help=boolean list.needs_help /th.timestamp=t 'attributes.list.closed_at'
/td.boolean.needs_payment=boolean list.needs_payment /th.table_number=t 'models.table'
/td.timestamp=time list.closed_at /th.currentcy=t 'attributes.list.price'
/td.table_number 7 /th.timestamp=t 'attributes.list.created_at'
/td.currency=currency list.price th.actions=t 'helpers.actions.title'
/td.timestamp=time list.created_at tbody
td.actions each section in sections
a.section-dashboard-orders{action showDashboardOrders section}: span tr
a.table-qr-codes{path qr_codes_suppliers_tables section_id=section.id} td
span a{ action "goToSection" section}= section.title
else td
.row span.table-count= section.tables.length
.panel=t 'section.none_found' td.numeric= section.width
.form-actions td.numeric= section.height
a.form-action-new{action "addSection"}=t 'helpers.links.new' /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
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
.row: .small-12.columns
.panel=t 'section.none_found'
.form-actions
a.form-action-new{action "addSection"}=t 'helpers.links.new'
@@ -1,11 +1,12 @@
h2=t 'models.table' .row: .small-12.columns
.display-row h2=t 'models.table'
.display-label= t 'attributes.table.number'
.display-field
span= table.number
if table.section
.display-row .display-row
.display-label=t 'models.section' .display-label= t 'attributes.table.number'
.display-field .display-field
link-to 'section' table.section span= table.number
span= table.section.title if table.section
.display-row
.display-label=t 'models.section'
.display-field
link-to 'section' table.section
span= table.section.title
@@ -1,21 +1,22 @@
h1=t 'models.plural.table' .row: .small-12.columns
if tables h1=t 'models.plural.table'
table.table if tables
thead table.table
tr thead
th=t 'attributes.table.number'
th.link=t 'models.section'
th.timestamp= t 'attributes.table.created_at'
th.actions=t 'helpers.actions.title'
tbody
each table in tables
tr tr
td: link-to 'table' table: span= table.number th=t 'attributes.table.number'
td.link th.link=t 'models.section'
if table.section th.timestamp= t 'attributes.table.created_at'
= link-to 'section' table.section th.actions=t 'helpers.actions.title'
= table.section.title tbody
td.numeric=time table.created_at each table in tables
td.actions tr
a.table-edit{ action 'editTable' table }: span td: link-to 'table' table: span= table.number
a.table-destroy{ action 'destroyTable' table }: span td.link
if table.section
= link-to 'section' table.section
= table.section.title
td.numeric=time table.created_at
td.actions
a.table-edit{ action 'editTable' table }: span
a.table-destroy{ action 'destroyTable' table }: span
@@ -1,17 +1,28 @@
App.ApplicationView = Ember.View.extend App.ApplicationView = Ember.View.extend
classNames: ['application-view']
didInsertElement: -> didInsertElement: ->
Qsupplier.watch_events() Qsupplier.watch_events()
selector_mappings = $('.toggle-side-menu,.side-menu').click ->
'.top-menu-root': '/' menu = $('aside.side-menu')
'.top-menu-lists': 'lists' toggle = $('.toggle-side-menu')
'.top-menu-sections': 'sections' if menu.is(':visible')
'.top-menu-tables': 'tables' menu.animate left: -255, -> $(@).hide()
'.top-menu-lists': 'lists' toggle.animate left: 0, -> $(@).removeClass('open')
'.top-menu-menu': 'menu' else
'.supplier-settings-link': 'settings' menu.show().animate left: 0
toggle.animate left: 222 - 30, -> $(@).addClass('open')
for selector, route of selector_mappings #selector_mappings =
do (selector, route)=> #'.top-menu-root': '/'
$(selector).click (e)=> #'.top-menu-lists': 'lists'
e.preventDefault() #'.top-menu-sections': 'sections'
@get('controller').transitionToRoute route #'.top-menu-tables': 'tables'
#'.top-menu-lists': 'lists'
#'.top-menu-menu': 'menu'
#'.supplier-settings-link': 'settings'
#for selector, route of selector_mappings
#do (selector, route)=>
#$(selector).click (e)=>
#e.preventDefault()
#@get('controller').transitionToRoute route
@@ -4,4 +4,4 @@ App.CloseListButtonView = Ember.View.extend
classNameBindings: ['content.active:show:hide'] classNameBindings: ['content.active:show:hide']
tagName: 'button' tagName: 'button'
click: (e)-> click: (e)->
@get('controller').send 'modal', 'close_list', model: @get('content') @get('controller').modal 'close_list', model: @get('content')
@@ -1,4 +1,4 @@
App.ListDisplayDateSelector = Ember.TextField.extend App.ListDisplayDateSelectorView = Ember.TextField.extend
classNames: 'datepicker' classNames: 'datepicker'
didInsertElement: -> didInsertElement: ->
setTranslations @$().hide() setTranslations @$().hide()
@@ -4,4 +4,6 @@ App.MarkListHelpedButtonView = Ember.View.extend
classNameBindings: ['content.needs_help:show:hide'] classNameBindings: ['content.needs_help:show:hide']
tagName: 'button' tagName: 'button'
click: (e)-> click: (e)->
@get('content').then (l)->l.is_helped() # record could be promise or object
record = @get('content')
if record.then then record.then((l)->l.is_helped()) else record.is_helped()
@@ -41,16 +41,6 @@ $ ->
setupTranslations() setupTranslations()
$('.toggle-side-menu,.side-menu').click ->
menu = $('aside.side-menu')
toggle = $('.toggle-side-menu')
if menu.is(':visible')
menu.animate left: -255, -> $(@).hide()
toggle.animate left: 0, -> $(@).removeClass('open')
else
menu.show().animate left: 0
toggle.animate left: 222 - 30, -> $(@).addClass('open')
$('[data-boolean]').each -> $('[data-boolean]').each ->
$(@).addClass(if $(@).data('boolean') then 'boolean-true' else 'boolean-false') $(@).addClass(if $(@).data('boolean') then 'boolean-true' else 'boolean-false')
@@ -23,3 +23,7 @@ aside.side-menu
+alert($bg: $alert-color, $radius: true) +alert($bg: $alert-color, $radius: true)
padding: 3px padding: 3px
margin-right: 20px margin-right: 20px
.supplier-open-shop
+alert($bg: $primary-color, $radius: true)
padding: 3px
margin-right: 20px
@@ -42,11 +42,16 @@ form
body body
background-image: $wood !important background-image: $wood !important
background-repeat: repeat background-repeat: repeat
main.main-section height: 100%
+panel($bg:rgba(200,200,200,0.8)) .ember-application, .application-view
min-height: 100% height: 100%
padding: 0 padding: 0
margin: 0 margin: 0
.main-section
+panel($bg:rgba(200,200,200,0.8))
padding: 0
margin: 0
min-height: 100%
.hide, .hidden .hide, .hidden
display: none display: none
+1 -1
View File
@@ -1,6 +1,6 @@
class SupplierController < ApplicationController class SupplierController < ApplicationController
before_filter :authenticate_supplier! before_filter :authenticate_supplier!
layout 'tablet' layout 'supplier/app'
def home def home
end end
@@ -1,7 +1,7 @@
module Suppliers module Suppliers
class ApplicationController < ::ApplicationController class ApplicationController < ::ApplicationController
before_filter :authenticate_supplier! before_filter :authenticate_supplier!
layout 'tablet' layout 'supplier/app'
rescue_from 'RestClient::Conflict' do |e| rescue_from 'RestClient::Conflict' do |e|
#binding.pry #binding.pry
+1
View File
@@ -143,6 +143,7 @@ class List
orders.map(&:close!) # close the connected orders orders.map(&:close!) # close the connected orders
self.state = 'closed' self.state = 'closed'
self.is_helped! if needs_help? self.is_helped! if needs_help?
self.needs_payment = false
self.user_requests_closing = false # if a user requested closing, not needed anymore self.user_requests_closing = false # if a user requested closing, not needed anymore
self.closed_at = Time.now self.closed_at = Time.now
if save if save
+21
View File
@@ -0,0 +1,21 @@
doctype html
html lang="en"
head
meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"
meta name="viewport" content="width=device-width, initial-scale=1.0"
title= content_for?(:title) ? yield(:title) : application_title
= csrf_meta_tags
/! Le HTML5 shim, for IE6-8 support of HTML elements
/[if lt IE 9]
= javascript_include_tag "http://html5shim.googlecode.com/svn/trunk/html5.js"
= stylesheet_link_tag "supplier/foundation1/application", media: "all"
link href="/favicon.ico" rel="shortcut icon"
= render 'suppliers/application/head'
= javascript_include_tag "supplier/foundation1/application"
= javascript_include_tag 'supplier/app/application'
= yield :head
/= javascript_include_tag "https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places&language=#{I18n.locale}"
body
#ember-app-container
-7
View File
@@ -1,7 +0,0 @@
- content_for :head do
= javascript_include_tag 'supplier/app/application'
/- content_for :footer do
javascript:
$(function(){
Qsupplier.watch_events();
});
-2
View File
@@ -1,2 +0,0 @@
- content_for :head do
= javascript_include_tag 'supplier/app/application'
@@ -5,8 +5,8 @@ header.top-menu
section.main-buttons section.main-buttons
= link_to image_tag('icons/logo-small.png'), supplier_root_path, class: 'top-menu-root' = link_to image_tag('icons/logo-small.png'), supplier_root_path, class: 'top-menu-root'
= link_to t('supplier.top_menu.menu'), "/supplier#/menu", class: 'top-menu-menu' = link_to t('supplier.top_menu.menu'), "/supplier#/menu", class: 'top-menu-menu'
= link_to ProductCategory.model_name.human_plural, suppliers_product_categories_path, data: {t: 'models.plural.product_category'}, class: 'top-menu-product_categories' /= link_to ProductCategory.model_name.human_plural, suppliers_product_categories_path, data: {t: 'models.plural.product_category'}, class: 'top-menu-product_categories'
= link_to Product.model_name.human_plural, suppliers_products_path, data: {t: 'models.plural.product'}, class: 'top-menu-products' /= link_to Product.model_name.human_plural, suppliers_products_path, data: {t: 'models.plural.product'}, class: 'top-menu-products'
= link_to Section.model_name.human_plural, "/supplier#/sections", data: {t: 'models.plural.section'}, class: 'top-menu-sections' = link_to Section.model_name.human_plural, "/supplier#/sections", data: {t: 'models.plural.section'}, class: 'top-menu-sections'
= link_to Table.model_name.human_plural, "/supplier#/tables", data: {t: 'models.plural.table'}, class: 'top-menu-tables' = link_to Table.model_name.human_plural, "/supplier#/tables", data: {t: 'models.plural.table'}, class: 'top-menu-tables'
= link_to List.model_name.human_plural, "/supplier#/lists", data: {t: 'models.plural.list'}, class: 'top-menu-lists' = link_to List.model_name.human_plural, "/supplier#/lists", data: {t: 'models.plural.list'}, class: 'top-menu-lists'