Merge branch 'feature/scheduled_sessions' of bitbucket.org:jamkazam/jam-cloud into feature/scheduled_sessions
This commit is contained in:
commit
ab5a7dc47a
|
|
@ -255,6 +255,8 @@ module JamRuby
|
|||
unless ms.errors.any?
|
||||
ms.reload
|
||||
|
||||
rsvp_slot_ids = []
|
||||
self_rsvp_slot_ids = []
|
||||
options[:rsvp_slots].each do |rs|
|
||||
rsvp = RsvpSlot.new
|
||||
rsvp.instrument = Instrument.find(rs[:instrument_id])
|
||||
|
|
@ -263,7 +265,24 @@ module JamRuby
|
|||
rsvp.save
|
||||
|
||||
ms.rsvp_slots << rsvp
|
||||
|
||||
if rs[:approved]
|
||||
self_rsvp_slot_ids.push rsvp.id
|
||||
else
|
||||
rsvp_slot_ids.push rsvp.id
|
||||
end
|
||||
end if options[:rsvp_slots]
|
||||
RsvpRequest.create({session_id: ms.id, rsvp_slots: rsvp_slot_ids}, user)
|
||||
rsvp_rq_ids = RsvpRequest.create({session_id: ms.id, rsvp_slots: self_rsvp_slot_ids}).map(&:id)
|
||||
|
||||
self_rsvp_rq = []
|
||||
rsvp_rq_ids.each do |rsvp_rq|
|
||||
r = Hash.new
|
||||
r[:request_slot_id] = rsvp_rq
|
||||
r[:approved] = true
|
||||
self_rsvp_rq.push r
|
||||
end
|
||||
RsvpRequest.update({session_id: ms.id, rsvp_responses: self_rsvp_rq})
|
||||
|
||||
options[:invitations].each do |invite_id|
|
||||
invitation = Invitation.new
|
||||
|
|
|
|||
|
|
@ -374,47 +374,68 @@
|
|||
|
||||
function startSession() {
|
||||
var data = {};
|
||||
data.name = createSessionSettings.name;
|
||||
data.description = createSessionSettings.description;
|
||||
data.genres = createSessionSettings.genres;
|
||||
if (createSessionSettings.musician_access.value == 'only-rsvp') {
|
||||
data.musician_access = false;
|
||||
data.approval_required = false;
|
||||
}
|
||||
else if (createSessionSettings.musician_access.value == 'musicians-approval') {
|
||||
data.musician_access = true;
|
||||
data.approval_required = true;
|
||||
}
|
||||
else if (createSessionSettings.musician_access.value == 'musicians') {
|
||||
data.musician_access = true;
|
||||
data.approval_required = false;
|
||||
}
|
||||
|
||||
if (createSessionSettings.fans_access.value == 'no-listen-chat') {
|
||||
data.fan_access = false; data.fan_chat = false;
|
||||
}
|
||||
else if (createSessionSettings.fans_access.value == 'listen-chat-each') {
|
||||
data.fan_access = true; data.fan_chat = false;
|
||||
}
|
||||
else if (createSessionSettings.fans_access.value == 'listen-chat-band') {
|
||||
data.fan_access = true; data.fan_chat = true;
|
||||
}
|
||||
data.legal_policy = createSessionSettings.session_policy;
|
||||
data.legal_terms = true;
|
||||
data.language = createSessionSettings.language.value;
|
||||
if (createSessionSettings.createType == 'quick-start' || createSessionSettings.createType == 'immediately') {
|
||||
data.start = new Date().toDateString() + ' ' + getFormattedTime(new Date(), false);
|
||||
}
|
||||
else {
|
||||
data.start = createSessionSettings.startDate + ' ' + createSessionSettings.startTime;
|
||||
}
|
||||
data.invitations = inviteMusiciansUtil.getInvitedFriends();
|
||||
data.recurring_mode = createSessionSettings.recurring_mode.value;
|
||||
data.music_notations = createSessionSettings.music_notations;
|
||||
|
||||
if (createSessionSettings.createType == 'start-scheduled') {
|
||||
data = scheduledSessions[createSessionSettings.selectedSessionId];
|
||||
}
|
||||
else {
|
||||
data.name = createSessionSettings.name;
|
||||
data.description = createSessionSettings.description;
|
||||
data.genres = createSessionSettings.genres;
|
||||
if (createSessionSettings.musician_access.value == 'only-rsvp') {
|
||||
data.musician_access = false;
|
||||
data.approval_required = false;
|
||||
}
|
||||
else if (createSessionSettings.musician_access.value == 'musicians-approval') {
|
||||
data.musician_access = true;
|
||||
data.approval_required = true;
|
||||
}
|
||||
else if (createSessionSettings.musician_access.value == 'musicians') {
|
||||
data.musician_access = true;
|
||||
data.approval_required = false;
|
||||
}
|
||||
|
||||
if (createSessionSettings.fans_access.value == 'no-listen-chat') {
|
||||
data.fan_access = false; data.fan_chat = false;
|
||||
}
|
||||
else if (createSessionSettings.fans_access.value == 'listen-chat-each') {
|
||||
data.fan_access = true; data.fan_chat = false;
|
||||
}
|
||||
else if (createSessionSettings.fans_access.value == 'listen-chat-band') {
|
||||
data.fan_access = true; data.fan_chat = true;
|
||||
}
|
||||
data.legal_policy = createSessionSettings.session_policy;
|
||||
data.legal_terms = true;
|
||||
data.language = createSessionSettings.language.value;
|
||||
if (createSessionSettings.createType == 'quick-start' || createSessionSettings.createType == 'immediately') {
|
||||
data.start = new Date().toDateString() + ' ' + getFormattedTime(new Date(), false);
|
||||
}
|
||||
else {
|
||||
data.start = createSessionSettings.startDate + ' ' + createSessionSettings.startTime;
|
||||
}
|
||||
data.invitations = inviteMusiciansUtil.getInvitedFriends();
|
||||
data.recurring_mode = createSessionSettings.recurring_mode.value;
|
||||
data.music_notations = createSessionSettings.music_notations;
|
||||
|
||||
data.rsvp_slots = [];
|
||||
$.each(instrumentSelector.getSelectedInstruments(), function(index, instrument) {
|
||||
var slot = {};
|
||||
slot.instrument = instrument.id;
|
||||
slot.proficiency_level = instrument.level;
|
||||
slot.approve = false;
|
||||
data.rsvp_slots.push(slot);
|
||||
});
|
||||
|
||||
$.each(instrumentRSVP.getSelectedInstruments(), function(index, instrument) {
|
||||
for (var i = 0; i < instrument.count; i++) {
|
||||
var slot = {};
|
||||
slot.instrument = instrument.id;
|
||||
slot.proficiency_level = instrument.level;
|
||||
slot.approve = true;
|
||||
data.rsvp_slots.push(slot);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var tracks = context.JK.TrackHelpers.getUserTracks(context.jamClient);
|
||||
if(tracks.length == 0) {
|
||||
|
|
@ -842,14 +863,12 @@
|
|||
if (createSessionSettings.createType == 'start-scheduled') {
|
||||
$('#start-scheduled-wrapper').show();
|
||||
$('#schedule-future-wrapper').hide();
|
||||
createSessionSettings = {
|
||||
createType: 'start-scheduled',
|
||||
timezone: {},
|
||||
recurring_mode: {},
|
||||
language: {},
|
||||
musician_access: {},
|
||||
fans_access: {}
|
||||
};
|
||||
createSessionSettings.timezone = {};
|
||||
createSessionSettings.recurring_mode = {};
|
||||
createSessionSettings.timezone = {};
|
||||
createSessionSettings.language = {};
|
||||
createSessionSettings.musician_access = {};
|
||||
createSessionSettings.fans_access = {};
|
||||
}
|
||||
else if (createSessionSettings.createType == 'schedule-future') {
|
||||
$('#start-scheduled-wrapper').hide();
|
||||
|
|
|
|||
|
|
@ -438,7 +438,7 @@
|
|||
|
||||
<script type="text/template" id="template-session-buttons">
|
||||
<div class="sessionbuttons-holder">
|
||||
<a class="button-orange" href="#">HELP</a>
|
||||
<a class="button-orange" href="http://jamkazam.desk.com/" target="_blank">HELP</a>
|
||||
<a class="button-orange btn-back" href="#">BACK</a>
|
||||
<a class="button-orange btn-next" href="#">NEXT</a>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue