From 87f4890638855e2201c52ab2f46bcf51e683cf38 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sat, 1 Mar 2014 10:39:35 -0600 Subject: [PATCH] * VRFS-1279 - whats next dialog shows twice, VRFS-721 - default to 1 for kernel streaming --- web/app/assets/javascripts/ftue.js | 8 +- web/app/assets/javascripts/user_dropdown.js | 210 ++++++++++---------- web/spec/features/welcome_spec.rb | 20 +- 3 files changed, 120 insertions(+), 118 deletions(-) diff --git a/web/app/assets/javascripts/ftue.js b/web/app/assets/javascripts/ftue.js index e51581602..7366f251f 100644 --- a/web/app/assets/javascripts/ftue.js +++ b/web/app/assets/javascripts/ftue.js @@ -766,11 +766,9 @@ // Win32, no ControlPanel = WDM/Kernel Streaming // frame=10, buffers=0 $asioBtn.hide(); - $frame.val('10'); - // TODO FIXME - the old FTUE set the buffers to 1 for WDM/Kernel streaming - // The new FTUE spec says to use 0, as I've done here... - $bin.val('0'); - $bout.val('0'); + $frame.val('2.5'); + $bin.val('1'); + $bout.val('1'); } } else { // Assuming Mac. TODO: Linux check here // frame=2.5, buffers=0 diff --git a/web/app/assets/javascripts/user_dropdown.js b/web/app/assets/javascripts/user_dropdown.js index 3a7369a1a..91b3d2743 100644 --- a/web/app/assets/javascripts/user_dropdown.js +++ b/web/app/assets/javascripts/user_dropdown.js @@ -1,110 +1,112 @@ -(function(context,$) { -/** Javascript for managing the (account dropdown) */ +(function (context, $) { + /** Javascript for managing the (account dropdown) */ -"use strict"; + "use strict"; - context.JK = context.JK || {}; - context.JK.UserDropdown = function(app) { + context.JK = context.JK || {}; + context.JK.UserDropdown = function (app) { - var logger = context.JK.logger; - var rest = new JK.Rest(); - var userMe = null; - var invitationDialog = null; + var logger = context.JK.logger; + var rest = new JK.Rest(); + var userMe = null; + var invitationDialog = null; + var notYetShownWhatsNext = true; - function menuHoverIn() { - $('ul.shortcuts', this).show(); - } - - function menuHoverOut() { - $('ul.shortcuts', this).hide(); - } - - function events() { - $('.userinfo').hoverIntent({ - over: function () { - $('ul.shortcuts', this).fadeIn(100); - }, - out: function() { - $('ul.shortcuts', this).fadeOut(100); - }, - timeout: 500 - }); - - $('.userinfo .invite-friends .menuheader').on('click', function(e) { - $(this).closest('li').css('height', 'auto').find('ul').toggle(); - e.stopPropagation(); - return false; - }); - - $('.invite-friends .google-invite a').on('click', function(e) { - invitationDialog.showGoogleDialog(); - }); - - $('.invite-friends .email-invite a').on('click', function(e) { - invitationDialog.showEmailDialog(); - }); - - $('.invite-friends .facebook-invite a').on('click', function(e) { - invitationDialog.showFacebookDialog(e); - }); - - $('#header-avatar').on('avatar_changed', function(event, newAvatarUrl) { - updateAvatar(newAvatarUrl); - event.preventDefault(); - return false; - }) - } - - function loadMe() { - if(!context.JK.currentUserId) { - return; - } - - $.ajax({ - url: '/api/users/' + context.JK.currentUserId - }).done(function(r) { - userMe = r; - // TODO - Setting global variable for local user. - context.JK.userMe = r; - updateHeader(); - handleWhatsNext(userMe); - }).fail(app.ajaxError); - } - - function updateHeader() { - $('#user').html(userMe.name); - showAvatar(); - } - - function handleWhatsNext(userProfile) { - if(gon.isNativeClient && userProfile.show_whats_next) { - app.layout.showDialog('whatsNext'); - } - } - - - // initially show avatar - function showAvatar() { - var photoUrl = context.JK.resolveAvatarUrl(userMe.photo_url); - $('#header-avatar').attr('src', photoUrl); - } - - // handle update avatar event - function updateAvatar(avatar_url) { - var photoUrl = context.JK.resolveAvatarUrl(avatar_url); - var avatar = $(new Image()); - avatar.attr('src', photoUrl + '?cache_bust=' + new Date().getTime()); - avatar.attr('alt', "Avatar"); - avatar.attr('id', 'header-avatar'); - $('#header-avatar').replaceWith(avatar); - } - - this.initialize = function(invitationDialogInstance) { - events(); - invitationDialog = invitationDialogInstance; - loadMe(); - } - this.loadMe = loadMe; + function menuHoverIn() { + $('ul.shortcuts', this).show(); } -})(window,jQuery); \ No newline at end of file + + function menuHoverOut() { + $('ul.shortcuts', this).hide(); + } + + function events() { + $('.userinfo').hoverIntent({ + over: function () { + $('ul.shortcuts', this).fadeIn(100); + }, + out: function () { + $('ul.shortcuts', this).fadeOut(100); + }, + timeout: 500 + }); + + $('.userinfo .invite-friends .menuheader').on('click', function (e) { + $(this).closest('li').css('height', 'auto').find('ul').toggle(); + e.stopPropagation(); + return false; + }); + + $('.invite-friends .google-invite a').on('click', function (e) { + invitationDialog.showGoogleDialog(); + }); + + $('.invite-friends .email-invite a').on('click', function (e) { + invitationDialog.showEmailDialog(); + }); + + $('.invite-friends .facebook-invite a').on('click', function (e) { + invitationDialog.showFacebookDialog(e); + }); + + $('#header-avatar').on('avatar_changed', function (event, newAvatarUrl) { + updateAvatar(newAvatarUrl); + event.preventDefault(); + return false; + }) + } + + function loadMe() { + if (!context.JK.currentUserId) { + return; + } + + $.ajax({ + url: '/api/users/' + context.JK.currentUserId + }).done(function (r) { + userMe = r; + // TODO - Setting global variable for local user. + context.JK.userMe = r; + updateHeader(); + handleWhatsNext(userMe); + }).fail(app.ajaxError); + } + + function updateHeader() { + $('#user').html(userMe.name); + showAvatar(); + } + + function handleWhatsNext(userProfile) { + if (notYetShownWhatsNext && gon.isNativeClient && userProfile.show_whats_next) { + notYetShownWhatsNext = false; + app.layout.showDialog('whatsNext'); + } + } + + + // initially show avatar + function showAvatar() { + var photoUrl = context.JK.resolveAvatarUrl(userMe.photo_url); + $('#header-avatar').attr('src', photoUrl); + } + + // handle update avatar event + function updateAvatar(avatar_url) { + var photoUrl = context.JK.resolveAvatarUrl(avatar_url); + var avatar = $(new Image()); + avatar.attr('src', photoUrl + '?cache_bust=' + new Date().getTime()); + avatar.attr('alt', "Avatar"); + avatar.attr('id', 'header-avatar'); + $('#header-avatar').replaceWith(avatar); + } + + this.initialize = function (invitationDialogInstance) { + events(); + invitationDialog = invitationDialogInstance; + loadMe(); + } + this.loadMe = loadMe; + } +})(window, jQuery); \ No newline at end of file diff --git a/web/spec/features/welcome_spec.rb b/web/spec/features/welcome_spec.rb index b4485f5c9..db9921a62 100644 --- a/web/spec/features/welcome_spec.rb +++ b/web/spec/features/welcome_spec.rb @@ -181,15 +181,6 @@ describe "Welcome", :js => true, :type => :feature, :capybara_feature => true d find('.feed-entry.music-session-history-entry .description', text: musicSessionHistory1.description) should_not have_selector('.feed-entry.recording-entry') - # try to mess with the music session history by removing all user histories (which makes it a bit invalid) - # but we really don't want the front page to ever crash if we can help it - musicSessionHistory1.music_session_user_histories.delete_all - musicSessionHistory1.reload - musicSessionHistory1.music_session_user_histories.length.should == 0 - - visit "/" - find('h1', text: 'Play music together over the Internet as if in the same room') - find('.feed-entry.music-session-history-entry .description', text: musicSessionHistory1.description) # try to hide the music session musicSessionHistory1.fan_access = false @@ -198,6 +189,17 @@ describe "Welcome", :js => true, :type => :feature, :capybara_feature => true d visit "/" find('h1', text: 'Play music together over the Internet as if in the same room') should_not have_selector('.feed-entry.music-session-history-entry') + + # try to mess with the music session history by removing all user histories (which makes it a bit invalid) + # but we really don't want the front page to ever crash if we can help it + musicSessionHistory1.fan_access = true + musicSessionHistory1.music_session_user_histories.delete_all + musicSessionHistory1.reload + musicSessionHistory1.music_session_user_histories.length.should == 0 + + visit "/" + find('h1', text: 'Play music together over the Internet as if in the same room') + should_not have_selector('.feed-entry.music-session-history-entry') end end end