From 2942ab8563fb50cc1b7c001895bd57c3bac18577 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 4 Mar 2015 20:15:02 +0800 Subject: [PATCH 1/2] small fix in js for google connect --- app/views/admin/members/show.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/admin/members/show.html.erb b/app/views/admin/members/show.html.erb index b66e806..9dc50b2 100644 --- a/app/views/admin/members/show.html.erb +++ b/app/views/admin/members/show.html.erb @@ -73,15 +73,15 @@ $("#google_connection div.main_text").css("opacity","0.5"); $("#google_connection div.wait_text").show(); if($(this).parent().hasClass("disable")){ - window.location.href = "/auth/google_oauth2" - }else{ - if(confirm("Are you sure?")){ + if(confirm("Are you sure?")){ window.location.href = "/auth/google_oauth2/remove"; }else{ $("#google_connection div.main_text").css("opacity","1"); $("#google_connection div.wait_text").hide(); return false; } + }else{ + window.location.href = "/auth/google_oauth2"; } }) From 8e7319b3c3484a7cc5f34d1d90a115bb2674cef0 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 4 Mar 2015 20:31:33 +0800 Subject: [PATCH 2/2] fixed js --- app/controllers/sessions_controller.rb | 2 +- app/views/admin/members/_user_social.html.erb | 2 +- app/views/admin/members/show.html.erb | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index b90631f..b9d4471 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -65,7 +65,7 @@ class SessionsController < ApplicationController end def google_remove - current_user.google.destroy + current_user.google.destroy rescue "" redirect_to admin_member_path(current_user.member_profile.to_param) and return end diff --git a/app/views/admin/members/_user_social.html.erb b/app/views/admin/members/_user_social.html.erb index ff0c05f..37fe06e 100644 --- a/app/views/admin/members/_user_social.html.erb +++ b/app/views/admin/members/_user_social.html.erb @@ -2,7 +2,7 @@

<%= t("social_profile_connections")%>

<% if current_site.google_oauth_enabled %> -
Google type="checkbox" id="google_connect_box" class="toggle-check set-sidebar-state" data-disabled="true">
+
Google type="checkbox" id="google_connect_box" class="set-sidebar-state" data-disabled="true">
<% end %>
\ No newline at end of file diff --git a/app/views/admin/members/show.html.erb b/app/views/admin/members/show.html.erb index 9dc50b2..3538a9e 100644 --- a/app/views/admin/members/show.html.erb +++ b/app/views/admin/members/show.html.erb @@ -72,16 +72,16 @@ $("#google_connect_box").on("click",function(){ $("#google_connection div.main_text").css("opacity","0.5"); $("#google_connection div.wait_text").show(); - if($(this).parent().hasClass("disable")){ - if(confirm("Are you sure?")){ + if($(this).is(":checked")){ + window.location.href = "/auth/google_oauth2"; + }else{ + if(confirm("Are you sure?")){ window.location.href = "/auth/google_oauth2/remove"; }else{ $("#google_connection div.main_text").css("opacity","1"); $("#google_connection div.wait_text").hide(); return false; } - }else{ - window.location.href = "/auth/google_oauth2"; } })