diff --git a/web/app/assets/images/content/icon_checkmark_circle.png b/web/app/assets/images/content/icon_checkmark_circle.png
new file mode 100644
index 000000000..ee372cf25
Binary files /dev/null and b/web/app/assets/images/content/icon_checkmark_circle.png differ
diff --git a/web/app/assets/javascripts/commentDialog.js b/web/app/assets/javascripts/commentDialog.js
index ea2f64b5e..263ea7d6d 100644
--- a/web/app/assets/javascripts/commentDialog.js
+++ b/web/app/assets/javascripts/commentDialog.js
@@ -128,9 +128,9 @@
function initialize() {
var dialogBindings = {
- 'beforeShow' : beforeShow,
- 'afterShow' : afterShow,
- 'afterHide': afterHide
+ 'beforeShow' : beforeShow,
+ 'afterShow' : afterShow,
+ 'afterHide': afterHide
};
app.bindDialog('comment-dialog', dialogBindings);
diff --git a/web/app/assets/javascripts/jam_rest.js b/web/app/assets/javascripts/jam_rest.js
index 5f7b8f93a..824e4cd2b 100644
--- a/web/app/assets/javascripts/jam_rest.js
+++ b/web/app/assets/javascripts/jam_rest.js
@@ -135,6 +135,31 @@
});
}
+ function submitRsvpRequest(sessionId) {
+ return $.ajax({
+ url: '/api/rsvp_requests',
+ type: "POST",
+ data : JSON.stringify({"session_id": sessionId}),
+ dataType : 'json',
+ contentType: 'application/json'
+ });
+ }
+
+ function getOpenSessionSlots(sessionId, openOnly) {
+ var url = '/api/rsvp_slots?session_id=' + sessionId;
+
+ if (openOnly) {
+ url += '&open_only=true';
+ }
+ return $.ajax({
+ type: "GET",
+ dataType: "json",
+ url: url,
+ contentType: 'application/json',
+ processData: false
+ });
+ }
+
function addRecordingComment(recordingId, userId, comment) {
return $.ajax({
url: '/api/recordings/' + recordingId + "/comments",
@@ -1061,6 +1086,8 @@
this.addSessionComment = addSessionComment;
this.addSessionInfoComment = addSessionInfoComment;
this.addSessionLike = addSessionLike;
+ this.submitRsvpRequest = submitRsvpRequest;
+ this.getOpenSessionSlots = getOpenSessionSlots;
this.addRecordingComment = addRecordingComment;
this.addRecordingLike = addRecordingLike;
this.addPlayablePlay = addPlayablePlay;
diff --git a/web/app/assets/javascripts/rsvpSubmitDialog.js b/web/app/assets/javascripts/rsvpSubmitDialog.js
index e69de29bb..1bb5d4a32 100644
--- a/web/app/assets/javascripts/rsvpSubmitDialog.js
+++ b/web/app/assets/javascripts/rsvpSubmitDialog.js
@@ -0,0 +1,105 @@
+(function(context,$) {
+
+ "use strict";
+ context.JK = context.JK || {};
+ context.JK.RsvpSubmitDialog = function(app, sessionId) {
+ var logger = context.JK.logger;
+ var rest = context.JK.Rest();
+ var $screen = null;
+
+ function beforeShow(data) {
+ }
+
+ function afterShow(data) {
+ $('.rsvp-instruments', $screen).empty();
+
+ rest.getSessionHistory(sessionId)
+ .done(function(response) {
+ if (response) {
+ $('.session-name', $screen).html(response.name);
+ $('.scheduled-start', $screen).html(response.scheduled_start);
+
+ if (response.recurring_mode !== null) {
+ $('.schedule-recurrence', $screen).html("Recurs " + response.recurring_mode + " on this day at this time");
+ }
+ }
+ })
+ .fail(function(xhr) {
+
+ });
+
+ // if the session has slots, get the open ones
+ rest.getOpenSessionSlots(sessionId, true)
+ .done(function(response) {
+ if (response && response.length > 0) {
+ $.each(response, function(index, val) {
+ var instrument = val.instrument_id;
+
+ var instrumentTitleCase = context.JK.toTitleCase(instrument);
+ // var instrumentTitleCase = instrument.charAt(0).toUpperCase() + instrument.substr(1).toLowerCase();
+ // var instTitleCase = val.instrument_id.charAt(0).toUpperCase() + context.val.instrument_id.charAt(0)
+ $('.rsvp-instruments', $screen).append('' + instrumentTitleCase + "
");
+ });
+ }
+ else {
+ $('.slot-instructions', $screen).hide();
+ $('.rsvp-instruments', $screen).hide();
+ }
+ })
+ .fail(function(xhr) {
+
+ });
+ }
+
+ function afterHide() {
+ }
+
+ function showDialog() {
+ app.layout.showDialog('rsvp-submit-dialog');
+ }
+
+ function events() {
+ $("#btnSubmit").click(function(e) {
+ rest.submitRsvpRequest(sessionId)
+ .done(function(response) {
+
+ var comment = $.trim($('#txtComment', $screen).val());
+ if (comment.length > 0) {
+ rest.addSessionInfoComment(sessionId, comment)
+ .done(function(response) {
+
+ })
+ .fail(function(xhr) {
+
+ });
+ }
+
+ app.layout.cDialog('rsvp-submit-dialog');
+ })
+ .fail(function(xhr) {
+
+ });
+ });
+ }
+
+ function initialize() {
+
+ var dialogBindings = {
+ 'beforeShow' : beforeShow,
+ 'afterShow' : afterShow,
+ 'afterHide': afterHide
+ };
+
+ app.bindDialog('rsvp-submit-dialog', dialogBindings);
+
+ $screen = $('[layout-id="rsvp-submit-dialog"]');
+
+ events();
+ }
+
+ this.initialize = initialize;
+ this.showDialog = showDialog;
+ }
+
+ return this;
+})(window,jQuery);
\ No newline at end of file
diff --git a/web/app/assets/javascripts/ui_helper.js b/web/app/assets/javascripts/ui_helper.js
index 97eacab17..a4b1240d1 100644
--- a/web/app/assets/javascripts/ui_helper.js
+++ b/web/app/assets/javascripts/ui_helper.js
@@ -35,10 +35,24 @@
shareDialog.showDialog();
}
+ function launchRsvpSubmitDialog(sessionId) {
+ var rsvpDialog = new JK.RsvpSubmitDialog(JK.app, sessionId);
+ rsvpDialog.initialize();
+ rsvpDialog.showDialog();
+ }
+
+ function launchRsvpCancelDialog(sessionId) {
+ var rsvpDialog = new JK.RsvpCancelDialog(JK.app, sessionId);
+ rsvpDialog.initialize();
+ rsvpDialog.showDialog();
+ }
+
this.addSessionLike = addSessionLike;
this.addRecordingLike = addRecordingLike;
this.launchCommentDialog = launchCommentDialog;
this.launchShareDialog = launchShareDialog;
+ this.launchRsvpSubmitDialog = launchRsvpSubmitDialog;
+ this.launchRsvpCancelDialog = launchRsvpCancelDialog;
return this;
};
diff --git a/web/app/assets/javascripts/utils.js b/web/app/assets/javascripts/utils.js
index 2203d6ffb..bcbb6d295 100644
--- a/web/app/assets/javascripts/utils.js
+++ b/web/app/assets/javascripts/utils.js
@@ -302,6 +302,12 @@
});
}
+ context.JK.toTitleCase = function(str) {
+ return str.replace(/\w\S*/g, function(txt){
+ return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
+ });
+ }
+
// Uber-simple templating
// var template = "Hey {name}";
diff --git a/web/app/assets/javascripts/web/scheduled_session.js b/web/app/assets/javascripts/web/scheduled_session.js
index 0c89246c0..ff3792ede 100644
--- a/web/app/assets/javascripts/web/scheduled_session.js
+++ b/web/app/assets/javascripts/web/scheduled_session.js
@@ -7,6 +7,7 @@
context.JK.ShowSessionInfo = function(app) {
var logger = context.JK.logger;
var rest = JK.Rest();
+ var ui = new context.JK.UIHelper(app);
function addComment(musicSessionId) {
console.log("here");
@@ -80,6 +81,10 @@
context.JK.bindHoverEvents($parent);
context.JK.setInstrumentAssetPath($('.instrument-icon', $parent));
+ $("#btn-rsvp").click(function(e) {
+ ui.launchRsvpSubmitDialog(musicSessionId);
+ });
+
$("#btnPostComment").click(function(e) {
if ($.trim($("#txtSessionInfoComment").val()).length > 0) {
addComment(musicSessionId);
diff --git a/web/app/assets/stylesheets/client/screen_common.css.scss b/web/app/assets/stylesheets/client/screen_common.css.scss
index 459d37cdd..1687c332d 100644
--- a/web/app/assets/stylesheets/client/screen_common.css.scss
+++ b/web/app/assets/stylesheets/client/screen_common.css.scss
@@ -171,6 +171,14 @@ a img {border:none;}
small, .small {font-size:11px;}
.bold {font-weight:bold;}
+.rsvp-instruments {
+ height:80px;
+ overflow:auto;
+ background-color:#202020;
+ padding:8px;
+ margin-top:5px;
+}
+
.button-grey {
margin:0px 8px 0px 8px;
background-color:#666;
diff --git a/web/app/controllers/api_rsvp_slots_controller.rb b/web/app/controllers/api_rsvp_slots_controller.rb
index 38771aa48..7b4f2e3bc 100644
--- a/web/app/controllers/api_rsvp_slots_controller.rb
+++ b/web/app/controllers/api_rsvp_slots_controller.rb
@@ -13,7 +13,11 @@ class ApiRsvpSlotsController < ApiController
music_session = MusicSession.find(params[:session_id])
# retrieve all slots for this session
- @rsvp_slots = RsvpSlot.index(music_session)
+ if params[:open_only]
+ @rsvp_slots = music_session.open_slots
+ else
+ @rsvp_slots = RsvpSlot.index(music_session)
+ end
respond_with @rsvp_slots, responder: ApiResponder, :status => 200
diff --git a/web/app/views/api_music_sessions/show.rabl b/web/app/views/api_music_sessions/show.rabl
index f2498edaf..a8547fe17 100644
--- a/web/app/views/api_music_sessions/show.rabl
+++ b/web/app/views/api_music_sessions/show.rabl
@@ -1,4 +1,4 @@
- object @music_session
+object @music_session
if !current_user
# there should be more data returned, but we need to think very carefully about what data is public for a music session
diff --git a/web/app/views/api_music_sessions/show_history.rabl b/web/app/views/api_music_sessions/show_history.rabl
index 01fef08f3..3ccfcb73e 100644
--- a/web/app/views/api_music_sessions/show_history.rabl
+++ b/web/app/views/api_music_sessions/show_history.rabl
@@ -17,7 +17,7 @@ if !current_user
else
attributes :id, :music_session_id, :name, :description, :musician_access, :approval_required, :fan_access, :fan_chat,
- :band_id, :user_id, :genre_id, :created_at, :like_count, :comment_count, :scheduled_start, :scheduled_duration, :language
+ :band_id, :user_id, :genre_id, :created_at, :like_count, :comment_count, :scheduled_start, :scheduled_duration, :language, :recurring_mode, :language_description, :scheduled_start_time, :access_description
node :share_url do |history|
unless history.share_token.nil?
diff --git a/web/app/views/clients/_rsvpReviewDialog.html.haml b/web/app/views/clients/_rsvpReviewDialog.html.haml
deleted file mode 100644
index e69de29bb..000000000
diff --git a/web/app/views/clients/_rsvpSubmitDialog.html.haml b/web/app/views/clients/_rsvpSubmitDialog.html.haml
index e69de29bb..49e7b2d9c 100644
--- a/web/app/views/clients/_rsvpSubmitDialog.html.haml
+++ b/web/app/views/clients/_rsvpSubmitDialog.html.haml
@@ -0,0 +1,26 @@
+.dialog.dialog-overlay-sm{layout: 'dialog', 'layout-id' => 'rsvp-submit-dialog', id: 'rsvp-submit-dialog'}
+ .content-head
+ = image_tag 'content/icon_checkmark_circle.png', :alt => "", :class => "content-icon", :width => "20", :height => "20"
+ %h1 rsvp
+ .dialog-inner
+ %h2 SESSION
+ %span.session-name
+ %br/
+ %span.scheduled-start
+ %br/
+ %span.schedule-recurrence
+ %br/
+ %br/
+ %span.slot-instructions Check the box(es) next to the track(s) you want to play in the session:
+ .rsvp-instruments
+ %br/
+ Enter a message to the other musicians in the session (optional):
+ %textarea.w95.p5.f15{id: 'txtComment', rows: '2', placeholder: 'Enter a comment...'}
+ %br/
+ %br/
+ .left
+ %a.button-orange{:href => 'TBD', :rel => 'external'} HELP
+ .right
+ %a.button-grey{:id => 'btnCancel', :href => 'TBD', 'layout-action' => 'close'} CANCEL
+ %a.button-orange{:id => 'btnSubmit', :href => 'TBD'} SUBMIT RSVP
+ %br{:clear => "all"}/
\ No newline at end of file
diff --git a/web/app/views/layouts/web.html.erb b/web/app/views/layouts/web.html.erb
index 60b500f40..b4518492c 100644
--- a/web/app/views/layouts/web.html.erb
+++ b/web/app/views/layouts/web.html.erb
@@ -83,6 +83,8 @@
<%= render "clients/hoverBand" %>
<%= render "clients/hoverSession" %>
<%= render "clients/hoverRecording" %>
+ <%= render "clients/rsvpSubmitDialog" %>
+ <%= render "clients/rsvpCancelDialog" %>
<%= yield(:extra_dialogs) %>