added biography to user model

This commit is contained in:
Brian Smith 2013-11-02 23:35:18 -04:00
parent 80086efad2
commit 5e79e34634
10 changed files with 17 additions and 30 deletions

View File

@ -74,3 +74,4 @@ crash_dumps_idx.sql
music_sessions_user_history_add_session_removed_at.sql
user_progress_tracking.sql
whats_next.sql
add_user_bio.sql

1
db/up/add_user_bio.sql Normal file
View File

@ -0,0 +1 @@
alter table users add column biography VARCHAR(4000);

View File

@ -422,7 +422,7 @@ module JamRuby
# this easy_save routine guards against nil sets, but many of these fields can be set to null.
# I've started to use it less as I go forward
def easy_save(first_name, last_name, email, password, password_confirmation, musician, gender,
birth_date, internet_service_provider, city, state, country, instruments, photo_url)
birth_date, internet_service_provider, city, state, country, instruments, photo_url, biography = nil)
# first name
unless first_name.nil?
@ -495,13 +495,17 @@ module JamRuby
self.photo_url = photo_url
end
unless biography.nil?
self.biography = biography
end
self.updated_at = Time.now.getutc
self.save
end
# helper method for creating / updating a User
def self.save(id, updater_id, first_name, last_name, email, password, password_confirmation, musician, gender,
birth_date, internet_service_provider, city, state, country, instruments, photo_url)
birth_date, internet_service_provider, city, state, country, instruments, photo_url, biography)
if id.nil?
user = User.new()
else
@ -513,7 +517,7 @@ module JamRuby
end
user.easy_save(first_name, last_name, email, password, password_confirmation, musician, gender,
birth_date, internet_service_provider, city, state, country, instruments, photo_url)
birth_date, internet_service_provider, city, state, country, instruments, photo_url, biography)
return user
end

View File

@ -229,27 +229,6 @@
// avatar
$('#band-profile-avatar').attr('src', context.JK.resolveAvatarUrl(band.photo_url));
// instruments
// if (user.instruments) {
// for (var i=0; i < user.instruments.length; i++) {
// var instrument = user.instruments[i];
// var description = instrument.instrument_id;
// var proficiency = instrument.proficiency_level;
// var instrument_icon_url = context.JK.getInstrumentIcon45(description);
// // add instrument info to layout
// var template = $('#template-profile-instruments').html();
// var instrumentHtml = context.JK.fillTemplate(template, {
// instrument_logo_url: instrument_icon_url,
// instrument_description: description,
// proficiency_level: proficiencyDescriptionMap[proficiency],
// proficiency_level_css: proficiencyCssMap[proficiency]
// });
// $('#profile-instruments').append(instrumentHtml);
// }
// }
// location
$('#band-profile-location').html(band.location);
@ -372,6 +351,7 @@
avatar_url: context.JK.resolveAvatarUrl(musician.photo_url),
name: musician.name,
location: musician.location,
biography: musician.biography,
friend_count: musician.friend_count,
follower_count: musician.follower_count,
recording_count: musician.recording_count,

View File

@ -319,7 +319,7 @@
text = user.recording_count > 1 || user.recording_count == 0 ? " Recordings" : " Recording";
$('#profile-recording-stats').html(user.recording_count + text);
//$('#profile-biography').html(user.biography);
$('#profile-biography').html(user.biography);
}
else {

View File

@ -1,6 +1,6 @@
collection @musicians
attributes :id, :first_name, :last_name, :name, :city, :state, :country, :location, :online, :photo_url, :musician, :gender, :birth_date, :internet_service_provider, :friend_count, :liker_count, :like_count, :band_like_count, :follower_count, :following_count, :band_following_count, :recording_count, :session_count
attributes :id, :first_name, :last_name, :name, :city, :state, :country, :location, :online, :photo_url, :musician, :gender, :birth_date, :internet_service_provider, :friend_count, :liker_count, :like_count, :band_like_count, :follower_count, :following_count, :band_following_count, :recording_count, :session_count, :biography
node :instruments do |musician|
unless musician.instruments.nil? || musician.instruments.size == 0

View File

@ -6,7 +6,7 @@ attributes :id, :name, :city, :state, :country, :location, :website, :biography,
node :musicians do |band|
unless band.users.nil? || band.users.size == 0
child :users => :musicians do
attributes :id, :first_name, :last_name, :name, :photo_url
attributes :id, :first_name, :last_name, :name, :photo_url, :biography
# TODO: figure out how to omit empty arrays
node :instruments do |user|

View File

@ -1,4 +1,4 @@
collection @users
# do not retrieve all child collections when showing a list of users
attributes :id, :first_name, :last_name, :name, :city, :state, :country, :email, :online, :musician, :photo_url
attributes :id, :first_name, :last_name, :name, :city, :state, :country, :email, :online, :musician, :photo_url, :biography

View File

@ -1,6 +1,7 @@
object @user
attributes :id, :first_name, :last_name, :name, :city, :state, :country, :location, :online, :photo_url, :musician, :gender, :birth_date, :internet_service_provider, :friend_count, :liker_count, :like_count, :band_like_count, :follower_count, :following_count, :band_following_count, :recording_count, :session_count
attributes :id, :first_name, :last_name, :name, :city, :state, :country, :location, :online, :photo_url, :musician, :gender, :birth_date, :internet_service_provider, :friend_count, :liker_count, :like_count, :band_like_count, :follower_count, :following_count, :band_following_count, :recording_count, :session_count,
:biography
# give back more info if the user being fetched is yourself
if @user == current_user

View File

@ -86,7 +86,7 @@
{recording_count}&nbsp;<img src="../assets/content/icon_recordings.png" width="12" height="13" align="absmiddle" />&nbsp;
{session_count}&nbsp;<img src="../assets/content/icon_session_tiny.png" width="12" height="12" align="absmiddle" />
</div>
<div style="height:90px" class="left ml20 f11 whitespace w35"><br />
<div style="height:90px" class="left ml20 f11 whitespace w60"><br />
{biography}<br /><br />
<a class="button-orange smallbutton m0" href="{profile_url}">PROFILE</a>&nbsp;&nbsp;
<a id="btn-follow-member" class="button-orange smallbutton m0">FOLLOW</a>&nbsp;&nbsp;