From 78f1056dc716a4c12fc38763a836cfe059c34a12 Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Fri, 13 Feb 2015 15:58:11 +0100 Subject: [PATCH] Big upgrade and supplier style upgrades --- Gemfile | 9 +- Gemfile.lock | 218 +++++++++--------- ...ection_arrange_tables_controller.js.coffee | 45 ++-- .../controllers/section_controller.js.coffee | 3 + .../app/templates/global/_side_menu.emblem | 11 +- .../modals/section_arrange_tables.emblem | 76 +++--- .../supplier/app/templates/section.emblem | 29 +-- .../app/templates/sections/index.emblem | 3 +- .../supplier/app/templates/settings.emblem | 2 +- .../app/templates/tables/index.emblem | 9 +- .../app/views/side_menu_item.js.coffee | 14 ++ .../supplier/foundation1/application.js.erb | 1 - .../foundation1/_form_actions.css.sass | 2 +- .../_foundation_and_overrides.css.sass | 6 +- .../supplier/foundation1/_qsections.css.sass | 19 +- .../components/_menu_side.css.sass | 9 + .../foundation1/components/_tables.css.sass | 12 +- config/locales/supplier.en.yml | 6 +- config/locales/supplier.nl.yml | 6 +- 19 files changed, 238 insertions(+), 242 deletions(-) create mode 100644 app/assets/javascripts/supplier/app/views/side_menu_item.js.coffee diff --git a/Gemfile b/Gemfile index a8591749..2368e517 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -gem 'rails', '4.2.0.rc2' +gem 'rails', '4.2.0' gem 'rack-cors', :require => 'rack/cors' # Bundle edge Rails instead: @@ -20,12 +20,12 @@ group :assets do gem 'ember-source', '1.8.1'#, github: 'emberjs/ember.js', require: 'ember/source' gem 'ember-rails' gem 'ember_script-rails', github: 'ghempton/ember-script-rails' - gem 'sass-rails', '5.0.0.beta1' + gem 'sass-rails', '~> 5.0.0' gem 'coffee-rails' #, '~> 3.2.1' #gem 'twitter-bootstrap-rails' # Only for mobile assets precompile, not used in this project - gem 'bootstrap-sass', '~>2.3' - gem 'bourbon', '4.0.2' + #gem 'bootstrap-sass', '~>2.3' + gem 'bourbon' #, '4.0.2' #gem 'compass-rails' gem 'js-routes' gem "font-awesome-rails" @@ -96,7 +96,6 @@ group :development do gem 'spring' gem 'spring-commands-rspec' gem 'web-console', '~> 2.0.0' - end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index 7f7a5268..d959d95f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: git://github.com/bterkuile/cmtool.git - revision: 323e68bcad3b21cd580d3aff5771d99a805fc985 + revision: e2f8459960eb4eff12365c6ebd60278d79eaab8f specs: cmtool (1.0.0) bourbon @@ -28,7 +28,7 @@ GIT GIT remote: git://github.com/bterkuile/simply_stored.git - revision: 8f00644f7a8e82dba057c01f86dbb8bc3154d5d8 + revision: 652caf8c2cfe4f828477f8b76d0cd201851cd53d specs: simply_stored (1.0.0) activesupport @@ -59,60 +59,58 @@ GIT GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.0.rc2) - actionpack (= 4.2.0.rc2) - actionview (= 4.2.0.rc2) - activejob (= 4.2.0.rc2) + actionmailer (4.2.0) + actionpack (= 4.2.0) + actionview (= 4.2.0) + activejob (= 4.2.0) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.0.rc2) - actionview (= 4.2.0.rc2) - activesupport (= 4.2.0.rc2) - rack (~> 1.6.0.beta2) + actionpack (4.2.0) + actionview (= 4.2.0) + activesupport (= 4.2.0) + rack (~> 1.6.0) rack-test (~> 0.6.2) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.1) - actionview (4.2.0.rc2) - activesupport (= 4.2.0.rc2) + actionview (4.2.0) + activesupport (= 4.2.0) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.1) - active_decorator (0.3.4) + active_decorator (0.4.0) active_model_serializers (0.9.0) activemodel (>= 3.2) - activejob (4.2.0.rc2) - activesupport (= 4.2.0.rc2) + activejob (4.2.0) + activesupport (= 4.2.0) globalid (>= 0.3.0) - activemodel (4.2.0.rc2) - activesupport (= 4.2.0.rc2) + activemodel (4.2.0) + activesupport (= 4.2.0) builder (~> 3.1) - activerecord (4.2.0.rc2) - activemodel (= 4.2.0.rc2) - activesupport (= 4.2.0.rc2) + activerecord (4.2.0) + activemodel (= 4.2.0) + activesupport (= 4.2.0) arel (~> 6.0) - activesupport (4.2.0.rc2) - i18n (>= 0.7.0.beta1, < 0.8) + activesupport (4.2.0) + i18n (~> 0.7) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) - thread_safe (~> 0.1) + thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - addressable (2.3.6) + addressable (2.3.7) arel (6.0.0) - barber (0.5.0) + barber (0.6.0) ember-source execjs handlebars-source (>= 1.0.0.rc.4) - barber-emblem (0.1.1) + barber-emblem (0.1.2) barber (>= 0.4.1) emblem-source - bcrypt (3.1.9) + bcrypt (3.1.10) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) - bootstrap-sass (2.3.2.2) - sass (~> 3.2) - bourbon (4.0.2) - sass (~> 3.3) + bourbon (4.2.0) + sass (~> 3.4) thor builder (3.2.2) capistrano (3.3.5) @@ -120,7 +118,7 @@ GEM i18n rake (>= 10.0.0) sshkit (~> 1.3) - capistrano-bundler (1.1.3) + capistrano-bundler (1.1.4) capistrano (~> 3.1) sshkit (~> 1.2) capistrano-local-precompile (0.0.2) @@ -138,7 +136,7 @@ GEM rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (~> 2.0) - capybara-screenshot (1.0.3) + capybara-screenshot (1.0.5) capybara (>= 1.0, < 3) colored launchy @@ -155,7 +153,7 @@ GEM coffee-script (2.3.0) coffee-script-source execjs - coffee-script-source (1.8.0) + coffee-script-source (1.9.0) colored (1.2) colorize (0.7.5) cookiejar (0.3.2) @@ -178,15 +176,15 @@ GEM eventmachine (>= 1.0.0.beta.4) email_validator (1.5.0) activemodel - ember-data-source (1.0.0.beta.12) - ember-source - ember-rails (0.15.1) + ember-data-source (1.0.0.beta.14.1) + ember-source (~> 1.8) + ember-rails (0.16.3) active_model_serializers - barber (>= 0.4.1) + barber (>= 0.6.0) ember-data-source (>= 1.0.0.beta.5) ember-source (>= 1.1.0) execjs (>= 1.2) - handlebars-source (> 1.0.0) + handlebars-source (> 1.0.0, < 3) jquery-rails (>= 1.0.17) railties (>= 3.1) ember-source (1.8.1) @@ -196,62 +194,62 @@ GEM execjs tilt ember_script-source (0.0.14) - emblem-rails (0.2.1) + emblem-rails (0.2.2) barber-emblem (~> 0.1.1) ember-rails (>= 0.14.0) - emblem-source (0.3.17) + emblem-source (0.3.18) erubis (2.7.0) - eventmachine (1.0.4) - execjs (2.2.2) + eventmachine (1.0.7) + execjs (2.3.0) factory_girl (4.5.0) activesupport (>= 3.0.0) factory_girl_rails (4.5.0) factory_girl (~> 4.5.0) railties (>= 3.0.0) - faraday (0.9.0) + faraday (0.9.1) multipart-post (>= 1.2, < 3) - faye (1.0.3) + faye (1.1.0) cookiejar (>= 0.3.0) em-http-request (>= 0.3.0) eventmachine (>= 0.12.0) - faye-websocket (>= 0.7.0) + faye-websocket (>= 0.9.1) multi_json (>= 1.0.0) rack (>= 1.0.0) - websocket-driver (>= 0.3.0) + websocket-driver (>= 0.5.1) faye-websocket (0.9.2) eventmachine (>= 0.12.0) websocket-driver (>= 0.5.1) ffi (1.9.6) - font-awesome-rails (4.2.0.0) + font-awesome-rails (4.3.0.0) railties (>= 3.2, < 5.0) - foundation-rails (5.5.0.0) + foundation-rails (5.5.1.0) railties (>= 3.1.0) - sass (>= 3.2.0, < 3.4) + sass (>= 3.3.0, < 3.5) fuubar (2.0.0) rspec (~> 3.0) ruby-progressbar (~> 1.4) gherkin (2.12.2) multi_json (~> 1.3) - globalid (0.3.0) + globalid (0.3.3) activesupport (>= 4.1.0) handlebars-source (1.3.0) - hashie (3.3.2) + hashie (3.4.0) hike (1.2.3) http_parser.rb (0.6.0) i18n (0.7.0) iso_country_codes (0.6.1) - jquery-rails (4.0.1) + jquery-rails (4.0.3) rails-dom-testing (~> 1.0) - railties (>= 4.2.0.beta) + railties (>= 4.2.0) thor (>= 0.14, < 2.0) jquery-ui-rails (5.0.3) railties (>= 3.2.16) - js-routes (0.9.9) + js-routes (1.0.0) railties (>= 3.2) sprockets-rails json (1.8.2) - jwt (1.2.0) - kaminari (0.16.1) + jwt (1.2.1) + kaminari (0.16.3) actionpack (>= 3.0.0) activesupport (>= 3.0.0) launchy (2.4.3) @@ -264,7 +262,7 @@ GEM mime-types (>= 1.16, < 3) method_source (0.8.2) mime-types (1.25.1) - mini_magick (4.0.1) + mini_magick (4.0.4) mini_portile (0.6.2) minitest (5.5.1) multi_json (1.10.1) @@ -272,8 +270,8 @@ GEM multipart-post (2.0.0) net-scp (1.2.1) net-ssh (>= 2.6.5) - net-ssh (2.9.1) - nokogiri (1.6.5) + net-ssh (2.9.2) + nokogiri (1.6.6.2) mini_portile (~> 0.6.0) oauth2 (1.0.0) faraday (>= 0.8, < 0.10) @@ -304,24 +302,24 @@ GEM coderay (~> 1.1.0) method_source (~> 0.8.1) slop (~> 3.4) - pry-rails (0.3.2) + pry-rails (0.3.3) pry (>= 0.9.10) - quiet_assets (1.0.3) + quiet_assets (1.1.0) railties (>= 3.1, < 5.0) rack (1.6.0) - rack-cors (0.3.0) + rack-cors (0.3.1) rack-test (0.6.3) rack (>= 1.0) - rails (4.2.0.rc2) - actionmailer (= 4.2.0.rc2) - actionpack (= 4.2.0.rc2) - actionview (= 4.2.0.rc2) - activejob (= 4.2.0.rc2) - activemodel (= 4.2.0.rc2) - activerecord (= 4.2.0.rc2) - activesupport (= 4.2.0.rc2) + rails (4.2.0) + actionmailer (= 4.2.0) + actionpack (= 4.2.0) + actionview (= 4.2.0) + activejob (= 4.2.0) + activemodel (= 4.2.0) + activerecord (= 4.2.0) + activesupport (= 4.2.0) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.0.rc2) + railties (= 4.2.0) sprockets-rails rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) @@ -331,52 +329,53 @@ GEM rails-deprecated_sanitizer (>= 1.0.1) rails-html-sanitizer (1.0.1) loofah (~> 2.0) - railties (4.2.0.rc2) - actionpack (= 4.2.0.rc2) - activesupport (= 4.2.0.rc2) + railties (4.2.0) + actionpack (= 4.2.0) + activesupport (= 4.2.0) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (10.4.2) rdoc (4.2.0) - json (~> 1.4) - responders (2.0.2) - railties (>= 4.2.0.alpha, < 5) + responders (2.1.0) + railties (>= 4.2.0, < 5) rest-client (1.6.8) mime-types (~> 1.16) rdoc (>= 2.4.2) rqrcode (0.4.2) - rspec (3.1.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-core (3.1.7) - rspec-support (~> 3.1.0) - rspec-expectations (3.1.2) + rspec (3.2.0) + rspec-core (~> 3.2.0) + rspec-expectations (~> 3.2.0) + rspec-mocks (~> 3.2.0) + rspec-core (3.2.0) + rspec-support (~> 3.2.0) + rspec-expectations (3.2.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.1.0) + rspec-support (~> 3.2.0) rspec-its (1.1.0) rspec-core (>= 3.0.0) rspec-expectations (>= 3.0.0) - rspec-mocks (3.1.3) - rspec-support (~> 3.1.0) - rspec-rails (3.1.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-support (~> 3.1.0) - rspec-support (3.1.2) + rspec-mocks (3.2.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.2.0) + rspec-rails (3.2.0) + actionpack (>= 3.0, <= 4.2) + activesupport (>= 3.0, <= 4.2) + railties (>= 3.0, <= 4.2) + rspec-core (~> 3.2.0) + rspec-expectations (~> 3.2.0) + rspec-mocks (~> 3.2.0) + rspec-support (~> 3.2.0) + rspec-support (3.2.1) ruby-progressbar (1.7.1) - rubyzip (1.1.6) + rubyzip (1.1.7) safe_yaml (1.0.4) - sass (3.3.14) - sass-rails (5.0.0.beta1) + sass (3.4.11) + sass-rails (5.0.1) railties (>= 4.0.0, < 5.0) - sass (~> 3.2) - sprockets (~> 2.12) + sass (~> 3.1) + sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) + tilt (~> 1.1) selenium-webdriver (2.44.0) childprocess (~> 0.5) multi_json (~> 1.0) @@ -387,7 +386,7 @@ GEM multi_json (~> 1.0) simplecov-html (~> 0.8.0) simplecov-html (0.8.0) - slim (3.0.1) + slim (3.0.2) temple (~> 0.7.3) tilt (>= 1.3.3, < 2.1) slim-rails (3.0.1) @@ -397,7 +396,7 @@ GEM railties (>= 3.1, < 5.0) slim (~> 3.0) slop (3.6.0) - spring (1.2.0) + spring (1.3.1) spring-commands-rspec (1.0.4) spring (>= 0.9.1) sprockets (2.12.3) @@ -405,7 +404,7 @@ GEM multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.2.2) + sprockets-rails (2.2.4) actionpack (>= 3.0) activesupport (>= 3.0) sprockets (>= 2.8, < 4.0) @@ -424,7 +423,7 @@ GEM rspec (>= 2.14.0, < 4.0) tzinfo (1.2.2) thread_safe (~> 0.1) - uglifier (2.6.0) + uglifier (2.7.0) execjs (>= 0.3.0) json (>= 1.8.0) warden (1.2.3) @@ -450,8 +449,7 @@ PLATFORMS DEPENDENCIES active_decorator active_model_serializers (= 0.9.0) - bootstrap-sass (~> 2.3) - bourbon (= 4.0.2) + bourbon capistrano (~> 3.0) capistrano-local-precompile capistrano-rails (~> 1.1) @@ -485,11 +483,11 @@ DEPENDENCIES pry-rails quiet_assets rack-cors - rails (= 4.2.0.rc2) + rails (= 4.2.0) rqrcode rspec-its rspec-rails - sass-rails (= 5.0.0.beta1) + sass-rails (~> 5.0.0) selenium-webdriver simplecov simply_stored! diff --git a/app/assets/javascripts/supplier/app/controllers/modals/section_arrange_tables_controller.js.coffee b/app/assets/javascripts/supplier/app/controllers/modals/section_arrange_tables_controller.js.coffee index cd2ce74d..977b3623 100644 --- a/app/assets/javascripts/supplier/app/controllers/modals/section_arrange_tables_controller.js.coffee +++ b/app/assets/javascripts/supplier/app/controllers/modals/section_arrange_tables_controller.js.coffee @@ -1,35 +1,50 @@ App.modals.SectionArrangeTablesController = App.modals.BaseController.extend + title_path: 'section.arrange_tables.modal.title' arrange_type: 'distributed' # can be distributed, by_row or by_column row_count: 2 column_count: 2 + alert_message: '' #isDistributed: ~> @arrange_type is 'distributed' #isByRow: ~> @arrange_type is 'by_row' #isByColumn: ~> @arrange_type is 'by_column' isDistributed: (->@get('arrange_type') is 'distributed').property('arrange_type') isByRow: (->@get('arrange_type') is 'by_row').property('arrange_type') isByColumn: (->@get('arrange_type') is 'by_column').property('arrange_type') + canArrangeTables: (-> + unless parseFloat(@get('model.width')) > 0 and parseFloat(@get('model.height')) > 0 + @set 'alert_message', t('section.arrange_tables.modal.cannot_arrange') + return false + @set 'alert_message', '' + true + ).property('model.width', 'model.height') actions: arrangeTables: -> + return unless @isValid() Ember.$.post Routes.arrange_tables_suppliers_section_path(@get('model.id')), option: @get('arrange_type') row_count: @get('row_count') column_count: @get('column_count') , (result,state,xhr)=> - #@store.pushPayload 'table', result @store.pushPayload result @send 'close' - - ##TODO remove followin code if Ember pushPayload is working - ##properly with associations - #section_id = @get('model.id') - #tables_that_should_be_in_section = @store.all('table').filter((t)->t.get('section.id') == section_id) - #current_table_ids = @get('model.tables').mapProperty('id') - #for table in tables_that_should_be_in_section.toArray() - #@get('model.tables').pushObject(table) unless table.get('id') in current_table_ids - ##TODO it still does not work for the second client side action, - ##soo the good old reload for now for the failing case - #window.location.reload() if result.tables.length != tables_that_should_be_in_section.toArray().length return - makeDistributed: -> @set 'arrange_type', 'distributed' - makeByRow: -> @set 'arrange_type', 'by_row' - makeByColumn: -> @set 'arrange_type', 'by_column' + makeDistributed: -> + @set 'arrange_type', 'distributed' + @set 'alert_message', '' + makeByRow: -> + @set 'arrange_type', 'by_row' + @set 'alert_message', '' + makeByColumn: -> + @set 'arrange_type', 'by_column' + @set 'alert_message', '' + isValid: -> + switch @get('arrange_type') + when 'by_row' + if parseInt(@get('row_count')) < 1 + @set 'alert_message', "Must at least be 1" + return false + when 'by_column' + if parseInt(@get('column_count')) < 1 + @set 'alert_message', "Must at least be 1" + return false + true diff --git a/app/assets/javascripts/supplier/app/controllers/section_controller.js.coffee b/app/assets/javascripts/supplier/app/controllers/section_controller.js.coffee index feee3264..1db748cc 100644 --- a/app/assets/javascripts/supplier/app/controllers/section_controller.js.coffee +++ b/app/assets/javascripts/supplier/app/controllers/section_controller.js.coffee @@ -6,6 +6,9 @@ App.SectionController = Ember.ObjectController.extend finishEditable: -> @set('editmode', false) @get('model').save() + rollbackEditable: -> + @get('model').rollback() + @set('editmode', false) addSection: -> @modal 'add_section', model: @get('model') addTables: -> @modal 'section_add_tables', model: @get('model') arrangeTables: -> @modal 'section_arrange_tables', model: @get('model') diff --git a/app/assets/javascripts/supplier/app/templates/global/_side_menu.emblem b/app/assets/javascripts/supplier/app/templates/global/_side_menu.emblem index 210d90ee..600eb0ac 100644 --- a/app/assets/javascripts/supplier/app/templates/global/_side_menu.emblem +++ b/app/assets/javascripts/supplier/app/templates/global/_side_menu.emblem @@ -6,6 +6,11 @@ aside.side-menu 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' + li + =link-to 'settings' class="supplier-settings-link" + span.settings-icon + span= t 'supplier.settings' + li class="supplier-sign-out-link" + a{action "signOut"} + span.sign-out-icon + = t 'supplier.sign_out' diff --git a/app/assets/javascripts/supplier/app/templates/modals/section_arrange_tables.emblem b/app/assets/javascripts/supplier/app/templates/modals/section_arrange_tables.emblem index da4dd4c9..88e36791 100644 --- a/app/assets/javascripts/supplier/app/templates/modals/section_arrange_tables.emblem +++ b/app/assets/javascripts/supplier/app/templates/modals/section_arrange_tables.emblem @@ -1,52 +1,30 @@ -.modal-alert== alert_message p=t 'section.arrange_tables.modal.body_header' -.arrange-type-buttons - if isDistributed - span.arrange-tables-current-type.distributed=t 'section.arrange_tables.modal.distributed.title' - else - button.arrange-tables-type-button.distributed{action "makeDistributed"}=t 'section.arrange_tables.modal.distributed.title' - if isByRow - span.arrange-tables-current-type.by_row=t 'section.arrange_tables.modal.by_row.title' - else - button.arrange-tables-type-button.by_row{action "makeByRow"}=t 'section.arrange_tables.modal.by_row.title' - if isByColumn - span.arrange-tables-current-type.by_column=t 'section.arrange_tables.modal.by_column.title' - else - button.arrange-tables-type-button.by_column{action "makeByColumn"}=t 'section.arrange_tables.modal.by_column.title' -.arrange-content - if isDistributed - ==t 'section.arrange_tables.modal.distributed.explanation' - if isByRow - ==t 'section.arrange_tables.modal.by_row.before_field' - App.NumberField valueBinding="row_count" - ==t 'section.arrange_tables.modal.by_row.after_field' - if isByColumn - ==t 'section.arrange_tables.modal.by_column.before_field' - App.NumberField valueBinding="column_count" - ==t 'section.arrange_tables.modal.by_column.after_field' +if canArrangeTables + .arrange-type-buttons + if isDistributed + span.arrange-tables-current-type.distributed=t 'section.arrange_tables.modal.distributed.title' + else + button.arrange-tables-type-button.distributed{action "makeDistributed"}=t 'section.arrange_tables.modal.distributed.title' + if isByRow + span.arrange-tables-current-type.by_row=t 'section.arrange_tables.modal.by_row.title' + else + button.arrange-tables-type-button.by_row{action "makeByRow"}=t 'section.arrange_tables.modal.by_row.title' + if isByColumn + span.arrange-tables-current-type.by_column=t 'section.arrange_tables.modal.by_column.title' + else + button.arrange-tables-type-button.by_column{action "makeByColumn"}=t 'section.arrange_tables.modal.by_column.title' + .arrange-content + if isDistributed + ==t 'section.arrange_tables.modal.distributed.explanation' + if isByRow + =t 'section.arrange_tables.modal.by_row.before_field' + App.NumberField valueBinding="row_count" + =t 'section.arrange_tables.modal.by_row.after_field' + if isByColumn + =t 'section.arrange_tables.modal.by_column.before_field' + App.NumberField valueBinding="column_count" + =t 'section.arrange_tables.modal.by_column.after_field' hr button.modal-close{action "close"}=t 'section.arrange_tables.modal.close_button' -button.modal-confirm.right{action "arrangeTables"}=t 'section.arrange_tables.modal.arrange_button' - - - /form.form-horizontal - .control-group - label.control-label for='arrange-tables-distributed' data-t='section.arrange_tables.modal.distributed' = t('supplier.section.arrange_tables.modal.distributed') - .controls - input#arrange-tables-distributed type="radio" name="arrange-table-option" checked=true value="distributed" - .control-group - label.control-label for='arrange-tables-by_row' data-t='section.arrange_tables.modal.by_row' = t('supplier.section.arrange_tables.modal.by_row') - .controls - input#arrange-tables-by_row type="radio" name="arrange-table-option" value="by_row" - label for="arrange-tables-by-row-count" data-t='section.arrange_tables.modal.by_row_count' = t('supplier.section.arrange_tables.modal.by_row_count') - input.input-mini#arrange-tables-by-row-count type="text" value=0 - ' - span data-t='models.plural.table' - .control-group - label.control-label for='arrange-tables-by_column' data-t='section.arrange_tables.modal.by_column' = t('supplier.section.arrange_tables.modal.by_column') - .controls - input#arrange-tables-by_column type="radio" name="arrange-table-option" value="by_column" - label for="arrange-tables-by-column-count" data-t='section.arrange_tables.modal.by_column_count' = t('supplier.section.arrange_tables.modal.by_column_count') - input.input-mini#arrange-tables-by-column-count type="text" value=0 - ' - span data-t='models.plural.table' +if canArrangeTables + button.modal-confirm.right{action "arrangeTables"}=t 'section.arrange_tables.modal.arrange_button' diff --git a/app/assets/javascripts/supplier/app/templates/section.emblem b/app/assets/javascripts/supplier/app/templates/section.emblem index f37c509b..e7160bb7 100644 --- a/app/assets/javascripts/supplier/app/templates/section.emblem +++ b/app/assets/javascripts/supplier/app/templates/section.emblem @@ -4,33 +4,18 @@ = view "section-tab-header" context=section a.add-section{action "addSection"}: span .section-manage-tables.pull-right + App.DropdownLink title="Action" + ul + li: a{action "addTables"}: span.section-add-tables-icon=t 'section.add_tables.button_label' + li: a{action "arrangeTables"}: span.section-arrange-tables-icon=t 'section.arrange_tables.modal.title' + li: a href="{{route 'qr_codes_suppliers_tables_path' section_id=id}}" target="_blank": span.qr-icon=t 'table.print_qr_codes' + li: a.section-destroy{action "destroySection"}: span.section-remove-icon=t 'helpers.links.destroy' if editmode - /.btn-group - /a.btn.dropdown-toggle data-toggle="dropdown" href="#section-background" - span Background - span.caret - ul#section-background.dropdown-menu - each texture in textures - li - a{ action "setTexture" texture }= texture - /a.tiny.button.dropdown.section-actions-menu-header href="#" data-dropdown="section-action-list" Action - /button.btn.dropdown-toggle data-toggle="dropdown" - span Action - span.caret - App.DropdownLink title="Action" - ul - li - a{action "addTables"}: span.section-add-tables-icon=t 'section.add_tables.button_label' - li - a{action "arrangeTables"}: span.section-arrange-tables-icon=t 'section.arrange_tables.modal.title' - li - 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' = 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-rollback-button{ action "rollbackEditable" }: span a.section-normal-mode-button{ action "finishEditable" }: span else a.section-edit-mode-button{ action "makeEditable" }: span diff --git a/app/assets/javascripts/supplier/app/templates/sections/index.emblem b/app/assets/javascripts/supplier/app/templates/sections/index.emblem index 3e5eec0a..5a232e3f 100644 --- a/app/assets/javascripts/supplier/app/templates/sections/index.emblem +++ b/app/assets/javascripts/supplier/app/templates/sections/index.emblem @@ -32,8 +32,7 @@ /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 + a.table-qr-codes{path qr_codes_suppliers_tables section_id=section.id} target="_blank": span.qr-icon else .row: .small-12.columns .panel=t 'section.none_found' diff --git a/app/assets/javascripts/supplier/app/templates/settings.emblem b/app/assets/javascripts/supplier/app/templates/settings.emblem index e62a9eff..d56c0d25 100644 --- a/app/assets/javascripts/supplier/app/templates/settings.emblem +++ b/app/assets/javascripts/supplier/app/templates/settings.emblem @@ -1,4 +1,4 @@ -h2=t 'settings.title' +.row: .small-12.columns: h2=t 'settings.title' .form-row .form-label: label=t 'attributes.supplier.name' .form-field: Ember.TextField valueBinding="controller.model.name" classNames="supplier-name" diff --git a/app/assets/javascripts/supplier/app/templates/tables/index.emblem b/app/assets/javascripts/supplier/app/templates/tables/index.emblem index 93225da9..13355ae5 100644 --- a/app/assets/javascripts/supplier/app/templates/tables/index.emblem +++ b/app/assets/javascripts/supplier/app/templates/tables/index.emblem @@ -20,7 +20,8 @@ td.actions a.table-edit{ action 'editTable' table }: span a.table-destroy{ action 'destroyTable' table }: span - a.button.new-table-button{action "newTable"}= t 'table.new_button' - a.table-qr-codes{path qr_codes_suppliers_tables} - span - = t 'table.print_qr_codes' + .form-actions + a.form-action-new{action "newTable"}= t 'table.new_button' + a.table-qr-codes{path qr_codes_suppliers_tables} target="_blank" + span.qr-icon + = t 'table.print_qr_codes' diff --git a/app/assets/javascripts/supplier/app/views/side_menu_item.js.coffee b/app/assets/javascripts/supplier/app/views/side_menu_item.js.coffee new file mode 100644 index 00000000..c1f27970 --- /dev/null +++ b/app/assets/javascripts/supplier/app/views/side_menu_item.js.coffee @@ -0,0 +1,14 @@ +App.SideMenuItemView = Ember.View.extend + classNames: 'menu-list-item' + classNameBindings: ['active'] + click: -> + if @route_param + @get('controller').transitionToRoute(@route, @route_param) + else + @get('controller').transitionToRoute(@route) + active: (-> + if @get('controller.currentPath') == @route then 'active' else '' + ).property('controller.currentPath') + init: -> + @templateName = "side_menu/#{@route}" + @_super() diff --git a/app/assets/javascripts/supplier/foundation1/application.js.erb b/app/assets/javascripts/supplier/foundation1/application.js.erb index c1e12550..b02f041e 100644 --- a/app/assets/javascripts/supplier/foundation1/application.js.erb +++ b/app/assets/javascripts/supplier/foundation1/application.js.erb @@ -21,7 +21,6 @@ $.extend($translations.en, <%= I18n.t('supplier', locale: :en).to_json %>); $.extend($translations.nl, <%= I18n.t('supplier', locale: :nl).to_json %>); String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.slice(1); } - window.time_zones = <%= ActiveSupport::TimeZone.all.map{|tz| {name: tz.name, formatted: "GMT#{tz.formatted_offset} #{tz.name}"}}.to_json.html_safe %>; window.countries = <%= IsoCountryCodes.all.map{|cc| {name: cc.name}}.to_json.html_safe %>; diff --git a/app/assets/stylesheets/supplier/foundation1/_form_actions.css.sass b/app/assets/stylesheets/supplier/foundation1/_form_actions.css.sass index 878cab0d..8ff1a78c 100644 --- a/app/assets/stylesheets/supplier/foundation1/_form_actions.css.sass +++ b/app/assets/stylesheets/supplier/foundation1/_form_actions.css.sass @@ -7,7 +7,7 @@ +button($bg: $button-index-color, $padding: $button-sml) margin-right: $button-margin &.form-action-new - +button($bg: $button-new-color, $padding: $button-sml) + +button($padding: $button-sml) margin-right: $button-margin &.form-action-edit +button($bg: $button-edit-color, $padding: $button-sml) diff --git a/app/assets/stylesheets/supplier/foundation1/_foundation_and_overrides.css.sass b/app/assets/stylesheets/supplier/foundation1/_foundation_and_overrides.css.sass index ddaf5f54..2eb43aaa 100644 --- a/app/assets/stylesheets/supplier/foundation1/_foundation_and_overrides.css.sass +++ b/app/assets/stylesheets/supplier/foundation1/_foundation_and_overrides.css.sass @@ -1258,8 +1258,8 @@ $alert-color: #ee3e41 $button-margin: rem-calc(10) $button-qr-code-color: #555 $button-index-color: $secondary-color -$button-new-color: #afa -$button-edit-color: #ffa -$button-destroy-color: #faa +$button-new-color: $primary-color +$button-edit-color: $warning-color +$button-destroy-color: $alert-color $button-submit-color: $primary-color $button-cancel-color: $secondary-color diff --git a/app/assets/stylesheets/supplier/foundation1/_qsections.css.sass b/app/assets/stylesheets/supplier/foundation1/_qsections.css.sass index 3523e35d..49060c69 100644 --- a/app/assets/stylesheets/supplier/foundation1/_qsections.css.sass +++ b/app/assets/stylesheets/supplier/foundation1/_qsections.css.sass @@ -1,20 +1,21 @@ .section-edit-mode-button - +button - margin: 0 - padding: 2px + margin-left: 5px span @extend .fa @extend .fa-lg @extend .fa-edit .section-normal-mode-button - +button - margin: 0 - padding: 2px - margin-left: 8px + margin-left: 5px span @extend .fa @extend .fa-lg @extend .fa-save +.section-rollback-button + margin-left: 5px + span + @extend .fa + @extend .fa-lg + @extend .fa-undo .arrange-tables-type-button +button($bg: $secondary-color, $padding: $button-tny) .arrange-tables-current-type @@ -31,7 +32,7 @@ .section-manage-tables .dropdown-container margin-right: 10px - $icon-right-margin: 8px + $icon-right-margin: 12px ul list-style: none margin: 0 @@ -44,7 +45,7 @@ padding: 4px 7px &:hover background-color: #ddd - span.table-qr-codes + span.qr-icon margin-right: $icon-right-margin .section-destroy color: $alert-color diff --git a/app/assets/stylesheets/supplier/foundation1/components/_menu_side.css.sass b/app/assets/stylesheets/supplier/foundation1/components/_menu_side.css.sass index deeaee0e..43ce7f31 100644 --- a/app/assets/stylesheets/supplier/foundation1/components/_menu_side.css.sass +++ b/app/assets/stylesheets/supplier/foundation1/components/_menu_side.css.sass @@ -20,6 +20,15 @@ aside.side-menu .title border-bottom: 1px solid #aaa margin-bottom: 4px + .settings-icon + margin-right: 18px + @extend .fa, .fa-gears + .about-mozo-icon + margin-right: 18px + @extend .fa, .fa-info-circle + .sign-out-icon + margin-right: 18px + @extend .fa, .fa-caret-square-o-left .supplier-close-shop +alert($bg: $alert-color, $radius: true) padding: 3px diff --git a/app/assets/stylesheets/supplier/foundation1/components/_tables.css.sass b/app/assets/stylesheets/supplier/foundation1/components/_tables.css.sass index f976a375..9524f2e4 100644 --- a/app/assets/stylesheets/supplier/foundation1/components/_tables.css.sass +++ b/app/assets/stylesheets/supplier/foundation1/components/_tables.css.sass @@ -24,19 +24,17 @@ table span @extend .fa @extend .fa-pencil -a.table-qr-codes - +button($bg: $secondary-color) - span - @extend .fa - @extend .fa-qrcode -span.table-qr-codes +span.qr-icon @extend .fa @extend .fa-qrcode + + span + padding-left: 7px +a.table-qr-codes + +button($bg: $secondary-color, $padding: $button-sml) .table-destroy +button($bg: $secondary-color) +button-icon-only color: $warning-color - margin-left: 8px span @extend .fa diff --git a/config/locales/supplier.en.yml b/config/locales/supplier.en.yml index 6086bda2..12e6c061 100644 --- a/config/locales/supplier.en.yml +++ b/config/locales/supplier.en.yml @@ -19,11 +19,6 @@ en: no_lists: No active lists active_orders: no_orders: No active orders - messages: - could_not_arrange_tables: 'The tables could not be arranged' - could_not_arrange_tables_distributed: 'The tables could not be arranged. Does the ${models.section|downcase} have a width and a height?' - could_not_arrange_tables_by_row: 'The tables could not be arranged. Does the ${models.section|downcase} have a width and a height?' - could_not_arrange_tables_by_column: 'The tables could not be arranged. Does the ${models.section|downcase} have a width and a height?' top_menu: menu: Menu active_lists: @@ -119,6 +114,7 @@ en: after_field: ' ${models.plural.table}' close_button: Close arrange_button: Distribute + cannot_arrange: 'The tables could not be arranged. Does the ${models.section|downcase} have a width and a height?' settings: title: Settings save: Save settings diff --git a/config/locales/supplier.nl.yml b/config/locales/supplier.nl.yml index 6d6dc798..447bb2e8 100644 --- a/config/locales/supplier.nl.yml +++ b/config/locales/supplier.nl.yml @@ -18,11 +18,6 @@ nl: no_lists: Geen actieve ${models.plural.list} active_orders: no_orders: Geen actieve ${models.plural.order} - messages: - could_not_arrange_tables: 'De ${models.plural.table} konden niet worden gepositioneerd' - could_not_arrange_tables_distributed: 'De ${models.plural.table} konden niet worden gepositioneerd. Heeft de ${models.section|downcase} een hoogte en breedte?' - could_not_arrange_tables_by_row: 'De ${models.plural.table} konden niet worden gepositioneerd. Heeft de ${models.section|downcase} een hoogte en breedte?' - could_not_arrange_tables_by_column: 'De ${models.plural.table} konden niet worden gepositioneerd. Heeft de ${models.section|downcase} een hoogte en breedte?' top_menu: menu: Menu active_lists: @@ -118,6 +113,7 @@ nl: after_field: ' ${models.plural.table}' close_button: Sluiten arrange_button: Positioneer + cannot_arrange: 'De ${models.plural.table} konden niet worden gepositioneerd. Heeft de ${models.section|downcase} een hoogte en breedte?' settings: title: Instellingen save: Instellingen opslaan