diff --git a/web/app/assets/javascripts/accounts_profile.js b/web/app/assets/javascripts/accounts_profile.js index b7189774a..1572d55a3 100644 --- a/web/app/assets/javascripts/accounts_profile.js +++ b/web/app/assets/javascripts/accounts_profile.js @@ -18,11 +18,19 @@ var nilOptionStr = ''; 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) { diff --git a/web/app/assets/javascripts/accounts_profile_samples.js b/web/app/assets/javascripts/accounts_profile_samples.js index 8e96446b4..97a83ed51 100644 --- a/web/app/assets/javascripts/accounts_profile_samples.js +++ b/web/app/assets/javascripts/accounts_profile_samples.js @@ -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(), diff --git a/web/app/assets/javascripts/profile_utils.js b/web/app/assets/javascripts/profile_utils.js index edab5c367..79c12c2fc 100644 --- a/web/app/assets/javascripts/profile_utils.js +++ b/web/app/assets/javascripts/profile_utils.js @@ -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; diff --git a/web/app/assets/stylesheets/client/accountProfileSamples.css.scss b/web/app/assets/stylesheets/client/accountProfileSamples.css.scss index e5f1e310b..dfe7bc128 100644 --- a/web/app/assets/stylesheets/client/accountProfileSamples.css.scss +++ b/web/app/assets/stylesheets/client/accountProfileSamples.css.scss @@ -32,7 +32,8 @@ } .sample-list { - + height: inherit; + overflow: auto; } } } \ No newline at end of file diff --git a/web/app/assets/stylesheets/client/client.css b/web/app/assets/stylesheets/client/client.css index 28049797e..c48ea6bef 100644 --- a/web/app/assets/stylesheets/client/client.css +++ b/web/app/assets/stylesheets/client/client.css @@ -59,7 +59,6 @@ *= require ./checkout_signin *= require ./checkout_payment *= require ./checkout_order - *= require ./genreSelector *= require ./sessionList *= require ./searchResults *= require ./clientUpdate diff --git a/web/app/views/clients/_account_profile.html.erb b/web/app/views/clients/_account_profile.html.erb index 08312237b..7d6da9224 100644 --- a/web/app/views/clients/_account_profile.html.erb +++ b/web/app/views/clients/_account_profile.html.erb @@ -1,105 +1,98 @@