From 7f27d043eb0421fd42ead94e7f85a2b8deb0e04b Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Tue, 11 Dec 2012 00:48:29 +0100 Subject: [PATCH] day work towards ios and qr optimization --- app/assets/images/icons/list.svg | 389 +++++++++--------- app/assets/images/icons/menu.svg | 4 +- app/assets/images/icons/needs-help.svg | 11 +- app/assets/images/icons/needs-payment.svg | 9 +- app/assets/images/icons/order-check.svg | 4 +- .../javascripts/user/application.js.erb | 16 +- app/assets/javascripts/user/quser.js.coffee | 2 - .../stylesheets/user/_constants.css.sass | 8 +- app/controllers/dashboard_controller.rb | 7 +- app/controllers/user_controller.rb | 2 +- app/views/layouts/phone.html.slim | 6 +- app/views/theme1/_navigation.html.slim | 2 +- app/views/user/active_list.html.slim | 6 +- .../user/{home.html.slim => index.html.slim} | 0 app/views/user/list_products.html.slim | 6 +- config/routes.rb | 6 +- lib/rqrcode-rails3/qr_container.svg | 2 +- script/build_mobile_app.rb | 60 ++- 18 files changed, 287 insertions(+), 253 deletions(-) rename app/views/user/{home.html.slim => index.html.slim} (100%) diff --git a/app/assets/images/icons/list.svg b/app/assets/images/icons/list.svg index bcd24df0..563063ee 100644 --- a/app/assets/images/icons/list.svg +++ b/app/assets/images/icons/list.svg @@ -17,8 +17,8 @@ inkscape:version="0.48.2 r9819" sodipodi:docname="list.svg" inkscape:export-filename="/Users/bterkuile/companytools/development/rails/qwaiter/app/assets/images/icons/list.png" - inkscape:export-xdpi="21.549999" - inkscape:export-ydpi="21.549999"> + inkscape:export-xdpi="21.969999" + inkscape:export-ydpi="21.969999"> - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + inkscape:connector-curvature="0" + inkscape:export-filename="/Users/bterkuile/companytools/development/rails/qwaiter/app/assets/images/icons/list.png" + inkscape:export-xdpi="24.829473" + inkscape:export-ydpi="24.829473" /> + height="1052.3622" + inkscape:export-filename="/Users/bterkuile/companytools/development/rails/qwaiter/app/assets/images/icons/list.png" + inkscape:export-xdpi="24.829473" + inkscape:export-ydpi="24.829473" /> + height="1052.3622" + inkscape:export-filename="/Users/bterkuile/companytools/development/rails/qwaiter/app/assets/images/icons/list.png" + inkscape:export-xdpi="24.829473" + inkscape:export-ydpi="24.829473" /> + height="1052.3622" + inkscape:export-filename="/Users/bterkuile/companytools/development/rails/qwaiter/app/assets/images/icons/list.png" + inkscape:export-xdpi="24.829473" + inkscape:export-ydpi="24.829473" /> + height="1052.3622" + inkscape:export-filename="/Users/bterkuile/companytools/development/rails/qwaiter/app/assets/images/icons/list.png" + inkscape:export-xdpi="24.829473" + inkscape:export-ydpi="24.829473" /> + inkscape:export-xdpi="8.2399998" + inkscape:export-ydpi="8.2399998"> image/svg+xml - + @@ -57,16 +57,17 @@ ? + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#7bb459;fill-opacity:1;font-family:Sans;-inkscape-font-specification:Clean Bold">? diff --git a/app/assets/images/icons/needs-payment.svg b/app/assets/images/icons/needs-payment.svg index 2122fb5d..86174852 100644 --- a/app/assets/images/icons/needs-payment.svg +++ b/app/assets/images/icons/needs-payment.svg @@ -57,16 +57,17 @@ + style="-inkscape-font-specification:Clean Bold;font-family:Sans;font-weight:bold;font-style:normal;font-stretch:normal;font-variant:normal;fill:#7bb459;fill-opacity:1">€ diff --git a/app/assets/images/icons/order-check.svg b/app/assets/images/icons/order-check.svg index 25025ebb..1975595b 100644 --- a/app/assets/images/icons/order-check.svg +++ b/app/assets/images/icons/order-check.svg @@ -371,7 +371,7 @@ inkscape:pageshadow="2" inkscape:zoom="4.6911765" inkscape:cx="50.233542" - inkscape:cy="13.840125" + inkscape:cy="82.053291" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" @@ -379,7 +379,7 @@ inkscape:window-height="856" inkscape:window-x="4" inkscape:window-y="0" - inkscape:window-maximized="1"> + inkscape:window-maximized="0"> code, :level => :l, :unit => 10, table_number: @table.number, qcontainer: true } @@ -42,8 +43,8 @@ class DashboardController < ApplicationController code = 'qwaiter.com' respond_to do |format| format.html - format.png { render qrcode: code, level: :h, unit: 10, size: 12} - format.svg { render qrcode: code, level: :h, unit: 10, size: 12} + format.png { render qrcode: code, level: :h, unit: 10, size: 7} + format.svg { render qrcode: code, level: :h, unit: 10, size: 7} end end diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index d3e835e8..bcfda3e4 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -35,7 +35,7 @@ class UserController < ApplicationController headers['Access-Control-Allow-Headers'] = '*' end - def home + def index handle_message_params end diff --git a/app/views/layouts/phone.html.slim b/app/views/layouts/phone.html.slim index 7fcbe663..9257f40c 100644 --- a/app/views/layouts/phone.html.slim +++ b/app/views/layouts/phone.html.slim @@ -22,7 +22,7 @@ html lang="en" var data_host = 'http://data.qwaiter.com'; var event_host = '#{event_host}'; var $locale = 'en'; - var $asset_path = 'file:///android_asset/assets/'; + var $asset_path = '##assets_path##'; - else javascript: var QMobile, Qwaiter, Quser; @@ -43,8 +43,8 @@ html lang="en" this.authentication_string_storage = 'auth_token='+token; this.authentication_object_storage = '{"auth_token": "'+token+'"}' }, - root_url: function(){return 'file:///Users/bterkuile/Documents/workspace/Qwaiter/assets'}, - root_url: function(){return ''}, + root_url: function(){return 'file:///Users/bterkuile/Documents/workspace/Qwaiter/assets/user'}, + root_url: function(){return '/user'}, goHome: function(){ redirect_to('user_root')}, connection_problem: function(){alert('There is a problem connecting to the server')}, locale: function(){ return $locale || ($locale = 'en')}, diff --git a/app/views/theme1/_navigation.html.slim b/app/views/theme1/_navigation.html.slim index ba4af5a6..65a7dfed 100644 --- a/app/views/theme1/_navigation.html.slim +++ b/app/views/theme1/_navigation.html.slim @@ -1,5 +1,5 @@ ul.nav - li[class=(current_page?(controller: '/dashboard', action: 'home') ? :active : nil)]= link_to t('menu.home'), root_path + li[class=(current_page?(controller: '/dashboard', action: 'index') ? :active : nil)]= link_to t('menu.home'), root_path li[class=(current_page?(controller: '/dashboard', action: 'clients') ? :active : nil)]= link_to t('menu.clients'), clients_path li[class=(current_page?(controller: '/dashboard', action: 'bars_restaurants') ? :active : nil)]= link_to t('menu.bars_restaurants'), bars_restaurants_path li[class=(current_page?(controller: '/dashboard', action: 'enquete') ? :active : nil)]= link_to t('menu.enquete'), enquete_path diff --git a/app/views/user/active_list.html.slim b/app/views/user/active_list.html.slim index 16966741..b1de8455 100644 --- a/app/views/user/active_list.html.slim +++ b/app/views/user/active_list.html.slim @@ -1,13 +1,13 @@ = top_bar title: 'active_list.title' do - .pull-right - .table-number - .supplier-name .action-buttons = link_to content_tag(:span, t('helpers.links.place_order')), user_list_products_path, class: ['user-top-button'], id: 'place-order-on-list' span#list-needs-payment-button.user-top-button span span#list-needs-help-button.user-top-button span + .pull-right + .table-number + .supplier-name .well table#active-list-table.table thead diff --git a/app/views/user/home.html.slim b/app/views/user/index.html.slim similarity index 100% rename from app/views/user/home.html.slim rename to app/views/user/index.html.slim diff --git a/app/views/user/list_products.html.slim b/app/views/user/list_products.html.slim index 336b73d7..b54eeb65 100644 --- a/app/views/user/list_products.html.slim +++ b/app/views/user/list_products.html.slim @@ -1,13 +1,13 @@ = top_bar title: 'show_products.title' do - .pull-right - .table-number - .supplier-name .action-buttons = link_to content_tag(:span, t('helpers.links.show_active_list'), list: List.model_name.human), user_active_list_path, class: ['user-top-button'], id: 'show-active-list' span#list-needs-payment-button.user-top-button span span#list-needs-help-button.user-top-button span + .pull-right + .table-number + .supplier-name .well table#products-table.table diff --git a/config/routes.rb b/config/routes.rb index 956c830f..7b34325d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -35,8 +35,8 @@ Qwaiter::Application.routes.draw do # USER #default_url_options format: 'html' - get '/user/home' => 'user#home', as: :user_root - get '/user' => 'user#home' + get '/user/home' => 'index#home', as: :user_root + get '/user' => 'user#index' get '/user/active_list(.:format)' => 'user#active_list', as: :user_active_list get '/user/list_info' => 'user#list_info', as: :user_list_info, via: [:get, :options] post '/user/needs_help' => 'user#needs_help', as: :user_needs_help @@ -65,7 +65,7 @@ Qwaiter::Application.routes.draw do get '/bars-restaurants' => 'dashboard#bars_restaurants', as: :bars_restaurants get '/clients' => 'dashboard#clients' get '/contact' => 'dashboard#contact' - get '/scan' => 'dashboard#scan', as: :scan + get '/s' => 'dashboard#scan', as: :scan # DEVELOPMENT ONLY get '/qr' => 'dashboard#qr' diff --git a/lib/rqrcode-rails3/qr_container.svg b/lib/rqrcode-rails3/qr_container.svg index c4932b3e..f3e7b4f5 100644 --- a/lib/rqrcode-rails3/qr_container.svg +++ b/lib/rqrcode-rails3/qr_container.svg @@ -208,7 +208,7 @@ transform="translate(0,141.73227)"> #qrcode + transform="translate(48.985567,-91.969866) scale(0.51) ">#qrcode ' + ios_view.gsub! '##assets_path##', './assets/' + File.open(File.join(ios_root, "#{action}.html"), 'w'){|f| f.puts ios_view} + + ## MODIFY FOR ANDROID #result.sub! //, '' - result.gsub! /(href|src)="([^#])/, %|\\1="#{root_url}\\2| - File.open(File.join(android_root, 'user', "#{action}.html"), 'w'){|f| f.puts result} + android_view = result.gsub /(href|src)="\/user\/([^"]+)/, %|\\1="/\\2| # replace absolute path names to relative ones + android_view.gsub! /(href|src)="([^#])/, %|\\1="#{android_root_url}\\2| # replace relative uri's with android specific one + android_view.gsub! '##assets_path##', 'file:///android_asset/assets/' + # write to android path + File.open(File.join(android_root, "#{action}.html"), 'w'){|f| f.puts android_view} end end view = view = ActionView::Base.new(uc.view_paths)