diff --git a/web/app/assets/javascripts/sessionList.js b/web/app/assets/javascripts/sessionList.js
index a8fc38a9d..ef83c22ec 100644
--- a/web/app/assets/javascripts/sessionList.js
+++ b/web/app/assets/javascripts/sessionList.js
@@ -25,7 +25,7 @@
$('#actionHeader', tbGroup).html('JOIN');
var i = 0;
- var inSessionUsersHtml = '', rsvpUsersHtml = '', openSlotsHtml = '', latencyHtml = '', notationFileHtml = '';
+ var inSessionUsersHtml = '', rsvpFirst3UsersHtml = '', rsvpRemainingUsersHtml = '', openSlotsFirst3Html = '', openSlotsRemainingHtml = '', latencyInSessionHtml = '', latencyFirst3Html = '', latencyRemainingHtml = '', notationFileHtml = '';
// this is used to track which users are already in the session so we can exclude them from the
// "RSVPs" section
@@ -39,25 +39,32 @@
inSessionUsers.push(session.active_music_session.participants[i].user.id);
var inSessionUserInfo = createInSessionUser(session.active_music_session.participants[i]);
inSessionUsersHtml += inSessionUserInfo[0];
- latencyHtml += inSessionUserInfo[1];
+ latencyInSessionHtml += inSessionUserInfo[1];
}
}
// this provides a buffer at the top to shift the first latency tag down in the event there are NO in-session musicians
else {
- latencyHtml += "
";
+ latencyInSessionHtml += "
";
}
// render users who have approved RSVPs
if (session.approved_rsvps) {
- for (i=0; i < session.approved_rsvps.length; i++) {
+ var approvedRsvpCount = session.approved_rsvps.length;
+ for (i=0; i < approvedRsvpCount; i++) {
// do not show the user in this section if he is already in the session
if ($.inArray(session.approved_rsvps[i].id, inSessionUsers) === -1) {
if (session.approved_rsvps[i].id === context.JK.currentUserId) {
showJoinLink = true;
}
var rsvpUserInfo = createRsvpUser(session.approved_rsvps[i], session);
- rsvpUsersHtml += rsvpUserInfo[0];
- latencyHtml += rsvpUserInfo[1];
+ if (i < 3) {
+ rsvpFirst3UsersHtml += rsvpUserInfo[0];
+ latencyFirst3Html += rsvpUserInfo[1];
+ }
+ else {
+ rsvpRemainingUsersHtml += rsvpUserInfo[0];
+ latencyRemainingHtml += rsvpUserInfo[1];
+ }
}
else {
showJoinLink = true;
@@ -67,13 +74,19 @@
// render if anyone interested
if(session['is_unstructured_rsvp?']) {
- openSlotsHtml += sessionUtils.createOpenSlot($openSlotsTemplate, {description: 'Any Instrument'})
+ openSlotsHtml += sessionUtils.createOpenSlot($openSlotsTemplate, {description: 'Any Instrument'});
}
// render open slots
if (session.open_slots) {
- for (i=0; i < session.open_slots.length; i++) {
- openSlotsHtml += sessionUtils.createOpenSlot($openSlotsTemplate, session.open_slots[i]);
+ var openSlotCount = session.open_slots.length;
+ for (i=0; i < openSlotCount; i++) {
+ if (i < 3) {
+ openSlotsFirst3Html += sessionUtils.createOpenSlot($openSlotsTemplate, session.open_slots[i], openSlotCount, i);
+ }
+ else {
+ openSlotsRemainingHtml += sessionUtils.createOpenSlot($openSlotsTemplate, session.open_slots[i], openSlotCount, i);
+ }
}
}
@@ -84,7 +97,7 @@
}
}
- var sessionVals = buildSessionObject(session, notationFileHtml, rsvpUsersHtml, openSlotsHtml, latencyHtml);
+ var sessionVals = buildSessionObject(session, notationFileHtml, rsvpFirst3UsersHtml, rsvpRemainingUsersHtml, openSlotsFirst3Html, openSlotsRemainingHtml, latencyFirst3Html, latencyRemainingHtml);
sessionVals.in_session_musicians = inSessionUsersHtml.length > 0 ? inSessionUsersHtml : 'N/A';
sessionVals.join_link_display_style = showJoinLink ? "block" : "none";
@@ -100,9 +113,20 @@
$(tbGroup).append($row);
+ var $parentRow = $('tr[data-session-id=' + session.id + ']', tbGroup);
+
+ $(tbGroup).on('click', 'a.more.slots', function() {
+ alert("HERE");
+ });
+
+ // if ($moreLink) {
+ // console.log("IN HERE");
+ // $moreLink[0].click(toggleSlots);
+ // }
+
if (showJoinLink) {
// wire up the Join Link to the T&Cs dialog
- var $parentRow = $('tr[data-session-id=' + session.id + ']', tbGroup);
+
$('.join-link', $parentRow).click(function(evt) {
if(!context.JK.guardAgainstBrowser(app)) {
return false;
@@ -141,7 +165,7 @@
$('#actionHeader', tbGroup).html('RSVP');
var i = 0;
- var rsvpUsersHtml = '', openSlotsHtml = '', latencyHtml = '', notationFileHtml = '';
+ var rsvpFirst3UsersHtml = '', rsvpRemainingUsersHtml = '', openSlotsFirst3Html = '', openSlotsRemainingHtml = '', latencyFirst3Html = '', latencyRemainingHtml = '', notationFileHtml = '';
context._.each(session.pending_rsvp_requests, function(pending_rsvp_request) {
if(pending_rsvp_request.user_id === context.JK.currentUserId) {
@@ -151,30 +175,48 @@
// render users who have approved RSVPs
if (session.approved_rsvps && session.approved_rsvps.length > 0) {
+ var approvedRsvpCount = session.approved_rsvps.length;
context._.each(session.approved_rsvps, function(approved_rsvp) {
if (approved_rsvp.id === context.JK.currentUserId) {
approvedRsvpId = approved_rsvp.rsvp_request_id;
}
+
var rsvpUserInfo = createRsvpUser(approved_rsvp, session);
- rsvpUsersHtml += rsvpUserInfo[0];
- latencyHtml += rsvpUserInfo[1];
+
+ if (i < 3) {
+ rsvpFirst3UsersHtml += rsvpUserInfo[0];
+ latencyFirst3Html += rsvpUserInfo[1];
+ }
+ else {
+ rsvpRemainingUsersHtml += rsvpUserInfo[0];
+ latencyRemainingHtml += rsvpUserInfo[1];
+ }
+
+ i++;
});
}
// this provides a buffer at the top to shift the first latency tag down in the event there are NO RSVP musicians
else {
- latencyHtml += "