diff --git a/web/app/assets/javascripts/accounts_session_detail.js b/web/app/assets/javascripts/accounts_session_detail.js
index d75a5ea2e..82c028e52 100644
--- a/web/app/assets/javascripts/accounts_session_detail.js
+++ b/web/app/assets/javascripts/accounts_session_detail.js
@@ -339,7 +339,14 @@
if ("instrument_list" in pending_rsvp_request && pending_rsvp_request.instrument_list != null) {
$.each(pending_rsvp_request.instrument_list, function (index, instrument) {
- var instrumentId = context.JK.getInstrumentId(instrument.id);
+ var instrumentId;
+
+ if (instrument) {
+ instrumentId = context.JK.getInstrumentId(instrument.id);
+ }
+ else {
+ instrumentId = 'other';
+ }
var inst = context.JK.getInstrumentIcon24(instrumentId);
instrumentLogoHtml += ' ';
instrumentDesc.push(instrumentId);
@@ -378,7 +385,14 @@
$.each(sessionData.approved_rsvps, function(index, approved_rsvp) {
if ("instrument_list" in approved_rsvp) {
$.each(approved_rsvp.instrument_list, function(index, instrument) {
- var instrumentId = context.JK.getInstrumentId(instrument.id);
+ var instrumentId;
+
+ if (instrument) {
+ instrumentId = context.JK.getInstrumentId(instrument.id);
+ }
+ else {
+ instrumentId = 'other';
+ }
var inst = context.JK.getInstrumentIcon24(instrumentId);
instrumentLogoHtml += '
';
});
diff --git a/web/app/assets/javascripts/dialog/sessionStartDialog.js b/web/app/assets/javascripts/dialog/sessionStartDialog.js
new file mode 100644
index 000000000..971a5da65
--- /dev/null
+++ b/web/app/assets/javascripts/dialog/sessionStartDialog.js
@@ -0,0 +1,130 @@
+(function(context,$) {
+
+ "use strict";
+ context.JK = context.JK || {};
+ context.JK.SessionStartDialog = function(app, session) {
+ var logger = context.JK.logger;
+ var sessionUtils = context.JK.SessionUtils;
+ var $dialog = null;
+ var dialogId = 'session-start-dialog';
+ var $btnStartSession = null;
+
+ function beforeShow(data) {
+ }
+
+ function afterShow(data) {
+ }
+
+ function afterHide() {
+ }
+
+ function showDialog() {
+ return app.layout.showDialog(dialogId);
+ }
+
+ function events() {
+ $btnStartSession.unbind('click');
+ $btnStartSession.click(function(e) {
+ context.location = '/client#/session/' + session.id;
+ app.layout.closeDialog(dialogId);
+ });
+ }
+
+ function initializeSessionDetails() {
+ $dialog.find('#session-start-type-disp').html('Now!');
+ $dialog.find('#session-name-disp').html(session.name);
+ $dialog.find('#session-description-disp').html(session.description);
+
+ if (session.music_notations && session.music_notations.length > 0) {
+ $dialog.find('#session-notations-disp').html("Notations: " + session.music_notations.join(', '));
+ }
+
+ if (session.band) {
+ $dialog.find('#session-band-disp').html(band.name);
+ }
+ else {
+ $dialog.find('#session-band-disp').html('N/A');
+ }
+
+ $dialog.find('#session-language-disp').html(session.language_description);
+
+ var invitedFriends = session.invitations;
+
+ var sessionInvited = [];
+ $.each(invitedFriends, function(index, invitation) {
+ sessionInvited.push(invitation.receiver_name);
+ });
+
+ var sessionInvitedString = sessionInvited.join(', ');
+
+ if (session.musician_access && session.approval_required) {
+ if (session.open_rsvps) {
+ if (invitedFriends.length == 0)
+ sessionInvitedString = "Any interested JamKazam musicians that I approve";
+ else
+ sessionInvitedString += ", plus any interested JamKazam musicians that I approve";
+ }
+ else {
+ if (invitedFriends.length == 0) {
+ sessionInvitedString = "No open RSVPs";
+ }
+ else {
+ sessionInvitedString += " (No open RSVPs)";
+ }
+ }
+ }
+ else if (session.musician_access && !session.approval_required) {
+ if (invitedFriends.length == 0)
+ sessionInvitedString = "Any interested JamKazam musicians who want to join us";
+ else
+ sessionInvitedString += ", plus any interested JamKazam musicians who want to join us";
+ }
+
+ $dialog.find('#session-invited-disp').html(sessionInvitedString);
+
+ var instrumentsMe = [], instrumentsOthers = [];
+
+ $.each(session.approved_rsvps, function(index, rsvp) {
+ if (rsvp.id === context.JK.currentUserId) {
+ $.each(rsvp.instrument_list, function(index, instrument) {
+ instrumentsMe.push(instrument.desc);
+ });
+ }
+ else {
+ $.each(rsvp.instrument_list, function(index, instrument) {
+ instrumentsOthers.push(instrument.desc);
+ });
+ }
+ });
+
+ $dialog.find('#session-instruments-me-disp').html(instrumentsMe.join(', '));
+ $dialog.find('#session-instruments-rsvp-disp').html(instrumentsOthers.join(', '));
+
+ $dialog.find('#session-musician-access-disp').html('Musicians: ' + session.musician_access_description);
+ $dialog.find('#session-fans-access-disp').html('Fans: ' + session.fan_access_description);
+ $dialog.find('#session-policy-disp').html(session.legal_policy);
+ }
+
+ function initialize() {
+
+ var dialogBindings = {
+ 'beforeShow' : beforeShow,
+ 'afterShow' : afterShow,
+ 'afterHide': afterHide
+ };
+
+ app.bindDialog(dialogId, dialogBindings);
+
+ $dialog = $('[layout-id="' + dialogId + '"]');
+ $btnStartSession = $dialog.find('.btnStartSession');
+
+ initializeSessionDetails();
+ events();
+ }
+
+ this.initialize = initialize;
+ this.showDialog = showDialog;
+ }
+
+ return this;
+})(window,jQuery);
\ No newline at end of file
diff --git a/web/app/assets/javascripts/scheduled_session.js.erb b/web/app/assets/javascripts/scheduled_session.js.erb
index ebbd6a9b3..969f9449d 100644
--- a/web/app/assets/javascripts/scheduled_session.js.erb
+++ b/web/app/assets/javascripts/scheduled_session.js.erb
@@ -200,14 +200,14 @@
createSessionSettings.startDate = createSessionSettings.startDate || (new Date().toDateString());
- $("#session-start-date").val(createSessionSettings.startDate);
+ $screen.find("#session-start-date").val(createSessionSettings.startDate);
toggleDate(true);
toggleStartTime();
toggleStepStatus();
sessionUtils.defaultTimezone($timezoneList);
if(firstTimeShown) {
firstTimeShown = false;
- $('#session-when-start-scheduled').iCheck('check');
+ $screen.find('#session-when-start-scheduled').iCheck('check');
}
}
@@ -217,7 +217,7 @@
function beforeShowStep3() {
rest.getBands(context.JK.currentUserId)
.done(function(result) {
- var options = $("#session-band-list");
+ var options = $screen.find("#session-band-list");
options.empty();
options.append($("").val('').text('No'));
$.each(result, function(idx, item) {
@@ -251,10 +251,10 @@
var sessionName = createSessionSettings.name;
sessionName += ' (' + createSessionSettings.genresValues[0] + ')';
- $('#session-name-disp').html(sessionName);
+ $screen.find('#session-name-disp').html(sessionName);
var sessionDescription = createSessionSettings.description;
- $('#session-description-disp').html(sessionDescription);
+ $screen.find('#session-description-disp').html(sessionDescription);
var sessionNotations = [];
for (var i = 0; i < createSessionSettings.notations.length; i++) {
@@ -262,16 +262,16 @@
sessionNotations.push(name);
}
if(sessionNotations.length > 0) {
- $('#session-notations-disp').html("Notations: " + sessionNotations.join(', '));
+ $screen.find('#session-notations-disp').html("Notations: " + sessionNotations.join(', '));
}
else {
- $('#session-notations-disp').html('');
+ $screen.find('#session-notations-disp').html('');
}
- $('#session-language-disp').html(createSessionSettings.language.label);
- $('#session-band-disp').html(createSessionSettings.band.label);
+ $screen.find('#session-language-disp').html(createSessionSettings.language.label);
+ $screen.find('#session-band-disp').html(createSessionSettings.band.label);
- var plusMusicians = $('#session-plus-musicians')[0].checked;
+ var plusMusicians = $screen.find('#session-plus-musicians')[0].checked;
var sessionInvited = [];
var invitedFriends = inviteMusiciansUtil.getInvitedFriendNames();
@@ -302,7 +302,7 @@
else
sessionInvitedString += ", plus any interested JamKazam musicians who want to join us";
}
- $('#session-invited-disp').html(sessionInvitedString);
+ $screen.find('#session-invited-disp').html(sessionInvitedString);
if (createSessionSettings.createType == '<%= MusicSession::CREATE_TYPE_START_SCHEDULED%>') {
var session = scheduledSessions[createSessionSettings.selectedSessionId];
@@ -315,7 +315,7 @@
});
}
});
- $('#session-instruments-me-disp').html(instruments_me.join(', '));
+ $screen.find('#session-instruments-me-disp').html(instruments_me.join(', '));
}
if (session.open_slots.length > 0) {
@@ -334,7 +334,7 @@
$.map(instruments_rsvp_arr, function(val, i) {
instruments_str_arr.push(i + ' (' + val.count + ') (' + val.level + ')');
})
- $('#session-instruments-rsvp-disp').html(instruments_str_arr.join(', '));
+ $screen.find('#session-instruments-rsvp-disp').html(instruments_str_arr.join(', '));
}
}
else {
@@ -342,7 +342,7 @@
$.each(getCreatorInstruments(), function(index, instrument) {
instruments_me.push(instrument.name);
});
- $('#session-instruments-me-disp').html(instruments_me.join(', '));
+ $screen.find('#session-instruments-me-disp').html(instruments_me.join(', '));
var instruments_rsvp = [];
var otherInstruments = instrumentRSVP.getSelectedInstruments();
@@ -353,13 +353,13 @@
$.each(otherInstruments, function(index, instrument) {
instruments_rsvp.push(instrument.name + ' (' + instrument.count + ') (' + proficiencyDescriptionMap[instrument.level] + ')');
});
- $('#session-instruments-rsvp-disp').html(instruments_rsvp.join(', '));
+ $screen.find('#session-instruments-rsvp-disp').html(instruments_rsvp.join(', '));
}
- $('#session-musician-access-disp').html('Musicians: ' + createSessionSettings.musician_access.label);
- $('#session-fans-access-disp').html('Fans: ' + createSessionSettings.fans_access.label);
+ $screen.find('#session-musician-access-disp').html('Musicians: ' + createSessionSettings.musician_access.label);
+ $screen.find('#session-fans-access-disp').html('Fans: ' + createSessionSettings.fans_access.label);
- $('#session-policy-disp').html(createSessionSettings.session_policy);
+ $screen.find('#session-policy-disp').html(createSessionSettings.session_policy);
}
function beforeMoveStep1() {
@@ -428,7 +428,7 @@
createSessionSettings.recurring_mode.value = 'once';
}
else {
- createSessionSettings.startDate = $('#session-start-date').val();
+ createSessionSettings.startDate = $screen.find('#session-start-date').val();
createSessionSettings.startTime = $startTimeList.val();
createSessionSettings.endTime = $endTimeList.val();
createSessionSettings.notations = [];
@@ -437,7 +437,7 @@
createSessionSettings.timezone.label = $timezoneList.get(0).options[$timezoneList.get(0).selectedIndex].text;
createSessionSettings.recurring_mode.label = $recurringModeList.get(0).options[$recurringModeList.get(0).selectedIndex].text;
createSessionSettings.recurring_mode.value = $recurringModeList.val();
- createSessionSettings.open_rsvps = $('#session-plus-musicians')[0].checked;
+ createSessionSettings.open_rsvps = $screen.find('#session-plus-musicians')[0].checked;
}
return true;
@@ -503,22 +503,22 @@
function beforeMoveStep2() {
var isValid = true;
- var name = $('#session-name').val();
+ var name = $screen.find('#session-name').val();
if (!name) {
$('#divSessionName .error-text').remove();
$('#divSessionName').addClass("error");
- $('#session-name').after("