diff --git a/app/assets/javascripts/supplier/app/controllers/application_controller.js.coffee b/app/assets/javascripts/supplier/app/controllers/application_controller.js.coffee index 9f985191..42de8efe 100644 --- a/app/assets/javascripts/supplier/app/controllers/application_controller.js.coffee +++ b/app/assets/javascripts/supplier/app/controllers/application_controller.js.coffee @@ -1,6 +1,6 @@ App.ApplicationController = Ember.Controller.extend active_section: null - init: -> + #init: -> #success = (supplier)=> ## 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 @@ -14,3 +14,12 @@ App.ApplicationController = Ember.Controller.extend #@set 'supplier', null #@store.find('supplier', 'current').then success, error # @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() diff --git a/app/assets/javascripts/supplier/app/controllers/modals/base_controller.js.em b/app/assets/javascripts/supplier/app/controllers/modals/base_controller.js.coffee similarity index 98% rename from app/assets/javascripts/supplier/app/controllers/modals/base_controller.js.em rename to app/assets/javascripts/supplier/app/controllers/modals/base_controller.js.coffee index 4de57d50..dbc06fac 100644 --- a/app/assets/javascripts/supplier/app/controllers/modals/base_controller.js.em +++ b/app/assets/javascripts/supplier/app/controllers/modals/base_controller.js.coffee @@ -1,6 +1,6 @@ @App.modals.BaseController = Ember.ObjectController.extend alert_message: "" - title: ~> + title: (-> # return title if directly set by options return @get('modal_options.title') if @get('modal_options.title') # return translated title_path if directly set by controller @@ -17,6 +17,7 @@ new Ember.Handlebars.SafeString(tspan(@get("modal.#{underscored}.title"), translation_params)) else underscored.capitalize().replace(/_/, ' ') + ).property('model.id') actions: close: -> if close = @get('modal_options.close') diff --git a/app/assets/javascripts/supplier/app/controllers/modals/table_edit_controller.js.coffee b/app/assets/javascripts/supplier/app/controllers/modals/table_edit_controller.js.coffee new file mode 100644 index 00000000..e7525411 --- /dev/null +++ b/app/assets/javascripts/supplier/app/controllers/modals/table_edit_controller.js.coffee @@ -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' diff --git a/app/assets/javascripts/supplier/app/controllers/tables_index_controller.js.coffee b/app/assets/javascripts/supplier/app/controllers/tables_index_controller.js.coffee index 40fd389d..70c228d5 100644 --- a/app/assets/javascripts/supplier/app/controllers/tables_index_controller.js.coffee +++ b/app/assets/javascripts/supplier/app/controllers/tables_index_controller.js.coffee @@ -2,14 +2,11 @@ App.TablesIndexController = Ember.ArrayController.extend tables: (-> @get('model').sortBy('casted_number')).property('model.@each.number') actions: editTable: (table)-> - @modal 'edit_table', + @modal 'table_edit', model: table - title_path: 'table.edit.modal.title' - ok: -> - table.save() close: -> table.rollback() destroyTable: (table)-> - @send 'confirm', + @modal 'confirm', title: t('table.destroy.modal.title', number: table.get('number')) ok: -> table.destroyRecord() diff --git a/app/assets/javascripts/supplier/app/models/supplier.js.coffee b/app/assets/javascripts/supplier/app/models/supplier.js.coffee index 7c97b0c2..bcf3765d 100644 --- a/app/assets/javascripts/supplier/app/models/supplier.js.coffee +++ b/app/assets/javascripts/supplier/app/models/supplier.js.coffee @@ -8,6 +8,7 @@ App.Supplier = DS.Model.extend house_number_addition: attr 'string' postal_code: attr 'string' city: attr 'string' + open: attr 'boolean' country: attr 'string' facebook_promotion_url: attr 'string' iens_profile: attr 'string' @@ -15,3 +16,11 @@ App.Supplier = DS.Model.extend lng: attr 'number' week_starts_on_monday: attr 'boolean' 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 + diff --git a/app/assets/javascripts/supplier/app/modifications/model_extensions.js.coffee b/app/assets/javascripts/supplier/app/modifications/model_extensions.js.coffee index ba5001a2..ffe2e562 100644 --- a/app/assets/javascripts/supplier/app/modifications/model_extensions.js.coffee +++ b/app/assets/javascripts/supplier/app/modifications/model_extensions.js.coffee @@ -1,10 +1,11 @@ DS.Model.reopen created_at: DS.attr('date') updated_at: DS.attr('date') + #TODO: at the moment deleteRecord might work as expected, check this eraseRecord: -> @clearRelationships() @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 findCached: (id)-> return null unless id diff --git a/app/assets/javascripts/supplier/app/templates/_list_content.emblem b/app/assets/javascripts/supplier/app/templates/_list_content.emblem index 4721a943..56cde200 100644 --- a/app/assets/javascripts/supplier/app/templates/_list_content.emblem +++ b/app/assets/javascripts/supplier/app/templates/_list_content.emblem @@ -11,7 +11,7 @@ if list.closed_at =state 'list' list.state .display-row .display-label   - .display-field: App.CloseListButtonView content=list + .display-field= view "close-list-button" content=list .user-info-container each user in list.users =user.facebook_image_tag diff --git a/app/assets/javascripts/supplier/app/templates/active_list.emblem b/app/assets/javascripts/supplier/app/templates/active_list.emblem index 95d1283f..528529b6 100644 --- a/app/assets/javascripts/supplier/app/templates/active_list.emblem +++ b/app/assets/javascripts/supplier/app/templates/active_list.emblem @@ -7,7 +7,7 @@ td.status-icons if view.content.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.currency.total_list_amount=currency view.content.total td.actions @@ -16,8 +16,8 @@ td.actions span.fa-stack.fa-2x.fa-stack-sized i.fa.fa-bell.fa-stack-small i.fa.fa-ban.revoke - App.MarkListHelpedButtonView content=view.content - /App.RemoveListNeedsPaymentView content=view.content - App.CloseListButtonView content=view.content + = view "mark-list-helped-button" content=view.content + /= view "remove-list-needs-payment" content=view.content + = view "close-list-button" content=view.content button.show-list.button{action "showList" view.content.id}: span diff --git a/app/assets/javascripts/supplier/app/templates/active_order.emblem b/app/assets/javascripts/supplier/app/templates/active_order.emblem index ef026d88..69306040 100644 --- a/app/assets/javascripts/supplier/app/templates/active_order.emblem +++ b/app/assets/javascripts/supplier/app/templates/active_order.emblem @@ -5,8 +5,8 @@ td.status-icons if view.content.active span.active-order.fa.fa-check.fa-lg td= view.content.display -td.numeric.table_number: App.TableNumberWithInfoView contextBinding="view.content.list" -td.section_title: link-to 'section' view.content.list.table.section.id: span=view.content.list.table.section.title +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.currency=currency view.content.total td.time= time view.content.created_at format="HH:mm" td.actions diff --git a/app/assets/javascripts/supplier/app/templates/application.emblem b/app/assets/javascripts/supplier/app/templates/application.emblem index 1b7dd0b3..e8cb0449 100644 --- a/app/assets/javascripts/supplier/app/templates/application.emblem +++ b/app/assets/javascripts/supplier/app/templates/application.emblem @@ -1,2 +1,3 @@ -= outlet += partial "global/top_menu" +.main-section= outlet = outlet modal diff --git a/app/assets/javascripts/supplier/app/templates/global/_top_menu.emblem b/app/assets/javascripts/supplier/app/templates/global/_top_menu.emblem new file mode 100644 index 00000000..54d4b3d4 --- /dev/null +++ b/app/assets/javascripts/supplier/app/templates/global/_top_menu.emblem @@ -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' diff --git a/app/assets/javascripts/supplier/app/templates/index.emblem b/app/assets/javascripts/supplier/app/templates/index.emblem index d8316676..64011c77 100644 --- a/app/assets/javascripts/supplier/app/templates/index.emblem +++ b/app/assets/javascripts/supplier/app/templates/index.emblem @@ -1,53 +1,56 @@ -= sections-header sectionBinding="controller.controllers.application.active_section" -.page-header - div.dashboard-section-selection - /App.HomeSectionSelectorView selectionBinding="controller.controllers.application.active_section" content=controller.sections prompt=controllers.application.supplier.name - /= home-section-selector sectionBinding="controller.controllers.application.active_section" - /= view "home-section-jumper" - if active_lists.length - h3.dashboard-lists-header{action "toggleDashboardLists"} - if show_lists - span.icon - else - span.icon.collapsed - =t 'active_lists.title' - span= list_number_info - else - h3=t 'dashboard.active_lists.no_lists' -if show_lists_table - table.active-lists-table.table - thead - tr - th.user-info.show-for-large-up - th.status-icons - th.numeric=t 'table_number' - th=t 'models.section' - th.currency=t 'active_lists.price' - th.actions - tbody - each list in active_lists: App.ActiveListView contentBinding="list" -.page-header - if active_orders.length - h3.dashboard-orders-header{action "toggleDashboardOrders"} - if show_orders - span.icon - else - span.icon.collapsed - =t 'active_orders.title' - span= order_number_info - else - h3= t 'dashboard.active_orders.no_orders' -if show_orders_table - table.active-orders-table.table - thead - tr - th.user-info.show-for-large-up - th.status-icons - th=t 'models.order' - th.numeric=t 'table_number' - th=t 'models.section' - th.currency=t 'active_orders.price' - th.time - th.actions - tbody - each order in active_orders: App.ActiveOrderView contentBinding="order" +.row: .small-12.columns + = sections-header sectionBinding="controller.controllers.application.active_section" + .page-header + div.dashboard-section-selection + /App.HomeSectionSelectorView selectionBinding="controller.controllers.application.active_section" content=controller.sections prompt=controllers.application.supplier.name + /= home-section-selector sectionBinding="controller.controllers.application.active_section" + /= view "home-section-jumper" + if active_lists.length + h3.dashboard-lists-header{action "toggleDashboardLists"} + if show_lists + span.icon + else + span.icon.collapsed + =t 'active_lists.title' + span= list_number_info + else + h3=t 'dashboard.active_lists.no_lists' + if show_lists_table + table.active-lists-table.table + thead + tr + th.user-info.show-for-large-up + th.status-icons + th.numeric=t 'table_number' + th=t 'models.section' + th.currency=t 'active_lists.price' + th.actions + tbody + each list in active_lists + = view "active-list" contentBinding="list" + .page-header + if active_orders.length + h3.dashboard-orders-header{action "toggleDashboardOrders"} + if show_orders + span.icon + else + span.icon.collapsed + =t 'active_orders.title' + span= order_number_info + else + h3= t 'dashboard.active_orders.no_orders' + if show_orders_table + table.active-orders-table.table + thead + tr + th.user-info.show-for-large-up + th.status-icons + th=t 'models.order' + th.numeric=t 'table_number' + th=t 'models.section' + th.currency=t 'active_orders.price' + th.time + th.actions + tbody + each order in active_orders + = view "active-order" contentBinding="order" diff --git a/app/assets/javascripts/supplier/app/templates/list.emblem b/app/assets/javascripts/supplier/app/templates/list.emblem index d833a0f1..9606f00e 100644 --- a/app/assets/javascripts/supplier/app/templates/list.emblem +++ b/app/assets/javascripts/supplier/app/templates/list.emblem @@ -1,4 +1,5 @@ -h2=t 'models.list' -partial "list_content" -link-to 'lists' class="button" - span=t 'list.go_to_lists' +.row: .small-12.columns + h2=t 'models.list' + partial "list_content" + link-to 'lists' class="button" + span=t 'list.go_to_lists' diff --git a/app/assets/javascripts/supplier/app/templates/lists/index.emblem b/app/assets/javascripts/supplier/app/templates/lists/index.emblem index 53943013..d0536dce 100644 --- a/app/assets/javascripts/supplier/app/templates/lists/index.emblem +++ b/app/assets/javascripts/supplier/app/templates/lists/index.emblem @@ -1,32 +1,33 @@ -h1=t 'models.plural.list' -App.ListDisplayDateSelector valueBinding="date" -if sorted_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 sorted_lists +.row: .small-12.columns + h1=t 'models.plural.list' + = view "list-display-date-selector" valueBinding="date" + if sorted_lists + table.table + thead 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= list.table.number - td.currency=currency list.price - td.timestamp=time list.created_at -else - .row - .panel - if loading - span.loading - else - =t 'list.none_found' + 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 + 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= 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' diff --git a/app/assets/javascripts/supplier/app/templates/menu.emblem b/app/assets/javascripts/supplier/app/templates/menu.emblem index 5b3dc202..dee485be 100644 --- a/app/assets/javascripts/supplier/app/templates/menu.emblem +++ b/app/assets/javascripts/supplier/app/templates/menu.emblem @@ -1,6 +1,7 @@ -.products-menu-filters-container - = input value=product_code_filter type="search" placeholder=product_code_filter_placeholder -h2 Menu +.row: .small-12.columns + .products-menu-filters-container + = input value=product_code_filter type="search" placeholder=product_code_filter_placeholder + h2 Menu each product_category in sorted_product_categories .row.product_category-container: .small-12.columns .product_category-header diff --git a/app/assets/javascripts/supplier/app/templates/modals/edit_table.emblem b/app/assets/javascripts/supplier/app/templates/modals/edit_table.emblem deleted file mode 100644 index c6153921..00000000 --- a/app/assets/javascripts/supplier/app/templates/modals/edit_table.emblem +++ /dev/null @@ -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' diff --git a/app/assets/javascripts/supplier/app/templates/modals/table_edit.emblem b/app/assets/javascripts/supplier/app/templates/modals/table_edit.emblem new file mode 100644 index 00000000..0e99902a --- /dev/null +++ b/app/assets/javascripts/supplier/app/templates/modals/table_edit.emblem @@ -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' diff --git a/app/assets/javascripts/supplier/app/templates/section.emblem b/app/assets/javascripts/supplier/app/templates/section.emblem index de0b0d8a..f37c509b 100644 --- a/app/assets/javascripts/supplier/app/templates/section.emblem +++ b/app/assets/javascripts/supplier/app/templates/section.emblem @@ -1,7 +1,7 @@ .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 - App.SectionTabHeaderView context=section + = view "section-tab-header" context=section a.add-section{action "addSection"}: span .section-manage-tables.pull-right 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' li 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" span.fa.fa-lg.fa-times App.NumberField valueBinding="height" class="dimension section-edit-height-field" a.section-normal-mode-button{ action "finishEditable" }: span else a.section-edit-mode-button{ action "makeEditable" }: span -App.SectionTablesView contentBinding="tables" += view "section-tables" contentBinding="tables" + diff --git a/app/assets/javascripts/supplier/app/templates/section_table.emblem b/app/assets/javascripts/supplier/app/templates/section_table.emblem index 6a7a44c7..fed8e1e1 100644 --- a/app/assets/javascripts/supplier/app/templates/section_table.emblem +++ b/app/assets/javascripts/supplier/app/templates/section_table.emblem @@ -7,8 +7,8 @@ if table.active_list div.table-actions .title= table.number .table-action-row - App.MarkListHelpedButtonView contentBinding="table.active_list" - App.CloseListButtonView contentBinding="table.active_list" + = view "mark-list-helped-button" contentBinding="table.active_list" + = view "close-list-button" contentBinding="table.active_list" .table-action-row=currency table.active_list.total /.table-action-row a{action "editTable" table}: span.fa.fa-lg.fa-wrench diff --git a/app/assets/javascripts/supplier/app/templates/section_tables.emblem b/app/assets/javascripts/supplier/app/templates/section_tables.emblem index 001eb342..3e9f50cf 100644 --- a/app/assets/javascripts/supplier/app/templates/section_tables.emblem +++ b/app/assets/javascripts/supplier/app/templates/section_tables.emblem @@ -1,2 +1,2 @@ each table in tables - App.SectionTableView content=table + = view "section-table" content=table diff --git a/app/assets/javascripts/supplier/app/templates/sections/index.emblem b/app/assets/javascripts/supplier/app/templates/sections/index.emblem index 7f07c42b..3e5eec0a 100644 --- a/app/assets/javascripts/supplier/app/templates/sections/index.emblem +++ b/app/assets/javascripts/supplier/app/templates/sections/index.emblem @@ -1,40 +1,41 @@ -h1=t 'models.plural.section' -if sections - table.table - thead - tr - 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 +.row: .small-12.columns + h1=t 'models.plural.section' + if sections + table.table + thead tr - td - a{ action "goToSection" section}= section.title - td - span.table-count= section.tables.length - td.numeric= section.width - td.numeric= section.height - /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 - .panel=t 'section.none_found' -.form-actions - a.form-action-new{action "addSection"}=t 'helpers.links.new' + 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 + td + a{ action "goToSection" section}= section.title + td + span.table-count= section.tables.length + td.numeric= section.width + td.numeric= section.height + /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' diff --git a/app/assets/javascripts/supplier/app/templates/table.emblem b/app/assets/javascripts/supplier/app/templates/table.emblem index e72ec5a1..0500017b 100644 --- a/app/assets/javascripts/supplier/app/templates/table.emblem +++ b/app/assets/javascripts/supplier/app/templates/table.emblem @@ -1,11 +1,12 @@ -h2=t 'models.table' -.display-row - .display-label= t 'attributes.table.number' - .display-field - span= table.number -if table.section +.row: .small-12.columns + h2=t 'models.table' .display-row - .display-label=t 'models.section' + .display-label= t 'attributes.table.number' .display-field - link-to 'section' table.section - span= table.section.title + span= table.number + if table.section + .display-row + .display-label=t 'models.section' + .display-field + link-to 'section' table.section + span= table.section.title diff --git a/app/assets/javascripts/supplier/app/templates/tables/index.emblem b/app/assets/javascripts/supplier/app/templates/tables/index.emblem index eb5bf645..e7a151cc 100644 --- a/app/assets/javascripts/supplier/app/templates/tables/index.emblem +++ b/app/assets/javascripts/supplier/app/templates/tables/index.emblem @@ -1,21 +1,22 @@ -h1=t 'models.plural.table' -if tables - table.table - thead - tr - 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 +.row: .small-12.columns + h1=t 'models.plural.table' + if tables + table.table + thead tr - td: link-to 'table' table: span= table.number - 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 + 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 + td: link-to 'table' table: span= table.number + 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 diff --git a/app/assets/javascripts/supplier/app/views/application_view.js.coffee b/app/assets/javascripts/supplier/app/views/application_view.js.coffee index ef98af04..c576d243 100644 --- a/app/assets/javascripts/supplier/app/views/application_view.js.coffee +++ b/app/assets/javascripts/supplier/app/views/application_view.js.coffee @@ -1,17 +1,28 @@ App.ApplicationView = Ember.View.extend + classNames: ['application-view'] didInsertElement: -> Qsupplier.watch_events() - selector_mappings = - '.top-menu-root': '/' - '.top-menu-lists': 'lists' - '.top-menu-sections': 'sections' - '.top-menu-tables': 'tables' - '.top-menu-lists': 'lists' - '.top-menu-menu': 'menu' - '.supplier-settings-link': 'settings' + $('.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') - for selector, route of selector_mappings - do (selector, route)=> - $(selector).click (e)=> - e.preventDefault() - @get('controller').transitionToRoute route + #selector_mappings = + #'.top-menu-root': '/' + #'.top-menu-lists': 'lists' + #'.top-menu-sections': 'sections' + #'.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 diff --git a/app/assets/javascripts/supplier/app/views/close_list_button_view.js.coffee b/app/assets/javascripts/supplier/app/views/close_list_button_view.js.coffee index b802e83e..816868bc 100644 --- a/app/assets/javascripts/supplier/app/views/close_list_button_view.js.coffee +++ b/app/assets/javascripts/supplier/app/views/close_list_button_view.js.coffee @@ -4,4 +4,4 @@ App.CloseListButtonView = Ember.View.extend classNameBindings: ['content.active:show:hide'] tagName: 'button' click: (e)-> - @get('controller').send 'modal', 'close_list', model: @get('content') + @get('controller').modal 'close_list', model: @get('content') diff --git a/app/assets/javascripts/supplier/app/views/list_display_date_selector.js.coffee b/app/assets/javascripts/supplier/app/views/list_display_date_selector.js.coffee index a3515d98..2a3b4637 100644 --- a/app/assets/javascripts/supplier/app/views/list_display_date_selector.js.coffee +++ b/app/assets/javascripts/supplier/app/views/list_display_date_selector.js.coffee @@ -1,4 +1,4 @@ -App.ListDisplayDateSelector = Ember.TextField.extend +App.ListDisplayDateSelectorView = Ember.TextField.extend classNames: 'datepicker' didInsertElement: -> setTranslations @$().hide() diff --git a/app/assets/javascripts/supplier/app/views/mark_list_helped_button_view.js.coffee b/app/assets/javascripts/supplier/app/views/mark_list_helped_button_view.js.coffee index f1db3805..4c57ab8a 100644 --- a/app/assets/javascripts/supplier/app/views/mark_list_helped_button_view.js.coffee +++ b/app/assets/javascripts/supplier/app/views/mark_list_helped_button_view.js.coffee @@ -4,4 +4,6 @@ App.MarkListHelpedButtonView = Ember.View.extend classNameBindings: ['content.needs_help:show:hide'] tagName: 'button' 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() diff --git a/app/assets/javascripts/supplier/foundation1/initializer.js.coffee b/app/assets/javascripts/supplier/foundation1/initializer.js.coffee index 0ca9790b..f0d56f11 100644 --- a/app/assets/javascripts/supplier/foundation1/initializer.js.coffee +++ b/app/assets/javascripts/supplier/foundation1/initializer.js.coffee @@ -41,16 +41,6 @@ $ -> 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 -> $(@).addClass(if $(@).data('boolean') then 'boolean-true' else 'boolean-false') diff --git a/app/assets/stylesheets/supplier/foundation1/_menu_side.css.sass b/app/assets/stylesheets/supplier/foundation1/_menu_side.css.sass index d56748f9..9f735f12 100644 --- a/app/assets/stylesheets/supplier/foundation1/_menu_side.css.sass +++ b/app/assets/stylesheets/supplier/foundation1/_menu_side.css.sass @@ -23,3 +23,7 @@ aside.side-menu +alert($bg: $alert-color, $radius: true) padding: 3px margin-right: 20px +.supplier-open-shop + +alert($bg: $primary-color, $radius: true) + padding: 3px + margin-right: 20px diff --git a/app/assets/stylesheets/supplier/foundation1/_qstructure.css.sass b/app/assets/stylesheets/supplier/foundation1/_qstructure.css.sass index f75c4507..27d5b742 100644 --- a/app/assets/stylesheets/supplier/foundation1/_qstructure.css.sass +++ b/app/assets/stylesheets/supplier/foundation1/_qstructure.css.sass @@ -42,11 +42,16 @@ form body background-image: $wood !important background-repeat: repeat -main.main-section - +panel($bg:rgba(200,200,200,0.8)) - min-height: 100% + height: 100% +.ember-application, .application-view + height: 100% padding: 0 margin: 0 +.main-section + +panel($bg:rgba(200,200,200,0.8)) + padding: 0 + margin: 0 + min-height: 100% .hide, .hidden display: none diff --git a/app/controllers/supplier_controller.rb b/app/controllers/supplier_controller.rb index de28ba1b..62bdc205 100644 --- a/app/controllers/supplier_controller.rb +++ b/app/controllers/supplier_controller.rb @@ -1,6 +1,6 @@ class SupplierController < ApplicationController before_filter :authenticate_supplier! - layout 'tablet' + layout 'supplier/app' def home end diff --git a/app/controllers/suppliers/application_controller.rb b/app/controllers/suppliers/application_controller.rb index 35156986..daa78f1c 100644 --- a/app/controllers/suppliers/application_controller.rb +++ b/app/controllers/suppliers/application_controller.rb @@ -1,7 +1,7 @@ module Suppliers class ApplicationController < ::ApplicationController before_filter :authenticate_supplier! - layout 'tablet' + layout 'supplier/app' rescue_from 'RestClient::Conflict' do |e| #binding.pry diff --git a/app/models/list.rb b/app/models/list.rb index eaae4699..f01c5683 100644 --- a/app/models/list.rb +++ b/app/models/list.rb @@ -143,6 +143,7 @@ class List orders.map(&:close!) # close the connected orders self.state = 'closed' self.is_helped! if needs_help? + self.needs_payment = false self.user_requests_closing = false # if a user requested closing, not needed anymore self.closed_at = Time.now if save diff --git a/app/views/layouts/supplier/app.html.slim b/app/views/layouts/supplier/app.html.slim new file mode 100644 index 00000000..2c9e60d5 --- /dev/null +++ b/app/views/layouts/supplier/app.html.slim @@ -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 diff --git a/app/views/supplier/home.html.slim b/app/views/supplier/home.html.slim index 6ae6c25c..e69de29b 100644 --- a/app/views/supplier/home.html.slim +++ b/app/views/supplier/home.html.slim @@ -1,7 +0,0 @@ -- content_for :head do - = javascript_include_tag 'supplier/app/application' -/- content_for :footer do - javascript: - $(function(){ - Qsupplier.watch_events(); - }); diff --git a/app/views/supplier/menu.html.slim b/app/views/supplier/menu.html.slim index f05514f6..e69de29b 100644 --- a/app/views/supplier/menu.html.slim +++ b/app/views/supplier/menu.html.slim @@ -1,2 +0,0 @@ -- content_for :head do - = javascript_include_tag 'supplier/app/application' diff --git a/app/views/suppliers/application/_top_menu.html.slim b/app/views/suppliers/application/_top_menu.html.slim index ce165435..f0f21de5 100644 --- a/app/views/suppliers/application/_top_menu.html.slim +++ b/app/views/suppliers/application/_top_menu.html.slim @@ -5,8 +5,8 @@ header.top-menu section.main-buttons = 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 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 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 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 List.model_name.human_plural, "/supplier#/lists", data: {t: 'models.plural.list'}, class: 'top-menu-lists'