diff --git a/ruby/lib/jam_ruby/models/user.rb b/ruby/lib/jam_ruby/models/user.rb index a469ab69a..d8ad7b48f 100644 --- a/ruby/lib/jam_ruby/models/user.rb +++ b/ruby/lib/jam_ruby/models/user.rb @@ -361,6 +361,10 @@ module JamRuby MusicSession.scheduled_rsvp(self, true).length end + def purchased_jamtracks_count + self.purchased_jam_tracks.count + end + def joined_score return nil unless has_attribute?(:score) a = read_attribute(:score) diff --git a/web/app/assets/javascripts/accounts.js b/web/app/assets/javascripts/accounts.js index 64501695d..e28d03578 100644 --- a/web/app/assets/javascripts/accounts.js +++ b/web/app/assets/javascripts/accounts.js @@ -33,6 +33,10 @@ } } + function licenseDetail(userDetail) { + return (userDetail.purchased_jamtracks_count==0) ? "You don't currently own any JamTracks" : 'You currently own a license to use ' + userDetail.purchased_jamtracks_count + " JamTracks" + } + function populateAccount(userDetail) { var validProfiles = prettyPrintAudioProfiles(context.JK.getGoodConfigMap()); @@ -42,8 +46,10 @@ var $template = $(context._.template($('#template-account-main').html(), { email: userDetail.email, name: userDetail.name, + licenseDetail: licenseDetail(userDetail), location : userDetail.location, session : sessionSummary, + paymentMethod: "mastercard", instruments : prettyPrintInstruments(userDetail.instruments), photoUrl : context.JK.resolveAvatarUrl(userDetail.photo_url), validProfiles : validProfiles, @@ -126,7 +132,7 @@ } function navToEditSubscriptions() { - + window.location = '/client#/account/profile' } function navToEditPayments() { diff --git a/web/app/controllers/api_users_controller.rb b/web/app/controllers/api_users_controller.rb index c9598a543..aff39557d 100644 --- a/web/app/controllers/api_users_controller.rb +++ b/web/app/controllers/api_users_controller.rb @@ -26,7 +26,7 @@ class ApiUsersController < ApiController @user = User.includes([{musician_instruments: :instrument}, {band_musicians: :user}, {genre_players: :genre}, - :bands, :instruments, :genres]) + :bands, :instruments, :genres, :jam_track_rights]) .find(params[:id]) respond_with @user, responder: ApiResponder, :status => 200 diff --git a/web/app/views/api_users/show.rabl b/web/app/views/api_users/show.rabl index b005b0fa8..02dd2fe4a 100644 --- a/web/app/views/api_users/show.rabl +++ b/web/app/views/api_users/show.rabl @@ -1,6 +1,6 @@ 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, :follower_count, :following_count, :recording_count, :session_count, :biography, :favorite_count, :audio_latency, :upcoming_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, :follower_count, :following_count, :recording_count, :session_count, :biography, :favorite_count, :audio_latency, :upcoming_session_count, :purchased_jamtracks_count if @user.musician? node :location do @user.location end diff --git a/web/app/views/clients/_account.html.erb b/web/app/views/clients/_account.html.erb index d675679a5..a31649ea4 100644 --- a/web/app/views/clients/_account.html.erb +++ b/web/app/views/clients/_account.html.erb @@ -94,18 +94,19 @@