From a675999d010efe00e2a68a4e4324ff01750ab3fd Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Wed, 13 Aug 2014 16:37:59 +0200 Subject: [PATCH] completely green --- app/assets/javascripts/supplier/app/models/user.js.coffee | 2 +- .../javascripts/supplier/app/templates/section_table.emblem | 2 +- .../javascripts/supplier/foundation1/qsupplier.js.coffee.erb | 4 ++++ app/views/user/obtain_token.html.slim | 2 +- spec/acceptance/users/sign_up_with_facebook.feature | 4 ++-- spec/acceptance_steps/users/authentication_steps.rb | 2 ++ 6 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/supplier/app/models/user.js.coffee b/app/assets/javascripts/supplier/app/models/user.js.coffee index f437b2ef..828a69f2 100644 --- a/app/assets/javascripts/supplier/app/models/user.js.coffee +++ b/app/assets/javascripts/supplier/app/models/user.js.coffee @@ -10,5 +10,5 @@ App.User= DS.Model.extend return '' unless facebook_id url = "http://graph.facebook.com/#{facebook_id}/picture?type=square" name = @get('name') - new Handlebars.SafeString "\"#{name}\"" + new Handlebars.SafeString "\"#{name}\"" ).property('facebook_id', 'name') diff --git a/app/assets/javascripts/supplier/app/templates/section_table.emblem b/app/assets/javascripts/supplier/app/templates/section_table.emblem index c1a20ea7..6a7a44c7 100644 --- a/app/assets/javascripts/supplier/app/templates/section_table.emblem +++ b/app/assets/javascripts/supplier/app/templates/section_table.emblem @@ -13,7 +13,7 @@ if table.active_list /.table-action-row a{action "editTable" table}: span.fa.fa-lg.fa-wrench each user in table.active_list.users - span= user.facebook_image_tag + = user.facebook_image_tag if editmodedisabled .table-settings select diff --git a/app/assets/javascripts/supplier/foundation1/qsupplier.js.coffee.erb b/app/assets/javascripts/supplier/foundation1/qsupplier.js.coffee.erb index 0d17d994..81dd6e2f 100644 --- a/app/assets/javascripts/supplier/foundation1/qsupplier.js.coffee.erb +++ b/app/assets/javascripts/supplier/foundation1/qsupplier.js.coffee.erb @@ -3,6 +3,10 @@ root.Qsupplier= watch_events: -> faye = new Faye.Client(event_host) faye.subscribe "/supplier/#{supplier_object.id}", (e)=> +<% if Rails.env.development? %> + console.log "Event: #{e.event}" + console.log e.data +<% end %> if(e.event == 'new_order') if App App.store().pushPayload(e.data) diff --git a/app/views/user/obtain_token.html.slim b/app/views/user/obtain_token.html.slim index eca9e668..d4470f64 100644 --- a/app/views/user/obtain_token.html.slim +++ b/app/views/user/obtain_token.html.slim @@ -21,7 +21,7 @@ Qstorage = window.localStorage; Qstorage.setItem('auth_token', '#{current_user.authentication_token}'); Qstorage.setItem('user_id', '#{current_user.id}'); - window.location = (Qstorage.getItem('root_url') || '/index.html') + '?user_id=#{current_user.id}&auth_token=#{current_user.authentication_token}'; + window.location = (Qstorage.getItem('root_url') || '/user/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}'; diff --git a/spec/acceptance/users/sign_up_with_facebook.feature b/spec/acceptance/users/sign_up_with_facebook.feature index b236ddcc..71c847de 100644 --- a/spec/acceptance/users/sign_up_with_facebook.feature +++ b/spec/acceptance/users/sign_up_with_facebook.feature @@ -6,8 +6,8 @@ Feature: Sign up as user using facebook Given There is no user information stored in the local storage When I visit the user obtain token path Then I should be signed in as a user through facebook - And I wait 4 seconds - And I should be redirected to the user home + When I wait 4 seconds + Then I should be redirected to the user home And the newly created user info should be stored in the local storage @javascript diff --git a/spec/acceptance_steps/users/authentication_steps.rb b/spec/acceptance_steps/users/authentication_steps.rb index 3895fabb..3cf182d8 100644 --- a/spec/acceptance_steps/users/authentication_steps.rb +++ b/spec/acceptance_steps/users/authentication_steps.rb @@ -1,5 +1,7 @@ step "There is no user information stored in the local storage" do + visit '/' + page.execute_script %|Qstorage = window.localStorage| page.evaluate_script(%|Qstorage.getItem('user_id')|).should be_blank page.evaluate_script(%|Qstorage.getItem('auth_token')|).should be_blank end