VRFS-1577 VRFS-736
This commit is contained in:
parent
1af868dd60
commit
968dff2829
|
|
@ -0,0 +1,69 @@
|
|||
(function(context,$) {
|
||||
|
||||
"use strict";
|
||||
|
||||
context.JK = context.JK || {};
|
||||
context.JK.RateSessionDialog = function(app, finishedCallback) {
|
||||
var logger = context.JK.logger;
|
||||
var dialogId = 'rate-session-dialog';
|
||||
var $scopeSelector = "[layout-id='rate-session-dialog']";
|
||||
|
||||
function showDialog() {
|
||||
app.layout.showDialog(dialogId);
|
||||
return true; // false if should not show dialog
|
||||
}
|
||||
|
||||
function closeDialog() {
|
||||
app.layout.closeDialog(dialogId);
|
||||
if (finishedCallback) {
|
||||
setTimeout(finishedCallback, 100);
|
||||
}
|
||||
}
|
||||
|
||||
function events() {
|
||||
$('#btn-rate-session-cancel', $scopeSelector).click(function(evt) {
|
||||
closeDialog();
|
||||
});
|
||||
$('#btn-rate-session-up', $scopeSelector).click(function(evt) {
|
||||
$(this).hasClass('selected') ? $(this).removeClass('selected') : $(this).addClass('selected');
|
||||
if ($('#btn-rate-session-down').hasClass('selected')) {
|
||||
$('#btn-rate-session-down').removeClass('selected')
|
||||
}
|
||||
});
|
||||
$('#btn-rate-session-down', $scopeSelector).click(function(evt) {
|
||||
$(this).hasClass('selected') ? $(this).removeClass('selected') : $(this).addClass('selected');
|
||||
if ($('#btn-rate-session-up').hasClass('selected')) {
|
||||
$('#btn-rate-session-up').removeClass('selected')
|
||||
}
|
||||
});
|
||||
$('#btn-rate-session-send', $scopeSelector).click(function(evt) {
|
||||
var url = "/api/participant_histories/"+context.JK.JamServer.clientID+"/rating";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url
|
||||
}).done(function (response) {
|
||||
closeDialog();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function beforeShow(data) {
|
||||
// confirm user should see dialog
|
||||
}
|
||||
|
||||
function afterShow(data) {
|
||||
}
|
||||
|
||||
function initialize() {
|
||||
var dialogBindings = {
|
||||
'beforeShow' : beforeShow,
|
||||
'afterShow' : afterShow
|
||||
};
|
||||
app.bindDialog(dialogId, dialogBindings);
|
||||
events();
|
||||
}
|
||||
|
||||
this.initialize = initialize;
|
||||
this.showDialog = showDialog;
|
||||
};
|
||||
})(window,jQuery);
|
||||
|
|
@ -1307,14 +1307,24 @@
|
|||
|
||||
function sessionLeave(evt) {
|
||||
evt.preventDefault();
|
||||
|
||||
promptLeave = false;
|
||||
app.layout.showDialog('leavingSession');
|
||||
//context.window.location = '/client#/home';
|
||||
|
||||
rateSession();
|
||||
return false;
|
||||
}
|
||||
|
||||
function bailOut() {
|
||||
promptLeave = false;
|
||||
context.window.location = '/client#/home';
|
||||
}
|
||||
|
||||
function rateSession() {
|
||||
var dialog = new context.JK.RateSessionDialog(context.JK.app, bailOut);
|
||||
dialog.initialize();
|
||||
if (dialog.showDialog() === false) {
|
||||
bailOut();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function sessionResync(evt) {
|
||||
evt.preventDefault();
|
||||
var response = context.jamClient.SessionAudioResync();
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ class ApiMusicSessionsController < ApiController
|
|||
end
|
||||
|
||||
def participant_rating
|
||||
if @history = MusicSessionUserHistory.find(params[:id])
|
||||
if @history = MusicSessionUserHistory.find_by_client_id(params[:client_id])
|
||||
@history.add_rating(params[:rating])
|
||||
@history.save
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
<div class="dialog" layout="dialog" layout-id="leavingSession" id="leaving-session-dialog">
|
||||
<div class="dialog" layout="dialog" layout-id="rate-session-dialog" id="rate-session-dialog">
|
||||
<div class="dialog-overlay-sm">
|
||||
<!-- dialog header -->
|
||||
<div class="content-head">
|
||||
<img src="images/content/icon_session.png" width="19" height="19" class="content-icon"><h1>please rate your session</h1>
|
||||
<img src="images/shared/icon_session.png" width="19" height="19" class="content-icon"><h1>please rate your session</h1>
|
||||
</div>
|
||||
<div class="dialog-inner">
|
||||
<div class="center">
|
||||
<a class="rate-thumbsup" href="javascript:void(0)"></a> <a href="javascript:void(0)" class="rate-thumbsdown"></a>
|
||||
<a id="btn-rate-session-up" class="rate-thumbsup" href="javascript:void(0)"></a> <a id="btn-rate-session-down" href="javascript:void(0)" class="rate-thumbsdown"></a>
|
||||
<br clear="left"><br>
|
||||
<textarea class="w80" rows="3">Tell us more about what you liked or didn't like...</textarea>
|
||||
<br><br>
|
||||
<a href="#" class="button-orange">SEND FEEDBACK</a> <a href="#" class="button-grey">NOT NOW, THANKS</a>
|
||||
<a id="btn-rate-session-send" href="#" class="button-orange">SEND FEEDBACK</a> <a id="btn-rate-session-cancel" href="#" class="button-grey">NOT NOW, THANKS</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end inner -->
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
<%= render "clients/gear/gear_wizard" %>
|
||||
<%= render "terms" %>
|
||||
<%= render "leaveSessionWarning" %>
|
||||
<%= render "rateSession" %>
|
||||
<%= render "alert" %>
|
||||
<%= render "sidebar" %>
|
||||
<%= render "createSession" %>
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ SampleApp::Application.routes.draw do
|
|||
match '/sessions/:id/claimed_recording/:claimed_recording_id/start' => 'api_music_sessions#claimed_recording_start', :via => :post
|
||||
match '/sessions/:id/claimed_recording/:claimed_recording_id/stop' => 'api_music_sessions#claimed_recording_stop', :via => :post
|
||||
|
||||
match '/participant_histories/:id/rating' => 'api_music_sessions#participant_rating', :via => :post
|
||||
match '/participant_histories/:client_id/rating' => 'api_music_sessions#participant_rating', :via => :post
|
||||
|
||||
# genres
|
||||
match '/genres' => 'api_genres#index', :via => :get
|
||||
|
|
|
|||
Loading…
Reference in New Issue