VRFS-2701 wip musician profile enhancements

This commit is contained in:
Brian Smith 2015-02-22 22:23:59 -05:00
parent 20ac47a2e1
commit 6667a33e67
4 changed files with 315 additions and 33 deletions

View File

@ -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('<span class="following-count">' + user.following_count + '</span>' + 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);

View File

@ -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);

View File

@ -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;

View File

@ -98,19 +98,19 @@
<br clear="all" />
<div>
<div class="left profile-experience">Status:</div>
<div class="left profile-details">Status:</div>
<div id="musician-status"></div>
</div>
<div>
<div class="left profile-experience">Genres:</div>
<div class="left profile-details">Genres:</div>
<div id="genres"></div>
</div>
<div>
<div class="left profile-experience">Concert Gigs:</div>
<div class="left profile-details">Concert Gigs:</div>
<div id="concert-count"></div>
</div>
<div>
<div class="left profile-experience">Studio Gigs:</div>
<div class="left profile-details">Studio Gigs:</div>
<div id="studio-count"></div>
</div>
@ -118,14 +118,90 @@
<br clear="all" />
<div class="section-header">Performance Samples</div>
<br clear="all" />
<div id="no-samples" class="left">None specified</div>
<br clear="all" />
<br clear="all" />
<div class="section-header">Online Presence</div>
<br clear="all" />
<div id="no-online-presence" class="left">None specified</div>
<br clear="all" />
<br clear="all" />
<div class="section-header">Current Interests</div>
<br clear="all" />
<div id="no-interests" class="left">None specified</div>
<div id="paid-gigs">
<div class="left profile-details">I'm interested in playing paid gigs</div>
<br clear="all" />
<div id="paid-gig-details">
<ul>
<li>Genre(s): </li>
<li>Hourly rate = </li>
<li>Day rate = </li>
</ul>
</div>
</div>
<br clear="all" />
<div id="free-gigs">
<div class="left profile-details">I'm interested in playing free gigs</div>
<br clear="all" />
<div id="free-gig-details">
<ul>
<li>Genre(s): </li>
</ul>
</div>
</div>
<br clear="all" />
<div id="cowriting">
<div class="left profile-details">Concert Gigs:</div>
<br clear="all" />
<div id="cowriting-details">
<ul>
<li>Genre(s): </li>
<li>Purpose: </li>
</ul>
</div>
</div>
<br clear="all" />
<div id="traditional-band">
<div class="left">I'm interested in forming traditional band(s)</div>
<br clear="all" />
<div id="traditional-band-details">
<ul>
<li>Genre(s): </li>
<li>Commitment: </li>
<li>Touring: </li>
</ul>
</div>
</div>
<br clear="all" />
<div id="virtual-band">
<div class="left profile-details">I'm interested in forming virtual band(s)</div>
<br clear="all" />
<div id="virtual-band-details">
<ul>
<li>Genre(s): </li>
<li>Commitment: </li>
</ul>
</div>
</div>
<br clear="all" />
<br clear="all" />
</div>
</div>
<div id="history-content" class="profile-wrapper">