diff --git a/ruby/lib/jam_ruby/models/band.rb b/ruby/lib/jam_ruby/models/band.rb
index 50f18486c..5f47cdb9d 100644
--- a/ruby/lib/jam_ruby/models/band.rb
+++ b/ruby/lib/jam_ruby/models/band.rb
@@ -65,6 +65,12 @@ module JamRuby
@musicians = User.joins(:band_musicians).where(:bands_musicians => {:band_id => "#{band_id}"})
end
+ def self.pending_musicians(band_id)
+ @musicians = User.joins(:received_band_invitations)
+ .where(:band_invitations => {:band_id => "#{band_id}"})
+ .where(:band_invitations => {:accepted => nil})
+ end
+
def self.recording_index(current_user, band_id)
hide_private = false
band = Band.find(band_id)
diff --git a/web/app/assets/javascripts/bandProfile.js b/web/app/assets/javascripts/bandProfile.js
index fd7938c3f..2097e7f4c 100644
--- a/web/app/assets/javascripts/bandProfile.js
+++ b/web/app/assets/javascripts/bandProfile.js
@@ -6,11 +6,13 @@
context.JK.BandProfileScreen = function(app) {
var logger = context.JK.logger;
var bandId;
+ var isMember = false;
var band = {};
var instrument_logo_map = context.JK.getInstrumentIconMap24();
function beforeShow(data) {
bandId = data.id;
+ setIsMember();
}
function afterShow(data) {
@@ -337,53 +339,76 @@
async: false,
processData:false,
success: function(response) {
- $.each(response, function(index, val) {
- var instrumentLogoHtml = '';
- var musician = val;
- if ("instruments" in musician) {
- for (var j=0; j < musician.instruments.length; j++) {
- var instrument = musician.instruments[j];
- var inst = '../assets/content/icon_instrument_default24.png';
- if (instrument.instrument_id in instrument_logo_map) {
- inst = instrument_logo_map[instrument.instrument_id];
- }
- instrumentLogoHtml += ' ';
- }
- }
+ bindMusicians(response);
+ },
+ error: app.ajaxError
+ });
- var template = $('#template-band-profile-members').html();
- var memberHtml = context.JK.fillTemplate(template, {
- userId: musician.id,
- profile_url: "/#/profile/" + musician.id,
- 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,
- session_count: musician.session_count,
- instruments: instrumentLogoHtml
- });
+ if (isMember) {
+ bindPendingMembers();
+ }
+ }
- $('#band-profile-members').append(memberHtml);
-
- // wire up Follow button click handler
- var following = isFollowingMember(musician.id);
- configureMemberFollowingButton(following, musician.id);
-
- // TODO: wire up Friend button click handler
- // var friend = isFriend(musician.id);
- // configureMemberFriendButton(friend, musician.id);
- });
+ function bindPendingMembers() {
+ $("#band-profile-members").append("