update qr code system and add location setter for suppliers

This commit is contained in:
2012-11-19 19:09:23 +01:00
parent 0036e5da60
commit 633665daaa
13 changed files with 369 additions and 350 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
source 'https://rubygems.org' source 'https://rubygems.org'
gem 'rails', '3.2.8' gem 'rails', '3.2.9'
gem 'rack-cors', :require => 'rack/cors' gem 'rack-cors', :require => 'rack/cors'
# Bundle edge Rails instead: # Bundle edge Rails instead:
+44 -45
View File
@@ -19,45 +19,44 @@ GIT
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actionmailer (3.2.8) actionmailer (3.2.9)
actionpack (= 3.2.8) actionpack (= 3.2.9)
mail (~> 2.4.4) mail (~> 2.4.4)
actionpack (3.2.8) actionpack (3.2.9)
activemodel (= 3.2.8) activemodel (= 3.2.9)
activesupport (= 3.2.8) activesupport (= 3.2.9)
builder (~> 3.0.0) builder (~> 3.0.0)
erubis (~> 2.7.0) erubis (~> 2.7.0)
journey (~> 1.0.4) journey (~> 1.0.4)
rack (~> 1.4.0) rack (~> 1.4.0)
rack-cache (~> 1.2) rack-cache (~> 1.2)
rack-test (~> 0.6.1) rack-test (~> 0.6.1)
sprockets (~> 2.1.3) sprockets (~> 2.2.1)
activemodel (3.2.8) activemodel (3.2.9)
activesupport (= 3.2.8) activesupport (= 3.2.9)
builder (~> 3.0.0) builder (~> 3.0.0)
activerecord (3.2.8) activerecord (3.2.9)
activemodel (= 3.2.8) activemodel (= 3.2.9)
activesupport (= 3.2.8) activesupport (= 3.2.9)
arel (~> 3.0.2) arel (~> 3.0.2)
tzinfo (~> 0.3.29) tzinfo (~> 0.3.29)
activeresource (3.2.8) activeresource (3.2.9)
activemodel (= 3.2.8) activemodel (= 3.2.9)
activesupport (= 3.2.8) activesupport (= 3.2.9)
activesupport (3.2.8) activesupport (3.2.9)
i18n (~> 0.6) i18n (~> 0.6)
multi_json (~> 1.0) multi_json (~> 1.0)
addressable (2.3.2)
ansi (1.4.3) ansi (1.4.3)
arel (3.0.2) arel (3.0.2)
bcrypt-ruby (3.0.1) bcrypt-ruby (3.0.1)
builder (3.0.4) builder (3.0.4)
capybara (1.1.3) capybara (2.0.0)
mime-types (>= 1.16) mime-types (>= 1.16)
nokogiri (>= 1.3.3) nokogiri (>= 1.3.3)
rack (>= 1.0.0) rack (>= 1.0.0)
rack-test (>= 0.5.4) rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0) selenium-webdriver (~> 2.0)
xpath (~> 0.1.4) xpath (~> 1.0.0)
childprocess (0.3.6) childprocess (0.3.6)
ffi (~> 1.0, >= 1.0.6) ffi (~> 1.0, >= 1.0.6)
chunky_png (1.2.6) chunky_png (1.2.6)
@@ -125,8 +124,8 @@ GEM
actionpack (>= 3.1) actionpack (>= 3.1)
less (~> 2.2.0) less (~> 2.2.0)
libv8 (3.3.10.4) libv8 (3.3.10.4)
libwebsocket (0.1.5) libwebsocket (0.1.6)
addressable websocket
mail (2.4.4) mail (2.4.4)
i18n (>= 0.4.0) i18n (>= 0.4.0)
mime-types (~> 1.16) mime-types (~> 1.16)
@@ -152,42 +151,40 @@ GEM
rack rack
rack-test (0.6.2) rack-test (0.6.2)
rack (>= 1.0) rack (>= 1.0)
rails (3.2.8) rails (3.2.9)
actionmailer (= 3.2.8) actionmailer (= 3.2.9)
actionpack (= 3.2.8) actionpack (= 3.2.9)
activerecord (= 3.2.8) activerecord (= 3.2.9)
activeresource (= 3.2.8) activeresource (= 3.2.9)
activesupport (= 3.2.8) activesupport (= 3.2.9)
bundler (~> 1.0) bundler (~> 1.0)
railties (= 3.2.8) railties (= 3.2.9)
railties (3.2.8) railties (3.2.9)
actionpack (= 3.2.8) actionpack (= 3.2.9)
activesupport (= 3.2.8) activesupport (= 3.2.9)
rack-ssl (~> 1.3.2) rack-ssl (~> 1.3.2)
rake (>= 0.8.7) rake (>= 0.8.7)
rdoc (~> 3.4) rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0) thor (>= 0.14.6, < 2.0)
rake (0.9.2.2) rake (10.0.2)
rdoc (3.12) rdoc (3.12)
json (~> 1.4) json (~> 1.4)
rest-client (1.6.7) rest-client (1.6.7)
mime-types (>= 1.16) mime-types (>= 1.16)
rqrcode (0.4.2) rqrcode (0.4.2)
rspec (2.11.0) rspec-core (2.12.0)
rspec-core (~> 2.11.0) rspec-expectations (2.12.0)
rspec-expectations (~> 2.11.0)
rspec-mocks (~> 2.11.0)
rspec-core (2.11.1)
rspec-expectations (2.11.3)
diff-lcs (~> 1.1.3) diff-lcs (~> 1.1.3)
rspec-mocks (2.11.3) rspec-mocks (2.12.0)
rspec-rails (2.11.4) rspec-rails (2.12.0)
actionpack (>= 3.0) actionpack (>= 3.0)
activesupport (>= 3.0) activesupport (>= 3.0)
railties (>= 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) rubyzip (0.9.9)
sass (3.2.2) sass (3.2.3)
sass-rails (3.2.5) sass-rails (3.2.5)
railties (~> 3.2.0) railties (~> 3.2.0)
sass (>= 3.1.10) sass (>= 3.1.10)
@@ -197,7 +194,7 @@ GEM
libwebsocket (~> 0.1.3) libwebsocket (~> 0.1.3)
multi_json (~> 1.0) multi_json (~> 1.0)
rubyzip rubyzip
slim (1.3.3) slim (1.3.4)
temple (~> 0.5.5) temple (~> 0.5.5)
tilt (~> 1.3.3) tilt (~> 1.3.3)
slim-rails (1.0.3) slim-rails (1.0.3)
@@ -206,8 +203,9 @@ GEM
railties (~> 3.0) railties (~> 3.0)
slim (~> 1.0) slim (~> 1.0)
slop (3.3.3) slop (3.3.3)
sprockets (2.1.3) sprockets (2.2.1)
hike (~> 1.2) hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0) rack (~> 1.0)
tilt (~> 1.1, != 1.3.0) tilt (~> 1.1, != 1.3.0)
subexec (0.2.2) subexec (0.2.2)
@@ -235,7 +233,8 @@ GEM
multi_json (~> 1.0, >= 1.0.2) multi_json (~> 1.0, >= 1.0.2)
warden (1.1.1) warden (1.1.1)
rack (>= 1.0) rack (>= 1.0)
xpath (0.1.4) websocket (1.0.3)
xpath (1.0.0)
nokogiri (~> 1.3) nokogiri (~> 1.3)
PLATFORMS PLATFORMS
@@ -256,7 +255,7 @@ DEPENDENCIES
mini_magick mini_magick
pry pry
rack-cors rack-cors
rails (= 3.2.8) rails (= 3.2.9)
rqrcode rqrcode
rspec-rails rspec-rails
sass-rails (~> 3.2.3) sass-rails (~> 3.2.3)
@@ -0,0 +1,40 @@
$( ->
$("input.location_picker").each( (i)->
location_input = $(this)
map_div = $('<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()
)
)
)
@@ -20,3 +20,9 @@ body
.alert .alert
form form
margin: 0 margin: 0
.location_picker_map
width: 300px
height: 200px
border: 1px solid black
padding: 2px
display: inline-block
+9 -4
View File
@@ -29,11 +29,12 @@ class DashboardController < ApplicationController
# GET /select_qr_image.svg # GET /select_qr_image.svg
def table_qr_image def table_qr_image
@table = Table.find(params[:table_id]) @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| respond_to do |format|
format.html format.html
format.svg { render :qrcode => code, :level => :l, :unit => 10, table_number: @table.number, qcontainer: true } 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
end end
@@ -41,9 +42,13 @@ class DashboardController < ApplicationController
code = 'qwaiter.com' code = 'qwaiter.com'
respond_to do |format| respond_to do |format|
format.html format.html
format.svg { render :qrcode => code, :level => :l, :unit => 10} format.png { render qrcode: code, level: :h, unit: 10, size: 12}
format.png { render qrcode: code} format.svg { render qrcode: code, level: :h, unit: 10, size: 12}
end end
end end
def scan
end
end end
+12
View File
@@ -6,6 +6,8 @@ class Supplier
property :name property :name
property :open, type: :boolean, default: false property :open, type: :boolean, default: false
property :night_offset, type: Float property :night_offset, type: Float
property :lat, type: Float, default: 52.08062426379751
property :lng, type: Float, default: 4.312562942504883
#WIFI #WIFI
property :offer_wifi property :offer_wifi
@@ -24,6 +26,16 @@ class Supplier
after_create :add_section_on_create 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 = {}) def active_orders(options = {})
return @active_orders if @active_orders && @active_orders_options == options return @active_orders if @active_orders && @active_orders_options == options
@active_orders_options = options @active_orders_options = options
+1 -1
View File
@@ -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.. frameborder="0" marginheight="0" marginwidth="0"] Loading..
+2
View File
@@ -0,0 +1,2 @@
- title 'Get the mobile app to order drinks'
p Get the mobile app
+1
View File
@@ -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-72x72.png" rel="apple-touch-icon-precomposed" sizes="72x72"
link href="/images/apple-touch-icon.png" rel="apple-touch-icon-precomposed" link href="/images/apple-touch-icon.png" rel="apple-touch-icon-precomposed"
link href="/favicon.ico" rel="shortcut icon" link href="/favicon.ico" rel="shortcut icon"
= yield :head
body body
.navbar.navbar-fixed-top.navbar-inverse .navbar.navbar-fixed-top.navbar-inverse
+7
View File
@@ -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| = form_for @supplier, url: supplier_update_settings_path, html: {class: 'form-horizontal'} do |f|
= render 'error_messages', target: current_supplier = render 'error_messages', target: current_supplier
.control-group class=(@supplier.errors[:name].any? ? 'error' : nil) .control-group class=(@supplier.errors[:name].any? ? 'error' : nil)
@@ -8,6 +11,10 @@
= f.label :email, class: 'control-label' = f.label :email, class: 'control-label'
.controls .controls
= f.text_field :email, class: 'text_field' = 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) .control-group class=(@supplier.errors[:offer_wifi].any? ? 'error' : nil)
= f.label :offer_wifi, class: 'control-label' = f.label :offer_wifi, class: 'control-label'
.controls .controls
+6 -4
View File
@@ -62,15 +62,17 @@ Qrammer::Application.routes.draw do
#match '/show_products' => 'dashboard#show_products', as: :user_products #match '/show_products' => 'dashboard#show_products', as: :user_products
# GENERAL
# DEVELOPMENT ONLY
get '/qr' => 'dashboard#qr'
get '/demo_both' => 'dashboard#demo_both'
get '/enquete' => 'dashboard#enquete' get '/enquete' => 'dashboard#enquete'
get '/cartoon' => 'dashboard#cartoon' get '/cartoon' => 'dashboard#cartoon'
get '/bars-restaurants' => 'dashboard#bars_restaurants', as: :bars_restaurants get '/bars-restaurants' => 'dashboard#bars_restaurants', as: :bars_restaurants
get '/clients' => 'dashboard#clients' get '/clients' => 'dashboard#clients'
get '/contact' => 'dashboard#contact' 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 namespace :suppliers, path: '/supplier' do
resources :sections do resources :sections do
+50 -105
View File
@@ -15,9 +15,10 @@
id="svg2991" id="svg2991"
version="1.1" version="1.1"
inkscape:version="0.48.2 r9819" inkscape:version="0.48.2 r9819"
sodipodi:docname="qr_container.svg"> sodipodi:docname="table_qr_image2.svg">
<defs <defs
id="defs3"><filter id="defs3">
<filter
id="filter3789" id="filter3789"
inkscape:label="Cutout" inkscape:label="Cutout"
x="0" x="0"
@@ -147,15 +148,6 @@
overflow="visible" overflow="visible"
id="use27-0" /> id="use27-0" />
</clipPath> </clipPath>
<clipPath <clipPath
id="SVGID_2_"> id="SVGID_2_">
<use <use
@@ -167,9 +159,7 @@
xlink:href="#SVGID_1_" xlink:href="#SVGID_1_"
overflow="visible" overflow="visible"
id="use27" /> id="use27" />
</clipPath> </clipPath>
<defs <defs
id="defs23"> id="defs23">
<rect <rect
@@ -178,9 +168,7 @@
y="4220.376" y="4220.376"
width="46.786999" width="46.786999"
height="62.563999" /> height="62.563999" />
</defs> </defs>
</defs> </defs>
<sodipodi:namedview <sodipodi:namedview
id="base" id="base"
@@ -190,8 +178,8 @@
inkscape:pageopacity="0.0" inkscape:pageopacity="0.0"
inkscape:pageshadow="2" inkscape:pageshadow="2"
inkscape:zoom="2.1440801" inkscape:zoom="2.1440801"
inkscape:cx="197.54796" inkscape:cx="80.481439"
inkscape:cy="195.73703" inkscape:cy="209.05013"
inkscape:document-units="mm" inkscape:document-units="mm"
inkscape:current-layer="layer1" inkscape:current-layer="layer1"
showgrid="false" showgrid="false"
@@ -209,7 +197,7 @@
<dc:format>image/svg+xml</dc:format> <dc:format>image/svg+xml</dc:format>
<dc:type <dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title /> <dc:title></dc:title>
</cc:Work> </cc:Work>
</rdf:RDF> </rdf:RDF>
</metadata> </metadata>
@@ -220,136 +208,93 @@
transform="translate(0,141.73227)"> transform="translate(0,141.73227)">
<g <g
id="g3838" id="g3838"
transform="matrix(0.49177687,0,0,0.49177687,49.419301,-77.511451)">#qrcode transform="matrix(0.39937678,0,0,0.39937678,48.985567,-91.969866)">#qrcode
</g> </g>
<text <text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
x="277.10553" x="277.10553"
y="160.40939" y="160.40939"
id="text3799" id="text3799"
sodipodi:linespacing="125%"><tspan xml:space="preserve"
sodipodi:role="line" style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"><tspan
id="tspan3801"
x="277.10553" x="277.10553"
y="160.40939">#table_number</tspan></text> y="160.40939"
id="tspan3801">#table_number</tspan></text>
<g
transform="translate(24.331912,-0.93280097)"
id="g13730">
<text <text
font-size="9.4245"
id="text5"
style="font-size:29.77246857px;fill:#634227;font-family:HelveticaRounded-Bold"
x="67.198868" x="67.198868"
y="-103.47206" y="-103.47206"
inkscape:export-filename="/Users/bterkuile/companytools/development/rails/qrammer/app/assets/images/logo.png" id="text5"
inkscape:export-xdpi="192.38" style="font-size:29.77246857px;fill:#634227;font-family:HelveticaRounded-Bold">
inkscape:export-ydpi="192.38">
<tspan <tspan
style="font-family:Arial Rounded MT Bold;-inkscape-font-specification:Arial Rounded MT Bold" id="tspan3936"
id="tspan3936">Q</tspan> style="font-family:Arial Rounded MT Bold;-inkscape-font-specification:Arial Rounded MT Bold">Q</tspan>
</text> </text>
<text <text
id="text7"
x="91.433167" x="91.433167"
y="-103.47206" y="-103.47206"
style="font-size:37.90859985px" id="text7"
inkscape:export-filename="/Users/bterkuile/companytools/development/rails/qrammer/app/assets/images/logo.png" style="font-size:37.90859985px">
inkscape:export-xdpi="192.38"
inkscape:export-ydpi="192.38">
<tspan <tspan
x="91.433167" x="91.433167"
y="-103.47206" y="-103.47206"
font-size="9.4245"
id="tspan9" id="tspan9"
style="font-size:29.77246857px;fill:#231f20;font-family:Arial Rounded MT Bold;-inkscape-font-specification:Arial Rounded MT Bold">WAITE</tspan> style="font-size:29.77246857px;fill:#231f20;font-family:Arial Rounded MT Bold;-inkscape-font-specification:Arial Rounded MT Bold">WAITE</tspan>
</text> </text>
<text <text
font-size="9.4245"
id="text19"
style="font-size:29.77246857px;fill:#634227;font-family:HelveticaRounded-Bold"
x="187.71786" x="187.71786"
y="-103.47206" y="-103.47206"
inkscape:export-filename="/Users/bterkuile/companytools/development/rails/qrammer/app/assets/images/logo.png" id="text19"
inkscape:export-xdpi="192.38" style="font-size:29.77246857px;fill:#634227;font-family:HelveticaRounded-Bold">
inkscape:export-ydpi="192.38">
<tspan <tspan
style="font-family:Arial Rounded MT Bold;-inkscape-font-specification:Arial Rounded MT Bold" id="tspan3938"
id="tspan3938">R</tspan> style="font-family:Arial Rounded MT Bold;-inkscape-font-specification:Arial Rounded MT Bold">R</tspan>
</text> </text>
<path <path
style="fill:#ffffff" d="m 4239.495,4221.196 c 0,0 -5.676,0 -5.676,5.676 v 33.539 c 0,0 0,5.676 5.676,5.676 h 33.797 c 0,0 5.676,0 5.676,-5.676 v -33.539 c 0,0 0,-5.676 -5.676,-5.676 h -33.797 z"
inkscape:connector-curvature="0" transform="matrix(0.7293556,0,0,0.7293556,-3066.7086,-3211.2792)"
clip-path="url(#SVGID_2_-0)"
id="path29" id="path29"
d="m 4239.495,4221.196 c 0,0 -5.676,0 -5.676,5.676 v 33.539 c 0,0 0,5.676 5.676,5.676 h 33.797 c 0,0 5.676,0 5.676,-5.676 v -33.539 c 0,0 0,-5.676 -5.676,-5.676 h -33.797 z" style="fill:#ffffff" />
clip-path="url(#SVGID_2_-0)"
transform="matrix(0.7293556,0,0,0.7293556,-3066.7086,-3211.2792)"
inkscape:export-filename="/Users/bterkuile/companytools/development/rails/qrammer/app/assets/images/logo.png"
inkscape:export-xdpi="192.38"
inkscape:export-ydpi="192.38" />
<path <path
style="fill:none;stroke:#634227;stroke-width:1.63800001" d="m 4239.495,4221.196 c 0,0 -5.676,0 -5.676,5.676 v 33.539 c 0,0 0,5.676 5.676,5.676 h 33.797 c 0,0 5.676,0 5.676,-5.676 v -33.539 c 0,0 0,-5.676 -5.676,-5.676 h -33.797 z"
inkscape:connector-curvature="0" transform="matrix(0.7293556,0,0,0.7293556,-3066.7086,-3211.2792)"
clip-path="url(#SVGID_2_-0)"
id="path31" id="path31"
d="m 4239.495,4221.196 c 0,0 -5.676,0 -5.676,5.676 v 33.539 c 0,0 0,5.676 5.676,5.676 h 33.797 c 0,0 5.676,0 5.676,-5.676 v -33.539 c 0,0 0,-5.676 -5.676,-5.676 h -33.797 z" style="fill:none;stroke:#634227;stroke-width:1.63800001" />
clip-path="url(#SVGID_2_-0)"
transform="matrix(0.7293556,0,0,0.7293556,-3066.7086,-3211.2792)"
inkscape:export-filename="/Users/bterkuile/companytools/development/rails/qrammer/app/assets/images/logo.png"
inkscape:export-xdpi="192.38"
inkscape:export-ydpi="192.38" />
<path <path
style="fill:#634227"
inkscape:connector-curvature="0"
id="path33"
d="m 4255.337,4249.788 c 0,0 0.091,12.386 -0.011,12.69 -0.18,0.539 -0.57,0.655 -1.942,0.671 -0.963,0.012 -2.048,0.077 -2.048,-1.073 0,-2.093 -0.01,-7.585 -0.022,-7.922 -0.013,-0.338 -1.305,-0.579 -1.305,0.079 0,1.5 0.077,7.812 -0.138,8.294 -0.24,0.87 -3.642,1.007 -4.057,-0.226 -0.435,-1.29 0,-12.284 0,-12.284 0,0 -0.902,-0.461 -0.902,-1.127 v -5.356 c -0.073,-0.544 -2.882,4.036 -3.287,4.484 -1.137,1.071 -3.071,0.437 -2.235,-1.946 0.121,-0.244 4.805,-7.985 5.635,-9.016 0.371,-0.461 1.658,-0.386 2.742,-0.271 0.714,0.077 1.315,3.538 1.991,5.343 0.677,1.803 0.677,1.803 1.466,0.225 0.789,-1.578 2.113,-4.957 2.254,-5.185 0.232,-0.376 1.69,-0.503 2.239,-0.165 0.989,0.607 3.96,3.434 3.96,3.434 l 2.367,-3.381 h -4.96 c 0,0 -1.467,-1.127 0.451,-1.014 1.916,0.111 15.666,0 15.666,0 0,0 0.9,1.014 0,1.014 h -6.988 l -4.846,6.478 c 0,0 -0.563,1.52 -2.48,0 -1.915,-1.519 -2.607,-2.068 -2.725,-1.97 0.02,0.257 0,6.763 0,6.763 0,0 0.076,1.236 -0.825,1.461" d="m 4255.337,4249.788 c 0,0 0.091,12.386 -0.011,12.69 -0.18,0.539 -0.57,0.655 -1.942,0.671 -0.963,0.012 -2.048,0.077 -2.048,-1.073 0,-2.093 -0.01,-7.585 -0.022,-7.922 -0.013,-0.338 -1.305,-0.579 -1.305,0.079 0,1.5 0.077,7.812 -0.138,8.294 -0.24,0.87 -3.642,1.007 -4.057,-0.226 -0.435,-1.29 0,-12.284 0,-12.284 0,0 -0.902,-0.461 -0.902,-1.127 v -5.356 c -0.073,-0.544 -2.882,4.036 -3.287,4.484 -1.137,1.071 -3.071,0.437 -2.235,-1.946 0.121,-0.244 4.805,-7.985 5.635,-9.016 0.371,-0.461 1.658,-0.386 2.742,-0.271 0.714,0.077 1.315,3.538 1.991,5.343 0.677,1.803 0.677,1.803 1.466,0.225 0.789,-1.578 2.113,-4.957 2.254,-5.185 0.232,-0.376 1.69,-0.503 2.239,-0.165 0.989,0.607 3.96,3.434 3.96,3.434 l 2.367,-3.381 h -4.96 c 0,0 -1.467,-1.127 0.451,-1.014 1.916,0.111 15.666,0 15.666,0 0,0 0.9,1.014 0,1.014 h -6.988 l -4.846,6.478 c 0,0 -0.563,1.52 -2.48,0 -1.915,-1.519 -2.607,-2.068 -2.725,-1.97 0.02,0.257 0,6.763 0,6.763 0,0 0.076,1.236 -0.825,1.461"
clip-path="url(#SVGID_2_-0)"
transform="matrix(0.7293556,0,0,0.7293556,-3066.7086,-3211.2792)" transform="matrix(0.7293556,0,0,0.7293556,-3066.7086,-3211.2792)"
inkscape:export-filename="/Users/bterkuile/companytools/development/rails/qrammer/app/assets/images/logo.png" clip-path="url(#SVGID_2_-0)"
inkscape:export-xdpi="192.38" id="path33"
inkscape:export-ydpi="192.38" /> style="fill:#634227" />
<path <path
style="fill:#634227"
inkscape:connector-curvature="0"
id="path35"
d="m 4255.833,4230.169 c 0,3.059 -2.479,5.536 -5.536,5.536 -3.057,0 -5.536,-2.478 -5.536,-5.536 0,-3.058 2.479,-5.535 5.536,-5.535 3.057,0 5.536,2.477 5.536,5.535" d="m 4255.833,4230.169 c 0,3.059 -2.479,5.536 -5.536,5.536 -3.057,0 -5.536,-2.478 -5.536,-5.536 0,-3.058 2.479,-5.535 5.536,-5.535 3.057,0 5.536,2.477 5.536,5.535"
clip-path="url(#SVGID_2_-0)"
transform="matrix(0.7293556,0,0,0.7293556,-3066.7086,-3211.2792)" transform="matrix(0.7293556,0,0,0.7293556,-3066.7086,-3211.2792)"
inkscape:export-filename="/Users/bterkuile/companytools/development/rails/qrammer/app/assets/images/logo.png" clip-path="url(#SVGID_2_-0)"
inkscape:export-xdpi="192.38" id="path35"
inkscape:export-ydpi="192.38" /> style="fill:#634227" />
<circle <circle
d="m 4255.8329,4230.1689 c 0,3.0575 -2.4786,5.536 -5.536,5.536 -3.0575,0 -5.536,-2.4785 -5.536,-5.536 0,-3.0574 2.4785,-5.536 5.536,-5.536 3.0574,0 5.536,2.4786 5.536,5.536 z"
style="fill:none;stroke:#634227;stroke-width:0.182;stroke-miterlimit:10"
sodipodi:ry="5.5359998"
sodipodi:rx="5.5359998"
sodipodi:cy="4230.1689"
sodipodi:cx="4250.2969"
id="circle37"
r="5.5359998"
cy="4230.1689"
cx="4250.2969" cx="4250.2969"
stroke-miterlimit="10" cy="4230.1689"
clip-path="url(#SVGID_2_-0)" r="5.5359998"
transform="matrix(0.7293556,0,0,0.7293556,-3066.7086,-3211.2792)" transform="matrix(0.7293556,0,0,0.7293556,-3066.7086,-3211.2792)"
inkscape:export-filename="/Users/bterkuile/companytools/development/rails/qrammer/app/assets/images/logo.png" clip-path="url(#SVGID_2_-0)"
inkscape:export-xdpi="192.38" id="circle37"
inkscape:export-ydpi="192.38" /> style="fill:none;stroke:#634227;stroke-width:0.182;stroke-miterlimit:10" />
<path <path
style="fill:#231f20"
inkscape:connector-curvature="0"
id="path39"
d="m 4250.515,4236.479 c 0.061,-0.155 2.532,-1.205 2.672,-1.102 0.139,0.104 0.434,2.063 0.228,2.369" d="m 4250.515,4236.479 c 0.061,-0.155 2.532,-1.205 2.672,-1.102 0.139,0.104 0.434,2.063 0.228,2.369"
clip-path="url(#SVGID_2_-0)"
transform="matrix(0.7293556,0,0,0.7293556,-3066.7086,-3211.2792)" transform="matrix(0.7293556,0,0,0.7293556,-3066.7086,-3211.2792)"
inkscape:export-filename="/Users/bterkuile/companytools/development/rails/qrammer/app/assets/images/logo.png" clip-path="url(#SVGID_2_-0)"
inkscape:export-xdpi="192.38" id="path39"
inkscape:export-ydpi="192.38" /> style="fill:#231f20" />
<path <path
style="fill:#231f20"
inkscape:connector-curvature="0"
id="path41"
d="m 4251.332,4236.363 c -0.096,-0.136 -2.748,-0.556 -2.858,-0.422 -0.111,0.134 0.076,2.106 0.351,2.354" d="m 4251.332,4236.363 c -0.096,-0.136 -2.748,-0.556 -2.858,-0.422 -0.111,0.134 0.076,2.106 0.351,2.354"
clip-path="url(#SVGID_2_-0)"
transform="matrix(0.7293556,0,0,0.7293556,-3066.7086,-3211.2792)" transform="matrix(0.7293556,0,0,0.7293556,-3066.7086,-3211.2792)"
inkscape:export-filename="/Users/bterkuile/companytools/development/rails/qrammer/app/assets/images/logo.png" clip-path="url(#SVGID_2_-0)"
inkscape:export-xdpi="192.38" id="path41"
inkscape:export-ydpi="192.38" /> style="fill:#231f20" />
</g>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 10 KiB

+3 -3
View File
@@ -22,13 +22,13 @@ module RQRCode
close_tag = "</svg>" close_tag = "</svg>"
result = [] result = []
qrcode.modules.each_index do |c| for c in 0...qrcode.module_count
tmp = [] tmp = []
qrcode.modules.each_index do |r| for r in 0...qrcode.module_count
y = c*unit + offset y = c*unit + offset
x = r*unit + offset x = r*unit + offset
next unless qrcode.is_dark(c, r) next unless qrcode.dark?(c, r)
tmp << %{<rect width="#{unit}" height="#{unit}" x="#{x}" y="#{y}" style="fill:##{color}"/>} tmp << %{<rect width="#{unit}" height="#{unit}" x="#{x}" y="#{y}" style="fill:##{color}"/>}
end end
result << tmp.join("\n") result << tmp.join("\n")