From f11bf578543aca5af6ecf0b7068217079d78d195 Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Tue, 13 Jan 2015 11:31:31 +0100 Subject: [PATCH 01/10] Insignificant updates --- .../user/app/views/application_view.js.coffee | 10 ++++++---- config/version | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/user/app/views/application_view.js.coffee b/app/assets/javascripts/user/app/views/application_view.js.coffee index 122820b2..497ee6df 100644 --- a/app/assets/javascripts/user/app/views/application_view.js.coffee +++ b/app/assets/javascripts/user/app/views/application_view.js.coffee @@ -4,16 +4,18 @@ App.ApplicationView = Ember.View.extend side_menu = @$('.side-menu') side_menu.addClass('closed').click -> side_menu.toggleClass('active').addClass('clicked').toggleClass('closed') controller = @get('controller') - #@$('.main-section').swipe + main_section = @$('.main-section') + #main_section.swipe #swipe: (event, direction, distance, duration, fingerCount) -> #if fingerCount is 2 #if direction is "right" #side_menu.addClass('active clicked').removeClass('closed') - #if direction is "left" + #else if direction is "left" #side_menu.removeClass('active').addClass('closed') - #if fingerCount is 3 and direction is "up" - #controller.transitionToRoute "settings" + ##else if fingerCount is 2 and direction is "down" + ##controller.transitionToRoute "settings" #fingers: 'all' + document.addEventListener "backbutton", => # close side menu if open if side_menu.hasClass('active') diff --git a/config/version b/config/version index f81283f3..380550b4 100644 --- a/config/version +++ b/config/version @@ -1 +1 @@ -0.9.40 +0.9.47 From b614eeeaef451335f006dece0945045e965c7cea Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Tue, 13 Jan 2015 11:59:12 +0100 Subject: [PATCH 02/10] Render user app in test env --- app/controllers/users/application_controller.rb | 3 ++- config/version | 2 +- spec/support/route_helpers.rb | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/users/application_controller.rb b/app/controllers/users/application_controller.rb index 7ddd4d31..dfd64bf5 100644 --- a/app/controllers/users/application_controller.rb +++ b/app/controllers/users/application_controller.rb @@ -1,7 +1,7 @@ module Users class ApplicationController < ::ApplicationController before_action :allow_all_origins - before_action :user_authentication, :unless => ->(c){ %w(obtain_token).include?(c.action_name) } # , except: [:obtain_token, :index] + before_action :user_authentication, unless: ->(c){ %w(obtain_token).include?(c.action_name) } # , except: [:obtain_token, :index] private @@ -11,6 +11,7 @@ module Users sign_in user if user sign_out current_user if current_user && !user # Other token attempt of logged in user else + return if Rails.env.test? and action_name == 'index' authenticate_user! end diff --git a/config/version b/config/version index 380550b4..2d72c8d3 100644 --- a/config/version +++ b/config/version @@ -1 +1 @@ -0.9.47 +0.9.48 diff --git a/spec/support/route_helpers.rb b/spec/support/route_helpers.rb index f9e14b55..99559b65 100644 --- a/spec/support/route_helpers.rb +++ b/spec/support/route_helpers.rb @@ -29,7 +29,7 @@ module SpecRouteHelpers # currentRouteName does not include model information: /list/123 => currentRouteName == 'list' # page.evaluate_script %|App.__container__.lookup('controller:application').get('currentRouteName')| # page.evaluate_script %|App.__container__.lookup('router:main').location.lastSetURL| # not working for direct path supplier#/settings - route = page.evaluate_script %{App.__container__ && (window.location.hash || "#/").substr(1)} + route = page.evaluate_script(%{App.__container__ && (window.location.hash || "#/").substr(1)}) unless omit_should_raise def route.should(*) raise "Cannot call should on ember route. Use ember_route_should_be instead" From 6d6b95d9c02c598fa93acfe72407247bdd759952 Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Tue, 13 Jan 2015 12:34:42 +0100 Subject: [PATCH 03/10] refactor out old modal structure in favor of the new namespaced one --- app/assets/javascripts/user/app/app.js.coffee | 5 ++ .../application_controller.js.coffee | 4 ++ .../modal_confirm_controller.js.coffee | 8 ---- .../controllers/modal_controller.js.coffee | 4 -- .../modal_info_controller.js.coffee | 5 -- .../modal_product_info_controller.js.coffee | 5 -- .../modals/base_controller.js.coffee | 46 +++++++++++++++++++ .../controllers/table_controller.js.coffee | 2 +- .../controller_modifications.js.coffee | 3 ++ .../routes/application_route.js.coffee.erb | 32 +++++++++++-- .../user/app/templates/application.emblem | 2 +- .../user/app/templates/modal.emblem | 4 -- .../user/app/templates/modal_confirm.emblem | 6 --- .../user/app/templates/modal_info.emblem | 5 -- .../app/templates/modal_product_info.emblem | 7 --- .../user/app/templates/modals/confirm.emblem | 4 ++ .../user/app/templates/modals/layout.emblem | 8 ++++ .../app/templates/modals/product_info.emblem | 5 ++ .../user/app/views/modal_view.js.coffee | 23 ++++++---- spec/acceptance/users/supplier_info.feature | 9 ++++ 20 files changed, 126 insertions(+), 61 deletions(-) delete mode 100644 app/assets/javascripts/user/app/controllers/modal_confirm_controller.js.coffee delete mode 100644 app/assets/javascripts/user/app/controllers/modal_controller.js.coffee delete mode 100644 app/assets/javascripts/user/app/controllers/modal_info_controller.js.coffee delete mode 100644 app/assets/javascripts/user/app/controllers/modal_product_info_controller.js.coffee create mode 100644 app/assets/javascripts/user/app/controllers/modals/base_controller.js.coffee delete mode 100644 app/assets/javascripts/user/app/templates/modal.emblem delete mode 100644 app/assets/javascripts/user/app/templates/modal_confirm.emblem delete mode 100644 app/assets/javascripts/user/app/templates/modal_info.emblem delete mode 100644 app/assets/javascripts/user/app/templates/modal_product_info.emblem create mode 100644 app/assets/javascripts/user/app/templates/modals/confirm.emblem create mode 100644 app/assets/javascripts/user/app/templates/modals/layout.emblem create mode 100644 app/assets/javascripts/user/app/templates/modals/product_info.emblem create mode 100644 spec/acceptance/users/supplier_info.feature diff --git a/app/assets/javascripts/user/app/app.js.coffee b/app/assets/javascripts/user/app/app.js.coffee index 944133d4..5455ea47 100644 --- a/app/assets/javascripts/user/app/app.js.coffee +++ b/app/assets/javascripts/user/app/app.js.coffee @@ -1,7 +1,12 @@ @App = Ember.Application.create LOG_TRANSITIONS: true rootElement: '#ember-app-container' + App.deferReadiness() + +@App.modals = Ember.Namespace.create() +@Modals = @App.modals + Ember.$.ajaxPrefilter (options) -> if options.type.toUpperCase() == 'GET' if auth_token = Qstorage.getItem('auth_token') diff --git a/app/assets/javascripts/user/app/controllers/application_controller.js.coffee b/app/assets/javascripts/user/app/controllers/application_controller.js.coffee index b5172032..e7b9db3e 100644 --- a/app/assets/javascripts/user/app/controllers/application_controller.js.coffee +++ b/app/assets/javascripts/user/app/controllers/application_controller.js.coffee @@ -9,6 +9,10 @@ App.ApplicationController = Ember.Controller.extend $('#confirm-modal').hide() clearNotice: -> @set 'notice', null + showSupplierStatusInfo: -> + @modal 'supplier_status_info', + model: @get('list.supplier') + openDebugger: -> debugger diff --git a/app/assets/javascripts/user/app/controllers/modal_confirm_controller.js.coffee b/app/assets/javascripts/user/app/controllers/modal_confirm_controller.js.coffee deleted file mode 100644 index f04a7b1e..00000000 --- a/app/assets/javascripts/user/app/controllers/modal_confirm_controller.js.coffee +++ /dev/null @@ -1,8 +0,0 @@ -App.ModalConfirmController = Ember.ObjectController.extend - actions: - close: -> - @get('model.cancel').call(@) if @get('model.cancel') - @send 'closeModal' - confirm: -> - @get('model.ok').call(@) - @send 'closeModal' diff --git a/app/assets/javascripts/user/app/controllers/modal_controller.js.coffee b/app/assets/javascripts/user/app/controllers/modal_controller.js.coffee deleted file mode 100644 index 56661006..00000000 --- a/app/assets/javascripts/user/app/controllers/modal_controller.js.coffee +++ /dev/null @@ -1,4 +0,0 @@ -App.ModalController = Ember.ObjectController.extend - actions: - close: -> - @send 'closeModal' diff --git a/app/assets/javascripts/user/app/controllers/modal_info_controller.js.coffee b/app/assets/javascripts/user/app/controllers/modal_info_controller.js.coffee deleted file mode 100644 index 99cdc654..00000000 --- a/app/assets/javascripts/user/app/controllers/modal_info_controller.js.coffee +++ /dev/null @@ -1,5 +0,0 @@ -App.ModalInfoController = Ember.ObjectController.extend - actions: - close: -> - @get('model.cancel').call(@) if @get('model.cancel') - @send 'closeModal' diff --git a/app/assets/javascripts/user/app/controllers/modal_product_info_controller.js.coffee b/app/assets/javascripts/user/app/controllers/modal_product_info_controller.js.coffee deleted file mode 100644 index 5b4951bd..00000000 --- a/app/assets/javascripts/user/app/controllers/modal_product_info_controller.js.coffee +++ /dev/null @@ -1,5 +0,0 @@ -App.ModalProductInfoController = Ember.ObjectController.extend - actions: - close: -> - @get('model.cancel').call(@) if @get('model.cancel') - @send 'closeModal' diff --git a/app/assets/javascripts/user/app/controllers/modals/base_controller.js.coffee b/app/assets/javascripts/user/app/controllers/modals/base_controller.js.coffee new file mode 100644 index 00000000..dbc06fac --- /dev/null +++ b/app/assets/javascripts/user/app/controllers/modals/base_controller.js.coffee @@ -0,0 +1,46 @@ +@App.modals.BaseController = Ember.ObjectController.extend + alert_message: "" + 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 + translation_params = {} + if model = @get('model') + translation_params = model.serialize() if model.serialize + return new Ember.Handlebars.SafeString(tspan(@title_path, translation_params)) if @title_path + # return translated title_path if directly set by options + return new Ember.Handlebars.SafeString(tspan(@get('modal_options.title_path'), translation_params)) if @get('modal_options.title_path') + # infer title path based on controller name App.modals.AddSectionController => add_section + underscored = `this.constructor.toString().substr(11).replace(/Controller$/, '').underscore()` + # find translated title or humanize the controller name + if convention_translation = ttry("modal.#{underscored}.title", translation_params) + 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') + close.apply(@) + @send 'closeModal' unless @preventClose + closeOnOverlay: -> + @send('close') if @get('modal_options.closeOnOverlay') + false + modalClick: -> + @send('close') if @get('modal_options.closeOnModalClick') + false + ok: -> + if ok = @get('modal_options.ok') + ok.apply(@) + @send 'closeModal' unless @preventClose + confirm: -> @send('ok') + save: -> + @get('model').save() + @send 'closeModal' unless @preventClose + destroy: -> + @modal 'confirm', + title_path: @get('modal_options.destroy_text_path') || 'general.destroy.text' + model: @get('model') + ok: -> + @get('model').destroyRecord() + @send 'closeModal' unless @preventClose diff --git a/app/assets/javascripts/user/app/controllers/table_controller.js.coffee b/app/assets/javascripts/user/app/controllers/table_controller.js.coffee index 4ba5621b..f6fe6fa3 100644 --- a/app/assets/javascripts/user/app/controllers/table_controller.js.coffee +++ b/app/assets/javascripts/user/app/controllers/table_controller.js.coffee @@ -28,4 +28,4 @@ App.TableController = Ember.ObjectController.extend toggleProductCategory: (product_category)-> product_category.set 'collapsed', not product_category.get('collapsed') showProductDescription: (product)-> - @send 'openModal', 'modal_product_info', product + @modal 'product_info', model: product, title: product.get('name') diff --git a/app/assets/javascripts/user/app/modifications/controller_modifications.js.coffee b/app/assets/javascripts/user/app/modifications/controller_modifications.js.coffee index 55b62484..7cc47255 100644 --- a/app/assets/javascripts/user/app/modifications/controller_modifications.js.coffee +++ b/app/assets/javascripts/user/app/modifications/controller_modifications.js.coffee @@ -12,6 +12,9 @@ ControllerExtensions = Ember.Mixin.create unless Qstorage.getItem('auth_token') return @transitionToRoute 'sign_in' callback.call(@) if callback + modal: (name, options={})-> + options.model ||= Ember.Object.create() + @send "openModal", name, options Ember.ArrayController.reopen ControllerExtensions Ember.Controller.reopen ControllerExtensions Ember.ObjectController.reopen ControllerExtensions diff --git a/app/assets/javascripts/user/app/routes/application_route.js.coffee.erb b/app/assets/javascripts/user/app/routes/application_route.js.coffee.erb index 8d3bc647..ea847181 100644 --- a/app/assets/javascripts/user/app/routes/application_route.js.coffee.erb +++ b/app/assets/javascripts/user/app/routes/application_route.js.coffee.erb @@ -35,19 +35,41 @@ App.ApplicationRoute = Ember.Route.extend @handleAuthInfo(user_id, auth_token) auth_win.close() true - openModal: (modalName, model)-> - @controllerFor(modalName).set('model', model) - @render modalName, + #openModal: (modalName, model)-> + # @controllerFor(modalName).set('model', model) + # @render modalName, + # into: 'application' + # outlet: 'modal' + #closeModal: -> + # @disconnectOutlet + # outlet: 'modal' + # parentView: 'application' + openModal: (modalName, options={})-> + controller_name = options.controller || modalName + try + controller = @controllerFor("modals/#{modalName}") + catch error + controller = @controllerFor("modals/base") + controller.set 'model', options.model + defaultModalOptions = + closeOnOverlay: true + closeOnModalClick: false + controller.set 'modal_options', $.extend(defaultModalOptions, options) + @render "modals/#{modalName}", into: 'application' outlet: 'modal' + view: 'modal' + controller: controller + closeModal: -> @disconnectOutlet outlet: 'modal' parentView: 'application' + confirm: (options = {})-> - @send 'openModal', 'modal_confirm', Ember.Object.create + @send 'openModal', 'confirm', + model: Ember.Object.create(body: options.body) title: options.title - body: options.body cancel: options.cancel ok: options.ok sendFeedback: (feedback, callback)-> diff --git a/app/assets/javascripts/user/app/templates/application.emblem b/app/assets/javascripts/user/app/templates/application.emblem index 6e10086f..2260d326 100644 --- a/app/assets/javascripts/user/app/templates/application.emblem +++ b/app/assets/javascripts/user/app/templates/application.emblem @@ -15,7 +15,7 @@ = view "menu-item-scan-qr" = view "menu-item-product-orders" if list - .extra-info + .extra-info{action "showSupplierStatusInfo"} .supplier-info-row / .supplier-name= list.supplier.name .table-number diff --git a/app/assets/javascripts/user/app/templates/modal.emblem b/app/assets/javascripts/user/app/templates/modal.emblem deleted file mode 100644 index 7bd6e23d..00000000 --- a/app/assets/javascripts/user/app/templates/modal.emblem +++ /dev/null @@ -1,4 +0,0 @@ -modal-dialog action="close" - h3.flush--top Alert - p= body - button{action "close"} Done diff --git a/app/assets/javascripts/user/app/templates/modal_confirm.emblem b/app/assets/javascripts/user/app/templates/modal_confirm.emblem deleted file mode 100644 index 5702f2f7..00000000 --- a/app/assets/javascripts/user/app/templates/modal_confirm.emblem +++ /dev/null @@ -1,6 +0,0 @@ -modal-dialog action="close" - h3.flush--top= title - p=body - hr - button.confirm-cancel{action "close"}= t 'confirm.cancel' - button.confirm-ok.right{action "confirm"}= t 'confirm.confirm' diff --git a/app/assets/javascripts/user/app/templates/modal_info.emblem b/app/assets/javascripts/user/app/templates/modal_info.emblem deleted file mode 100644 index 5c44e769..00000000 --- a/app/assets/javascripts/user/app/templates/modal_info.emblem +++ /dev/null @@ -1,5 +0,0 @@ -modal-dialog action="close" - h3.flush--top= title - p==body - hr - button{action "close"}= t 'modal.info.close' diff --git a/app/assets/javascripts/user/app/templates/modal_product_info.emblem b/app/assets/javascripts/user/app/templates/modal_product_info.emblem deleted file mode 100644 index 70ebfcca..00000000 --- a/app/assets/javascripts/user/app/templates/modal_product_info.emblem +++ /dev/null @@ -1,7 +0,0 @@ -modal-dialog action="close" - h3.flush--top= name - if image - .right: img src=image.small alt="" - p==description - hr - button{action "close"}= t 'modal.info.close' diff --git a/app/assets/javascripts/user/app/templates/modals/confirm.emblem b/app/assets/javascripts/user/app/templates/modals/confirm.emblem new file mode 100644 index 00000000..15948948 --- /dev/null +++ b/app/assets/javascripts/user/app/templates/modals/confirm.emblem @@ -0,0 +1,4 @@ +p=body +hr +button.modal-close{action "close"}= t 'confirm.cancel' +button.modal-confirm.right{action "confirm"}= t 'confirm.confirm' diff --git a/app/assets/javascripts/user/app/templates/modals/layout.emblem b/app/assets/javascripts/user/app/templates/modals/layout.emblem new file mode 100644 index 00000000..a2d072bc --- /dev/null +++ b/app/assets/javascripts/user/app/templates/modals/layout.emblem @@ -0,0 +1,8 @@ +.overlay{action "closeOnOverlay"} + .modal{action "modalClick" bubbles=false preventDefault=false} + .modal-header + h3.flush--top= title + hr + .modal-body + .modal-alert== alert_message + = yield diff --git a/app/assets/javascripts/user/app/templates/modals/product_info.emblem b/app/assets/javascripts/user/app/templates/modals/product_info.emblem new file mode 100644 index 00000000..b4ad3c51 --- /dev/null +++ b/app/assets/javascripts/user/app/templates/modals/product_info.emblem @@ -0,0 +1,5 @@ +if image + .right: img src=image.small alt="" +p==description +hr +button{action "close"}= t 'modal.info.close' diff --git a/app/assets/javascripts/user/app/views/modal_view.js.coffee b/app/assets/javascripts/user/app/views/modal_view.js.coffee index 0b12acf8..ad3745f0 100644 --- a/app/assets/javascripts/user/app/views/modal_view.js.coffee +++ b/app/assets/javascripts/user/app/views/modal_view.js.coffee @@ -1,10 +1,13 @@ -#App.ModalView = Ember.View.extend - #templateName: "modal" - #title: "" - #classNames: ["reveal-modal"], - #didInsertElement: -> - ##this.$().foundation('reveal', 'open') - #actions: - #close: -> - #console.log('close action fired') - #this.destroy() +App.ModalView = Ember.View.extend + layoutName: 'modals/layout' + didInsertElement: -> + sortable = $('.sortable') + controller = @get('controller') + if sortable.length + sortable.sortable + update: (e, ui)-> + ids = sortable.find('.sortable-item-container').map((i, el) -> $(el).data('sortableId')).toArray() + if callback = controller.sortableUpdate + callback.call(controller, ids) + + diff --git a/spec/acceptance/users/supplier_info.feature b/spec/acceptance/users/supplier_info.feature new file mode 100644 index 00000000..d3cd94a7 --- /dev/null +++ b/spec/acceptance/users/supplier_info.feature @@ -0,0 +1,9 @@ +Feature: A signed in uses sees supplier info in the top right corner + + @javascript + Scenario: Clicking on the table number opens the supplier info popup + Given there is a confirmed and open supplier + And there is a facebook user + And the user has an active order + When the user clicks on the table number info in the top right corner + Then the user sees the supplier information popup From a774b2fd90e015897a36c802a687530e116c1024 Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Tue, 13 Jan 2015 12:48:01 +0100 Subject: [PATCH 04/10] fix failing changing table spec --- spec/acceptance_steps/users/changing_table_steps.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/acceptance_steps/users/changing_table_steps.rb b/spec/acceptance_steps/users/changing_table_steps.rb index 309cb33b..269b23b7 100644 --- a/spec/acceptance_steps/users/changing_table_steps.rb +++ b/spec/acceptance_steps/users/changing_table_steps.rb @@ -10,7 +10,7 @@ step "the user should see a popup asking the user if he would like to change tab end step "the user indicates in the popup that he wants to change the table" do - find('.confirm-ok').click + find('.modal-confirm').click end step "the user should see the supplier menu having the other table as base" do From 2f812ad52ef9af464af5e1588caa388dcbc06c34 Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Tue, 13 Jan 2015 13:38:52 +0100 Subject: [PATCH 05/10] Add supplier info popup --- .../shared-ember-helpers/translation.js.coffee | 4 ++-- .../controllers/application_controller.js.coffee | 1 + .../user/app/templates/modals/layout.emblem | 2 +- .../templates/modals/supplier_status_info.emblem | 13 +++++++++++++ .../user/flat/application.js.coffee.erb | 1 + .../foundation/components/_menu_main.css.sass | 11 ++++++----- config/locales/user.en.yml | 8 ++++++++ config/locales/user.nl.yml | 8 ++++++++ spec/acceptance/users/supplier_info.feature | 5 +++-- spec/acceptance_steps/global_list_steps.rb | 14 -------------- .../users/order_products_steps.rb | 16 ++++++++++++++++ .../users/supplier_info_steps.rb | 9 +++++++++ 12 files changed, 68 insertions(+), 24 deletions(-) create mode 100644 app/assets/javascripts/user/app/templates/modals/supplier_status_info.emblem create mode 100644 spec/acceptance_steps/users/supplier_info_steps.rb diff --git a/app/assets/javascripts/shared-ember-helpers/translation.js.coffee b/app/assets/javascripts/shared-ember-helpers/translation.js.coffee index 51955734..e2bbd057 100644 --- a/app/assets/javascripts/shared-ember-helpers/translation.js.coffee +++ b/app/assets/javascripts/shared-ember-helpers/translation.js.coffee @@ -1,4 +1,4 @@ Ember.Handlebars.helper 't', (path, params..., options)-> - text = t(path) - tag = if options.hash.bare then text else "#{text}" + text = t(path, options.hash) + tag = if options.hash.bare then text else "#{text}" tag.htmlSafe() diff --git a/app/assets/javascripts/user/app/controllers/application_controller.js.coffee b/app/assets/javascripts/user/app/controllers/application_controller.js.coffee index e7b9db3e..55db6b8b 100644 --- a/app/assets/javascripts/user/app/controllers/application_controller.js.coffee +++ b/app/assets/javascripts/user/app/controllers/application_controller.js.coffee @@ -12,6 +12,7 @@ App.ApplicationController = Ember.Controller.extend showSupplierStatusInfo: -> @modal 'supplier_status_info', model: @get('list.supplier') + title_path: 'supplier_status_info.title' openDebugger: -> debugger diff --git a/app/assets/javascripts/user/app/templates/modals/layout.emblem b/app/assets/javascripts/user/app/templates/modals/layout.emblem index a2d072bc..85e13538 100644 --- a/app/assets/javascripts/user/app/templates/modals/layout.emblem +++ b/app/assets/javascripts/user/app/templates/modals/layout.emblem @@ -3,6 +3,6 @@ .modal-header h3.flush--top= title hr - .modal-body + .modal-body.clearfix .modal-alert== alert_message = yield diff --git a/app/assets/javascripts/user/app/templates/modals/supplier_status_info.emblem b/app/assets/javascripts/user/app/templates/modals/supplier_status_info.emblem new file mode 100644 index 00000000..c038af13 --- /dev/null +++ b/app/assets/javascripts/user/app/templates/modals/supplier_status_info.emblem @@ -0,0 +1,13 @@ +p== t 'supplier_status_info.header' +.row: .small-12.columns + .counter.supplier-orders-placed-count + = model.orders_placed_count + span.orders-placed-count-icon + = t 'supplier_status_info.orders_placed_count_explanation' count=model.orders_placed_count +.row: .small-12.columns + .counter.supplier-orders-in-process-count + = model.orders_in_process_count + span.orders-in-process-count-icon + = t 'supplier_status_info.orders_in_process_count_explanation' count=model.orders_in_process_count +hr +button.modal-confirm.right{action "close"}= t 'supplier_status_info.close' diff --git a/app/assets/javascripts/user/flat/application.js.coffee.erb b/app/assets/javascripts/user/flat/application.js.coffee.erb index adecdeca..65d67168 100644 --- a/app/assets/javascripts/user/flat/application.js.coffee.erb +++ b/app/assets/javascripts/user/flat/application.js.coffee.erb @@ -6,6 +6,7 @@ #= require_self @Qstorage = localStorage + $.extend($translations.en, <%= I18n.t('user', locale: :en).to_json %>); $.extend($translations.nl, <%= I18n.t('user', locale: :nl).to_json %>); diff --git a/app/assets/stylesheets/user/foundation/components/_menu_main.css.sass b/app/assets/stylesheets/user/foundation/components/_menu_main.css.sass index 3dc36f7e..ab6803cd 100644 --- a/app/assets/stylesheets/user/foundation/components/_menu_main.css.sass +++ b/app/assets/stylesheets/user/foundation/components/_menu_main.css.sass @@ -55,11 +55,6 @@ //text-transform: lowercase .supplier-name display: inline-block - .supplier-orders-placed-count - display: inline-block - // margin-right: 15px - .supplier-orders-in-process-count - display: inline-block .menu-list-item margin-left: 20px cursor: pointer @@ -80,11 +75,17 @@ margin-left: 8px @media #{$small-only} margin-left: 5px +.supplier-orders-placed-count + display: inline-block + // margin-right: 15px .orders-placed-count-icon @extend .fa @extend .fa-clock-o @extend .fa-lg margin-left: 3px + +.supplier-orders-in-process-count + display: inline-block .orders-in-process-count-icon @extend .fa @extend .fa-check diff --git a/config/locales/user.en.yml b/config/locales/user.en.yml index 80c84bbe..91007797 100644 --- a/config/locales/user.en.yml +++ b/config/locales/user.en.yml @@ -132,3 +132,11 @@ en: with external parties.
footer:
+ supplier_status_info: + title: "%{name} info" + header: | + The icons at the top right corner contain information about the place where you + are currently ordering. The number prefixed with # is your table number. + orders_placed_count_explanation: "  means that there are %{count} orders placed and not yet processing or finished" + orders_in_process_count_explanation: "  means that there are %{count} orders currently processing" + close: Got it diff --git a/config/locales/user.nl.yml b/config/locales/user.nl.yml index ad30ff68..e90009d1 100644 --- a/config/locales/user.nl.yml +++ b/config/locales/user.nl.yml @@ -132,3 +132,11 @@ nl: horeca onderneming waar je wat bestelt.
footer:
+ supplier_status_info: + title: "%{name} info" + header: | + De icoontjes rechtsboven geven informatie over de plek waar je aan het bestellen bent. + Het getal met # is je tafelnummer. + orders_placed_count_explanation: "  betekent dat er %{count} nog niet in behandeling of afgesloten bestellingen zijn" + orders_in_process_count_explanation: "  betekent dat er %{count} bestellingen in behandeling zijn" + close: Got it diff --git a/spec/acceptance/users/supplier_info.feature b/spec/acceptance/users/supplier_info.feature index d3cd94a7..00244552 100644 --- a/spec/acceptance/users/supplier_info.feature +++ b/spec/acceptance/users/supplier_info.feature @@ -3,7 +3,8 @@ Feature: A signed in uses sees supplier info in the top right corner @javascript Scenario: Clicking on the table number opens the supplier info popup Given there is a confirmed and open supplier - And there is a facebook user + And I am signed in as a user And the user has an active order - When the user clicks on the table number info in the top right corner + When I am on the user homepage + And the user clicks on the table number info in the top right corner Then the user sees the supplier information popup diff --git a/spec/acceptance_steps/global_list_steps.rb b/spec/acceptance_steps/global_list_steps.rb index 455b71dd..1c6e5655 100644 --- a/spec/acceptance_steps/global_list_steps.rb +++ b/spec/acceptance_steps/global_list_steps.rb @@ -7,20 +7,6 @@ step "the list is marked as in need of payment" do @list.needs_payment! end -step "the user has an active list with a/an :order_status order" do |order_status| - @list = create :list, supplier: @supplier, table: @table, user_ids: [@user.id] - @product ||= create :product, supplier: @supplier, name: 'Beer', price: 2.34 - @order = create :order, order_status.to_sym, supplier: @supplier, list: @list, user: @user - @product_order = create :product_order, order: @order, product: @product, quantity: 2, price: 2.34 - @user.reload - @user.active_list_id = @list.id - @user.save - case order_status.to_sym - when :placed then @supplier.increment_orders_placed_count! - when :active then @supplier.increment_orders_in_process_count! - end -end - step "the list changes to another table" do @list.move_to_table! @other_table end diff --git a/spec/acceptance_steps/users/order_products_steps.rb b/spec/acceptance_steps/users/order_products_steps.rb index b5b93908..9f4e1657 100644 --- a/spec/acceptance_steps/users/order_products_steps.rb +++ b/spec/acceptance_steps/users/order_products_steps.rb @@ -113,3 +113,19 @@ step "the user has an older list for the same supplier" do @older_list = create :list, supplier: @supplier, table: @table, user_ids: [@user.id] end + +step "the user has an active list with a/an :order_status order" do |order_status| + @list = create :list, supplier: @supplier, table: @table, user_ids: [@user.id] + @product_category ||= create :product_category, supplier: @supplier + @product ||= create :product, supplier: @supplier, name: 'Beer', price: 2.34, product_category: @product_category + @order = create :order, order_status.to_sym, supplier: @supplier, list: @list, user: @user + @product_order = create :product_order, order: @order, product: @product, quantity: 2, price: 2.34 + @user.reload + @user.active_list_id = @list.id + @user.save + case order_status.to_sym + when :placed then @supplier.increment_orders_placed_count! + when :active then @supplier.increment_orders_in_process_count! + end +end + diff --git a/spec/acceptance_steps/users/supplier_info_steps.rb b/spec/acceptance_steps/users/supplier_info_steps.rb new file mode 100644 index 00000000..e687eccf --- /dev/null +++ b/spec/acceptance_steps/users/supplier_info_steps.rb @@ -0,0 +1,9 @@ +step "the user clicks on the table number info in the top right corner" do + find('.top-menu .table-number').click +end + +step "the user sees the supplier information popup" do + within '.modal' do + page.should have_content @supplier.name + end +end From 9674a8155ec4cdace2f8e1eff798c36f54ba3dd5 Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Tue, 13 Jan 2015 18:08:21 +0100 Subject: [PATCH 06/10] Main website responsiveness --- Gemfile | 2 +- Gemfile.lock | 26 +- .../javascripts/theme1/application.js.coffee | 2 + .../routes/application_route.js.coffee.erb | 1 + app/assets/stylesheets/application.css | 14 - .../stylesheets/theme1/_mixins.css.sass | 20 ++ .../stylesheets/theme1/_structure.css.sass | 110 +++++- .../stylesheets/theme1/application.css.sass | 13 +- .../theme1/elements/_footer.css.sass | 30 ++ .../theme1/elements/_header.css.sass | 76 ++++ .../stylesheets/theme1/elements/_nav.css.sass | 68 ++++ app/assets/stylesheets/theme1/home.css.sass | 10 - .../_cartoon.css.sass} | 0 .../stylesheets/theme1/pages/_home.css.sass | 58 +++ app/assets/stylesheets/theme1/theme1.css.sass | 330 ------------------ app/views/layouts/theme1-home.html.slim | 28 +- app/views/layouts/theme1.html.slim | 23 +- app/views/theme1/_footer.html.slim | 5 + app/views/theme1/_header.html.slim | 15 + app/views/theme1/_navigation.html.slim | 14 +- app/views/theme1/_social.html.slim | 6 +- bin/user_asset_corrections | 2 +- config/application.rb | 1 + config/version | 2 +- 24 files changed, 428 insertions(+), 428 deletions(-) delete mode 100644 app/assets/stylesheets/application.css create mode 100644 app/assets/stylesheets/theme1/_mixins.css.sass create mode 100644 app/assets/stylesheets/theme1/elements/_footer.css.sass create mode 100644 app/assets/stylesheets/theme1/elements/_header.css.sass create mode 100644 app/assets/stylesheets/theme1/elements/_nav.css.sass delete mode 100644 app/assets/stylesheets/theme1/home.css.sass rename app/assets/stylesheets/theme1/{cartoon.css.sass => pages/_cartoon.css.sass} (100%) create mode 100644 app/assets/stylesheets/theme1/pages/_home.css.sass delete mode 100644 app/assets/stylesheets/theme1/theme1.css.sass create mode 100644 app/views/theme1/_footer.html.slim create mode 100644 app/views/theme1/_header.html.slim diff --git a/Gemfile b/Gemfile index 07527b96..bddc5179 100644 --- a/Gemfile +++ b/Gemfile @@ -25,7 +25,7 @@ group :assets do #gem 'twitter-bootstrap-rails' # Only for mobile assets precompile, not used in this project gem 'bootstrap-sass', '~>2.3' - gem 'bourbon' + gem 'bourbon', '4.0.2' #gem 'compass-rails' gem 'js-routes' gem "font-awesome-rails" diff --git a/Gemfile.lock b/Gemfile.lock index 6fa655e2..f04613b9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: git://github.com/bterkuile/cmtool.git - revision: a4bef656ccf3ad434f13e458e2c96abe8636cfa0 + revision: 323e68bcad3b21cd580d3aff5771d99a805fc985 specs: cmtool (1.0.0) bourbon @@ -249,7 +249,7 @@ GEM js-routes (0.9.9) railties (>= 3.2) sprockets-rails - json (1.8.1) + json (1.8.2) jwt (1.2.0) kaminari (0.16.1) actionpack (>= 3.0.0) @@ -265,8 +265,8 @@ GEM method_source (0.8.2) mime-types (1.25.1) mini_magick (4.0.1) - mini_portile (0.6.1) - minitest (5.5.0) + mini_portile (0.6.2) + minitest (5.5.1) multi_json (1.10.1) multi_xml (0.5.5) multipart-post (2.0.0) @@ -310,7 +310,7 @@ GEM railties (>= 3.1, < 5.0) rack (1.6.0) rack-cors (0.3.0) - rack-test (0.6.2) + rack-test (0.6.3) rack (>= 1.0) rails (4.2.0.rc2) actionmailer (= 4.2.0.rc2) @@ -381,14 +381,14 @@ GEM multi_json (~> 1.0) simplecov-html (~> 0.8.0) simplecov-html (0.8.0) - slim (3.0.0) + slim (3.0.1) temple (~> 0.7.3) tilt (>= 1.3.3, < 2.1) - slim-rails (3.0.0) - actionmailer (>= 3.0, < 4.2) - actionpack (>= 3.0, < 4.2) - activesupport (>= 3.0, < 4.2) - railties (>= 3.0, < 4.2) + slim-rails (3.0.1) + actionmailer (>= 3.1, < 5.0) + actionpack (>= 3.1, < 5.0) + activesupport (>= 3.1, < 5.0) + railties (>= 3.1, < 5.0) slim (~> 3.0) slop (3.6.0) spring (1.2.0) @@ -407,7 +407,7 @@ GEM colorize (>= 0.7.0) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) - temple (0.7.3) + temple (0.7.5) thor (0.19.1) thread_safe (0.3.4) tilt (1.4.1) @@ -444,7 +444,7 @@ DEPENDENCIES active_decorator active_model_serializers (= 0.9.0) bootstrap-sass (~> 2.3) - bourbon + bourbon (= 4.0.2) capistrano (~> 3.0) capistrano-local-precompile capistrano-rails (~> 1.1) diff --git a/app/assets/javascripts/theme1/application.js.coffee b/app/assets/javascripts/theme1/application.js.coffee index a89230aa..e78ef1b3 100644 --- a/app/assets/javascripts/theme1/application.js.coffee +++ b/app/assets/javascripts/theme1/application.js.coffee @@ -3,3 +3,5 @@ #= require_directory . #= require_self $(document).on 'click', '.flash-box', -> $(@).slideUp() +$ -> + $('.menu-secondary-toggle').click -> $('.nav.secondary').toggleClass('active') diff --git a/app/assets/javascripts/user/app/routes/application_route.js.coffee.erb b/app/assets/javascripts/user/app/routes/application_route.js.coffee.erb index ea847181..a8c871f8 100644 --- a/app/assets/javascripts/user/app/routes/application_route.js.coffee.erb +++ b/app/assets/javascripts/user/app/routes/application_route.js.coffee.erb @@ -50,6 +50,7 @@ App.ApplicationRoute = Ember.Route.extend controller = @controllerFor("modals/#{modalName}") catch error controller = @controllerFor("modals/base") + controller ||= @controllerFor("modals/base") controller.set 'model', options.model defaultModalOptions = closeOnOverlay: true diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css deleted file mode 100644 index e065c82d..00000000 --- a/app/assets/stylesheets/application.css +++ /dev/null @@ -1,14 +0,0 @@ -/* - * This is a manifest file that'll be compiled into application.css, which will include all the files - * listed below. - * - * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, - * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. - * - * You're free to add application-wide styles to this file and they'll appear at the top of the - * compiled file, but it's generally better to create a new file per style scope. - * - *= require_self - *= require_directory . - *= require 'theme1/application' - */ diff --git a/app/assets/stylesheets/theme1/_mixins.css.sass b/app/assets/stylesheets/theme1/_mixins.css.sass new file mode 100644 index 00000000..d4ebd6fa --- /dev/null +++ b/app/assets/stylesheets/theme1/_mixins.css.sass @@ -0,0 +1,20 @@ +=content-top-background + .left + position: absolute + bottom: 0 + left: 0 + background-image: image-url('theme1/floor-left.jpg') + background-position: right + height: $cth-height + width: 50% + .right + position: absolute + bottom: 0 + right: 0 + background-image: image-url('theme1/floor-right.jpg') + background-position: left + height: $cth-height + width: 50% + .content-container + position: relative + max-width: $content-max-width diff --git a/app/assets/stylesheets/theme1/_structure.css.sass b/app/assets/stylesheets/theme1/_structure.css.sass index d608c31c..59f7de3f 100644 --- a/app/assets/stylesheets/theme1/_structure.css.sass +++ b/app/assets/stylesheets/theme1/_structure.css.sass @@ -1,3 +1,107 @@ -.container - margin-left: auto - margin-right: auto +=linear-gradient($pos, $G1, $G2: null, $G3: null, $G4: null, $G5: null, $G6: null, $G7: null, $G8: null, $G9: null, $G10: null, $fallback: null) + // Detect what type of value exists in $pos + $pos-type: type-of(nth($pos, 1)) + $pos-spec: null + $pos-degree: null + // If $pos is missing from mixin, reassign vars and add default position + @if $pos-type == color or nth($pos, 1) == "transparent" + $G10: $G9 + $G9: $G8 + $G8: $G7 + $G7: $G6 + $G6: $G5 + $G5: $G4 + $G4: $G3 + $G3: $G2 + $G2: $G1 + $G1: $pos + $pos: null + @if $pos + $positions: _linear-positions-parser($pos) + $pos-degree: nth($positions, 1) + $pos-spec: nth($positions, 2) + $full: $G1, $G2, $G3, $G4, $G5, $G6, $G7, $G8, $G9, $G10 + // Set $G1 as the default fallback color + $fallback-color: nth($G1, 1) + // If $fallback is a color use that color as the fallback color + @if type-of($fallback) == color or $fallback == "transparent" + $fallback-color: $fallback + background-color: $fallback-color + background-image: -webkit-linear-gradient($pos-degree $full) + // Safari 5.1+, Chrome + background-image: unquote("linear-gradient(#{$pos-spec}#{$full})") +body + background-color: #333 + margin: 0 + padding: 0 + background-image: image-url('theme1/footer-bg.jpg') + background-position: center top + .header-nav-banner + background-image: image-url('theme1/header.jpg') + background-position: center 25px + #content-header + position: relative + height: $cth-height + +content-top-background + .container + height: $cth-height + margin: 0 auto + background-image: image-url("theme1/no-banner-bg-left.png"), image-url('theme1/no-banner-bg-right.png') + background-repeat: no-repeat, no-repeat + background-position: left bottom, right bottom + .top-ribbon + background-image: image-url("theme1/no-banner-bg-middle.png") + height: $cth-height + background-repeat: repeat-x + background-position: bottom + margin: 0 68px 0 42px + #main-wrap + font-size: 14px + font-family: $font-family-content + line-height: 1.5 + color: #848585 + position: relative + h1 + font-size: 28px + padding: 0.5em 0 0.2em 0 + line-height: 1.4 + font-family: $font-family-headers + color: #AE571F + h2 + font-size: 24px + padding: 0.5em 0 0.2em 0 + line-height: 1.2 + font-family: $font-family-headers + color: #AE571F + + background-image: image-url('theme1/wall-bg.jpg') + background-position: center top + overflow: visible + position: relative + .container + margin: 0 auto + max-width: $content-max-width + .main-inner + +linear-gradient(#d6d6d6 0, white 70px) + position: relative + padding: 10px 40px 30px 40px + margin-left: 2px + margin-right: 2px + min-height: 400px + @media (max-width: 680px) + padding: 8px 15px + h1.page-title + margin: 0 + padding: 0 + margin-bottom: 12px + a + color: $green + text-decoration: none + &:hover + color: darken($green, 20%) + .right + float: right + .left + float: left + .clearing + clear: both diff --git a/app/assets/stylesheets/theme1/application.css.sass b/app/assets/stylesheets/theme1/application.css.sass index 77a5e05f..1d7b0012 100644 --- a/app/assets/stylesheets/theme1/application.css.sass +++ b/app/assets/stylesheets/theme1/application.css.sass @@ -1,5 +1,14 @@ -//= require_self -//= require_directory . +@import constants +$font-family-navigation: Verdana,serif +$font-family-headers: Verdana,serif //'Pacifico', serif +$content-max-width: 962px +$cth-height: 48px +$green-original: #99CB23 +$green: #7BB459 //Heineken +$font-family-content: Georgia, serif +@import font-awesome +@import ./mixins @import ./foundation_and_overrides @import ./elements/* +@import ./pages/* @import ./structure diff --git a/app/assets/stylesheets/theme1/elements/_footer.css.sass b/app/assets/stylesheets/theme1/elements/_footer.css.sass new file mode 100644 index 00000000..494e85a6 --- /dev/null +++ b/app/assets/stylesheets/theme1/elements/_footer.css.sass @@ -0,0 +1,30 @@ +#footer-wrap + color: white + background-image: image-url('theme1/footer-bg.jpg') + background-position: center + overflow: visible + position: relative + .footer-shadow + height: 1px + //+box-shadow(0px 4px 10px #000) + .footer-content-container + max-width: 838px + margin: 0 auto + .footer-content + background-color: #420F03 + text-align: right + padding: 72px 30px 20px 10px + overflow: visible + margin: 0 auto + a + margin-left: 20px + .footer-bottom + background-image: image-url('theme1/footer-bottom.png') + position: relative + height: 35px + padding-left: 30px + padding-right: 30px + max-width: 838px + position: relative + overflow: visible + margin: 0 auto diff --git a/app/assets/stylesheets/theme1/elements/_header.css.sass b/app/assets/stylesheets/theme1/elements/_header.css.sass new file mode 100644 index 00000000..d4666a67 --- /dev/null +++ b/app/assets/stylesheets/theme1/elements/_header.css.sass @@ -0,0 +1,76 @@ +#header-wrap + #ceiling + position: relative + width: 100% + background-image: image-url('theme1/ceiling-center.jpg') + background-position: top center + background-repeat: no-repeat + overflow: hidden + .left + background-image: image-url('theme1/ceiling-left.jpg') + background-position: right top + background-repeat: repeat-x + height: 25px + position: absolute + left: 0 + width: 50% + .right + background-image: image-url('theme1/ceiling-right.jpg') + background-position: left top + background-repeat: repeat-x + height: 25px + position: absolute + right: 0 + width: 50% + .lights + position: absolute + height: 140px + width: 990px + left: 50% + margin-left: -495px + div + position: relative + background-repeat: no-repeat + width: 315px + height: 140px + float: left + &.light1 + background-image: image-url('theme1/light-1.jpg') + margin-left: 15px + margin-right: 2px + &.light2 + background-image: image-url('theme1/light-2.jpg') + margin-right: 3px + &.light3 + background-image: image-url('theme1/light-3.jpg') + .container + max-width: 960px + padding-top: 40px + position: relative + margin: 0 auto + #header + margin-bottom: 10px + #logo + max-width: 80% + a + margin: 20px + #header-right + padding-right: 30px + .social + float: right + width: 222px + text-align: right + a + background-image: image-url('theme1/social.png') + margin: 0 0 0 3px + width: 32px + height: 56px + display: inline-block + &.wsite-social-facebook + background-position: 0 0 + &.wsite-social-twitter + background-position: -35px 0 + &.wsite-social-linkedin + background-position: -70px 0 + &.wsite-social-rss + background-position: -141px 0 diff --git a/app/assets/stylesheets/theme1/elements/_nav.css.sass b/app/assets/stylesheets/theme1/elements/_nav.css.sass new file mode 100644 index 00000000..815c4712 --- /dev/null +++ b/app/assets/stylesheets/theme1/elements/_nav.css.sass @@ -0,0 +1,68 @@ +#nav-wrap + max-width: 960px + position: relative + margin: 0 auto + .navbar-inner + height: 48px + background-color: transparent + background-image: image-url('theme1/nav-bar-left.png'), image-url('theme1/nav-bar-right.png'), image-url('theme1/nav-bar-middle.png') + background-repeat: no-repeat, no-repeat, repeat-x + background-position: left center, right center, center center + border: 0 + -ms-filter: '' + .nav-collapse + &.in.collapse + background-color: rgba(0,0,0,0.4) + z-index: 400 + ul.nav + margin: 0 + padding: 0 + list-style: none + li + position: relative + list-style: none + float: left + a + border: 0 + color: white + display: block + font-family: $font-family-navigation + text-decoration: none + font-size: 18px + height: 46px + line-height: 46px + margin: 0 10px + padding: 0 20px + text-shadow: 0 2px 2px rgba(0, 0, 0, 0.5) + &:hover + color: $green + @media (max-width: 480px) + font-size: 12px + margin: 0 5px + padding: 0 10px + &.active + a + color: $green + background-color: inherit + &.secondary + @media (max-width: 924px) + position: absolute + background-color: #555 + z-index: 5487 + top: 48px + width: 100% + opacity: 0.8 + display: none + li + float: none + &.active + display: block + .menu-secondary-toggle + float: right + display: none + margin-top: 8px + margin-right: 1em + span + @extend .fa, .fa-lg, .fa-bars + @media (max-width: 924px) + display: inline-block diff --git a/app/assets/stylesheets/theme1/home.css.sass b/app/assets/stylesheets/theme1/home.css.sass deleted file mode 100644 index 311a2138..00000000 --- a/app/assets/stylesheets/theme1/home.css.sass +++ /dev/null @@ -1,10 +0,0 @@ -.home-tablet-phone - right: 0 - top: -200px - position: absolute - z-index: 120 -.introduction - padding-top: 20px -.home-qr - float: left - margin: 0 20px 20px 0 diff --git a/app/assets/stylesheets/theme1/cartoon.css.sass b/app/assets/stylesheets/theme1/pages/_cartoon.css.sass similarity index 100% rename from app/assets/stylesheets/theme1/cartoon.css.sass rename to app/assets/stylesheets/theme1/pages/_cartoon.css.sass diff --git a/app/assets/stylesheets/theme1/pages/_home.css.sass b/app/assets/stylesheets/theme1/pages/_home.css.sass new file mode 100644 index 00000000..53a77d8a --- /dev/null +++ b/app/assets/stylesheets/theme1/pages/_home.css.sass @@ -0,0 +1,58 @@ +.home-tablet-phone + right: 0 + top: -200px + position: absolute + z-index: 120 +.introduction + padding-top: 20px +.home-qr + float: left + margin: 0 20px 20px 0 +#home-splash + height: 318px - 10px + position: relative + #home-splash-content + z-index: 12 + height: 318px - 61px - 10px + max-width: $content-max-width + margin: 0 auto + #home-splash-content-inner + background-color: white + height: 260px + margin-left: 49px + margin-right: 53px + position: relative + overflow: hidden + #home-splash-content-inner-bar + position: absolute + height: 260px + left: 10px + right: 10px + top: 10px + z-index: 20 + background-image: image-url("theme1/home_qwaiter_den_haag.png") + background-repeat: no-repeat + background-position: center top + #home-splash-footer + +content-top-background + #home-splash-footer-inner + background-color: transparent + background-repeat: no-repeat, no-repeat + margin: 0 auto + height: 61px + max-width: $content-max-width + background-position: left bottom, right bottom + background-image: image-url('theme1/button-bar-left.png'), image-url('theme1/button-bar-right.png') + color: $green + border-width: 0 + border-radius: 0 + height: 61px + #home-splash-footer-inner-bar + margin-left: 49px + margin-right: 53px + background-color: white + background-repeat: repeat-x + background-position: center bottom + background-image: image-url('theme1/button-bar-middle.png') + //min-height: 61px + height: 61px diff --git a/app/assets/stylesheets/theme1/theme1.css.sass b/app/assets/stylesheets/theme1/theme1.css.sass deleted file mode 100644 index fbc40ab2..00000000 --- a/app/assets/stylesheets/theme1/theme1.css.sass +++ /dev/null @@ -1,330 +0,0 @@ -$cth-height: 48px -$green-original: #99CB23 -$green: #7BB459 //Heineken -$font-family-content: Georgia, serif -$font-family-navigation: Verdana,serif -$font-family-headers: Verdana,serif //'Pacifico', serif -$content-max-width: 962px -=linear-gradient($pos, $G1, $G2: null, $G3: null, $G4: null, $G5: null, $G6: null, $G7: null, $G8: null, $G9: null, $G10: null, $fallback: null) - // Detect what type of value exists in $pos - $pos-type: type-of(nth($pos, 1)) - $pos-spec: null - $pos-degree: null - // If $pos is missing from mixin, reassign vars and add default position - @if $pos-type == color or nth($pos, 1) == "transparent" - $G10: $G9 - $G9: $G8 - $G8: $G7 - $G7: $G6 - $G6: $G5 - $G5: $G4 - $G4: $G3 - $G3: $G2 - $G2: $G1 - $G1: $pos - $pos: null - @if $pos - $positions: _linear-positions-parser($pos) - $pos-degree: nth($positions, 1) - $pos-spec: nth($positions, 2) - $full: $G1, $G2, $G3, $G4, $G5, $G6, $G7, $G8, $G9, $G10 - // Set $G1 as the default fallback color - $fallback-color: nth($G1, 1) - // If $fallback is a color use that color as the fallback color - @if type-of($fallback) == color or $fallback == "transparent" - $fallback-color: $fallback - background-color: $fallback-color - background-image: -webkit-linear-gradient($pos-degree $full) - // Safari 5.1+, Chrome - background-image: unquote("linear-gradient(#{$pos-spec}#{$full})") -=content-top-background - .left - position: absolute - bottom: 0 - left: 0 - background-image: image-url('theme1/floor-left.jpg') - background-position: right - height: $cth-height - width: 50% - .right - position: absolute - bottom: 0 - right: 0 - background-image: image-url('theme1/floor-right.jpg') - background-position: left - height: $cth-height - width: 50% - .container - position: relative - max-width: $content-max-width -body - background-color: #333 - margin: 0 - padding: 0 - background-image: image-url('theme1/footer-bg.jpg') - background-position: center top - .header-nav-banner - background-image: image-url('theme1/header.jpg') - background-position: center 25px - #header-wrap - #ceiling - position: relative - width: 100% - background-image: image-url('theme1/ceiling-center.jpg') - background-position: top center - background-repeat: no-repeat - overflow: hidden - .left - background-image: image-url('theme1/ceiling-left.jpg') - background-position: right top - background-repeat: repeat-x - height: 25px - position: absolute - left: 0 - width: 50% - .right - background-image: image-url('theme1/ceiling-right.jpg') - background-position: left top - background-repeat: repeat-x - height: 25px - position: absolute - right: 0 - width: 50% - .lights - position: absolute - height: 140px - width: 990px - left: 50% - margin-left: -495px - div - position: relative - background-repeat: no-repeat - width: 315px - height: 140px - float: left - &.light1 - background-image: image-url('theme1/light-1.jpg') - margin-left: 15px - margin-right: 2px - &.light2 - background-image: image-url('theme1/light-2.jpg') - margin-right: 3px - &.light3 - background-image: image-url('theme1/light-3.jpg') - .container - max-width: 960px - padding-top: 40px - position: relative - margin: 0 auto - #header - margin-bottom: 10px - #logo - max-width: 80% - a - margin: 20px - #header-right - padding-right: 30px - .social - float: right - width: 222px - text-align: right - a - background-image: image-url('theme1/social.png') - margin: 0 0 0 3px - width: 32px - height: 56px - display: inline-block - &.wsite-social-facebook - background-position: 0 0 - &.wsite-social-twitter - background-position: -35px 0 - &.wsite-social-linkedin - background-position: -70px 0 - &.wsite-social-rss - background-position: -141px 0 - #nav-wrap - max-width: 960px - position: relative - .navbar-inner - height: 48px - background-color: transparent - background-image: image-url('theme1/nav-bar-left.png'), image-url('theme1/nav-bar-right.png'), image-url('theme1/nav-bar-middle.png') - background-repeat: no-repeat, no-repeat, repeat-x - background-position: left center, right center, center center - border: 0 - -ms-filter: '' - .nav-collapse - &.in.collapse - background-color: rgba(0,0,0,0.4) - z-index: 400 - ul.nav - margin: 0 - padding: 0 - list-style: none - li - position: relative - list-style: none - float: left - a - border: 0 - color: white - display: block - font-family: $font-family-navigation - text-decoration: none - font-size: 18px - height: 46px - line-height: 46px - margin: 0 10px - padding: 0 20px - text-shadow: 0 2px 2px rgba(0, 0, 0, 0.5) - &:hover - color: $green - @media (max-width: 480px) - font-size: 12px - margin: 0 5px - padding: 0 10px - &.active - a - color: $green - background-color: inherit - #home-splash - height: 318px - 10px - position: relative - #home-splash-content - z-index: 12 - height: 318px - 61px - 10px - max-width: $content-max-width - #home-splash-content-inner - background-color: white - height: 260px - margin-left: 49px - margin-right: 53px - position: relative - overflow: hidden - #home-splash-content-inner-bar - position: absolute - height: 260px - left: 10px - right: 10px - top: 10px - z-index: 20 - background-image: image-url("theme1/home_qwaiter_den_haag.png") - background-repeat: no-repeat - background-position: center top - #home-splash-footer - +content-top-background - #home-splash-footer-inner - background-color: transparent - background-repeat: no-repeat, no-repeat - height: 61px - max-width: $content-max-width - background-position: left bottom, right bottom - background-image: image-url('theme1/button-bar-left.png'), image-url('theme1/button-bar-right.png') - color: $green - border-width: 0 - border-radius: 0 - height: 61px - #home-splash-footer-inner-bar - margin-left: 49px - margin-right: 53px - background-color: white - background-repeat: repeat-x - background-position: center bottom - background-image: image-url('theme1/button-bar-middle.png') - //min-height: 61px - height: 61px - #content-header - position: relative - height: $cth-height - +content-top-background - .container - height: $cth-height - margin: 0 auto - background-image: image-url("theme1/no-banner-bg-left.png"), image-url('theme1/no-banner-bg-right.png') - background-repeat: no-repeat, no-repeat - background-position: left bottom, right bottom - .top-ribbon - background-image: image-url("theme1/no-banner-bg-middle.png") - height: $cth-height - background-repeat: repeat-x - background-position: bottom - margin: 0 68px 0 42px - #main-wrap - font-size: 14px - font-family: $font-family-content - line-height: 1.5 - color: #848585 - position: relative - h1 - font-size: 28px - padding: 0.5em 0 0.2em 0 - line-height: 1.4 - font-family: $font-family-headers - color: #AE571F - h2 - font-size: 24px - padding: 0.5em 0 0.2em 0 - line-height: 1.2 - font-family: $font-family-headers - color: #AE571F - - background-image: image-url('theme1/wall-bg.jpg') - background-position: center top - overflow: visible - position: relative - .container - margin: 0 auto - max-width: $content-max-width - .main-inner - +linear-gradient(#d6d6d6 0, white 70px) - position: relative - padding: 10px 40px 30px 40px - margin-left: 2px - margin-right: 2px - min-height: 400px - @media (max-width: 680px) - padding: 8px 15px - h1.page-title - margin: 0 - padding: 0 - margin-bottom: 12px - #footer-wrap - color: white - background-image: image-url('theme1/footer-bg.jpg') - background-position: center - overflow: visible - position: relative - .footer-shadow - height: 1px - //+box-shadow(0px 4px 10px #000) - .container - max-width: 838px - .footer-content - background-color: #420F03 - text-align: right - padding: 72px 30px 20px 10px - overflow: visible - margin: 0 auto - a - margin-left: 20px - .footer-bottom - background-image: image-url('theme1/footer-bottom.png') - position: relative - height: 35px - padding-left: 30px - padding-right: 30px - max-width: 838px - position: relative - overflow: visible - margin: 0 auto - a - color: $green - text-decoration: none - &:hover - color: darken($green, 20%) - .right - float: right - .left - float: left - .clearing - clear: both diff --git a/app/views/layouts/theme1-home.html.slim b/app/views/layouts/theme1-home.html.slim index c924e484..e77e3ca5 100644 --- a/app/views/layouts/theme1-home.html.slim +++ b/app/views/layouts/theme1-home.html.slim @@ -10,35 +10,20 @@ html lang="en" /[if lt IE 9] = javascript_include_tag "http://html5shim.googlecode.com/svn/trunk/html5.js" = stylesheet_link_tag "theme1/application", :media => "all" - = javascript_include_tag 'theme1/application' link href="/favicon.ico" rel="shortcut icon" link href='http://fonts.googleapis.com/css?family=Pacifico' rel='stylesheet' type='text/css' body .header-nav-banner - #header-wrap - #ceiling - .left - .right - .lights - .light1 - .light2 - .light3 - .container - #header - #header-right= render 'theme1/social' - #logo= link_to image_tag('icons/logo-text.png', alt: application_title), root_path - #nav-wrap.container - .navbar - .navbar-inner= render 'theme1/navigation' + = render 'theme1/header' #home-splash - #home-splash-content.container + #home-splash-content #home-splash-content-inner #home-splash-content-inner-bar #home-splash-footer .left .right - #home-splash-footer-inner.container + #home-splash-footer-inner.content-container #home-splash-footer-inner-bar #main-wrap .container @@ -55,8 +40,5 @@ html lang="en" a.close data-dismiss="alert" × = yield :page_title = yield - #footer-wrap - .footer-shadow - .container - .footer-content= render 'footer' - .footer-bottom © mozo.bar 2014 + = render 'theme1/footer' + = javascript_include_tag 'theme1/application' diff --git a/app/views/layouts/theme1.html.slim b/app/views/layouts/theme1.html.slim index a1a2722c..f34a6c14 100644 --- a/app/views/layouts/theme1.html.slim +++ b/app/views/layouts/theme1.html.slim @@ -6,7 +6,6 @@ html lang="en" meta name="viewport" content="width=device-width, initial-scale=1.0" title= site_page_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" @@ -16,21 +15,7 @@ html lang="en" body .header-nav-banner - #header-wrap - #ceiling - .left - .right - .lights - .light1 - .light2 - .light3 - .container - #header - #header-right= render 'theme1/social' - #logo= link_to image_tag('icons/logo-text.png', alt: application_title), root_path - #nav-wrap.container - .navbar - .navbar-inner= render 'theme1/navigation' + = render 'theme1/header' #content-header .left .right @@ -50,9 +35,5 @@ html lang="en" - if @page && @page.title.present? h1.page-title= @page.title = yield - #footer-wrap - .footer-shadow - .container - .footer-content= render 'footer' - .footer-bottom © mozo.bar 2014 + = render 'theme1/footer' = javascript_include_tag "theme1/application" diff --git a/app/views/theme1/_footer.html.slim b/app/views/theme1/_footer.html.slim new file mode 100644 index 00000000..fd33daa9 --- /dev/null +++ b/app/views/theme1/_footer.html.slim @@ -0,0 +1,5 @@ +#footer-wrap + .footer-shadow + .footer-content-container + .footer-content= render 'footer' + .footer-bottom © mozo.bar 2014 diff --git a/app/views/theme1/_header.html.slim b/app/views/theme1/_header.html.slim new file mode 100644 index 00000000..821c96fd --- /dev/null +++ b/app/views/theme1/_header.html.slim @@ -0,0 +1,15 @@ +#header-wrap + #ceiling + .left + .right + .lights + .light1 + .light2 + .light3 + .container + #header + #header-right= render 'theme1/social' + #logo= link_to image_tag('icons/logo-text.png', alt: application_title), root_path +#nav-wrap + .navbar + .navbar-inner= render 'theme1/navigation' diff --git a/app/views/theme1/_navigation.html.slim b/app/views/theme1/_navigation.html.slim index d46ed853..a126f719 100644 --- a/app/views/theme1/_navigation.html.slim +++ b/app/views/theme1/_navigation.html.slim @@ -1,6 +1,8 @@ -.container - ul.nav - li[class=(current_page?(controller: '/pages', action: 'home') ? :active : nil)]= link_to find_page('home').try(:menu_text), locale_root_path - li[class=(current_page?(controller: '/pages', action: 'show', name: 'about') ? :active : nil)]= link_to find_page('about').try(:menu_text), page_path('about') - - Page.menu_roots.each do |page| - li[class=(current_page?(controller: '/pages', action: 'show', name: page.name) ? :active : nil)]= link_to page.menu_text, page_path(page.name) +a.menu-secondary-toggle href="#" + span +ul.nav + li[class=(current_page?(controller: '/pages', action: 'home') ? :active : nil)]= link_to find_page('home').try(:menu_text), locale_root_path + li[class=(current_page?(controller: '/pages', action: 'show', name: 'about') ? :active : nil)]= link_to find_page('about').try(:menu_text), page_path('about') +ul.nav.secondary + - Page.menu_roots.each do |page| + li[class=(current_page?(controller: '/pages', action: 'show', name: page.name) ? :active : nil)]= link_to page.menu_text, page_path(page.name) diff --git a/app/views/theme1/_social.html.slim b/app/views/theme1/_social.html.slim index 106ab857..5a2dd33d 100644 --- a/app/views/theme1/_social.html.slim +++ b/app/views/theme1/_social.html.slim @@ -1,9 +1,9 @@ .social a.wsite-social-facebook href="https://www.facebook.com/mozo.bar" target=:_blank span.wsite-social-inner - a.wsite-social-twitter href="https://twitter.com/mozo.bar" target=:_blank + /a.wsite-social-twitter href="https://twitter.com/mozo.bar" target=:_blank span.wsite-social-inner - a.wsite-social-linkedin href="http://www.linkedin.com/company/2801351" target=:_blank + /a.wsite-social-linkedin href="http://www.linkedin.com/company/2801351" target=:_blank span.wsite-social-inner - a.wsite-social-rss + /a.wsite-social-rss span.wsite-social-inner diff --git a/bin/user_asset_corrections b/bin/user_asset_corrections index 59343240..9ba2a132 100755 --- a/bin/user_asset_corrections +++ b/bin/user_asset_corrections @@ -43,7 +43,7 @@ remove 'user/app/application.js' # embedded in flat/application gsub_file 'user/foundation/application.css', /url\(("?)\/assets/, 'url(\1../..' gsub_all_scripts 'src="/assets', 'src="./assets' -#compress_js 'user/flat/application.js' +compress_js 'user/flat/application.js' end_time = Time.now puts "Converted assets for mobile in #{(end_time - start_time).round} seconds" diff --git a/config/application.rb b/config/application.rb index 01420739..95a57ad5 100644 --- a/config/application.rb +++ b/config/application.rb @@ -75,6 +75,7 @@ module Qwaiter # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] config.i18n.default_locale = :nl + config.i18n.available_locales = [:nl, :en] # Configure the default encoding used in templates for Ruby 1.9. config.encoding = "utf-8" diff --git a/config/version b/config/version index 2d72c8d3..a75b09ef 100644 --- a/config/version +++ b/config/version @@ -1 +1 @@ -0.9.48 +0.9.51 From a9c9e80ed468df537caedd9fa674f802581c2020 Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Tue, 13 Jan 2015 18:41:57 +0100 Subject: [PATCH 07/10] implement rails5 recommendation --- config/environments/production.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index d5584477..2868cb37 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -46,7 +46,7 @@ Qwaiter::Application.configure do # Prepend all log lines with the following tags # config.log_tags = [ :subdomain, :uuid ] - + config.log_level = :info # Use a different logger for distributed setups # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) From 65df2c08b9d2ccf9c687620aed28b53287cb8695 Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Tue, 13 Jan 2015 18:42:37 +0100 Subject: [PATCH 08/10] set compile to true --- config/environments/production.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 2868cb37..7f922184 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -29,7 +29,7 @@ Qwaiter::Application.configure do # Generate digests for assets URLs config.assets.digest = true # Don't fallback to assets pipeline if a precompiled asset is missed - config.assets.compile = false + config.assets.compile = true # Defaults to nil and saved in location specified by config.assets.prefix # config.assets.manifest = YOUR_PATH From 8b04bd96ed193b9d54c7f069c691eefcafb8c019 Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Tue, 13 Jan 2015 18:46:49 +0100 Subject: [PATCH 09/10] capistrano duplication --- app/assets/stylesheets/theme1/_structure.css.sass | 1 + 1 file changed, 1 insertion(+) diff --git a/app/assets/stylesheets/theme1/_structure.css.sass b/app/assets/stylesheets/theme1/_structure.css.sass index 59f7de3f..8019ca26 100644 --- a/app/assets/stylesheets/theme1/_structure.css.sass +++ b/app/assets/stylesheets/theme1/_structure.css.sass @@ -1,3 +1,4 @@ +$cth-height: 48px =linear-gradient($pos, $G1, $G2: null, $G3: null, $G4: null, $G5: null, $G6: null, $G7: null, $G8: null, $G9: null, $G10: null, $fallback: null) // Detect what type of value exists in $pos $pos-type: type-of(nth($pos, 1)) From 2a0d9ffdc0bdc5bd0f4f114305d951c3e74999e2 Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Tue, 13 Jan 2015 18:54:18 +0100 Subject: [PATCH 10/10] see if a rename helps --- .../theme1/{_structure.css.sass => _theme_structure.css.sass} | 1 - app/assets/stylesheets/theme1/application.css.sass | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) rename app/assets/stylesheets/theme1/{_structure.css.sass => _theme_structure.css.sass} (99%) diff --git a/app/assets/stylesheets/theme1/_structure.css.sass b/app/assets/stylesheets/theme1/_theme_structure.css.sass similarity index 99% rename from app/assets/stylesheets/theme1/_structure.css.sass rename to app/assets/stylesheets/theme1/_theme_structure.css.sass index 8019ca26..59f7de3f 100644 --- a/app/assets/stylesheets/theme1/_structure.css.sass +++ b/app/assets/stylesheets/theme1/_theme_structure.css.sass @@ -1,4 +1,3 @@ -$cth-height: 48px =linear-gradient($pos, $G1, $G2: null, $G3: null, $G4: null, $G5: null, $G6: null, $G7: null, $G8: null, $G9: null, $G10: null, $fallback: null) // Detect what type of value exists in $pos $pos-type: type-of(nth($pos, 1)) diff --git a/app/assets/stylesheets/theme1/application.css.sass b/app/assets/stylesheets/theme1/application.css.sass index 1d7b0012..06ec1ff4 100644 --- a/app/assets/stylesheets/theme1/application.css.sass +++ b/app/assets/stylesheets/theme1/application.css.sass @@ -11,4 +11,4 @@ $font-family-content: Georgia, serif @import ./foundation_and_overrides @import ./elements/* @import ./pages/* -@import ./structure +@import ./theme_structure