From 90316d5b25070b20fa9dd601d20a837970d75e3b Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Mon, 17 Mar 2014 11:31:02 +0100 Subject: [PATCH] Multi theme support and supplier order facebook info option --- .../controllers/index_controller.js.coffee | 2 + .../app/templates/active_order.emblem | 3 +- .../active_order_table_number.emblem | 3 + .../supplier/app/templates/table.emblem | 5 + .../active_order_table_number_view.js.coffee | 10 ++ .../{ => basic1}/active_lists.css.sass | 15 +++ .../supplier/{ => basic1}/application.css | 0 .../{ => basic1}/product_categories.css.sass | 0 .../{ => basic1}/products_preview.css.sass | 0 .../supplier/basic1/section_tables.css.sass | 106 ++++++++++++++++++ .../supplier/basic1/structure.css.sass | 58 ++++++++++ .../supplier/wood1/active_lists.css.sass | 50 +++++++++ .../supplier/wood1/application.css | 10 ++ .../supplier/{ => wood1}/darkstrap.sass | 0 .../supplier/{ => wood1}/mixins.sass | 0 .../wood1/product_categories.css.sass | 21 ++++ .../supplier/wood1/products_preview.css.sass | 17 +++ .../{ => wood1}/section_tables.css.sass | 0 .../supplier/{ => wood1}/structure.css.sass | 0 .../bootstrap_overrides.css.sass | 11 -- app/controllers/suppliers/lists_controller.rb | 7 ++ app/models/supplier.rb | 1 + app/views/layouts/tablet.html.slim | 2 +- .../suppliers/lists/extra_info.html.slim | 4 + config/routes.rb | 4 + 25 files changed, 316 insertions(+), 13 deletions(-) create mode 100644 app/assets/javascripts/supplier/app/templates/active_order_table_number.emblem create mode 100644 app/assets/javascripts/supplier/app/views/active_order_table_number_view.js.coffee rename app/assets/stylesheets/supplier/{ => basic1}/active_lists.css.sass (61%) rename app/assets/stylesheets/supplier/{ => basic1}/application.css (100%) rename app/assets/stylesheets/supplier/{ => basic1}/product_categories.css.sass (100%) rename app/assets/stylesheets/supplier/{ => basic1}/products_preview.css.sass (100%) create mode 100644 app/assets/stylesheets/supplier/basic1/section_tables.css.sass create mode 100644 app/assets/stylesheets/supplier/basic1/structure.css.sass create mode 100644 app/assets/stylesheets/supplier/wood1/active_lists.css.sass create mode 100644 app/assets/stylesheets/supplier/wood1/application.css rename app/assets/stylesheets/supplier/{ => wood1}/darkstrap.sass (100%) rename app/assets/stylesheets/supplier/{ => wood1}/mixins.sass (100%) create mode 100644 app/assets/stylesheets/supplier/wood1/product_categories.css.sass create mode 100644 app/assets/stylesheets/supplier/wood1/products_preview.css.sass rename app/assets/stylesheets/supplier/{ => wood1}/section_tables.css.sass (100%) rename app/assets/stylesheets/supplier/{ => wood1}/structure.css.sass (100%) create mode 100644 app/views/suppliers/lists/extra_info.html.slim diff --git a/app/assets/javascripts/supplier/app/controllers/index_controller.js.coffee b/app/assets/javascripts/supplier/app/controllers/index_controller.js.coffee index fdc2e50a..a4466a9c 100644 --- a/app/assets/javascripts/supplier/app/controllers/index_controller.js.coffee +++ b/app/assets/javascripts/supplier/app/controllers/index_controller.js.coffee @@ -31,3 +31,5 @@ Qsupplier.App.IndexController = Ember.ObjectController.extend $.post('/supplier/mark_order_in_process', order_id: id) if order = Qsupplier.App.Order.findCached(id) order.set('state', 'active') + showListInfo: (view, link)-> + debugger diff --git a/app/assets/javascripts/supplier/app/templates/active_order.emblem b/app/assets/javascripts/supplier/app/templates/active_order.emblem index 015638ac..b0baa38b 100644 --- a/app/assets/javascripts/supplier/app/templates/active_order.emblem +++ b/app/assets/javascripts/supplier/app/templates/active_order.emblem @@ -1,5 +1,6 @@ td {{view.content.display}} -td.numeric.table_number {{view.content.list.table.number}} +td.numeric.table_number + view Qsupplier.App.ActiveOrderTableNumberView contextBinding=view.content td.section_title {{view.content.section.title}} td.currency {{currency view.content.price }} td.actions diff --git a/app/assets/javascripts/supplier/app/templates/active_order_table_number.emblem b/app/assets/javascripts/supplier/app/templates/active_order_table_number.emblem new file mode 100644 index 00000000..22eb4302 --- /dev/null +++ b/app/assets/javascripts/supplier/app/templates/active_order_table_number.emblem @@ -0,0 +1,3 @@ +.number= list.table_number +.extra-list-info + img.spinner src="/assets/spinner.gif" alt="" diff --git a/app/assets/javascripts/supplier/app/templates/table.emblem b/app/assets/javascripts/supplier/app/templates/table.emblem index 638b99a2..76a18c91 100644 --- a/app/assets/javascripts/supplier/app/templates/table.emblem +++ b/app/assets/javascripts/supplier/app/templates/table.emblem @@ -13,3 +13,8 @@ div class="table-actions table-actions-#{unbound table.id}" button{ action closeList table.active_list } class="btn btn-warning btn-small close-list" {{t 'list.close_list'}} /.table-action-row a href="suppliers_table_path(@table)" {{t 'section.tables_view.table_actions.got_to_table'}} +if editmode + .table-settings + select + option Round + option rectangular diff --git a/app/assets/javascripts/supplier/app/views/active_order_table_number_view.js.coffee b/app/assets/javascripts/supplier/app/views/active_order_table_number_view.js.coffee new file mode 100644 index 00000000..13798e76 --- /dev/null +++ b/app/assets/javascripts/supplier/app/views/active_order_table_number_view.js.coffee @@ -0,0 +1,10 @@ +Qsupplier.App.ActiveOrderTableNumberView = Ember.View.extend + tagName: 'span' + templateName: 'active_order_table_number' + classNames: 'active_order_table_number' + click: -> + $el = $(@get('element')).find('.extra-list-info') + return $el.hide() if $el.is(':visible') + $el.show() + $.get Routes.extra_info_suppliers_list_path(@get('context.list.id')), (res)-> + $el.html(res) diff --git a/app/assets/stylesheets/supplier/active_lists.css.sass b/app/assets/stylesheets/supplier/basic1/active_lists.css.sass similarity index 61% rename from app/assets/stylesheets/supplier/active_lists.css.sass rename to app/assets/stylesheets/supplier/basic1/active_lists.css.sass index 132799a5..25ebba2a 100644 --- a/app/assets/stylesheets/supplier/active_lists.css.sass +++ b/app/assets/stylesheets/supplier/basic1/active_lists.css.sass @@ -25,6 +25,21 @@ padding-left: 35px background-position: 5px center background-repeat: no-repeat + .active_order_table_number + position: relative + .extra-list-info + display: none + $extra-info-width: 220px + position: absolute + width: $extra-info-width + // 7px is padding + border, 5px is extra spacing + right: -$extra-info-width - 7px*2 - 5px + top: -7px*2 + padding: 4px + border: 3px solid #aaa + border-radius: 3px + background-color: white + text-align: left &.active td &:first-child diff --git a/app/assets/stylesheets/supplier/application.css b/app/assets/stylesheets/supplier/basic1/application.css similarity index 100% rename from app/assets/stylesheets/supplier/application.css rename to app/assets/stylesheets/supplier/basic1/application.css diff --git a/app/assets/stylesheets/supplier/product_categories.css.sass b/app/assets/stylesheets/supplier/basic1/product_categories.css.sass similarity index 100% rename from app/assets/stylesheets/supplier/product_categories.css.sass rename to app/assets/stylesheets/supplier/basic1/product_categories.css.sass diff --git a/app/assets/stylesheets/supplier/products_preview.css.sass b/app/assets/stylesheets/supplier/basic1/products_preview.css.sass similarity index 100% rename from app/assets/stylesheets/supplier/products_preview.css.sass rename to app/assets/stylesheets/supplier/basic1/products_preview.css.sass diff --git a/app/assets/stylesheets/supplier/basic1/section_tables.css.sass b/app/assets/stylesheets/supplier/basic1/section_tables.css.sass new file mode 100644 index 00000000..91809260 --- /dev/null +++ b/app/assets/stylesheets/supplier/basic1/section_tables.css.sass @@ -0,0 +1,106 @@ +.section-title + font-size: 24px + padding: 4px 0px +.section-tables-container + .section-manage-tables + margin: -26px 6px 4px 6px + .section-table + background-color: #ccc + //TODO remove width and height for ember control + height: 48px + width: 83px + background-repeat: no-repeat + color: black + a + color: black + //background-image: image-url('icons/section-table.png') + .table-link + margin-top: -45px + .table-number + color: black + position: absolute + top: 0 + line-height: 44px + width: 45px + font-size: 42px + text-align: center + .status-icons + float: right + width: 16px + span + display: none + float: right + .action-button-container + margin-right: -20px + .table-actions + display: none + position: absolute + left: 100% + top: 0 + width: 140px + text-align: center + background-color: white + border: 1px solid #aaa + padding-bottom: 10px + .title + background-color: #aaa + .table-action-row + margin-top: 10px + .table-settings + width: 200px + height: 30px + position: absolute + top: -30px + select + width: 92px + &.section-tables-active + position: relative + padding: 0 + height: 400px + //background-image: image-url('textures/wood4.jpg') + background-color: rgba(0,0,0,0.4) + .section-table + position: absolute + cursor: pointer + &.occupied + background-color: #ffa + &.needs_help + background-color: #7f7 + .needs_help + display: block + &.needs_payment + background-image: image-url('icons/needs-payment.png') + background-position: 40px 2px + .needs_payment + display: block + &.active_order + .active_order + display: block + //background-color: #f77 + a + &:hover + text-decoration: none + &.section-tables-manage + .section-table + cursor: move + &.section-tables-inactive + .section-table + position: relative + margin-top: 10px + margin-bottom: 30px + float: left + margin-right: 30px +// INDEX + +table + td + &.table-info + .table-count + &:after + content: " - " +.go-to-tables-view.hide + display: inline-block + +ul#table-actions-list + list-style: none + margin: 0 diff --git a/app/assets/stylesheets/supplier/basic1/structure.css.sass b/app/assets/stylesheets/supplier/basic1/structure.css.sass new file mode 100644 index 00000000..67a5dc37 --- /dev/null +++ b/app/assets/stylesheets/supplier/basic1/structure.css.sass @@ -0,0 +1,58 @@ +$side-spacing: 0px +@import constants +html +body + padding-left: $side-spacing + padding-right: $side-spacing + background-color: transparent + //padding-top: 50px + .navbar-fixed-top + margin-left: -$side-spacing + margin-right: -$side-spacing + margin-bottom: 3px + .page-header + margin-top: 4px + margin-bottom: 6px + padding-bottom: 0 + .main-content + padding-top: 16px + label + &.number + display: inline + padding: 4px 10px + input + &.number + width: 40px +.supplier-is-closed + .alert + form + margin: 0 +.location_picker_search + float: left +.draggable + cursor: move !important +input.dimension + width: 40px +.location_picker_map + width: 600px + height: 500px + border: 1px solid black + padding: 2px + display: inline-block + float: left + clear: left + img + max-width: none + label + width: auto + display:inline +.handle + cursor: move + font-size: 0.8em + color: #777 +form + &.form-inline + display: inline-block + padding: 4px +.clear + clear: both diff --git a/app/assets/stylesheets/supplier/wood1/active_lists.css.sass b/app/assets/stylesheets/supplier/wood1/active_lists.css.sass new file mode 100644 index 00000000..25ebba2a --- /dev/null +++ b/app/assets/stylesheets/supplier/wood1/active_lists.css.sass @@ -0,0 +1,50 @@ +.list-status + .list-needs-help-indicator + display: inline-block + width: 30px + color: #400 + background-color: #aaf + text-align: center + margin-right: 7px + &.hide + display: none + .list-needs-payment-indicator + display: inline-block + width: 30px + color: #440 + background-color: #faa + text-align: center + margin-right: 7px + &.hide + display: none +.active-orders-table + tbody + tr + td + &:first-child + padding-left: 35px + background-position: 5px center + background-repeat: no-repeat + .active_order_table_number + position: relative + .extra-list-info + display: none + $extra-info-width: 220px + position: absolute + width: $extra-info-width + // 7px is padding + border, 5px is extra spacing + right: -$extra-info-width - 7px*2 - 5px + top: -7px*2 + padding: 4px + border: 3px solid #aaa + border-radius: 3px + background-color: white + text-align: left + &.active + td + &:first-child + background-image: image-url('icons/order-check.png') + &.delivered + td + &:first-child + background-image: image-url('icons/order-doublecheck.png') diff --git a/app/assets/stylesheets/supplier/wood1/application.css b/app/assets/stylesheets/supplier/wood1/application.css new file mode 100644 index 00000000..ba917973 --- /dev/null +++ b/app/assets/stylesheets/supplier/wood1/application.css @@ -0,0 +1,10 @@ +/* + *= require 'twitter-bootstrap/bootstrap_and_overrides' + *= require 'twitter-bootstrap/bootstrap_overrides' + *= require 'jquery-ui-1.8.23.custom.css' + *= require qtip + *= require 'general' + *= require user/active_list + *= require_directory . + *= require_self + */ diff --git a/app/assets/stylesheets/supplier/darkstrap.sass b/app/assets/stylesheets/supplier/wood1/darkstrap.sass similarity index 100% rename from app/assets/stylesheets/supplier/darkstrap.sass rename to app/assets/stylesheets/supplier/wood1/darkstrap.sass diff --git a/app/assets/stylesheets/supplier/mixins.sass b/app/assets/stylesheets/supplier/wood1/mixins.sass similarity index 100% rename from app/assets/stylesheets/supplier/mixins.sass rename to app/assets/stylesheets/supplier/wood1/mixins.sass diff --git a/app/assets/stylesheets/supplier/wood1/product_categories.css.sass b/app/assets/stylesheets/supplier/wood1/product_categories.css.sass new file mode 100644 index 00000000..2f0efc1f --- /dev/null +++ b/app/assets/stylesheets/supplier/wood1/product_categories.css.sass @@ -0,0 +1,21 @@ +#product-category-list + list-style: none + li + clear: both + margin-bottom: 8px + .name + padding: 5px 5px +#week_days-group + .btn + opacity: 0.4 + &.active + opacity: 1 +#full_day-controller + margin: 0 10px +#sub-day-container + display: inline-block + &.hide + display: none + select + width: 70px + margin-right: 14px diff --git a/app/assets/stylesheets/supplier/wood1/products_preview.css.sass b/app/assets/stylesheets/supplier/wood1/products_preview.css.sass new file mode 100644 index 00000000..eb1854cf --- /dev/null +++ b/app/assets/stylesheets/supplier/wood1/products_preview.css.sass @@ -0,0 +1,17 @@ +.products_preview-date + .products_preview-time-container + float: left + input + width: 120px +.products_preview-hour + float: left + margin-left: 10px + select + width: 50px + &:after + content: " :" +.products_preview-minute + float: left + margin-left: 10px + select + width: 50px diff --git a/app/assets/stylesheets/supplier/section_tables.css.sass b/app/assets/stylesheets/supplier/wood1/section_tables.css.sass similarity index 100% rename from app/assets/stylesheets/supplier/section_tables.css.sass rename to app/assets/stylesheets/supplier/wood1/section_tables.css.sass diff --git a/app/assets/stylesheets/supplier/structure.css.sass b/app/assets/stylesheets/supplier/wood1/structure.css.sass similarity index 100% rename from app/assets/stylesheets/supplier/structure.css.sass rename to app/assets/stylesheets/supplier/wood1/structure.css.sass diff --git a/app/assets/stylesheets/twitter-bootstrap/bootstrap_overrides.css.sass b/app/assets/stylesheets/twitter-bootstrap/bootstrap_overrides.css.sass index 7e91e519..be0e48f4 100644 --- a/app/assets/stylesheets/twitter-bootstrap/bootstrap_overrides.css.sass +++ b/app/assets/stylesheets/twitter-bootstrap/bootstrap_overrides.css.sass @@ -1,17 +1,6 @@ //BOOTSTRAP overrides body - .main-content - h1, h2, h3, h4 - color: #eee - a - color: white - .table-hover - tbody - tr - &:hover - td - background-color: #555 .navbar-inner $navbar-inner-teint: 200 background-color: rgba($navbar-inner-teint, $navbar-inner-teint, $navbar-inner-teint, 0.8) diff --git a/app/controllers/suppliers/lists_controller.rb b/app/controllers/suppliers/lists_controller.rb index 8e47dc2c..36d120ff 100644 --- a/app/controllers/suppliers/lists_controller.rb +++ b/app/controllers/suppliers/lists_controller.rb @@ -57,6 +57,13 @@ module Suppliers end end + # GET /lists/1/extra_info + # GET /lists/1/extra_info.json + def extra_info + @list = List.find_by_supplier_id_and_id!(current_supplier.id, params[:id]) + render layout: false + end + # GET /lists/new # GET /lists/new.json def new diff --git a/app/models/supplier.rb b/app/models/supplier.rb index cceb1ac3..88db232c 100644 --- a/app/models/supplier.rb +++ b/app/models/supplier.rb @@ -84,6 +84,7 @@ class Supplier self.open = true save end + def mark_as_closed! self.open = false save diff --git a/app/views/layouts/tablet.html.slim b/app/views/layouts/tablet.html.slim index b8dd78d9..e4d888c0 100644 --- a/app/views/layouts/tablet.html.slim +++ b/app/views/layouts/tablet.html.slim @@ -10,7 +10,7 @@ html lang="en" /! 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/application", :media => "all" + = stylesheet_link_tag "supplier/basic1/application", media: "all" link href="/favicon.ico" rel="shortcut icon" = render 'suppliers/application/head' = javascript_include_tag "supplier/application" diff --git a/app/views/suppliers/lists/extra_info.html.slim b/app/views/suppliers/lists/extra_info.html.slim new file mode 100644 index 00000000..9ed15895 --- /dev/null +++ b/app/views/suppliers/lists/extra_info.html.slim @@ -0,0 +1,4 @@ +- @list.users.each do |user| + .extra-list-info-user + img src="http://graph.facebook.com/#{user.uid}/picture?type=square" + span= user.auth_data['info']['nickname'] rescue '(unknown)' diff --git a/config/routes.rb b/config/routes.rb index 6133dec8..76dadea5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -103,6 +103,10 @@ Qwaiter::Application.routes.draw do get :active get :at_date end + + member do + get :extra_info + end end resources :product_categories do collection do