VRFS-2278 show tooltip for instrument icons on Find Session and Session Detail screens, show user friendly error when unable to approve RSVP

This commit is contained in:
Brian Smith 2014-10-05 22:12:50 -04:00
parent 49170d31a0
commit 14c9a5b469
6 changed files with 30 additions and 10 deletions

View File

@ -182,7 +182,7 @@ module JamRuby
end
if rsvp_slot.chosen && r[:accept]
raise StateError, "The #{rsvp_slot.instrument_id} slot has already been approved for another user."
raise StateError, "All RSVP slots for the #{rsvp_slot.instrument_id} have been already approved."
end
if r[:accept]

View File

@ -101,7 +101,18 @@
rest.updateRsvpRequest(rsvpId, params)
.done(refreshSessionDetail)
.fail(app.ajaxError);
.fail(function(jqXHR, textStatus, errorMessage) {
if (jqXHR.status === 400) {
app.notify(
{
title: "Unable to Approve RSVP",
text: jqXHR.responseJSON.message
});
}
else {
app.ajaxError(jqXHR, textStatus, errorMessage);
}
});
}
function declineRsvpRequest(e) {
@ -132,6 +143,9 @@
});
context.JK.bindHoverEvents();
// context.JK.bindInstrumentHover($('#pendingRSVPs'));
// context.JK.bindInstrumentHover($('#session-rsvps'));
// context.JK.bindInstrumentHover($('#still-needed'));
}
function loadSessionData() {
@ -243,7 +257,7 @@
$.each(pending_rsvp_request.instrument_list, function (index, instrument) {
var instrumentId = instrument == null ? null : instrument.id;
var inst = context.JK.getInstrumentIcon24(instrumentId);
instrumentLogoHtml += '<img data-instrument-id="' + instrumentId + '" src="' + inst + '" width="24" height="24" />&nbsp;';
instrumentLogoHtml += '<img title="' + instrumentId + '" hoveraction="instrument" data-instrument-id="' + instrumentId + '" src="' + inst + '" width="24" height="24" />&nbsp;';
})
}
@ -281,7 +295,7 @@
$.each(approved_rsvp.instrument_list, function(index, instrument) {
var instrumentId = instrument == null ? null : instrument.id;
var inst = context.JK.getInstrumentIcon24(instrumentId);
instrumentLogoHtml += '<img src="' + inst + '" width="24" height="24" />&nbsp;';
instrumentLogoHtml += '<img title="' + instrumentId + '" hoveraction="instrument" data-instrument-id="' + instrumentId + '" src="' + inst + '" width="24" height="24" />&nbsp;';
});
}
@ -312,7 +326,7 @@
rsvpHtml = context._.template(
$("#template-account-session-rsvp").html(),
{id: approved_rsvp.id, user_id: approved_rsvp.user_id, avatar_url: avatar_url,
{id: approved_rsvp.id, avatar_url: avatar_url,
user_name: approved_rsvp.name, instruments: instrumentLogoHtml,
latency: latencyHtml, is_owner: sessionData.isOwner, request_id: request_id},
{variable: 'data'}
@ -346,7 +360,7 @@
resultHtml += context._.template(
$("#template-account-invited").html(),
{avatar_url: avatar_url, user_id: invitation.reciever_id},
{avatar_url: avatar_url, user_id: invitation.receiver_id},
{variable: 'data'}
);
});

View File

@ -85,6 +85,9 @@
context.JK.bindHoverEvents();
$ssSpinner.hide();
});
// context.JK.bindInstrumentHover($(CATEGORY.ACTIVE.id));
// context.JK.bindInstrumentHover($(CATEGORY.SCHEDULED.id));
}
/***************** ACTIVE SESSIONS *****************/

View File

@ -123,11 +123,11 @@
*/
function ajaxError(jqXHR, textStatus, errorMessage) {
if (jqXHR.status == 404) {
if (jqXHR.status === 404) {
logger.error("Unexpected ajax error: " + textStatus + ", msg:" + errorMessage);
app.notify({title: "Oops!", text: "What you were looking for is gone now."});
}
else if (jqXHR.status = 422) {
else if (jqXHR.status === 422) {
logger.error("Unexpected ajax error: " + textStatus + ", msg: " + errorMessage + ", response: " + jqXHR.responseText);
// present a nicer message
try {

View File

@ -369,7 +369,7 @@
var track = participant.tracks[j];
logger.debug("Find:Finding instruments. Participant tracks:", participant.tracks);
var inst = context.JK.getInstrumentIcon24(track.instrument_id);
instrumentLogoHtml += '<img src="' + inst + '" width="24" height="24" />&nbsp;';
instrumentLogoHtml += '<img title="' + track.instrument_id + '" hoveraction="instrument" data-instrument-id="' + track.instrument_id + '" src="' + inst + '" width="24" height="24" />&nbsp;';
}
var id = participant.user.id;
@ -400,7 +400,7 @@
for (j=0; j < user.instrument_list.length; j++) {
var instrument = user.instrument_list[j];
var inst = context.JK.getInstrumentIcon24(instrument.id);
instrumentLogoHtml += '<img src="' + inst + '" width="24" height="24" />&nbsp;';
instrumentLogoHtml += '<img title="' + instrument.id + '" hoveraction="instrument" data-instrument-id="' + instrument.id + '" src="' + inst + '" width="24" height="24" />&nbsp;';
}
}

View File

@ -239,6 +239,9 @@
var instrumentId = $element.attr('data-instrument-id');
if(instrumentId) {
if (instrumentId === "null") {
instrumentId = "not specified";
}
context.JK.hoverBubble($element, instrumentId, options);
}
else {