diff --git a/db/manifest b/db/manifest index 4bc66447b..13ef8931c 100755 --- a/db/manifest +++ b/db/manifest @@ -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 \ No newline at end of file diff --git a/db/up/add_user_bio.sql b/db/up/add_user_bio.sql new file mode 100644 index 000000000..725ff5b70 --- /dev/null +++ b/db/up/add_user_bio.sql @@ -0,0 +1 @@ +alter table users add column biography VARCHAR(4000); \ No newline at end of file diff --git a/ruby/lib/jam_ruby/models/user.rb b/ruby/lib/jam_ruby/models/user.rb index 7af848254..037c490f2 100644 --- a/ruby/lib/jam_ruby/models/user.rb +++ b/ruby/lib/jam_ruby/models/user.rb @@ -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 diff --git a/web/app/assets/javascripts/bandProfile.js b/web/app/assets/javascripts/bandProfile.js index c98f81525..d03ce3bdf 100644 --- a/web/app/assets/javascripts/bandProfile.js +++ b/web/app/assets/javascripts/bandProfile.js @@ -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, diff --git a/web/app/assets/javascripts/profile.js b/web/app/assets/javascripts/profile.js index 1e1feff0e..fc69c53bc 100644 --- a/web/app/assets/javascripts/profile.js +++ b/web/app/assets/javascripts/profile.js @@ -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 { diff --git a/web/app/views/api_bands/musician_index.rabl b/web/app/views/api_bands/musician_index.rabl index 6a85ccd42..57b723984 100644 --- a/web/app/views/api_bands/musician_index.rabl +++ b/web/app/views/api_bands/musician_index.rabl @@ -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 diff --git a/web/app/views/api_users/band_index.rabl b/web/app/views/api_users/band_index.rabl index dae20b3d6..fb7b3a748 100644 --- a/web/app/views/api_users/band_index.rabl +++ b/web/app/views/api_users/band_index.rabl @@ -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| diff --git a/web/app/views/api_users/index.rabl b/web/app/views/api_users/index.rabl index 8f9bbf9a7..7d9b57db6 100644 --- a/web/app/views/api_users/index.rabl +++ b/web/app/views/api_users/index.rabl @@ -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 \ No newline at end of file +attributes :id, :first_name, :last_name, :name, :city, :state, :country, :email, :online, :musician, :photo_url, :biography \ No newline at end of file diff --git a/web/app/views/api_users/show.rabl b/web/app/views/api_users/show.rabl index 99394b57b..9a35978ef 100644 --- a/web/app/views/api_users/show.rabl +++ b/web/app/views/api_users/show.rabl @@ -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 diff --git a/web/app/views/clients/_bandProfile.html.erb b/web/app/views/clients/_bandProfile.html.erb index 807aa901b..6228fd0a1 100644 --- a/web/app/views/clients/_bandProfile.html.erb +++ b/web/app/views/clients/_bandProfile.html.erb @@ -86,7 +86,7 @@ {recording_count}   {session_count}  -

+

{biography}

PROFILE   FOLLOW