* teacher profile musician profile QA'ed some
This commit is contained in:
parent
88afc1c272
commit
0d49744a7a
|
|
@ -48,6 +48,7 @@ module JamRuby
|
||||||
|
|
||||||
teacher = user.teacher
|
teacher = user.teacher
|
||||||
teacher ||= user.build_teacher()
|
teacher ||= user.build_teacher()
|
||||||
|
teacher.user = user
|
||||||
|
|
||||||
teacher.website = params[:website] if params.key?(:website)
|
teacher.website = params[:website] if params.key?(:website)
|
||||||
teacher.biography = params[:biography] if params.key?(:biography)
|
teacher.biography = params[:biography] if params.key?(:biography)
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ describe Teacher do
|
||||||
|
|
||||||
|
|
||||||
it "with instruments" do
|
it "with instruments" do
|
||||||
teacher = user.build_teacher
|
teacher = Teacher.build_teacher(user, {})
|
||||||
teacher.instruments << instrument1
|
teacher.instruments << instrument1
|
||||||
teacher.instruments << instrument2
|
teacher.instruments << instrument2
|
||||||
teacher.save.should be_true
|
teacher.save.should be_true
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
(function(context,$) {
|
(function (context, $) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
context.JK = context.JK || {};
|
context.JK = context.JK || {};
|
||||||
context.JK.AccountProfileScreen = function(app) {
|
context.JK.AccountProfileScreen = function (app) {
|
||||||
var $document = $(document);
|
var $document = $(document);
|
||||||
var logger = context.JK.logger;
|
var logger = context.JK.logger;
|
||||||
var EVENTS = context.JK.EVENTS;
|
var EVENTS = context.JK.EVENTS;
|
||||||
|
|
@ -32,12 +32,18 @@
|
||||||
var $btnSubmit = $screen.find('.account-edit-profile-submit');
|
var $btnSubmit = $screen.find('.account-edit-profile-submit');
|
||||||
|
|
||||||
function beforeShow(data) {
|
function beforeShow(data) {
|
||||||
userId = data.id;
|
userId = data.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
function afterShow(data) {
|
function afterShow(data) {
|
||||||
resetForm();
|
if (window.ProfileStore.solo) {
|
||||||
renderAccountProfile();
|
$btnSubmit.text('SAVE & RETURN TO PROFILE');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$btnSubmit.text('SAVE & NEXT');
|
||||||
|
}
|
||||||
|
resetForm();
|
||||||
|
renderAccountProfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetForm() {
|
function resetForm() {
|
||||||
|
|
@ -64,7 +70,7 @@
|
||||||
var content_root = $('#account-profile-content-scroller');
|
var content_root = $('#account-profile-content-scroller');
|
||||||
|
|
||||||
// set birth_date
|
// set birth_date
|
||||||
if(userDetail.birth_date) {
|
if (userDetail.birth_date) {
|
||||||
var birthDateFields = userDetail.birth_date.split('-')
|
var birthDateFields = userDetail.birth_date.split('-')
|
||||||
var birthDateYear = birthDateFields[0];
|
var birthDateYear = birthDateFields[0];
|
||||||
var birthDateMonth = birthDateFields[1];
|
var birthDateMonth = birthDateFields[1];
|
||||||
|
|
@ -79,8 +85,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function populateAccountProfileLocation(userDetail, regions, cities) {
|
function populateAccountProfileLocation(userDetail, regions, cities) {
|
||||||
populateRegions(regions, userDetail.state);
|
populateRegions(regions, userDetail.state);
|
||||||
populateCities(cities, userDetail.city);
|
populateCities(cities, userDetail.city);
|
||||||
}
|
}
|
||||||
|
|
||||||
function populateCountries(countries, userCountry) {
|
function populateCountries(countries, userCountry) {
|
||||||
|
|
@ -94,21 +100,21 @@
|
||||||
nilOption.text(nilOptionText);
|
nilOption.text(nilOptionText);
|
||||||
countrySelect.append(nilOption);
|
countrySelect.append(nilOption);
|
||||||
|
|
||||||
$.each(countries, function(index, country) {
|
$.each(countries, function (index, country) {
|
||||||
if(!country) return;
|
if (!country) return;
|
||||||
|
|
||||||
var option = $(nilOptionStr);
|
var option = $(nilOptionStr);
|
||||||
option.text(country);
|
option.text(country);
|
||||||
option.attr("value", country);
|
option.attr("value", country);
|
||||||
|
|
||||||
if(country == userCountry) {
|
if (country == userCountry) {
|
||||||
foundCountry = true;
|
foundCountry = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
countrySelect.append(option);
|
countrySelect.append(option);
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!foundCountry) {
|
if (!foundCountry) {
|
||||||
// in this case, the user has a country that is not in the database
|
// in this case, the user has a country that is not in the database
|
||||||
// this can happen in a development/test scenario, but let's assume it can
|
// this can happen in a development/test scenario, but let's assume it can
|
||||||
// happen in production too.
|
// happen in production too.
|
||||||
|
|
@ -137,21 +143,21 @@
|
||||||
nilOption.text(nilOptionText);
|
nilOption.text(nilOptionText);
|
||||||
countrySelect.append(nilOption);
|
countrySelect.append(nilOption);
|
||||||
|
|
||||||
$.each(countriesx, function(index, countryx) {
|
$.each(countriesx, function (index, countryx) {
|
||||||
if (!countryx.countrycode) return;
|
if (!countryx.countrycode) return;
|
||||||
|
|
||||||
var option = $(nilOptionStr);
|
var option = $(nilOptionStr);
|
||||||
option.text(countryx.countryname);
|
option.text(countryx.countryname);
|
||||||
option.attr("value", countryx.countrycode);
|
option.attr("value", countryx.countrycode);
|
||||||
|
|
||||||
if(countryx.countrycode == userCountry) {
|
if (countryx.countrycode == userCountry) {
|
||||||
foundCountry = true;
|
foundCountry = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
countrySelect.append(option);
|
countrySelect.append(option);
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!foundCountry) {
|
if (!foundCountry) {
|
||||||
// in this case, the user has a country that is not in the database
|
// in this case, the user has a country that is not in the database
|
||||||
// this can happen in a development/test scenario, but let's assume it can
|
// this can happen in a development/test scenario, but let's assume it can
|
||||||
// happen in production too.
|
// happen in production too.
|
||||||
|
|
@ -175,8 +181,8 @@
|
||||||
nilOption.text(nilOptionText);
|
nilOption.text(nilOptionText);
|
||||||
regionSelect.append(nilOption);
|
regionSelect.append(nilOption);
|
||||||
|
|
||||||
$.each(regions, function(index, region) {
|
$.each(regions, function (index, region) {
|
||||||
if(!region) return;
|
if (!region) return;
|
||||||
|
|
||||||
var option = $(nilOptionStr);
|
var option = $(nilOptionStr);
|
||||||
option.text(region['name']);
|
option.text(region['name']);
|
||||||
|
|
@ -199,8 +205,8 @@
|
||||||
nilOption.text(nilOptionText);
|
nilOption.text(nilOptionText);
|
||||||
citySelect.append(nilOption);
|
citySelect.append(nilOption);
|
||||||
|
|
||||||
$.each(cities, function(index, city) {
|
$.each(cities, function (index, city) {
|
||||||
if(!city) return;
|
if (!city) return;
|
||||||
|
|
||||||
var option = $(nilOptionStr);
|
var option = $(nilOptionStr);
|
||||||
option.text(city);
|
option.text(city);
|
||||||
|
|
@ -218,27 +224,32 @@
|
||||||
/****************** MAIN PORTION OF SCREEN *****************/
|
/****************** MAIN PORTION OF SCREEN *****************/
|
||||||
// events for main screen
|
// events for main screen
|
||||||
function events() {
|
function events() {
|
||||||
$btnCancel.click(function(evt) {
|
$btnCancel.click(function (evt) {
|
||||||
evt.stopPropagation();
|
evt.stopPropagation();
|
||||||
window.ProfileActions.cancelProfileEdit()
|
window.ProfileActions.cancelProfileEdit()
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#account-profile-content-scroller').on('click', '#account-change-avatar', function(evt) { evt.stopPropagation(); navToAvatar(); return false; } );
|
$('#account-profile-content-scroller').on('click', '#account-change-avatar', function (evt) {
|
||||||
|
evt.stopPropagation();
|
||||||
|
navToAvatar();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
enableSubmits();
|
enableSubmits();
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderAccountProfile() {
|
function renderAccountProfile() {
|
||||||
|
|
||||||
$.when(api.getUserProfile())
|
$.when(api.getUserProfile())
|
||||||
.done(function(userDetail) {
|
.done(function (userDetail) {
|
||||||
recentUserDetail = userDetail;
|
recentUserDetail = userDetail;
|
||||||
populateAccountProfile(userDetail);
|
populateAccountProfile(userDetail);
|
||||||
|
|
||||||
selectLocation = new context.JK.SelectLocation(getCountryElement(), getRegionElement(), getCityElement(), app);
|
selectLocation = new context.JK.SelectLocation(getCountryElement(), getRegionElement(), getCityElement(), app);
|
||||||
selectLocation.load(userDetail.country, userDetail.state, userDetail.city)
|
selectLocation.load(userDetail.country, userDetail.state, userDetail.city)
|
||||||
});
|
});
|
||||||
|
|
||||||
context.JK.dropdown($('select'));
|
context.JK.dropdown($('select'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -277,20 +288,24 @@
|
||||||
biography: biography,
|
biography: biography,
|
||||||
subscribe_email: subscribeEmail
|
subscribe_email: subscribeEmail
|
||||||
})
|
})
|
||||||
.done(postUpdateProfileSuccess)
|
.done(postUpdateProfileSuccess)
|
||||||
.fail(postUpdateProfileFailure)
|
.fail(postUpdateProfileFailure)
|
||||||
.always(enableSubmits)
|
.always(enableSubmits)
|
||||||
}
|
}
|
||||||
|
|
||||||
function enableSubmits() {
|
function enableSubmits() {
|
||||||
$btnSubmit.click(function(evt) {
|
$btnSubmit.click(function (evt) {
|
||||||
evt.stopPropagation();
|
evt.stopPropagation();
|
||||||
handleUpdateProfile();
|
handleUpdateProfile();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
$btnSubmit.removeClass("disabled");
|
$btnSubmit.removeClass("disabled");
|
||||||
$('#account-profile-content-scroller').on('submit', '#account-edit-email-form', function(evt) { evt.stopPropagation(); handleUpdateProfile(); return false; } );
|
$('#account-profile-content-scroller').on('submit', '#account-edit-email-form', function (evt) {
|
||||||
$("#account-edit-email-form").removeClass("disabled");
|
evt.stopPropagation();
|
||||||
|
handleUpdateProfile();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
$("#account-edit-email-form").removeClass("disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
function disableSubmits() {
|
function disableSubmits() {
|
||||||
|
|
@ -309,7 +324,7 @@
|
||||||
|
|
||||||
var errors = JSON.parse(xhr.responseText)
|
var errors = JSON.parse(xhr.responseText)
|
||||||
|
|
||||||
if(xhr.status == 422) {
|
if (xhr.status == 422) {
|
||||||
var first_name = context.JK.format_errors("first_name", errors);
|
var first_name = context.JK.format_errors("first_name", errors);
|
||||||
var last_name = context.JK.format_errors("last_name", errors);
|
var last_name = context.JK.format_errors("last_name", errors);
|
||||||
var country = context.JK.format_errors("country", errors);
|
var country = context.JK.format_errors("country", errors);
|
||||||
|
|
@ -320,41 +335,41 @@
|
||||||
var subscribeEmail = context.JK.format_errors("subscribe_email", errors);
|
var subscribeEmail = context.JK.format_errors("subscribe_email", errors);
|
||||||
var biography = context.JK.format_errors("biography", errors);
|
var biography = context.JK.format_errors("biography", errors);
|
||||||
|
|
||||||
if(first_name != null) {
|
if (first_name != null) {
|
||||||
getFirstNameElement().closest('div.field').addClass('error').end().after(first_name);
|
getFirstNameElement().closest('div.field').addClass('error').end().after(first_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(last_name != null) {
|
if (last_name != null) {
|
||||||
getLastNameElement().closest('div.field').addClass('error').end().after(last_name);
|
getLastNameElement().closest('div.field').addClass('error').end().after(last_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(country != null) {
|
if (country != null) {
|
||||||
getCountryElement().closest('div.field').addClass('error').end().after(country);
|
getCountryElement().closest('div.field').addClass('error').end().after(country);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(state != null) {
|
if (state != null) {
|
||||||
getRegionElement().closest('div.field').addClass('error').end().after(state);
|
getRegionElement().closest('div.field').addClass('error').end().after(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(city != null) {
|
if (city != null) {
|
||||||
getCityElement().closest('div.field').addClass('error').end().after(city);
|
getCityElement().closest('div.field').addClass('error').end().after(city);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(birth_date != null) {
|
if (birth_date != null) {
|
||||||
getYearElement().closest('div.field').addClass('error').end().after(birth_date);
|
getYearElement().closest('div.field').addClass('error').end().after(birth_date);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(subscribeEmail != null) {
|
if (subscribeEmail != null) {
|
||||||
getSubscribeEmail().closest('div.field').addClass('error').end().after(subscribeEmail);
|
getSubscribeEmail().closest('div.field').addClass('error').end().after(subscribeEmail);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(gender != null) {
|
if (gender != null) {
|
||||||
getGenderElement().closest('div.field').addClass('error').end().after(gender);
|
getGenderElement().closest('div.field').addClass('error').end().after(gender);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
app.ajaxError(xhr, textStatus, errorMessage)
|
app.ajaxError(xhr, textStatus, errorMessage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleCountryChanged() {
|
function handleCountryChanged() {
|
||||||
|
|
@ -376,9 +391,9 @@
|
||||||
regionElement.children().remove()
|
regionElement.children().remove()
|
||||||
regionElement.append($(nilOptionStr).text('loading...'))
|
regionElement.append($(nilOptionStr).text('loading...'))
|
||||||
|
|
||||||
api.getRegions({ country: selectedCountry })
|
api.getRegions({country: selectedCountry})
|
||||||
.done(getRegionsDone)
|
.done(getRegionsDone)
|
||||||
.error(function(err) {
|
.error(function (err) {
|
||||||
regionElement.children().remove()
|
regionElement.children().remove()
|
||||||
regionElement.append($(nilOptionStr).text(nilOptionText))
|
regionElement.append($(nilOptionStr).text(nilOptionText))
|
||||||
})
|
})
|
||||||
|
|
@ -404,14 +419,14 @@
|
||||||
cityElement.children().remove();
|
cityElement.children().remove();
|
||||||
cityElement.append($(nilOptionStr).text('loading...'));
|
cityElement.append($(nilOptionStr).text('loading...'));
|
||||||
|
|
||||||
api.getCities({ country: selectedCountry, region: selectedRegion })
|
api.getCities({country: selectedCountry, region: selectedRegion})
|
||||||
.done(getCitiesDone)
|
.done(getCitiesDone)
|
||||||
.error(function(err) {
|
.error(function (err) {
|
||||||
cityElement.children().remove();
|
cityElement.children().remove();
|
||||||
cityElement.append($(nilOptionStr).text(nilOptionText));
|
cityElement.append($(nilOptionStr).text(nilOptionText));
|
||||||
})
|
})
|
||||||
.always(function () {
|
.always(function () {
|
||||||
loadingCitiesData = false;
|
loadingCitiesData = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -483,7 +498,7 @@
|
||||||
var day = getDayElement().val()
|
var day = getDayElement().val()
|
||||||
var year = getYearElement().val()
|
var year = getYearElement().val()
|
||||||
|
|
||||||
if(month != null && month.length > 0 && day != null && day.length > 0 && year != null && year.length > 0) {
|
if (month != null && month.length > 0 && day != null && day.length > 0 && year != null && year.length > 0) {
|
||||||
return month + "-" + day + "-" + year;
|
return month + "-" + day + "-" + year;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -506,4 +521,4 @@
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
})(window,jQuery);
|
})(window, jQuery);
|
||||||
|
|
@ -21,11 +21,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function afterShow(data) {
|
function afterShow(data) {
|
||||||
|
|
||||||
if (window.ProfileStore.solo) {
|
if (window.ProfileStore.solo) {
|
||||||
$btnBack.hide()
|
$btnBack.hide()
|
||||||
|
$btnSubmit.text('SAVE & RETURN TO PROFILE');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$btnBack.show()
|
$btnBack.show()
|
||||||
|
$btnSubmit.text('SAVE & NEXT');
|
||||||
}
|
}
|
||||||
|
|
||||||
resetForm();
|
resetForm();
|
||||||
|
|
|
||||||
|
|
@ -72,9 +72,11 @@
|
||||||
function afterShow(data) {
|
function afterShow(data) {
|
||||||
if (window.ProfileStore.solo) {
|
if (window.ProfileStore.solo) {
|
||||||
$btnBack.hide()
|
$btnBack.hide()
|
||||||
|
$btnSubmit.text('SAVE & RETURN TO PROFILE');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$btnBack.show()
|
$btnBack.show()
|
||||||
|
$btnSubmit.text('SAVE & NEXT');
|
||||||
}
|
}
|
||||||
|
|
||||||
renderInterests()
|
renderInterests()
|
||||||
|
|
|
||||||
|
|
@ -60,9 +60,11 @@
|
||||||
function afterShow(data) {
|
function afterShow(data) {
|
||||||
if (window.ProfileStore.solo) {
|
if (window.ProfileStore.solo) {
|
||||||
$btnBack.hide()
|
$btnBack.hide()
|
||||||
|
$btnSubmit.text('SAVE & RETURN TO PROFILE');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$btnBack.show()
|
$btnBack.show()
|
||||||
|
$btnSubmit.text('SAVE & FINISH');
|
||||||
}
|
}
|
||||||
|
|
||||||
$.when(loadFn())
|
$.when(loadFn())
|
||||||
|
|
@ -167,6 +169,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildNonJamKazamEntry($sampleList, type, source) {
|
function buildNonJamKazamEntry($sampleList, type, source) {
|
||||||
|
|
||||||
|
// remove anything that matches
|
||||||
|
$sampleList.find('[data-recording-id=' + source.recording_id + ']').remove();
|
||||||
|
|
||||||
// TODO: this code is repeated in HTML file
|
// TODO: this code is repeated in HTML file
|
||||||
var recordingIdAttr = ' data-recording-id="' + source.recording_id + '" ';
|
var recordingIdAttr = ' data-recording-id="' + source.recording_id + '" ';
|
||||||
var recordingUrlAttr = ' data-recording-url="' + source.url + '" ';
|
var recordingUrlAttr = ' data-recording-url="' + source.url + '" ';
|
||||||
|
|
@ -395,7 +401,7 @@
|
||||||
|
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
urlValidator = new JK.SiteValidator('url', userNameSuccessCallback, userNameFailCallback, parent)
|
urlValidator = new JK.SiteValidator('url', websiteSuccessCallback, userNameFailCallback, parent)
|
||||||
urlValidator.init()
|
urlValidator.init()
|
||||||
|
|
||||||
soundCloudValidator = new JK.SiteValidator('soundcloud', userNameSuccessCallback, userNameFailCallback, parent)
|
soundCloudValidator = new JK.SiteValidator('soundcloud', userNameSuccessCallback, userNameFailCallback, parent)
|
||||||
|
|
@ -437,6 +443,13 @@
|
||||||
$inputDiv.append("<span class='error-text'>Invalid username</span>").show();
|
$inputDiv.append("<span class='error-text'>Invalid username</span>").show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function websiteSuccessCallback($inputDiv) {
|
||||||
|
$inputDiv.addClass('error');
|
||||||
|
$inputDiv.find('.error-text').remove();
|
||||||
|
$inputDiv.append("<span class='error-text'>Invalid URL</span>").show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function soundCloudSuccessCallback($inputDiv) {
|
function soundCloudSuccessCallback($inputDiv) {
|
||||||
siteSuccessCallback($inputDiv, soundCloudRecordingValidator, $soundCloudSampleList, 'soundcloud');
|
siteSuccessCallback($inputDiv, soundCloudRecordingValidator, $soundCloudSampleList, 'soundcloud');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -591,7 +591,7 @@
|
||||||
detail = $.ajax({
|
detail = $.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
url: "/api/users/" + id + '?'+ $.param(options),
|
url: "/api/users/" + id + '?' + $.param(options),
|
||||||
processData: false
|
processData: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -604,11 +604,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUserProfile(options) {
|
function getUserProfile(options) {
|
||||||
|
if (!options) {
|
||||||
|
options = {}
|
||||||
|
}
|
||||||
var id = getId(options);
|
var id = getId(options);
|
||||||
return $.ajax({
|
return $.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
url: "/api/users/" + id + "/profile",
|
url: "/api/users/" + id + "/profile" + '?' + $.param(options),
|
||||||
processData: false
|
processData: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,8 @@
|
||||||
|
|
||||||
// buttons
|
// buttons
|
||||||
var $btnEdit = $screen.find('.edit-profile-btn');
|
var $btnEdit = $screen.find('.edit-profile-btn');
|
||||||
|
var $btnTeacherProfileEdit = $screen.find('.edit-teacher-profile-btn');
|
||||||
|
var $btnTeacherProfileView = $screen.find('.view-teacher-profile-btn');
|
||||||
var $btnAddFriend = $screen.find('#btn-add-friend');
|
var $btnAddFriend = $screen.find('#btn-add-friend');
|
||||||
var $btnFollowUser = $screen.find('#btn-follow-user');
|
var $btnFollowUser = $screen.find('#btn-follow-user');
|
||||||
var $btnMessageUser = $screen.find('#btn-message-user');
|
var $btnMessageUser = $screen.find('#btn-message-user');
|
||||||
|
|
@ -145,7 +147,7 @@
|
||||||
user = null;
|
user = null;
|
||||||
decrementedFriendCountOnce = false;
|
decrementedFriendCountOnce = false;
|
||||||
sentFriendRequest = false;
|
sentFriendRequest = false;
|
||||||
userDefer = rest.getUserProfile({id: userId})
|
userDefer = rest.getUserProfile({id: userId, show_teacher:true})
|
||||||
.done(function (response) {
|
.done(function (response) {
|
||||||
user = response;
|
user = response;
|
||||||
configureUserType();
|
configureUserType();
|
||||||
|
|
@ -169,6 +171,10 @@
|
||||||
return user.musician;
|
return user.musician;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isTeacher() {
|
||||||
|
return user.teacher;
|
||||||
|
}
|
||||||
|
|
||||||
function isCurrentUser() {
|
function isCurrentUser() {
|
||||||
return userId === context.JK.currentUserId;
|
return userId === context.JK.currentUserId;
|
||||||
}
|
}
|
||||||
|
|
@ -200,6 +206,13 @@
|
||||||
|
|
||||||
if (isCurrentUser()) {
|
if (isCurrentUser()) {
|
||||||
$btnEdit.show();
|
$btnEdit.show();
|
||||||
|
$btnTeacherProfileEdit.show();
|
||||||
|
if(isTeacher()) {
|
||||||
|
$btnTeacherProfileView.show();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$btnTeacherProfileView.hide();
|
||||||
|
}
|
||||||
$btnAddFriend.hide();
|
$btnAddFriend.hide();
|
||||||
$btnFollowUser.hide();
|
$btnFollowUser.hide();
|
||||||
$btnMessageUser.hide();
|
$btnMessageUser.hide();
|
||||||
|
|
@ -207,6 +220,8 @@
|
||||||
configureFriendFollowersControls();
|
configureFriendFollowersControls();
|
||||||
|
|
||||||
$btnEdit.hide();
|
$btnEdit.hide();
|
||||||
|
$btnTeacherProfileEdit.hide();
|
||||||
|
$btnTeacherProfileView.show();
|
||||||
$btnAddFriend.show();
|
$btnAddFriend.show();
|
||||||
$btnFollowUser.show();
|
$btnFollowUser.show();
|
||||||
$btnMessageUser.show();
|
$btnMessageUser.show();
|
||||||
|
|
@ -258,6 +273,16 @@
|
||||||
window.ProfileActions.startProfileEdit(null, false)
|
window.ProfileActions.startProfileEdit(null, false)
|
||||||
return false;
|
return false;
|
||||||
})
|
})
|
||||||
|
$btnTeacherProfileEdit.click(function(e) {
|
||||||
|
e.preventDefault()
|
||||||
|
window.ProfileActions.startTeacherEdit(null, false)
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
$btnTeacherProfileView.click(function(e) {
|
||||||
|
e.preventDefault()
|
||||||
|
context.location = '/client#/profile/teacher/' + context.JK.currentUserId;
|
||||||
|
return false;
|
||||||
|
})
|
||||||
$btnEditBio.click(function(e) {
|
$btnEditBio.click(function(e) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
window.ProfileActions.startProfileEdit(null, true)
|
window.ProfileActions.startProfileEdit(null, true)
|
||||||
|
|
|
||||||
|
|
@ -625,6 +625,7 @@ proficiencyDescriptionMap = {
|
||||||
profileSelections = []
|
profileSelections = []
|
||||||
|
|
||||||
for tile, i in @TILES
|
for tile, i in @TILES
|
||||||
|
console.log("@state.selected", @state.selected, @state.selected == tile)
|
||||||
classes = classNames({last: i == @TILES.length - 1, active: @state.selected == tile})
|
classes = classNames({last: i == @TILES.length - 1, active: @state.selected == tile})
|
||||||
|
|
||||||
profileSelections.push(`<div className="profile-tile"><a className={classes}
|
profileSelections.push(`<div className="profile-tile"><a className={classes}
|
||||||
|
|
|
||||||
|
|
@ -62,12 +62,12 @@ rest = window.JK.Rest()
|
||||||
|
|
||||||
<div className="teacher-field" name="years_teaching">
|
<div className="teacher-field" name="years_teaching">
|
||||||
<label htmlFor="years-teaching-experience">Years Teaching Experience:</label>
|
<label htmlFor="years-teaching-experience">Years Teaching Experience:</label>
|
||||||
<input className="years-teaching-experience" name="years_teaching" ref ="years_teaching_experience" type="number" min="0" max="99" value={this.state.years_teaching} onChange={this.handleTextChange} placeholder="Select" />
|
<input className="years-teaching-experience" name="years_teaching" ref ="years_teaching_experience" type="number" min="0" max="99" value={this.state.years_teaching} onChange={this.handleTextChange} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="teacher-field" name="years_playing">
|
<div className="teacher-field" name="years_playing">
|
||||||
<label htmlFor="teacher-playing-experience">Years Playing Experience:</label>
|
<label htmlFor="teacher-playing-experience">Years Playing Experience:</label>
|
||||||
<input className="years-playing-experience" name="years_playing" ref="years_playing_experience" type="number" min="0" max="99" value={this.state.years_playing} onChange={this.handleTextChange} placeholder="Select" />
|
<input className="years-playing-experience" name="years_playing" ref="years_playing_experience" type="number" min="0" max="99" value={this.state.years_playing} onChange={this.handleTextChange} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<TeacherSetupNav hideBack={true} handleNav={this.handleNav}/>
|
<TeacherSetupNav hideBack={true} handleNav={this.handleNav}/>
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,12 @@ ProfileActions = @ProfileActions
|
||||||
|
|
||||||
render: () ->
|
render: () ->
|
||||||
if window.ProfileStore.solo
|
if window.ProfileStore.solo
|
||||||
saveText = 'SAVE'
|
saveText = 'SAVE & RETURN TO PROFILE'
|
||||||
else
|
else
|
||||||
saveText = 'SAVE & NEXT'
|
if @props.last
|
||||||
|
saveText = 'SAVE & FINISH'
|
||||||
|
else
|
||||||
|
saveText = 'SAVE & NEXT'
|
||||||
|
|
||||||
if !this.props.hideBack && !window.ProfileStore.solo
|
if !this.props.hideBack && !window.ProfileStore.solo
|
||||||
back = `<a className="nav-button button-grey" onClick={this.navBack}>
|
back = `<a className="nav-button button-grey" onClick={this.navBack}>
|
||||||
|
|
|
||||||
|
|
@ -276,7 +276,7 @@ rest = window.JK.Rest()
|
||||||
{priceRows}
|
{priceRows}
|
||||||
|
|
||||||
<br className="clearall"/>
|
<br className="clearall"/>
|
||||||
<TeacherSetupNav handleNav={this.handleNav}></TeacherSetupNav>
|
<TeacherSetupNav handleNav={this.handleNav} last={true}></TeacherSetupNav>
|
||||||
</div>`
|
</div>`
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -492,9 +492,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
label {
|
|
||||||
font-size: 1.05em;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#bands-screen {
|
#bands-screen {
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,29 @@
|
||||||
&.no-online-presence {
|
&.no-online-presence {
|
||||||
display:block;
|
display:block;
|
||||||
}
|
}
|
||||||
|
float:left;
|
||||||
|
margin-right:20px;
|
||||||
|
margin-top:20px;
|
||||||
|
|
||||||
|
&.bandcamp-presence img {
|
||||||
|
|
||||||
|
position:relative;
|
||||||
|
top:9px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.user-website img {
|
||||||
|
position:relative;
|
||||||
|
top:-5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.performance-sample-option {
|
||||||
|
margin-right:40px;
|
||||||
|
a {
|
||||||
|
display:block;
|
||||||
|
}
|
||||||
|
img {
|
||||||
|
margin-bottom:5px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.instruments-holder {
|
.instruments-holder {
|
||||||
margin-bottom:20px;
|
margin-bottom:20px;
|
||||||
|
|
@ -78,6 +101,7 @@
|
||||||
font-weight:600;
|
font-weight:600;
|
||||||
font-size:18px;
|
font-size:18px;
|
||||||
margin: 0px 0px 10px 0px;
|
margin: 0px 0px 10px 0px;
|
||||||
|
clear:both;
|
||||||
}
|
}
|
||||||
|
|
||||||
.section-content {
|
.section-content {
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,17 @@
|
||||||
float:left;
|
float:left;
|
||||||
margin-right:20px;
|
margin-right:20px;
|
||||||
margin-top:20px;
|
margin-top:20px;
|
||||||
|
|
||||||
|
&.bandcamp-presence img {
|
||||||
|
|
||||||
|
position:relative;
|
||||||
|
top:9px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.user-website img {
|
||||||
|
position:relative;
|
||||||
|
top:-5px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.performance-sample-option {
|
.performance-sample-option {
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,7 @@
|
||||||
}
|
}
|
||||||
.add-experience-btn {
|
.add-experience-btn {
|
||||||
width:80px;
|
width:80px;
|
||||||
font-size:16px;
|
font-size:12px;
|
||||||
margin-right:0;
|
margin-right:0;
|
||||||
}
|
}
|
||||||
.teacher-third-column {
|
.teacher-third-column {
|
||||||
|
|
@ -338,9 +338,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
label {
|
|
||||||
font-size: 1.05em;
|
|
||||||
}
|
|
||||||
|
|
||||||
label.strong-label {
|
label.strong-label {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,8 @@ ApiUsersController < ApiController
|
||||||
:online_presences, :performance_samples])
|
:online_presences, :performance_samples])
|
||||||
.find(params[:id])
|
.find(params[:id])
|
||||||
|
|
||||||
|
@show_teacher_profile = params[:show_teacher]
|
||||||
|
|
||||||
respond_with @profile, responder: ApiResponder, :status => 200
|
respond_with @profile, responder: ApiResponder, :status => 200
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,4 +30,10 @@ end
|
||||||
|
|
||||||
child :musician_instruments => :instruments do
|
child :musician_instruments => :instruments do
|
||||||
attributes :description, :proficiency_level, :priority, :instrument_id
|
attributes :description, :proficiency_level, :priority, :instrument_id
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if @show_teacher_profile && @profile && @profile.teacher
|
||||||
|
node :teacher do
|
||||||
|
partial("api_teachers/detail", :object => @profile.teacher)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@
|
||||||
<div class="user-header">
|
<div class="user-header">
|
||||||
<h2 id="username"></h2>
|
<h2 id="username"></h2>
|
||||||
<%= link_to("EDIT PROFILE", '/client#/account/profile', :class => "button-orange edit-profile-btn") %>
|
<%= link_to("EDIT PROFILE", '/client#/account/profile', :class => "button-orange edit-profile-btn") %>
|
||||||
|
<%= link_to("EDIT TEACHER PROFILE", '/client#/profile/teachers/setup/introduction', :class => "button-orange edit-teacher-profile-btn") %>
|
||||||
|
<%= link_to("VIEW TEACHER PROFILE", '/client#/profile/profile/teacher/ID', :class => "button-orange view-teacher-profile-btn") %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- action buttons -->
|
<!-- action buttons -->
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue