user upgrades

This commit is contained in:
2014-09-15 15:47:51 +02:00
parent 7ca7dc4d12
commit 04adfbcd66
11 changed files with 75 additions and 34 deletions
@@ -15,3 +15,4 @@ App.Router.map ->
@route 'settings'
@route 'product_orders'
@route 'error'
@route 'scanning'
@@ -101,34 +101,35 @@ App.ApplicationRoute = Ember.Route.extend
<% if Rails.env.user_app? %>
ar = @
scanner = cordova.require("cordova/plugin/BarcodeScanner")
scanner.scan (result)->
if result.cancelled
ar.transitionTo('index')
$log
action: 'qrscan'
result: 'cancel'
else
table_id_index = result.text.indexOf('s?t=');
if table_id_index > -1
table_id = result.text.substr(table_id_index + 4);
# ar.transitionTo 'table', table_id
# ar.actions.selectQr.call(ar, table: {_id: table_id})
ar.send('selectQr', _id: table_id)
else
ar.transitionTo('index').then (route)->
route.get('controller.controllers.application').set 'notice', "we got a barcode: '#{result.text}' but cannot extract a table id"
@transitionTo('scanning').then ->
scanner.scan (result)->
if result.cancelled
ar.transitionTo('index')
$log
action: 'qrscan'
error: 'cannot extract table id'
info: result.text
result: 'cancel'
else
table_id_index = result.text.indexOf('s?t=');
if table_id_index > -1
table_id = result.text.substr(table_id_index + 4);
# ar.transitionTo 'table', table_id
# ar.actions.selectQr.call(ar, table: {_id: table_id})
ar.send('selectQr', _id: table_id)
else
ar.transitionTo('index').then (route)->
route.get('controller.controllers.application').set 'notice', "we got a barcode: '#{result.text}' but cannot extract a table id"
$log
action: 'qrscan'
error: 'cannot extract table id'
info: result.text
, (error)->
$log
action: 'qrscan'
error: 'scan failed'
info: error
ar.transitionTo('index').then (route)->
route.get('controller.controllers.application').set 'notice', "scanning failed: #{error}"
, (error)->
$log
action: 'qrscan'
error: 'scan failed'
info: error
ar.transitionTo('index').then (route)->
route.get('controller.controllers.application').set 'notice', "scanning failed: #{error}"
<% else %>
@transitionTo 'select_qrcode'
<% end %>
@@ -0,0 +1,3 @@
.page-scanning
.scanning-qr-image: span
.scanning-laser
@@ -1257,4 +1257,3 @@ $button-edit-color: #ffa
$button-destroy-color: #faa
$button-submit-color: $primary-color
$button-cancel-color: $secondary-color
@@ -1,11 +1,11 @@
@import constants
@import bourbon
@import ./qconstants
@import ./foundation_and_overrides
@import font-awesome
@import ./structure
@import ./components/*
@import ./qmodal
@import ./pages/*
@import ./display_fields
@import ./qproduct_orders
@import ./qindex
@import ./qlists
@@ -20,6 +20,8 @@ header.top-menu
.top-menu-logo
@media #{$small-only}
display: none
img
margin-top: -6px
.menu-content
background-color: white
background-repeat: repeat-x
@@ -1,8 +1,10 @@
.modal
margin: 10px auto
margin: auto
margin-top: 90px
width: 300px
background-color: #fff
padding: 1em
z-index: 9085
.overlay
height: 100%
@@ -11,6 +13,7 @@
top: 0
left: 0
background-color: rgba(0, 0, 0, 0.2)
z-index: 9084
.flush--top
margin-top: 0
@@ -0,0 +1,27 @@
$scanning-code-width: 200px
$scanning-code-height: $scanning-code-width/0.785
.page-scanning
width: $scanning-code-width
margin-left: auto
margin-right: auto
position: relative
margin-top: 30px
.scanning-qr-image
position: absolute
font-size: $scanning-code-height
span
@extend .fa
@extend .fa-qrcode
.scanning-laser
position: absolute
height: $scanning-code-height
border-right: 2px solid #f00
+animation(scanning 1s infinite)
+animation-direction(alternate)
+animation-timing-function(linear)
+keyframes(scanning)
from
left: 0
to
left: $scanning-code-width