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
@@ -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,18 +10,21 @@ if list.closed_at
.display-row
.display-label=t 'attributes.list.state'
.display-field=state 'list' list.state
if list.sorted_orders
.list-orders-container
each order in list.sorted_orders
App.ListOrderView contentBinding="order"
if showTotal
.list-orders-total.total
= t 'total'
span.currency= currency list.total
if list.orders.isLoaded
if list.sorted_orders
.list-orders-container
each order in list.sorted_orders
App.ListOrderView contentBinding="order"
if showTotal
.list-orders-total.total
= t 'total'
span.currency= currency list.total
else
p
span=t 'active_list.no_orders_explanation'
br
if list.table
link-to 'table' list.table class="button"
span=t 'list_products.title'
else
p
span=t 'active_list.no_orders_explanation'
br
if list.table
link-to 'table' list.table class="button"
span=t 'list_products.title'
span.loading.large
@@ -1,10 +1,13 @@
.row
h2=t 'active_list.title'
if list
partial "list_content"
if list.orders.isLoaded
if list
partial "list_content"
else
p
span=t 'active_list.not_active.message'
br
link-to 'index' class="button"
span= t 'active_list.not_active.home_button_text'
else
p
span=t 'active_list.not_active.message'
br
link-to 'index' class="button"
span= t 'active_list.not_active.home_button_text'
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}'});