From 6667a33e678cb109a33898b4550b09051e1ee556 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Sun, 22 Feb 2015 22:23:59 -0500 Subject: [PATCH] VRFS-2701 wip musician profile enhancements --- web/app/assets/javascripts/profile.js | 154 +++++++++++++++--- web/app/assets/javascripts/profile_utils.js | 104 ++++++++++++ .../stylesheets/client/profile.css.scss | 6 +- web/app/views/clients/_profile.html.erb | 84 +++++++++- 4 files changed, 315 insertions(+), 33 deletions(-) diff --git a/web/app/assets/javascripts/profile.js b/web/app/assets/javascripts/profile.js index 11d6c3ea3..dda9c97af 100644 --- a/web/app/assets/javascripts/profile.js +++ b/web/app/assets/javascripts/profile.js @@ -18,12 +18,38 @@ var NOT_SPECIFIED_TEXT = 'Not specified'; var $screen = $('#user-profile'); + + // musical experience var $instruments = $screen.find('#instruments'); var $musicianStatus = $screen.find('#musician-status'); var $genres = $screen.find('#genres'); var $concertCount = $screen.find('#concert-count'); var $studioCount = $screen.find('#studio-count'); + // performance samples + var $noSamples = $screen.find('no-samples'); + + // online presence + var $noOnlinePresence = $screen.find('no-online-presence'); + + // current interests + var $noInterests = $screen.find('#no-interests'); + var $paidGigSection = $screen.find('#paid-gigs'); + var $paidGigDetails = $screen.find('#paid-gig-details'); + + var $freeGigSection = $screen.find('#free-gigs'); + var $freeGigDetails = $screen.find('#free-gig-details'); + + var $cowritingSection = $screen.find('#cowriting'); + var $cowritingDetails = $screen.find('#cowriting-details'); + + var $traditionalBandSection = $screen.find("#traditional-band"); + var $traditionalBandDetails = $screen.find('#traditional-band-details'); + + var $virtualBandSection = $screen.find("#virtual-band"); + var $virtualBandDetails = $screen.find('#virtual-band-details'); + + // tabs var $aboutLink = $screen.find('#about-link'); var $aboutContent = $screen.find('#about-content'); @@ -39,6 +65,7 @@ var $favoritesLink = $screen.find('#favorites-link'); var $favoritesContent = $screen.find('#favorites-content'); + // stats var $friendStats = $screen.find('#friend-stats'); var $followerStats = $screen.find('#follower-stats'); var $sessionStats = $screen.find('#session-stats'); @@ -46,23 +73,25 @@ var $followingStats = $screen.find('#following-stats'); var $favoriteStats = $screen.find('#favorite-stats'); + // miscellaneous + var $userName = $screen.find('#username'); + var $avatar = $screen.find('#avatar'); var $typeLabel = $screen.find('#type-label'); var $location = $screen.find('#location'); var $age = $screen.find('#age'); + // buttons var $btnEdit = $screen.find('#btn-edit'); var $btnAddFriend = $screen.find('#btn-add-friend'); var $btnFollowUser = $screen.find('#btn-follow-user'); var $btnMessageUser = $screen.find('#btn-message-user'); + // social var $socialLeft = $screen.find('.profile-social-left'); var $socialFriends = $screen.find('#social-friends'); var $socialFollowings = $screen.find('#social-followings'); var $socialFollowers = $screen.find('#social-followers'); - var $userName = $screen.find('#username'); - var $avatar = $screen.find('#avatar'); - var $bioTextArea = $screen.find('.user-biography'); var $showBio = $screen.find('.have-bio'); var $noBio = $screen.find('.no-bio'); @@ -79,19 +108,6 @@ "3": "EXPERT" }; - var skillLevelMap = { - "1": "Amateur", - "2": "Professional" - } - - var gigMap = { - "0": "zero", - "1": "under 10", - "2": "10 to 50", - "3": "50 to 100", - "4": "over 100" - } - var proficiencyCssMap = { "1": "proficiency-beginner", "2": "proficiency-intermediate", @@ -430,25 +446,20 @@ // status var status = user.skill_level; - $musicianStatus.html(status ? skillLevelMap[status] + ' musician' : NOT_SPECIFIED_TEXT) + $musicianStatus.html(status ? profileUtils.skillLevelMap[status] + ' musician' : NOT_SPECIFIED_TEXT) // genres $genres.empty(); - var profileGenres = profileUtils.profileGenres(user.genres); - for (var i=0; i < profileGenres.length; i++) { - $genres.append(profileGenres[i].genre_id); - if (i !== profileGenres.length - 1) { - $genres.append(', '); - } - } + var profileGenres = profileUtils.profileGenreList(user.genres); + $genres.append(profileGenres); // concert gigs var concertGigCount = user.concert_count; - $concertCount.html(concertGigCount > 0 ? 'Has played ' + gigMap[concertGigCount] + ' live concert gigs' : NOT_SPECIFIED_TEXT); + $concertCount.html(concertGigCount > 0 ? 'Has played ' + profileUtils.gigMap[concertGigCount] + ' live concert gigs' : NOT_SPECIFIED_TEXT); // studio gigs var studioGigCount = user.studio_session_count; - $studioCount.html(studioGigCount > 0 ? 'Has played ' + gigMap[studioGigCount] + ' studio session gigs' : NOT_SPECIFIED_TEXT); + $studioCount.html(studioGigCount > 0 ? 'Has played ' + profileUtils.gigMap[studioGigCount] + ' studio session gigs' : NOT_SPECIFIED_TEXT); // location $location.html(user.location); @@ -465,6 +476,97 @@ // text = user.following_count > 1 || user.following_count === 0 ? " Followings" : " Following"; // $('#profile-following-stats').html('' + user.following_count + '' + text); + // performance samples + var performanceSamples = user.performance_samples; + if (!performanceSamples || performanceSamples.length === 0) { + $noSamples.show(); + } + else { + $noSamples.hide(); + } + + // online presences + var onlinePresences = user.online_presences; + if (!onlinePresences || onlinePresences.length === 0) { + $noOnlinePresence.show(); + } + else { + $noOnlinePresence.hide(); + } + + // current interests + + var noInterests = !user.paid_sessions && !user.free_sessions && !user.cowriting && !user.virtual_band && !user.traditional_band; + if (noInterests) { + $noInterests.show(); + $paidGigSection.hide(); + $freeGigSection.hide(); + $cowritingSection.hide(); + $traditionalBandSection.hide(); + $virtualBandSection.hide(); + } + + else { + // paid sessions + if (user.paid_sessions) { + $paidGigDetails.find("ul li:nth-child(1)").append(profileUtils.paidSessionGenreList(user.genres)); + + var hourlyRate = user.paid_sessions_hourly_rate; + $paidGigDetails.find("ul li:nth-child(2)").append(hourlyRate ? hourlyRate : NOT_SPECIFIED_TEXT); + + var dailyRate = user.paid_sessions_daily_rate; + $paidGigDetails.find("ul li:nth-child(3)").append(dailyRate ? dailyRate : NOT_SPECIFIED_TEXT); + } + else { + $paidGigSection.hide(); + } + + // free sessions + if (user.free_sessions) { + $paidGigDetails.find("ul li:nth-child(1)").append(profileUtils.freeSessionGenreList(user.genres)); + } + else { + $freeGigSection.hide(); + } + + // cowriting + if (user.cowriting) { + $cowritingDetails.find("ul li:nth-child(1)").append(profileUtils.cowritingGenreList(user.genres)); + + var purpose = user.cowriting_purpose; + $cowritingDetails.find("ul li:nth-child(2)").append(purpose ? profileUtils.cowritingPurposeMap[purpose] : NOT_SPECIFIED_TEXT); + } + else { + $cowritingSection.hide(); + } + + // traditional bands + if (user.traditional_band) { + $traditionalBandDetails.find("ul li:nth-child(1)").append(profileUtils.traditionalBandGenreList(user.genres)); + + var commitment = user.traditional_band_commitment; + $traditionalBandDetails.find("ul li:nth-child(2)").append(commitment ? profileUtils.bandCommitmentMap[commitment] : NOT_SPECIFIED_TEXT); + + var canTour = user.traditional_band_touring; + var canTourResponse = canTour ? "Yes" : (canTour === false ? "No" : NOT_SPECIFIED_TEXT); + $traditionalBandDetails.find("ul li:nth-child(3)").append(canTourResponse); + } + else { + $traditionalBandSection.hide(); + } + + // virtual band + if (user.virtual_band) { + $virtualBandDetails.find("ul li:nth-child(1)").append(profileUtils.virtualBandGenreList(user.genres)); + + var commitment = user.virtual_band_commitment; + $virtualBandDetails.find("ul li:nth-child(2)").append(commitment ? profileUtils.bandCommitmentMap[commitment] : NOT_SPECIFIED_TEXT); + } + else { + $virtualBandSection.hide(); + } + } + if (isMusician()) { text = user.session_count > 1 || user.session_count === 0 ? " Sessions" : " Session"; $sessionStats.html(user.session_count + text); diff --git a/web/app/assets/javascripts/profile_utils.js b/web/app/assets/javascripts/profile_utils.js index d01fbe2fc..8c1eba1a1 100644 --- a/web/app/assets/javascripts/profile_utils.js +++ b/web/app/assets/javascripts/profile_utils.js @@ -9,6 +9,7 @@ var profileUtils = {}; context.JK.ProfileUtils = profileUtils; + // genre types var PROFILE_GENRE_TYPE = 'profile'; var VIRTUAL_BAND_GENRE_TYPE = 'virtual_band'; var TRADITIONAL_BAND_GENRE_TYPE = 'traditional_band'; @@ -16,8 +17,52 @@ var FREE_SESSION_GENRE_TYPE = 'free_session'; var COWRITING_GENRE_TYPE = 'cowriting'; + // performance samples + var JAMKAZAM = 'jamkazam'; + var SOUNDCLOUD = 'soundcloud'; + var YOUTUBE = 'youtube'; + var USER_TYPE = 'JamRuby::User'; + profileUtils.skillLevelMap = { + "1": "Amateur", + "2": "Professional" + }; + + profileUtils.gigMap = { + "0": "zero", + "1": "under 10", + "2": "10 to 50", + "3": "50 to 100", + "4": "over 100" + }; + + profileUtils.cowritingPurposeMap = { + "1": "just for fun", + "2": "sell music" + }; + + profileUtils.bandCommitmentMap = { + "1": "infrequent", + "2": "once a week", + "3": "2-3 times a week", + "4": "4+ times a week" + } + + function buildGenreList(genres) { + var list = ''; + + for (var i=0; i < genres.length; i++) { + list = list.concat(genres[i].genre_id); + if (i !== genres.length - 1) { + list = list.concat(', '); + } + } + + return list.length > 0 ? list : 'None specified'; + } + + // profile genres profileUtils.profileGenres = function(genres) { var matches = $.grep(genres, function(g) { return g.player_type === USER_TYPE && g.genre_type === PROFILE_GENRE_TYPE; @@ -26,6 +71,12 @@ return matches; } + profileUtils.profileGenreList = function(genres) { + var matches = profileUtils.profileGenres(genres); + return buildGenreList(matches); + } + + // virtual band genres profileUtils.virtualBandGenres = function(genres) { var matches = $.grep(genres, function(g) { return g.player_type === USER_TYPE && g.genre_type === VIRTUAL_BAND_GENRE_TYPE; @@ -34,6 +85,12 @@ return matches; } + profileUtils.virtualBandGenreList = function(genres) { + var matches = profileUtils.virtualBandGenres(genres); + return buildGenreList(matches); + } + + // traditional band genres profileUtils.traditionalBandGenres = function(genres) { var matches = $.grep(genres, function(g) { return g.player_type === USER_TYPE && g.genre_type === TRADITIONAL_BAND_GENRE_TYPE; @@ -42,6 +99,12 @@ return matches; } + profileUtils.traditionalBandGenreList = function(genres) { + var matches = profileUtils.traditionalBandGenres(genres); + return buildGenreList(matches); + } + + // paid session genres profileUtils.paidSessionGenres = function(genres) { var matches = $.grep(genres, function(g) { return g.player_type === USER_TYPE && g.genre_type === PAID_SESSION_GENRE_TYPE; @@ -50,6 +113,12 @@ return matches; } + profileUtils.paidSessionGenreList = function(genres) { + var matches = profileUtils.paidSessionGenres(genres); + return buildGenreList(matches); + } + + // free session genres profileUtils.freeSessionGenres = function(genres) { var matches = $.grep(genres, function(g) { return g.player_type === USER_TYPE && g.genre_type === FREE_SESSION_GENRE_TYPE; @@ -58,6 +127,12 @@ return matches; } + profileUtils.freeSessionGenreList = function(genres) { + var matches = profileUtils.freeSessionGenres(genres); + return buildGenreList(matches); + } + + // cowriting genres profileUtils.cowritingGenres = function(genres) { var matches = $.grep(genres, function(g) { return g.player_type === USER_TYPE && g.genre_type === COWRITING_GENRE_TYPE; @@ -66,4 +141,33 @@ return matches; } + profileUtils.cowritingGenreList = function(genres) { + var matches = profileUtils.cowritingGenres(genres); + return buildGenreList(matches); + } + + profileUtils.jamkazamSamples = function(samples) { + var matches = $.grep(samples, function(s) { + return s.service_type === JAMKAZAM; + }); + + return matches; + } + + profileUtils.soundCloudSamples = function(samples) { + var matches = $.grep(samples, function(s) { + return s.service_type === SOUNDCLOUD; + }); + + return matches; + } + + profileUtils.youTubeSamples = function(samples) { + var matches = $.grep(samples, function(s) { + return s.service_type === YOUTUBE; + }); + + return matches; + } + })(window, jQuery); \ No newline at end of file diff --git a/web/app/assets/stylesheets/client/profile.css.scss b/web/app/assets/stylesheets/client/profile.css.scss index e656aa722..86d732695 100644 --- a/web/app/assets/stylesheets/client/profile.css.scss +++ b/web/app/assets/stylesheets/client/profile.css.scss @@ -29,13 +29,13 @@ } .profile-about-right .section-header { - font-weight:200; - font-size:20px; + font-weight:600; + font-size:18px; float:left; margin: 0px 0px 10px 0px; } -.profile-experience { +.profile-details { font-size:12px; float:left; width: 80px; diff --git a/web/app/views/clients/_profile.html.erb b/web/app/views/clients/_profile.html.erb index 4a262170e..4224184b0 100644 --- a/web/app/views/clients/_profile.html.erb +++ b/web/app/views/clients/_profile.html.erb @@ -98,19 +98,19 @@
-
Status:
+
Status:
-
Genres:
+
Genres:
-
Concert Gigs:
+
Concert Gigs:
-
Studio Gigs:
+
Studio Gigs:
@@ -118,14 +118,90 @@
Performance Samples
+
+
None specified


Online Presence

+
None specified
+
+
+ +
Current Interests
+
+
None specified
+ + + +
+ +
+
I'm interested in playing free gigs
+
+
+
    +
  • Genre(s):
  • +
+
+
+ +
+ +
+
Concert Gigs:
+
+
+
    +
  • Genre(s):
  • +
  • Purpose:
  • +
+
+
+ +
+ +
+
I'm interested in forming traditional band(s)
+
+
+
    +
  • Genre(s):
  • +
  • Commitment:
  • +
  • Touring:
  • +
+
+
+ +
+ +
+
I'm interested in forming virtual band(s)
+
+
+
    +
  • Genre(s):
  • +
  • Commitment:
  • +
+
+
+ +
+
+