Mixed commit, user facebook issues

This commit is contained in:
2014-08-11 17:54:43 +02:00
parent 28192f8e39
commit 031e2bedea
19 changed files with 95 additions and 77 deletions
+3 -3
View File
@@ -247,8 +247,8 @@ GEM
omniauth (1.2.2)
hashie (>= 1.2, < 4)
rack (~> 1.0)
omniauth-facebook (1.6.0)
omniauth-oauth2 (~> 1.1)
omniauth-facebook (2.0.0)
omniauth-oauth2 (~> 1.2)
omniauth-oauth2 (1.2.0)
faraday (>= 0.8, < 0.10)
multi_json (~> 1.3)
@@ -375,7 +375,7 @@ GEM
turnip (1.2.2)
gherkin (>= 2.5)
rspec (>= 2.0, < 4.0)
tzinfo (1.2.1)
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (2.5.3)
execjs (>= 0.3.0)
@@ -1,4 +1,7 @@
Ember.Handlebars.registerBoundHelper 'image_tag', (path, params..., options={})->
alt = options.hash.alt ||= ''
Ember.Handlebars.helper 'image_tag', (path, options={})->
alt = options.hash.alt || ''
image_path = if path.substring(0,4) == 'http' then path else "/assets/#{path}"
new Handlebars.SafeString "<img src=\"#{image_path}\" alt=\"#{alt}\" title=\"#{alt}\" >"
extra_attributes = ''
extra_attributes += " width=\"#{options.hash.width}\"" if options.hash.width
extra_attributes += " height=\"#{options.hash.height}\"" if options.hash.height
new Handlebars.SafeString "<img src=\"#{image_path}\" alt=\"#{alt}\" title=\"#{alt}\" #{extra_attributes}>"
@@ -1,6 +1,6 @@
App.SettingsController = Ember.ObjectController.extend
needs: ['application']
model: (-> @get('controllers.application.supplier')).property('controllers.application.supplier')
# model: (-> @get('controllers.application.supplier')).property('controllers.application.supplier')
time_zones: (-> window.time_zones ).property()
countries: (-> window.countries ).property()
editIensProfile: (-> @get('model.country') is 'Netherlands' ).property('model.country')
@@ -1,7 +1,5 @@
App.SettingsRoute = Ember.Route.extend
model: ->
Em.RSVP.hash
supplier: @controllerFor('application').get('supplier')
setupController: (controller, model)->
#controller.set 'model', controller.get('controllers.application.supplier')
controller.set 'model', model.supplier
model: -> @container.lookup('route:application').supplier
# setupController: (controller, model)->
# #controller.set 'model', controller.get('controllers.application.supplier')
# controller.set 'model', model.supplier
@@ -12,7 +12,10 @@
rootElement: '#ember-app-container'
obtain_token: (message)->
message ||= ''
window.location = "#{$root_url}/obtain_token?message=#{message}"
# frame = $('<iframe></iframe>').addClass('obtain-token-frame').attr 'src', $obtain_token_url
# frame.css width: $('body').outerWidth(), height: $('body').outerHeight()
# $('body').append frame
window.location = "#{$obtain_token_url}"
Ember.$.ajaxPrefilter (options) ->
if options.type.toUpperCase() == 'GET'
@@ -10,6 +10,7 @@ if list.closed_at
.display-row
.display-label=t 'attributes.list.state'
.display-field=state 'list' list.state
if list.orders.isLoaded
if list.sorted_orders
.list-orders-container
each order in list.sorted_orders
@@ -25,3 +26,5 @@ else
if list.table
link-to 'table' list.table class="button"
span=t 'list_products.title'
else
span.loading.large
@@ -1,5 +1,6 @@
.row
h2=t 'active_list.title'
if list.orders.isLoaded
if list
partial "list_content"
else
@@ -8,3 +9,5 @@
br
link-to 'index' class="button"
span= t 'active_list.not_active.home_button_text'
else
span.loading.large
@@ -17,7 +17,7 @@ header.top-menu
.table-number
|
= t 'models.table'
|
|&nbsp;
= list.table.number
.supplier-info-row
.counter.supplier-orders-placed-count
@@ -1,6 +1,6 @@
.home-panel
.home-header = image_tag 'logo.png'
.home-header= image_tag 'logo.png' width=100 height=115 alt="Logo"
.home-center
a{action scanQr} href="#"= image_tag 'scan-logo.png'
a{ action "scanQr" } href="#"= image_tag 'scan-logo.png' width=148 height=177 alt="Scan"
.home-footer
.home-footer-content
+6
View File
@@ -292,6 +292,12 @@ class UserController < Users::ApplicationController
def obtain_token
redirect_to user_omniauth_authorize_path('facebook') and return unless current_user.present?
# redirect_to case platform
# when 'android' then "file:///android_asset/user/index.html?user_id=#{current_user.id}&auth_token=#{current_user.authentication_token}"
# when
# else user_root_path(user_id: current_user.id, auth_token: current_user.authentication_token)
# end
# return
respond_to do |format|
format.html { render layout: 'user/obtain_token' }
format.json do
+10 -2
View File
@@ -32,8 +32,16 @@ module ApplicationHelper
def user_dynamic_root_url
case Rails.env
when 'test' then "$root_url = 'http://#{request.host}:#{request.port}/user';".html_safe
when 'development' then "$root_url = 'http://localhost:3000/user';".html_safe
when 'test' then "Qstorage.setItem('root_url', 'http://#{request.host}:#{request.port}/user/index.html');".html_safe
when 'development' then "Qstorage.setItem('root_url', 'http://localhost:3000/user/index.html');".html_safe
else ''
end
end
def user_dynamic_obtain_token_url
case Rails.env
when 'test' then "$obtain_token_url = 'http://#{request.host}:#{request.port}/user/obtain_token.html';".html_safe
when 'development' then "$obtain_token_url = 'http://localhost:3000/user/obtain_token.html';".html_safe
else ''
end
end
+4 -4
View File
@@ -4,10 +4,10 @@ html lang="en"
meta charset="utf-8"
meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"
meta name="viewport" content="width=device-width, initial-scale=1.0"
title= content_for?(:title) ? yield(:title) : application_title
= stylesheet_link_tag 'obtain_token/application'
= csrf_meta_tags
body class=action_name
title= application_title
/ = stylesheet_link_tag 'obtain_token/application'
/ = csrf_meta_tags
body
- if flash[:alert].present?
.alert.alert-error
a.close data-dismiss="alert" &#215;
+10 -25
View File
@@ -5,9 +5,9 @@ html lang="en"
meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"
meta name="viewport" content="width=device-width, initial-scale=1.0"
title= application_title
= stylesheet_link_tag "user/foundation/application"
= javascript_include_tag "vendor/modernizr"
= javascript_include_tag 'http://connect.facebook.net/en_US/all.js'
= stylesheet_link_tag "user/foundation/application"
/ = javascript_include_tag 'http://connect.facebook.net/en_US/all.js'
= javascript_include_tag "user/flat/application"
- if ENV['QWAITER_MOBILE_EXPORT'] == 'yes'
javascript:
@@ -15,35 +15,20 @@ html lang="en"
var $data_host = 'http://data.mozo.bar';
var $event_host = '#{Qwaiter.event_host}';
var $asset_path = '##assets_path##';
var Qstorage = localStorage;
var $root_url = 'http://www.mozo.bar/user';
var Qstorage = window.localStorage;
var Qstorage.setItem('root_url', '##root_url##');
var $platform = '##platform##';
var $obtain_token_url = 'http://mozo.bar/user/obtain_token';
- else
javascript:
var QMobile, Qwaiter, Quser;
var $event_host = '#{Qwaiter.event_host}';
var $asset_path = '/assets/';
var Qstorage = localStorage;
var Qstorage = window.localStorage;
#{user_dynamic_data_host};
#{user_dynamic_root_url};
QMobile || (QMobile = {
scanQr: function(){window.location = '/select_qrcode'},
activateRotation: function(){},
mobile: function(){return false},
authentication_string: function(){return this.authentication_string_storage || ''},
authentication_object: function(){return this.authentication_object_storage || '{}'},
setAuthToken: function(token){
this.auth_token = token;
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/user'},
$root_url: function(){return '/user'},
goHome: function(){ redirect_to('user_root')},
connection_problem: function(){alert('There is a problem connecting to the server')},
token: function(){return this.auth_token},
setUserId: function(id){ this.stored_user_id = id},
user_id: function(){return this.stored_user_id },
log: function(str){console.log(str)}
});
#{user_dynamic_obtain_token_url};
var $platform = 'web'
body
#ember-app-container
+7 -1
View File
@@ -18,6 +18,12 @@
button.btn.btn-primary data-t="obtain_token.obtain" onclick="Quser.authenticate_user(); return false" = t('user.obtain_token.obtain')
- unless current_user.blank? || ENV['QWAITER_MOBILE_EXPORT']=='yes'
javascript:
Qstorage = window.localStorage;
Qstorage.setItem('auth_token', '#{current_user.authentication_token}');
Qstorage.setItem('user_id', '#{current_user.id}');
window.location = '/index.html';
window.location = (Qstorage.getItem('root_url') || '/index.html') + '?user_id=#{current_user.id}&auth_token=#{current_user.authentication_token}';
// localStorage.setItem('auth_token', '#{current_user.authentication_token}');
// localStorage.setItem('user_id', '#{current_user.id}');
// window.location = $root_url + '?user_id=#{current_user.id}&auth_token=#{current_user.authentication_token}';
// debugger;
// QMobile.signed_in({user_id: '#{current_user.id}', auth_token: '#{current_user.authentication_token}'});
+3
View File
@@ -79,6 +79,7 @@ for action in uc.action_methods
ios_view = ios_view.gsub /(href|src)="\/assets\/([^"]+)/, %|\\1="./assets/\\2| # make assets calls relative
ios_view.sub! /<\/title>/, '</title><script type="text/javascript" src="qmobile.js"></script><script type="text/javascript" src="cordova-2.2.0.js"></script><script type="text/javascript" src="barcodescanner.js"></script>'
ios_view.gsub! '##assets_path##', './assets/'
android_view.gsub! '##platform##', 'ios'
File.open(File.join(ios_root, "#{action}.html"), 'w'){|f| f.puts ios_view}
## MODIFY FOR ANDROID
@@ -87,6 +88,8 @@ for action in uc.action_methods
android_view.gsub! /(href|src)="([^#])/, %|\\1="#{android_root_url}\\2| # replace relative uri's with android specific one
android_view.sub! /<\/title>/, '</title><script type="text/javascript" src="qmobile.js"></script><script type="text/javascript" src="cordova-2.6.0rc1.js"></script><script type="text/javascript" src="barcodescanner.js"></script>'
android_view.gsub! '##assets_path##', 'file:///android_asset/assets/'
android_view.gsub! '##root_url##', 'file:///android_asset/user/index.html'
android_view.gsub! '##platform##', 'android'
if testhost = ENV['TEST_HOST'].presence
android_view.gsub! /data.mozo.bar|www.mozo.bar/, "#{testhost}:3000"
android_view.gsub! /events.mozo.bar/, "#{testhost}:9296"
+1 -1
View File
@@ -1,7 +1,7 @@
Feature: Active list view
@javascript
Scenario: Loading lists and switching back to the active list
Scenario: Loading lists and switching back to the active list works, lists loading may unlink active list orders
Given There is an open supplier with a menu
And there is a signed in user with an active order
And the user is on the active list page
+2 -1
View File
@@ -22,7 +22,8 @@ step "I wait :number second/seconds" do |number|
end
placeholder :number do
match /[-+]?\d+(\.\d+)?/ do |number_string|
# match /[-+]?\d+(\.\d+)?/ do |number_string|
match /\d+\.?\d?/ do |number_string|
number_string.to_f
end
end
@@ -31,9 +31,9 @@ step "the section table should not be marked as in need of help" do
table['class'].should_not include 'needs_help'
end
step 'Then the table should be marked as occupied and having an active order' do
step 'the table should be marked as occupied and having an active order' do
classes = find(".section-table-#{@table.id}")['class'].split(/\s+/)
expect(classes & %w[occupied active_order]).to eq & %w[occupied active_order]
expect(classes & %w[occupied active_order]).to eq %w[occupied active_order]
end
step "I click on section table as a supplier" do
@@ -70,7 +70,6 @@ end
step "the section table should not have any active list markings anymore" do
table = page.find(".section-table-#{@table.id}")
css_class = table['class']
binding.pry
css_class.should_not include 'needs_help'
css_class.should_not include 'occupied'
css_class.should_not include 'active_order'
@@ -80,7 +79,8 @@ end
step "I should be redirected to the supplier section view" do
sleep 1
#page.current_path.should == "/supplier/sections/#{@section.id}"
page.evaluate_script('window.location.pathname').should == "/supplier/sections/#{@section.id}"
# page.evaluate_script('window.location.pathname').should == "/supplier/sections/#{@section.id}"
js_path.should == "/supplier#/sections/#{@section.id}"
end
step "the last supplier section has a table with known coordinates" do
-1
View File
@@ -118,7 +118,6 @@ RSpec.configure do |config|
#config.use_transactional_fixtures = true
config.before :suite do
Qwaiter::Couchbase.load_design_docs!
# NOT THREADSAFE!!!!!! but good enough for testing since the real couchbase flush is slowwwwww....
Qwaiter::Counter.connection = TestCounter.new
end