From c1dd3eea75caeaeab0e1aee609388a2230b9ba3b Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Mon, 10 Feb 2014 08:03:29 -0500 Subject: [PATCH 1/9] VRFS-1028 hover bubble work --- web/app/assets/javascripts/hoverBand.js | 14 ++++++ web/app/assets/javascripts/hoverFan.js | 14 ++++++ web/app/assets/javascripts/hoverMusician.js | 16 +++++++ web/app/assets/javascripts/hoverRecording.js | 14 ++++++ web/app/assets/javascripts/hoverSession.js | 14 ++++++ web/app/assets/javascripts/shareDialog.js | 18 ++----- web/app/assets/javascripts/utils.js | 3 +- .../stylesheets/client/hoverBubble.css.scss | 32 +++++++++++++ web/app/views/clients/_hoverMusician.html.erb | 48 +++++++++++++++++++ 9 files changed, 157 insertions(+), 16 deletions(-) create mode 100644 web/app/assets/javascripts/hoverBand.js create mode 100644 web/app/assets/javascripts/hoverFan.js create mode 100644 web/app/assets/javascripts/hoverMusician.js create mode 100644 web/app/assets/javascripts/hoverRecording.js create mode 100644 web/app/assets/javascripts/hoverSession.js diff --git a/web/app/assets/javascripts/hoverBand.js b/web/app/assets/javascripts/hoverBand.js new file mode 100644 index 000000000..076c8f466 --- /dev/null +++ b/web/app/assets/javascripts/hoverBand.js @@ -0,0 +1,14 @@ +(function(context,$) { + + "use strict"; + context.JK = context.JK || {}; + context.JK.BandHoverBubble = function(app) { + + function initialize() { + + } + + this.initialize = initialize; + this.showBubble = showBubble; + } +})(window,jQuery); \ No newline at end of file diff --git a/web/app/assets/javascripts/hoverFan.js b/web/app/assets/javascripts/hoverFan.js new file mode 100644 index 000000000..aac8914f5 --- /dev/null +++ b/web/app/assets/javascripts/hoverFan.js @@ -0,0 +1,14 @@ +(function(context,$) { + + "use strict"; + context.JK = context.JK || {}; + context.JK.FanHoverBubble = function(app) { + + function initialize() { + + } + + this.initialize = initialize; + this.showBubble = showBubble; + } +})(window,jQuery); \ No newline at end of file diff --git a/web/app/assets/javascripts/hoverMusician.js b/web/app/assets/javascripts/hoverMusician.js new file mode 100644 index 000000000..168eae817 --- /dev/null +++ b/web/app/assets/javascripts/hoverMusician.js @@ -0,0 +1,16 @@ +(function(context,$) { + + "use strict"; + context.JK = context.JK || {}; + context.JK.MusicianHoverBubble = function(app, user, position) { + var logger = context.JK.logger; + var rest = context.JK.Rest(); + + function showBubble() { + $("#musician-hover").css({left: position.left; top: position.top}); + } + + this.initialize = initialize; + this.showBubble = showBubble; + } +})(window,jQuery); \ No newline at end of file diff --git a/web/app/assets/javascripts/hoverRecording.js b/web/app/assets/javascripts/hoverRecording.js new file mode 100644 index 000000000..68718743c --- /dev/null +++ b/web/app/assets/javascripts/hoverRecording.js @@ -0,0 +1,14 @@ +(function(context,$) { + + "use strict"; + context.JK = context.JK || {}; + context.JK.RecordingHoverBubble = function(app) { + + function initialize() { + + } + + this.initialize = initialize; + this.showBubble = showBubble; + } +})(window,jQuery); \ No newline at end of file diff --git a/web/app/assets/javascripts/hoverSession.js b/web/app/assets/javascripts/hoverSession.js new file mode 100644 index 000000000..7bfe105cf --- /dev/null +++ b/web/app/assets/javascripts/hoverSession.js @@ -0,0 +1,14 @@ +(function(context,$) { + + "use strict"; + context.JK = context.JK || {}; + context.JK.SessionHoverBubble = function(app) { + + function initialize() { + + } + + this.initialize = initialize; + this.showBubble = showBubble; + } +})(window,jQuery); \ No newline at end of file diff --git a/web/app/assets/javascripts/shareDialog.js b/web/app/assets/javascripts/shareDialog.js index a8a26d4e0..1dbc2fec9 100644 --- a/web/app/assets/javascripts/shareDialog.js +++ b/web/app/assets/javascripts/shareDialog.js @@ -338,14 +338,6 @@ return false; }) - /* - $("#btn-share-copy").zclip({ - path: 'zeroclipboard.swf', - copy: function() { - // console.log("copied " + $(".link-contents").text()); - return "TEXT"; - } - });*/ } function showDialog() { @@ -416,10 +408,6 @@ } } - function clearTextFields() { - - } - function beforeShow() { disableTwitter(); // no disableFacebook on purpose @@ -477,7 +465,7 @@ registerEvents(false); } - function initialize(_facebookHelper){ + function initialize(_facebookHelper) { facebookHelper = _facebookHelper; var dialogBindings = { @@ -491,11 +479,11 @@ initDialog(); facebookHelper.deferredLoginStatus().done(function(response) { handleFbStateChange(response); }); - }; + } this.initialize = initialize; this.showDialog = showDialog; } return this; -})(window,jQuery) \ No newline at end of file +})(window,jQuery); \ No newline at end of file diff --git a/web/app/assets/javascripts/utils.js b/web/app/assets/javascripts/utils.js index 1fe7623c8..804f3e03b 100644 --- a/web/app/assets/javascripts/utils.js +++ b/web/app/assets/javascripts/utils.js @@ -141,6 +141,7 @@ $element.bt(text, options); } + // Uber-simple templating // var template = "Hey {name}"; // var vals = { name: "Jon" }; @@ -650,7 +651,7 @@ if(context.JK.CurrentSessionModel.recordingModel.isRecording()) { app.notify({ title: "Currently Recording", - text: "Tracks can not be modified while recording.", + text: "Tracks cannot be modified while recording.", icon_url: "/assets/content/icon_alert_big.png"}); return false; } diff --git a/web/app/assets/stylesheets/client/hoverBubble.css.scss b/web/app/assets/stylesheets/client/hoverBubble.css.scss index e69de29bb..0e714e024 100644 --- a/web/app/assets/stylesheets/client/hoverBubble.css.scss +++ b/web/app/assets/stylesheets/client/hoverBubble.css.scss @@ -0,0 +1,32 @@ +.bubble { + width:350px; + min-height:200px; + background-color:#242323; + border:solid 1px #ed3618; + position:absolute; + z-index:999; +} + +.bubble h2 { + padding:6px 0px; + text-align:center; + font-size:15px; + font-weight:200; + width:100%; + background-color:#ed3618; +} + +.bubble h3 { + font-weight:400; + font-size:16px; + color:#fff; +} + +.bubble-inner { + padding:10px; + color:#ccc; +} + +.bubble-inner div.mb { + margin-bottom:5px; +} \ No newline at end of file diff --git a/web/app/views/clients/_hoverMusician.html.erb b/web/app/views/clients/_hoverMusician.html.erb index e69de29bb..d9e2c89a4 100644 --- a/web/app/views/clients/_hoverMusician.html.erb +++ b/web/app/views/clients/_hoverMusician.html.erb @@ -0,0 +1,48 @@ + \ No newline at end of file From bca7f334002c53c83096d36315c0eb31a3e903eb Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Mon, 10 Feb 2014 23:08:40 -0500 Subject: [PATCH 2/9] VRFS-1028 hover bubble work --- web/app/assets/javascripts/findMusician.js | 3 + web/app/assets/javascripts/hoverMusician.js | 18 +- web/app/assets/javascripts/utils.js | 75 +++++++ web/app/views/clients/_bandProfile.html.erb | 2 +- web/app/views/clients/_hoverBubble.html.erb | 229 -------------------- web/app/views/clients/_musicians.html.erb | 8 +- web/app/views/clients/index.html.erb | 7 + 7 files changed, 102 insertions(+), 240 deletions(-) diff --git a/web/app/assets/javascripts/findMusician.js b/web/app/assets/javascripts/findMusician.js index 9293852c9..bc0b4b2a8 100644 --- a/web/app/assets/javascripts/findMusician.js +++ b/web/app/assets/javascripts/findMusician.js @@ -105,6 +105,7 @@ for (var jj=0, ilen=mm['followings'].length; jj +
diff --git a/web/app/views/clients/_hoverBubble.html.erb b/web/app/views/clients/_hoverBubble.html.erb index 4ef9c6edc..6fb92a38e 100644 --- a/web/app/views/clients/_hoverBubble.html.erb +++ b/web/app/views/clients/_hoverBubble.html.erb @@ -1,232 +1,3 @@ - - - - - - - - - - - - - - - - diff --git a/web/app/views/clients/index.html.erb b/web/app/views/clients/index.html.erb index 3ff305987..222afd70f 100644 --- a/web/app/views/clients/index.html.erb +++ b/web/app/views/clients/index.html.erb @@ -36,6 +36,11 @@ <%= render "account_audio_profile" %> <%= render "invitationDialog" %> <%= render "inviteMusicians" %> +<%= render "hoverBand" %> +<%= render "hoverFan" %> +<%= render "hoverMusician" %> +<%= render "hoverRecording" %> +<%= render "hoverSession" %> <%= render "whatsNextDialog" %> <%= render "recordingFinishedDialog" %> <%= render "localRecordingsDialog" %> @@ -242,6 +247,8 @@ } testConnected(); } + + JK.bindHoverEvents(); }) From 4265ef50b7e6cf212397e4ed5843aa71b1718192 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Wed, 12 Feb 2014 01:35:44 -0500 Subject: [PATCH 3/9] VRFS-1028 musician hover bubble --- web/app/assets/javascripts/hoverMusician.js | 70 +++++++++++++++++++ web/app/assets/javascripts/profile.js | 20 +----- web/app/assets/javascripts/utils.js | 20 +++++- .../stylesheets/client/hoverBubble.css.scss | 21 ++++++ web/app/views/api_users/show.rabl | 20 ++++-- web/app/views/clients/_hoverMusician.html.erb | 60 +++++++--------- 6 files changed, 151 insertions(+), 60 deletions(-) diff --git a/web/app/assets/javascripts/hoverMusician.js b/web/app/assets/javascripts/hoverMusician.js index 46c3c0500..cb66a2edd 100644 --- a/web/app/assets/javascripts/hoverMusician.js +++ b/web/app/assets/javascripts/hoverMusician.js @@ -5,10 +5,80 @@ context.JK.MusicianHoverBubble = function(userId, position) { var logger = context.JK.logger; var rest = context.JK.Rest(); + var instrumentLogoMap = context.JK.getInstrumentIconMap24(); this.showBubble = function() { $("#musician-hover").css({left: position.left, top: position.top}); $("#musician-hover").fadeIn(500); + + rest.getUserDetail({id: userId}) + .done(function(response) { + $("#musician-hover").html(''); + + // instruments + var instrumentHtml = ''; + $.each(response.instruments, function(index, val) { + instrumentHtml += '
'; + }); + + // followings + var followingHtml = ''; + $.each(response.followings, function(index, val) { + if (index < 4) { // display max of 4 followings (NOTE: this only displays USER followings, not BAND followings) + if (index % 2 === 0) { + followingHtml += ''; + } + + followingHtml += ''; + followingHtml += '' + val.name + ''; + + if (index % 2 > 0) { + followingHtml += ''; + } + } + }); + + var template = $('#template-hover-musician').html(); + if (response.biography == null) { + response.biography = 'No Biography Available'; + } + + var sessionDisplayStyle = 'none'; + var sessionId = ''; + if (response.sessions !== undefined && response.sessions.length > 0) { + sessionDisplayStyle = 'block'; + sessionId = response.sessions[0].id; + } + + var musicianHtml = context.JK.fillTemplate(template, { + avatar_url: context.JK.resolveAvatarUrl(response.photo_url), + name: response.name, + location: response.location, + instruments: instrumentHtml, + friend_count: response.friend_count, + follower_count: response.follower_count, + recording_count: response.recording_count, + session_count: response.session_count, + session_display: sessionDisplayStyle, + session_id: sessionId, + biography: response.biography, + followings: followingHtml, + profile_url: "/client#/profile/" + response.id + }); + + $("#musician-hover").append('

Musician Detail

' + musicianHtml); + }) + .fail(function(xhr) { + if(jqXHR.status >= 500) { + context.JK.fetchUserNetworkOrServerFailure(); + } + else if(jqXHR.status == 404) { + context.JK.entityNotFound("User"); + } + else { + app.ajaxError(arguments); + } + }); }; this.hideBubble = function() { diff --git a/web/app/assets/javascripts/profile.js b/web/app/assets/javascripts/profile.js index 6d1777d1e..bc6815b89 100644 --- a/web/app/assets/javascripts/profile.js +++ b/web/app/assets/javascripts/profile.js @@ -60,10 +60,10 @@ }) .fail(function(jqXHR) { if(jqXHR.status >= 500) { - fetchUserNetworkOrServerFailure(); + context.JK.fetchUserNetworkOrServerFailure(); } else if(jqXHR.status == 404) { - fetchUserGone(); + context.JK.entityNotFound("User"); } else { app.ajaxError(arguments); @@ -644,22 +644,6 @@ } - function fetchUserGone() { - app.notify({ - title: "User Deleted", - text: "The user you are looking for is gone", - icon_url: "/assets/content/icon_alert_big.png" - }) - } - - function fetchUserNetworkOrServerFailure() { - app.notify({ - title: "Unable to communicate with server", - text: "Please try again later", - icon_url: "/assets/content/icon_alert_big.png" - }) - } - function bindFavorites() { } diff --git a/web/app/assets/javascripts/utils.js b/web/app/assets/javascripts/utils.js index da03f2d73..9a9a6bd94 100644 --- a/web/app/assets/javascripts/utils.js +++ b/web/app/assets/javascripts/utils.js @@ -197,7 +197,7 @@ // SESSION $("[hoveraction='session']").hover( function() { - var bubble = new JK.BandHoverBubble($(this).attr('session-id'), $(this).position()); + var bubble = new JK.SessionHoverBubble($(this).attr('session-id'), $(this).position()); showBubble(bubble, $(this)); }, function() { // this registers for leaving the hoverable element @@ -208,7 +208,7 @@ // RECORDING $("[hoveraction='recording']").hover( function() { - var bubble = new JK.BandHoverBubble($(this).attr('recording-id'), $(this).position()); + var bubble = new JK.RecordingHoverBubble($(this).attr('recording-id'), $(this).position()); showBubble(bubble, $(this)); }, function() { // this registers for leaving the hoverable element @@ -217,6 +217,22 @@ ); } + context.JK.fetchUserNetworkOrServerFailure = function() { + app.notify({ + title: "Unable to communicate with server", + text: "Please try again later", + icon_url: "/assets/content/icon_alert_big.png" + }); + } + + context.JK.entityNotFound = function(type) { + app.notify({ + title: type + " Deleted", + text: "The " + type + " no longer exists.", + icon_url: "/assets/content/icon_alert_big.png" + }); + } + // Uber-simple templating // var template = "Hey {name}"; // var vals = { name: "Jon" }; diff --git a/web/app/assets/stylesheets/client/hoverBubble.css.scss b/web/app/assets/stylesheets/client/hoverBubble.css.scss index 0e714e024..761ea0258 100644 --- a/web/app/assets/stylesheets/client/hoverBubble.css.scss +++ b/web/app/assets/stylesheets/client/hoverBubble.css.scss @@ -29,4 +29,25 @@ .bubble-inner div.mb { margin-bottom:5px; +} + +strong { + font-weight:600 !important; +} + +.musicians { + margin-top:-3px; + font-size:11px; +} + +.musicians td { + border-right:none; + border-top:none; + padding:3px; + vertical-align:middle; +} + +.musicians a { + color:#fff; + text-decoration:none; } \ No newline at end of file diff --git a/web/app/views/api_users/show.rabl b/web/app/views/api_users/show.rabl index 4d78029b3..45e28fb9b 100644 --- a/web/app/views/api_users/show.rabl +++ b/web/app/views/api_users/show.rabl @@ -21,13 +21,19 @@ elsif current_user end end -unless @user.friends.nil? || @user.friends.size == 0 +unless @user.friends.blank? child :friends => :friends do - attributes :id, :first_name, :last_name, :online + attributes :id, :first_name, :last_name, :name, :online, :photo_url end end -unless @user.bands.nil? || @user.bands.size == 0 +unless @user.followings.blank? + child :followings => :followings do + attributes :id, :first_name, :last_name, :name, :online, :photo_url + end +end + +unless @user.bands.blank? child :band_musicians => :bands do attributes :id, :name, :admin, :photo_url, :logo_url @@ -38,8 +44,14 @@ unless @user.bands.nil? || @user.bands.size == 0 end end -unless @user.instruments.nil? || @user.instruments.size == 0 +unless @user.instruments.blank? child :musician_instruments => :instruments do attributes :description, :proficiency_level, :priority, :instrument_id end end + +unless @user.music_sessions.blank? + child :music_sessions => :sessions do + attributes :id, :description, :musician_access, :approval_required, :fan_access + end +end diff --git a/web/app/views/clients/_hoverMusician.html.erb b/web/app/views/clients/_hoverMusician.html.erb index d9e2c89a4..51e1d12f9 100644 --- a/web/app/views/clients/_hoverMusician.html.erb +++ b/web/app/views/clients/_hoverMusician.html.erb @@ -1,48 +1,36 @@