Merge branch 'develop' of bitbucket.org:jamkazam/jam-cloud into develop

This commit is contained in:
Brian Smith 2014-11-06 21:18:30 -05:00
commit 0732216a0d
7 changed files with 50 additions and 6 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -40,5 +40,13 @@
}
clear: left;
}
.google_login_button {
vertical-align: middle;
}
.signed_in_to_google {
color: yellow;
}
}

View File

@ -150,6 +150,10 @@ class SessionsController < ApplicationController
render 'oauth_complete', :layout => "landing"
end
def has_google_auth
render :json => {has_google_auth: (!!current_user && !!UserAuthorization.google_auth(current_user).first)}
end
def redirect_after_signin(default)
redirect_to(params['redirect-to'].blank? ? default : params['redirect-to'])
end

View File

@ -23,12 +23,16 @@
.field.w100.left{:purpose => "description"}
%label{:for => "description"} Description:
%textarea#claim-recording-description.w100{:name => "description"}
.field.left{:purpose => "save_video"}
%input{:checked => "checked", :name => "save_video", :type => "checkbox"}/
%label{:for => "save_video"} Save Video to Computer
.field.left{:purpose => "upload_to_youtube"}
%input{:checked => "checked", :name => "upload_to_youtube", :type => "checkbox"}/
%label{:for => "upload_to_youtube"} Upload Video to YouTube
/ TODO VRFS-1849: Uncomment this when rest of feature developed:
/ .field.left{:purpose => "save_video"}
/ %input{:checked => "checked", :name => "save_video", :type => "checkbox"}/
/ %label{:for => "save_video"} Save Video to Computer
/ .field.left{:purpose => "upload_to_youtube"}
/ %span
/ %input{:checked => "checked", :name => "upload_to_youtube", :type => "checkbox"}/
/ %label{:for => "upload_to_youtube"} Upload Video to YouTube
/ %span
/ = render(:partial => "shared/google_login")
.field.left{:purpose => "is_public"}
%input{:checked => "checked", :name => "is_public", :type => "checkbox"}/
%label{:for => "is_public"} Public Recording

View File

@ -30,6 +30,7 @@
<% else %>
<%= render "layouts/social_meta" %>
<% end %>
<%= yield(:extra_js) %>
</head>
<body class="jam" data-client-type="<%= @nativeClient ? 'client' : 'browser' %>">
<%= yield %>

View File

@ -0,0 +1,26 @@
-content_for :extra_js do
javascript:
// Check for google authorization using AJAX and show/hide the
// google login button / "signed in" label as appropriate:
$(window).on('focus', function() {
$.ajax({
type: "GET",
dataType: "json",
url: "/auth/has_google_auth"
}).success(function(data) {
if(data.has_google_auth) {
$("input.google_login_button").addClass("hidden")
$("span.signed_in_to_google").removeClass("hidden")
if (window._oauth_win) {
window._oauth_win.close()
}
} else {
$("span.signed_in_to_google").addClass("hidden")
$("input.google_login_button").removeClass("hidden")
}
})
});
-google_auth = (current_user.nil?) ? nil : !!JamRuby::UserAuthorization.google_auth(current_user).first
span.signed_in_to_google class=((!google_auth) ? "hidden" : "") ="(Signed in)"
input.google_login_button class=((google_auth) ? "hidden" : "") type='image' onclick='window._oauth_win = window.open("/auth/google_login", "_blank", "height=500,width=500,menubar=no,resizable=no,status=no");' src="/assets/google_signin.png" height="30px"

View File

@ -30,6 +30,7 @@ SampleApp::Application.routes.draw do
# oauth
match '/auth/:provider/callback', :to => 'sessions#oauth_callback'
match '/auth/failure', :to => 'sessions#failure'
match '/auth/has_google_auth', :to => 'sessions#has_google_auth'
# session info page
match '/sessions/:id/details' => 'music_sessions#session_info', :via => :get, :as => 'music_scheduled_session_detail'