VRFS-2701 wip editing presence and samples

This commit is contained in:
Brian Smith 2015-03-31 20:35:38 -04:00
parent c9468d0981
commit 546205b186
6 changed files with 137 additions and 162 deletions

View File

@ -18,11 +18,19 @@
var nilOptionStr = '<option value=""></option>';
var nilOptionText = 'n/a';
var $screen = $('#account-profile-basics');
var $avatar = $screen.find('#avatar');
var $country = $screen.find('#country');
var $region = $screen.find('#region');
var $city = $screen.find('#city');
var $firstName = $screen.find('#first-name');
var $lastName = $screen.find('#last-name');
var $gender = $screen.find('#gender');
var $biography = $screen.find('#biography');
var $subscribe = $screen.find('#subscribe');
var $btnCancel = $screen.find('#account-edit-profile-cancel');
var $btnSubmit = $screen.find('#account-edit-profile-submit');
var $biography = null;
function beforeShow(data) {
userId = data.id;
}
@ -39,27 +47,33 @@
}
function populateAccountProfile(userDetail) {
var template = context.JK.fillTemplate($('#template-account-profile-basics').html(), {
country: userDetail.country,
region: userDetail.state,
city: userDetail.city,
first_name: userDetail.first_name,
last_name: userDetail.last_name,
photoUrl: context.JK.resolveAvatarUrl(userDetail.photo_url),
birth_date : userDetail.birth_date,
gender: userDetail.gender,
biography: userDetail.biography ? userDetail.biography : '',
subscribe_email: userDetail.subscribe_email ? "checked=checked" : ""
});
// var template = context.JK.fillTemplate($('#template-account-profile-basics').html(), {
// country: userDetail.country,
// region: userDetail.state,
// city: userDetail.city,
// first_name: userDetail.first_name,
// last_name: userDetail.last_name,
// photoUrl: context.JK.resolveAvatarUrl(userDetail.photo_url),
// birth_date : userDetail.birth_date,
// gender: userDetail.gender,
// biography: userDetail.biography ? userDetail.biography : '',
// subscribe_email: userDetail.subscribe_email ? "checked=checked" : ""
// });
$avatar.attr('src', context.JK.resolveAvatarUrl(userDetail.photo_url));
$country.val(userDetail.country);
$region.val(userDetail.state);
$city.val(userDetail.city);
$firstName.val(userDetail.first_name);
$lastName.val(userDetail.last_name);
$gender.val(userDetail.gender);
$biography.val(userDetail.biography);
if (userDetail.subscribe_email) {
$subscribe.attr('checked', 'checked');
}
var content_root = $('#account-profile-content-scroller');
content_root.html(template);
$biography = $screen.find('#biography');
// now use javascript to fix up values too hard to do with templating
// set gender
$('select[name=gender]', content_root).val(userDetail.gender)
// set birth_date
if(userDetail.birth_date) {

View File

@ -137,24 +137,6 @@
return false;
});
$btnAddSoundCloudRecording.click(function(evt) {
var url = $soundCloudRecordingUrl.val();
if (url.length > 0) {
if (extractSoundCloudUrlParts(url)) {
// add to list
}
}
});
$btnAddYouTubeVideo.click(function(evt) {
var url = $youTubeVideoUrl.val();
if (url.length) {
if (extractYouTubeUrlParts(url)) {
// add to list
}
}
});
$btnCancel.click(function(evt) {
evt.stopPropagation();
navigateTo('/client#/profile/' + context.JK.currentUserId);
@ -176,22 +158,8 @@
}
function validate() {
// website
if ($.trim($website.val()).length > 0) {
}
// SoundCloud
if ($.trim($soundCloudUsername.val()).length > 0) {
}
// ReverbNation
if ($.trim($reverbNationUsername.val())) {
}
return true;
var errors = $screen.find('.site_validator.error');
return !(errors && errors.length > 0);
}
function navigateTo(targetLocation) {
@ -199,7 +167,7 @@
}
function addOnlinePresence(presenceArray, username, type) {
if ($.trim($soundCloudUsername.val()).length > 0) {
if ($.trim(username).length > 0) {
presenceArray.push({
service_type: type,
username: username
@ -228,9 +196,9 @@
// extract performance samples
var ps = [];
var performanceSampleTypes = profileUtils.SAMPLE_TYPES;
addPerformanceSamples(ps, $jamkazamSampleList, performanceSampleTypes.JAMKAZAM);
addPerformanceSamples(ps, $soundCloudSampleList, performanceSampleTypes.SOUNDCLOUD);
addPerformanceSamples(ps, $youTubeSampleList, performanceSampleTypes.YOUTUBE);
addPerformanceSamples(ps, $jamkazamSampleList, performanceSampleTypes.JAMKAZAM.description);
addPerformanceSamples(ps, $soundCloudSampleList, performanceSampleTypes.SOUNDCLOUD.description);
addPerformanceSamples(ps, $youTubeSampleList, performanceSampleTypes.YOUTUBE.description);
// api.updateUser({
// website: $website.val(),

View File

@ -18,14 +18,14 @@
var COWRITING_GENRE_TYPE = 'cowriting';
// performance sample types
var SAMPLE_TYPES = {
profileUtils.SAMPLE_TYPES = {
JAMKAZAM: {description: "jamkazam"},
SOUNDCLOUD: {description: "soundcloud"},
YOUTUBE: {description: "youtube"}
};
// online presence types
var ONLINE_PRESENCE_TYPES = {
profileUtils.ONLINE_PRESENCE_TYPES = {
SOUNDCLOUD: {description: "soundcloud"},
REVERBNATION: {description: "reverbnation"},
BANDCAMP: {description: "bandcamp"},
@ -176,7 +176,7 @@
profileUtils.jamkazamSamples = function(samples) {
var matches = $.grep(samples, function(s) {
return s.service_type === SAMPLE_TYPES.JAMKAZAM.description;
return s.service_type === profileUtils.SAMPLE_TYPES.JAMKAZAM.description;
});
return matches;
@ -184,7 +184,7 @@
profileUtils.soundCloudSamples = function(samples) {
var matches = $.grep(samples, function(s) {
return s.service_type === SAMPLE_TYPES.SOUNDCLOUD.description;
return s.service_type === profileUtils.SAMPLE_TYPES.SOUNDCLOUD.description;
});
return matches;
@ -192,7 +192,7 @@
profileUtils.youTubeSamples = function(samples) {
var matches = $.grep(samples, function(s) {
return s.service_type === SAMPLE_TYPES.YOUTUBE.description;
return s.service_type === profileUtils.SAMPLE_TYPES.YOUTUBE.description;
});
return matches;
@ -200,7 +200,7 @@
profileUtils.soundCloudPresences = function(presences) {
var matches = $.grep(presences, function(p) {
return p.service_type === ONLINE_PRESENCE_TYPES.SOUNDCLOUD.description;
return p.service_type === profileUtils.ONLINE_PRESENCE_TYPES.SOUNDCLOUD.description;
});
return matches;
@ -208,7 +208,7 @@
profileUtils.reverbNationPresences = function(presences) {
var matches = $.grep(presences, function(p) {
return p.service_type === ONLINE_PRESENCE_TYPES.REVERBNATION.description;
return p.service_type === profileUtils.ONLINE_PRESENCE_TYPES.REVERBNATION.description;
});
return matches;
@ -216,7 +216,7 @@
profileUtils.bandCampPresences = function(presences) {
var matches = $.grep(presences, function(p) {
return p.service_type === ONLINE_PRESENCE_TYPES.BANDCAMP.description;
return p.service_type === profileUtils.ONLINE_PRESENCE_TYPES.BANDCAMP.description;
});
return matches;
@ -224,7 +224,7 @@
profileUtils.fandalismPresences = function(presences) {
var matches = $.grep(presences, function(p) {
return p.service_type === ONLINE_PRESENCE_TYPES.FANDALISM.description;
return p.service_type === profileUtils.ONLINE_PRESENCE_TYPES.FANDALISM.description;
});
return matches;
@ -232,7 +232,7 @@
profileUtils.youTubePresences = function(presences) {
var matches = $.grep(presences, function(p) {
return p.service_type === ONLINE_PRESENCE_TYPES.YOUTUBE.description;
return p.service_type === profileUtils.ONLINE_PRESENCE_TYPES.YOUTUBE.description;
});
return matches;
@ -240,7 +240,7 @@
profileUtils.facebookPresences = function(presences) {
var matches = $.grep(presences, function(p) {
return p.service_type === ONLINE_PRESENCE_TYPES.FACEBOOK.description;
return p.service_type === profileUtils.ONLINE_PRESENCE_TYPES.FACEBOOK.description;
});
return matches;
@ -248,7 +248,7 @@
profileUtils.twitterPresences = function(presences) {
var matches = $.grep(presences, function(p) {
return p.service_type === ONLINE_PRESENCE_TYPES.TWITTER.description;
return p.service_type === profileUtils.ONLINE_PRESENCE_TYPES.TWITTER.description;
});
return matches;

View File

@ -32,7 +32,8 @@
}
.sample-list {
height: inherit;
overflow: auto;
}
}
}

View File

@ -59,7 +59,6 @@
*= require ./checkout_signin
*= require ./checkout_payment
*= require ./checkout_order
*= require ./genreSelector
*= require ./sessionList
*= require ./searchResults
*= require ./clientUpdate

View File

@ -1,105 +1,98 @@
<!-- Account Profile Screen -->
<div layout="screen" id="account-profile-basics" layout-id="account/profile" class="screen secondary">
<!-- header -->
<div class="content-head">
<!-- icon -->
<div class="content-icon">
<%= image_tag "content/icon_account.png", {:width => 27, :height => 20} %>
</div>
<!-- section head text -->
<h1>my account</h1>
<%= render "screen_navigation" %>
</div>
<!-- end header -->
<!-- profile scrolling area -->
<div class="content-body">
<div id="account-profile-content-scroller" class="content-body-scroller account-content-scroller">
<div class="content-wrapper account-profile">
<form id="account-edit-profile-form">
<h2>edit profile: basics</h2>
<br /><br />
<div class="location w25 left">
<a href="#" class="avatar_large"><img id="avatar" /></a>
<a href="#" class="small" id="account-change-avatar">Change Avatar</a>
<div class="clearall"></div>
<div class="field">
<label>Country:</label>
<select id="country" name='country' class="w80">
<option selected="selected"></option>
</select>
</div>
<div class="field">
<label>State/Province:</label>
<select id="region" name='region' class="w80" disabled='disabled'>
<option selected="selected"></option>
</select>
</div>
<div class="field">
<label>City:</label>
<select id="city" name='city' class="w80" disabled='disabled'>
<option selected="selected"></option>
</select>
</div>
</div>
<div class="right-side right w70" style="margin-top:-36px;">
<div class="field left w45">
<label>First Name:</label>
<input type="text" id="first-name" name="first_name" class="w70" style="margin-bottom:12px;">
</div>
<div class="field left w45">
<label>Last Name:</label>
<input type="text" id="last-name" name="last_name" class="w70" style="margin-bottom:12px;">
</div>
<br class="clearall"/>
<div class="field left w45 gender">
<label>Gender:</label>
<select id="gender" name="gender" class="w80">
<option value='M'>Male</option>
<option value='F'>Female</option>
<option>-</option>
</select>
</div>
<div class="field left w45 birth_date">
<label>Birth Date:</label>
<%= date_select("user", "birth_date", :use_short_month => true, :start_year => 1900, :end_year => Time.now.year - 18, :order => [:month, :day, :year], :default => -25.years.from_now, :html=>{:class => "account-profile-birthdate"} ) %>
</div>
<br class="clearall"/>
<div class="field">
<label>Musical Bio:</label>
<textarea id="biography" name="biography" class="biography"></textarea>
</div>
<div class="field">
<input type="checkbox" id="subscribe" name="subscribe_email" /> I will accept email from JamKazam about this service.
</div>
<div class="right field actions">
<a id="account-edit-profile-cancel" class="button-grey">CANCEL</a>&nbsp;&nbsp;<a id="account-edit-profile-submit" class="button-orange">SAVE &amp; NEXT</a>
</div>
</div>
<div class="clearall"/>
</form>
</div>
</div>
</div>
<!-- end content scrolling area -->
</div>
<script type="text/template" id="template-account-profile-basics">
<!-- content wrapper -->
<div class="content-wrapper account-profile">
<form id="account-edit-profile-form">
<h2>edit profile: basics</h2>
<br /><br />
<div class="location w25 left">
<a href="#" class="avatar_large"><img src="{photoUrl}" id="profile-avatar" /></a>
<a href="#" class="small" id="account-change-avatar">Change Avatar</a>
<div class="clearall"></div>
<div class="field">
<label>Country:</label>
<select name='country' class="w80">
<option value='{country}' selected="selected">{country}</option>
</select>
</div>
<div class="field">
<label>State/Province:</label>
<select name='region' class="w80" disabled='disabled'>
<option value="{region}" selected="selected">{region}</option>
</select>
</div>
<div class="field">
<label>City:</label>
<select name='city' class="w80" disabled='disabled'>
<option value="{city}" selected="selected">{city}</option>
</select>
</div>
</div>
<div class="right-side right w70" style="margin-top:-36px;">
<div class="field left w45">
<label>First Name:</label>
<input type="text" name="first_name" value="{first_name}" class="w70" style="margin-bottom:12px;">
</div>
<div class="field left w45">
<label>Last Name:</label>
<input type="text" name="last_name" value="{last_name}" class="w70" style="margin-bottom:12px;">
</div>
<br class="clearall"/>
<div class="field left w45 gender">
<label>Gender:</label>
<select name="gender" data-value="{gender}" class="w80">
<option value='M'>Male</option>
<option value='F'>Female</option>
<option>-</option>
</select>
</div>
<div class="field left w45 birth_date">
<label>Birth Date:</label>
<%= date_select("user", "birth_date", :use_short_month => true, :start_year => 1900, :end_year => Time.now.year - 18, :order => [:month, :day, :year], :default => -25.years.from_now, :html=>{:class => "account-profile-birthdate"} ) %>
</div>
<br class="clearall"/>
<div class="field">
<label>Musical Bio:</label>
<textarea id="biography" name="biography" class="biography">{biography}</textarea>
</div>
<div class="field">
<input type="checkbox" name="subscribe_email" {subscribe_email} /> I will accept email from JamKazam about this service.
</div>
<div class="right field actions">
<a id="account-edit-profile-cancel" href="#" class="button-grey">CANCEL</a>&nbsp;&nbsp;<a id="account-edit-profile-submit" href="#" class="button-orange">SAVE & NEXT</a>
</div>
</div>
<div class="clearall"/>
</form>
</div>
</script>