From 14c9a5b469023a4b680803248defd3aeb6222b39 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Sun, 5 Oct 2014 22:12:50 -0400 Subject: [PATCH] VRFS-2278 show tooltip for instrument icons on Find Session and Session Detail screens, show user friendly error when unable to approve RSVP --- ruby/lib/jam_ruby/models/rsvp_request.rb | 2 +- .../javascripts/accounts_session_detail.js | 24 +++++++++++++++---- web/app/assets/javascripts/findSession.js | 3 +++ web/app/assets/javascripts/jamkazam.js | 4 ++-- web/app/assets/javascripts/sessionList.js | 4 ++-- web/app/assets/javascripts/utils.js | 3 +++ 6 files changed, 30 insertions(+), 10 deletions(-) diff --git a/ruby/lib/jam_ruby/models/rsvp_request.rb b/ruby/lib/jam_ruby/models/rsvp_request.rb index 689aad72e..f30851efe 100644 --- a/ruby/lib/jam_ruby/models/rsvp_request.rb +++ b/ruby/lib/jam_ruby/models/rsvp_request.rb @@ -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] diff --git a/web/app/assets/javascripts/accounts_session_detail.js b/web/app/assets/javascripts/accounts_session_detail.js index c43a8b537..a93d0b1c7 100644 --- a/web/app/assets/javascripts/accounts_session_detail.js +++ b/web/app/assets/javascripts/accounts_session_detail.js @@ -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 += ' '; + instrumentLogoHtml += ' '; }) } @@ -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 += ' '; + instrumentLogoHtml += ' '; }); } @@ -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'} ); }); diff --git a/web/app/assets/javascripts/findSession.js b/web/app/assets/javascripts/findSession.js index df765fb3a..98db4761f 100644 --- a/web/app/assets/javascripts/findSession.js +++ b/web/app/assets/javascripts/findSession.js @@ -85,6 +85,9 @@ context.JK.bindHoverEvents(); $ssSpinner.hide(); }); + + // context.JK.bindInstrumentHover($(CATEGORY.ACTIVE.id)); + // context.JK.bindInstrumentHover($(CATEGORY.SCHEDULED.id)); } /***************** ACTIVE SESSIONS *****************/ diff --git a/web/app/assets/javascripts/jamkazam.js b/web/app/assets/javascripts/jamkazam.js index 08d79d34a..d8fb6e4aa 100644 --- a/web/app/assets/javascripts/jamkazam.js +++ b/web/app/assets/javascripts/jamkazam.js @@ -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 { diff --git a/web/app/assets/javascripts/sessionList.js b/web/app/assets/javascripts/sessionList.js index 06d26efa6..d58218dbf 100644 --- a/web/app/assets/javascripts/sessionList.js +++ b/web/app/assets/javascripts/sessionList.js @@ -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 += ' '; + instrumentLogoHtml += ' '; } 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 += ' '; + instrumentLogoHtml += ' '; } } diff --git a/web/app/assets/javascripts/utils.js b/web/app/assets/javascripts/utils.js index b83d901c7..2afdd2f53 100644 --- a/web/app/assets/javascripts/utils.js +++ b/web/app/assets/javascripts/utils.js @@ -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 {