diff --git a/app/assets/javascripts/recordings.coffee b/app/assets/javascripts/recordings.coffee index 2992b888..eccd9fb3 100644 --- a/app/assets/javascripts/recordings.coffee +++ b/app/assets/javascripts/recordings.coffee @@ -166,14 +166,6 @@ class @Recordings options.title = I18n.mail_recording $('#recordings').tooltip(options) - options.selector = '.disabled-tooltip' - options.title = I18n.youtube_disabled - $('#recordings').tooltip(options) - - options.selector = '.invalid-tooltip' - options.title = I18n.invalid_provider - $('#recordings').tooltip(options) - $(document).one "turbolinks:before-cache", => @getTable().api().clear().draw().destroy() @@ -374,15 +366,42 @@ class @Recordings }).success((res_data) -> canUpload = res_data['uploadable'] ) + + youtube_button = $('.share-popover').find('.youtube-upload') + + attr = $(this).attr('data-popover-body'); + + # Check if the cloud button has a popover body. + if (typeof attr == typeof undefined || attr == false) + switch canUpload + # We can upload the recording. + when 'true' + youtube_button.attr('title', I18n.upload_youtube) + youtube_button.removeClass('disabled-button') + youtube_button.addClass('has-popover') + youtube_button.show() + # Can't upload because uploading is disabled. + when 'uploading_disabled' + youtube_button.hide() + # Can't upload because account is not authenticated with Google. + when 'invalid_provider' + youtube_button.attr('title', I18n.invalid_provider) + youtube_button.addClass('disabled-button') + youtube_button.removeClass('has-popover') + youtube_button.show() + # Can't upload because recording does not contain video. + else + youtube_button.attr('title', I18n.no_video) + youtube_button.addClass('disabled-button') + youtube_button.removeClass('has-popover') + youtube_button.show() - if canUpload == 'true' - $(this).attr('data-popover-body', '.mail_youtube_popover') - else if canUpload == 'invalid_provider' - $(this).attr('data-popover-body', '.no_youtube_popover') + $(this).attr('data-popover-body', '.share-popover') + $(this).popover('show') else - $(this).attr('data-popover-body', '.mail_popover') - - $(this).popover('show') + $(this).popover('hide') + $(this).removeAttr('data-popover-body') + @getTable().on 'draw.dt', (event) -> $('time[data-time-ago]').timeago(); diff --git a/app/assets/stylesheets/main/landing.scss b/app/assets/stylesheets/main/landing.scss index 99d10488..34da270f 100644 --- a/app/assets/stylesheets/main/landing.scss +++ b/app/assets/stylesheets/main/landing.scss @@ -94,6 +94,10 @@ width: 100%; text-align: center; } + +.disabled-button { + opacity: 0.5; +} .youtube-red { color: red; diff --git a/app/controllers/bbb_controller.rb b/app/controllers/bbb_controller.rb index bda9a5eb..e8c21be0 100644 --- a/app/controllers/bbb_controller.rb +++ b/app/controllers/bbb_controller.rb @@ -202,7 +202,9 @@ class BbbController < ApplicationController # POST /rooms/:room_id/recordings/can_upload def can_upload # The recording is uploadable if it contains webcam data and they are logged in through Google. - if current_user.provider != 'google' + if Rails.configuration.enable_youtube_uploading == false then + uploadable = 'uploading_disabled' + elsif current_user.provider != 'google' uploadable = 'invalid_provider' else uploadable = (Faraday.head(get_webcams_url(params[:rec_id])).status == 200 && current_user.provider == 'google').to_s diff --git a/app/views/landing/rooms.html.erb b/app/views/landing/rooms.html.erb index e714ef50..d092df1c 100644 --- a/app/views/landing/rooms.html.erb +++ b/app/views/landing/rooms.html.erb @@ -79,36 +79,16 @@
-