2014-04-25 05:56:24 +00:00
|
|
|
(function(context,$) {
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
context.JK = context.JK || {};
|
|
|
|
|
|
|
|
|
|
context.JK.UIHelper = function(app) {
|
|
|
|
|
var logger = context.JK.logger;
|
|
|
|
|
var rest = new context.JK.Rest();
|
2015-02-02 00:14:39 +00:00
|
|
|
var sessionUtils = context.JK.SessionUtils;
|
2014-04-25 05:56:24 +00:00
|
|
|
|
|
|
|
|
function addSessionLike(sessionId, userId, $likeCountSelector, $likeButtonSelector) {
|
|
|
|
|
rest.addSessionLike(sessionId, userId)
|
|
|
|
|
.done(function(response) {
|
|
|
|
|
$likeCountSelector.html(parseInt($likeCountSelector.text()) + 1);
|
|
|
|
|
$likeButtonSelector.unbind("click");
|
|
|
|
|
});
|
2014-04-27 08:09:55 +00:00
|
|
|
}
|
2014-04-25 05:56:24 +00:00
|
|
|
|
|
|
|
|
function addRecordingLike(recordingId, claimedRecordingId, userId, $likeCountSelector, $likeButtonSelector) {
|
|
|
|
|
rest.addRecordingLike(recordingId, claimedRecordingId, userId)
|
|
|
|
|
.done(function(response) {
|
|
|
|
|
$likeCountSelector.html(parseInt($likeCountSelector.text()) + 1);
|
|
|
|
|
$likeButtonSelector.unbind("click");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-27 08:09:55 +00:00
|
|
|
function launchCommentDialog(options) {
|
|
|
|
|
var commentDialog = new JK.CommentDialog(JK.app, options);
|
|
|
|
|
commentDialog.initialize();
|
2014-06-27 19:17:56 +00:00
|
|
|
return commentDialog.showDialog();
|
2014-04-27 08:09:55 +00:00
|
|
|
}
|
2014-04-25 05:56:24 +00:00
|
|
|
|
|
|
|
|
function launchShareDialog(entityId, entityType) {
|
2014-04-26 18:21:17 +00:00
|
|
|
var shareDialog = new JK.ShareDialog(JK.app, entityId, entityType);
|
|
|
|
|
shareDialog.initialize(JK.FacebookHelperInstance);
|
2014-06-27 19:17:56 +00:00
|
|
|
return shareDialog.showDialog();
|
2014-04-27 08:09:55 +00:00
|
|
|
}
|
2014-04-25 05:56:24 +00:00
|
|
|
|
2014-05-28 05:14:14 +00:00
|
|
|
function launchRsvpSubmitDialog(sessionId) {
|
|
|
|
|
var rsvpDialog = new JK.RsvpSubmitDialog(JK.app, sessionId);
|
|
|
|
|
rsvpDialog.initialize();
|
2014-06-27 19:17:56 +00:00
|
|
|
return rsvpDialog.showDialog();
|
2014-05-28 05:14:14 +00:00
|
|
|
}
|
|
|
|
|
|
2014-05-29 06:33:37 +00:00
|
|
|
function launchRsvpCancelDialog(sessionId, rsvpRequestId) {
|
|
|
|
|
var rsvpDialog = new JK.RsvpCancelDialog(JK.app, sessionId, rsvpRequestId);
|
2014-05-28 05:14:14 +00:00
|
|
|
rsvpDialog.initialize();
|
2014-06-27 19:17:56 +00:00
|
|
|
return rsvpDialog.showDialog();
|
2014-05-28 05:14:14 +00:00
|
|
|
}
|
|
|
|
|
|
2014-10-26 02:23:52 +00:00
|
|
|
function launchRsvpCreateSlotDialog(sessionId, instrumentIds, rsvpRequesterName, createSlotsCallback) {
|
|
|
|
|
var rsvpDialog = new JK.RsvpCreateSlotDialog(JK.app, sessionId, instrumentIds, rsvpRequesterName, createSlotsCallback);
|
|
|
|
|
rsvpDialog.initialize();
|
|
|
|
|
return rsvpDialog.showDialog();
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-08 04:18:07 +00:00
|
|
|
function launchSessionStartDialog(session) {
|
2015-02-02 00:14:39 +00:00
|
|
|
sessionUtils.ensureValidClient(app, context.JK.GearUtils, function() {
|
|
|
|
|
var sessionStartDialog = new JK.SessionStartDialog(JK.app, session);
|
|
|
|
|
sessionStartDialog.initialize();
|
|
|
|
|
return sessionStartDialog.showDialog();
|
|
|
|
|
});
|
2015-01-08 04:18:07 +00:00
|
|
|
}
|
|
|
|
|
|
2014-04-25 05:56:24 +00:00
|
|
|
this.addSessionLike = addSessionLike;
|
|
|
|
|
this.addRecordingLike = addRecordingLike;
|
|
|
|
|
this.launchCommentDialog = launchCommentDialog;
|
|
|
|
|
this.launchShareDialog = launchShareDialog;
|
2014-05-28 05:14:14 +00:00
|
|
|
this.launchRsvpSubmitDialog = launchRsvpSubmitDialog;
|
|
|
|
|
this.launchRsvpCancelDialog = launchRsvpCancelDialog;
|
2014-10-26 02:23:52 +00:00
|
|
|
this.launchRsvpCreateSlotDialog = launchRsvpCreateSlotDialog;
|
2015-01-08 04:18:07 +00:00
|
|
|
this.launchSessionStartDialog = launchSessionStartDialog;
|
2014-04-25 05:56:24 +00:00
|
|
|
|
|
|
|
|
return this;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
})(window,jQuery);
|