diff --git a/Gemfile b/Gemfile
index f792b268..7cf43305 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,6 +1,6 @@
source 'https://rubygems.org'
-gem 'rails', '3.2.8'
+gem 'rails', '3.2.9'
gem 'rack-cors', :require => 'rack/cors'
# Bundle edge Rails instead:
diff --git a/Gemfile.lock b/Gemfile.lock
index 46be1878..3263f1b0 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -19,45 +19,44 @@ GIT
GEM
remote: https://rubygems.org/
specs:
- actionmailer (3.2.8)
- actionpack (= 3.2.8)
+ actionmailer (3.2.9)
+ actionpack (= 3.2.9)
mail (~> 2.4.4)
- actionpack (3.2.8)
- activemodel (= 3.2.8)
- activesupport (= 3.2.8)
+ actionpack (3.2.9)
+ activemodel (= 3.2.9)
+ activesupport (= 3.2.9)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.0)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
- sprockets (~> 2.1.3)
- activemodel (3.2.8)
- activesupport (= 3.2.8)
+ sprockets (~> 2.2.1)
+ activemodel (3.2.9)
+ activesupport (= 3.2.9)
builder (~> 3.0.0)
- activerecord (3.2.8)
- activemodel (= 3.2.8)
- activesupport (= 3.2.8)
+ activerecord (3.2.9)
+ activemodel (= 3.2.9)
+ activesupport (= 3.2.9)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
- activeresource (3.2.8)
- activemodel (= 3.2.8)
- activesupport (= 3.2.8)
- activesupport (3.2.8)
+ activeresource (3.2.9)
+ activemodel (= 3.2.9)
+ activesupport (= 3.2.9)
+ activesupport (3.2.9)
i18n (~> 0.6)
multi_json (~> 1.0)
- addressable (2.3.2)
ansi (1.4.3)
arel (3.0.2)
bcrypt-ruby (3.0.1)
builder (3.0.4)
- capybara (1.1.3)
+ capybara (2.0.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
- xpath (~> 0.1.4)
+ xpath (~> 1.0.0)
childprocess (0.3.6)
ffi (~> 1.0, >= 1.0.6)
chunky_png (1.2.6)
@@ -125,8 +124,8 @@ GEM
actionpack (>= 3.1)
less (~> 2.2.0)
libv8 (3.3.10.4)
- libwebsocket (0.1.5)
- addressable
+ libwebsocket (0.1.6)
+ websocket
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
@@ -152,42 +151,40 @@ GEM
rack
rack-test (0.6.2)
rack (>= 1.0)
- rails (3.2.8)
- actionmailer (= 3.2.8)
- actionpack (= 3.2.8)
- activerecord (= 3.2.8)
- activeresource (= 3.2.8)
- activesupport (= 3.2.8)
+ rails (3.2.9)
+ actionmailer (= 3.2.9)
+ actionpack (= 3.2.9)
+ activerecord (= 3.2.9)
+ activeresource (= 3.2.9)
+ activesupport (= 3.2.9)
bundler (~> 1.0)
- railties (= 3.2.8)
- railties (3.2.8)
- actionpack (= 3.2.8)
- activesupport (= 3.2.8)
+ railties (= 3.2.9)
+ railties (3.2.9)
+ actionpack (= 3.2.9)
+ activesupport (= 3.2.9)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
- rake (0.9.2.2)
+ rake (10.0.2)
rdoc (3.12)
json (~> 1.4)
rest-client (1.6.7)
mime-types (>= 1.16)
rqrcode (0.4.2)
- rspec (2.11.0)
- rspec-core (~> 2.11.0)
- rspec-expectations (~> 2.11.0)
- rspec-mocks (~> 2.11.0)
- rspec-core (2.11.1)
- rspec-expectations (2.11.3)
+ rspec-core (2.12.0)
+ rspec-expectations (2.12.0)
diff-lcs (~> 1.1.3)
- rspec-mocks (2.11.3)
- rspec-rails (2.11.4)
+ rspec-mocks (2.12.0)
+ rspec-rails (2.12.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
- rspec (~> 2.11.0)
+ rspec-core (~> 2.12.0)
+ rspec-expectations (~> 2.12.0)
+ rspec-mocks (~> 2.12.0)
rubyzip (0.9.9)
- sass (3.2.2)
+ sass (3.2.3)
sass-rails (3.2.5)
railties (~> 3.2.0)
sass (>= 3.1.10)
@@ -197,7 +194,7 @@ GEM
libwebsocket (~> 0.1.3)
multi_json (~> 1.0)
rubyzip
- slim (1.3.3)
+ slim (1.3.4)
temple (~> 0.5.5)
tilt (~> 1.3.3)
slim-rails (1.0.3)
@@ -206,8 +203,9 @@ GEM
railties (~> 3.0)
slim (~> 1.0)
slop (3.3.3)
- sprockets (2.1.3)
+ sprockets (2.2.1)
hike (~> 1.2)
+ multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
subexec (0.2.2)
@@ -235,7 +233,8 @@ GEM
multi_json (~> 1.0, >= 1.0.2)
warden (1.1.1)
rack (>= 1.0)
- xpath (0.1.4)
+ websocket (1.0.3)
+ xpath (1.0.0)
nokogiri (~> 1.3)
PLATFORMS
@@ -256,7 +255,7 @@ DEPENDENCIES
mini_magick
pry
rack-cors
- rails (= 3.2.8)
+ rails (= 3.2.9)
rqrcode
rspec-rails
sass-rails (~> 3.2.3)
diff --git a/app/assets/javascripts/supplier/initializer.js.coffee b/app/assets/javascripts/supplier/initializer.js.coffee
new file mode 100644
index 00000000..57b20ff4
--- /dev/null
+++ b/app/assets/javascripts/supplier/initializer.js.coffee
@@ -0,0 +1,40 @@
+$( ->
+ $("input.location_picker").each( (i)->
+ location_input = $(this)
+ map_div = $('
').addClass("location_picker_map")
+
+ location_input.before(map_div)
+ #this.parentNode.insertBefore(map_div, this)
+ location_input.hide()
+
+ lat = 52.07436798080633
+ lng = 4.316811561584473
+ if (this.value.split(',').length == 2)
+ values = this.value.split(',')
+ lat = values[0]
+ lng = values[1]
+ center = new google.maps.LatLng(lat,lng)
+ mapOptions =
+ zoom: 13
+ center: center
+ mapTypeId: google.maps.MapTypeId.ROADMAP,
+ zoomControl: true
+ zoomControlOptions:
+ style: google.maps.ZoomControlStyle.SMALL
+ mapTypeControl: false
+ panControl: false
+ scaleControl: false
+ streetViewControl: false
+
+ map = new google.maps.Map(map_div.get(0), mapOptions)
+ marker = new google.maps.Marker(
+ position: center
+ map: map
+ title: 'Location'
+ )
+ google.maps.event.addListener(map, 'click', (point)->
+ marker.setPosition(point.latLng)
+ location_input.val point.latLng.lat() + ','+ point.latLng.lng()
+ )
+ )
+)
diff --git a/app/assets/stylesheets/supplier/structure.css.sass b/app/assets/stylesheets/supplier/structure.css.sass
index 38ff1649..23e078b7 100644
--- a/app/assets/stylesheets/supplier/structure.css.sass
+++ b/app/assets/stylesheets/supplier/structure.css.sass
@@ -20,3 +20,9 @@ body
.alert
form
margin: 0
+.location_picker_map
+ width: 300px
+ height: 200px
+ border: 1px solid black
+ padding: 2px
+ display: inline-block
diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb
index bac370cb..58d2f8f2 100644
--- a/app/controllers/dashboard_controller.rb
+++ b/app/controllers/dashboard_controller.rb
@@ -29,11 +29,12 @@ class DashboardController < ApplicationController
# GET /select_qr_image.svg
def table_qr_image
@table = Table.find(params[:table_id])
- code = {table_id: @table.id}.to_json
+ #code = [get_the_app_url, {table_id: @table.id}.to_json].join('?')
+ code = "#{scan_url}?json=#{{table_id: @table.id}.to_json}"
respond_to do |format|
format.html
format.svg { render :qrcode => code, :level => :l, :unit => 10, table_number: @table.number, qcontainer: true }
- format.png { render qrcode: code, table_number: @table.number, qcontainer: true }
+ format.png { render qrcode: code, level: :l, table_number: @table.number, qcontainer: true }
end
end
@@ -41,9 +42,13 @@ class DashboardController < ApplicationController
code = 'qwaiter.com'
respond_to do |format|
format.html
- format.svg { render :qrcode => code, :level => :l, :unit => 10}
- format.png { render qrcode: code}
+ format.png { render qrcode: code, level: :h, unit: 10, size: 12}
+ format.svg { render qrcode: code, level: :h, unit: 10, size: 12}
end
end
+ def scan
+
+ end
+
end
diff --git a/app/models/supplier.rb b/app/models/supplier.rb
index 9423a543..51777738 100644
--- a/app/models/supplier.rb
+++ b/app/models/supplier.rb
@@ -6,6 +6,8 @@ class Supplier
property :name
property :open, type: :boolean, default: false
property :night_offset, type: Float
+ property :lat, type: Float, default: 52.08062426379751
+ property :lng, type: Float, default: 4.312562942504883
#WIFI
property :offer_wifi
@@ -24,6 +26,16 @@ class Supplier
after_create :add_section_on_create
+ def location=(val)
+ lat, lng = val.strip.split(/[ ,]+/).map(&:to_f)
+ self.lat = lat
+ self.lng = lng
+ end
+
+ def location
+ [lat, lng].join(',')
+ end
+
def active_orders(options = {})
return @active_orders if @active_orders && @active_orders_options == options
@active_orders_options = options
diff --git a/app/views/dashboard/enquete.html.slim b/app/views/dashboard/enquete.html.slim
index e2f5c8f0..bc3910c4 100644
--- a/app/views/dashboard/enquete.html.slim
+++ b/app/views/dashboard/enquete.html.slim
@@ -1,2 +1,2 @@
-iframe[ src="https://docs.google.com/spreadsheet/embeddedform?formkey=dEI3NmlWRUFMbnVySWd6SzljYjM3NVE6MQ" width="760" height="2332"
+iframe[ src="https://docs.google.com/spreadsheet/embeddedform?formkey=dEI3NmlWRUFMbnVySWd6SzljYjM3NVE6MQ" width="760" height="2432"
frameborder="0" marginheight="0" marginwidth="0"] Loading..
diff --git a/app/views/dashboard/scan.html.slim b/app/views/dashboard/scan.html.slim
new file mode 100644
index 00000000..3af1ced1
--- /dev/null
+++ b/app/views/dashboard/scan.html.slim
@@ -0,0 +1,2 @@
+- title 'Get the mobile app to order drinks'
+p Get the mobile app
diff --git a/app/views/layouts/tablet.html.slim b/app/views/layouts/tablet.html.slim
index c30a78f8..945d774c 100644
--- a/app/views/layouts/tablet.html.slim
+++ b/app/views/layouts/tablet.html.slim
@@ -17,6 +17,7 @@ html lang="en"
link href="/images/apple-touch-icon-72x72.png" rel="apple-touch-icon-precomposed" sizes="72x72"
link href="/images/apple-touch-icon.png" rel="apple-touch-icon-precomposed"
link href="/favicon.ico" rel="shortcut icon"
+ = yield :head
body
.navbar.navbar-fixed-top.navbar-inverse
diff --git a/app/views/supplier/edit.html.slim b/app/views/supplier/edit.html.slim
index b2dd04a1..f6639358 100644
--- a/app/views/supplier/edit.html.slim
+++ b/app/views/supplier/edit.html.slim
@@ -1,3 +1,6 @@
+- content_for :head do
+ = javascript_include_tag 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false'
+
= form_for @supplier, url: supplier_update_settings_path, html: {class: 'form-horizontal'} do |f|
= render 'error_messages', target: current_supplier
.control-group class=(@supplier.errors[:name].any? ? 'error' : nil)
@@ -8,6 +11,10 @@
= f.label :email, class: 'control-label'
.controls
= f.text_field :email, class: 'text_field'
+ .control-group class=(@supplier.errors[:location].any? ? 'error' : nil)
+ = f.label :location, class: 'control-label'
+ .controls
+ = f.text_field :location, class: 'location_picker'
.control-group class=(@supplier.errors[:offer_wifi].any? ? 'error' : nil)
= f.label :offer_wifi, class: 'control-label'
.controls
diff --git a/config/routes.rb b/config/routes.rb
index 62d9ebcd..e8f815d1 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -62,15 +62,17 @@ Qrammer::Application.routes.draw do
#match '/show_products' => 'dashboard#show_products', as: :user_products
-
- # DEVELOPMENT ONLY
- get '/qr' => 'dashboard#qr'
- get '/demo_both' => 'dashboard#demo_both'
+ # GENERAL
get '/enquete' => 'dashboard#enquete'
get '/cartoon' => 'dashboard#cartoon'
get '/bars-restaurants' => 'dashboard#bars_restaurants', as: :bars_restaurants
get '/clients' => 'dashboard#clients'
get '/contact' => 'dashboard#contact'
+ get '/scan' => 'dashboard#scan', as: :scan
+
+ # DEVELOPMENT ONLY
+ get '/qr' => 'dashboard#qr'
+ get '/demo_both' => 'dashboard#demo_both'
namespace :suppliers, path: '/supplier' do
resources :sections do
diff --git a/lib/rqrcode-rails3/qr_container.svg b/lib/rqrcode-rails3/qr_container.svg
index ba9bbeb9..c4932b3e 100644
--- a/lib/rqrcode-rails3/qr_container.svg
+++ b/lib/rqrcode-rails3/qr_container.svg
@@ -15,173 +15,161 @@
id="svg2991"
version="1.1"
inkscape:version="0.48.2 r9819"
- sodipodi:docname="qr_container.svg">
+ sodipodi:docname="table_qr_image2.svg">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ id="defs3">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
image/svg+xml
-
+
@@ -220,136 +208,93 @@
transform="translate(0,141.73227)">
#qrcode
+ transform="matrix(0.39937678,0,0,0.39937678,48.985567,-91.969866)">#qrcode
#table_number
-
- Q
-
-
- #table_number
+
+
+ Q
+
+ WAITE
-
-
- R
-
-
-
-
-
-
-
-
+ id="text7"
+ style="font-size:37.90859985px">
+ WAITE
+
+
+ R
+
+
+
+
+
+
+
+
+
diff --git a/lib/rqrcode-rails3/renderers/svg.rb b/lib/rqrcode-rails3/renderers/svg.rb
index ad2d3c09..55a51b9c 100644
--- a/lib/rqrcode-rails3/renderers/svg.rb
+++ b/lib/rqrcode-rails3/renderers/svg.rb
@@ -22,13 +22,13 @@ module RQRCode
close_tag = ""
result = []
- qrcode.modules.each_index do |c|
+ for c in 0...qrcode.module_count
tmp = []
- qrcode.modules.each_index do |r|
+ for r in 0...qrcode.module_count
y = c*unit + offset
x = r*unit + offset
- next unless qrcode.is_dark(c, r)
+ next unless qrcode.dark?(c, r)
tmp << %{}
end
result << tmp.join("\n")