From 0ece384569c9d9cd9f6b2a8d9d4599a84f283d9c Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Tue, 1 Jul 2014 00:36:06 -0400 Subject: [PATCH] VRFS-1828 VRFS-1829 add date/time info to Find Session screen, fix RSVP dialog issues --- ruby/lib/jam_ruby/models/music_session.rb | 4 + .../assets/javascripts/rsvpSubmitDialog.js | 8 +- .../assets/javascripts/scheduled_session.js | 33 +--- web/app/assets/javascripts/sessionList.js | 8 +- web/app/assets/javascripts/utils.js | 24 +++ .../assets/stylesheets/client/dialog.css.scss | 2 +- .../stylesheets/client/screen_common.css.scss | 2 +- web/app/views/clients/_findSession.html.erb | 144 +++++++++--------- .../views/clients/_rsvpSubmitDialog.html.haml | 5 +- 9 files changed, 124 insertions(+), 106 deletions(-) diff --git a/ruby/lib/jam_ruby/models/music_session.rb b/ruby/lib/jam_ruby/models/music_session.rb index b8037e189..1a089a1fe 100644 --- a/ruby/lib/jam_ruby/models/music_session.rb +++ b/ruby/lib/jam_ruby/models/music_session.rb @@ -442,6 +442,10 @@ module JamRuby end end + def scheduled_end_time + + end + def timezone_description self.get_timezone.to_s end diff --git a/web/app/assets/javascripts/rsvpSubmitDialog.js b/web/app/assets/javascripts/rsvpSubmitDialog.js index 9f7ea2e59..0b37a72f9 100644 --- a/web/app/assets/javascripts/rsvpSubmitDialog.js +++ b/web/app/assets/javascripts/rsvpSubmitDialog.js @@ -20,9 +20,13 @@ .done(function(response) { if (response) { $('.session-name', $screen).html(response.name); - $('.scheduled-start', $screen).html(response.scheduled_start); - if (response.recurring_mode !== null) { + var timestamp = new Date(response.scheduled_start).toDateString() + ', ' + + context.JK.formatUtcTime(new Date(response.scheduled_start), false); + + $('.scheduled-start', $screen).html(timestamp); + + if (response.recurring_mode !== null && response.recurring_mode === 'weekly') { $('.schedule-recurrence', $screen).html("Recurs " + response.recurring_mode + " on this day at this time"); } } diff --git a/web/app/assets/javascripts/scheduled_session.js b/web/app/assets/javascripts/scheduled_session.js index b2209a014..ed35376fb 100644 --- a/web/app/assets/javascripts/scheduled_session.js +++ b/web/app/assets/javascripts/scheduled_session.js @@ -98,7 +98,8 @@ context._.each(sessionList, function (session) { session.scheduled_start = new Date(session.scheduled_start).toDateString() + ', ' + - getFormattedTime(new Date(session.scheduled_start), false); + context.JK.formatUtcTime(new Date(session.scheduled_start), false); + var options = { id: session.id, name: session.name, @@ -311,7 +312,7 @@ var moveToFinish = function() { app.layout.closeDialog('confirm'); createSessionSettings.startDate = new Date(session.scheduled_start).toDateString(); - createSessionSettings.startTime = getFormattedTime(new Date(session.scheduled_start), false); + createSessionSettings.startTime = context.JK.formatUtcTime(new Date(session.scheduled_start), false); createSessionSettings.genresValues = session.genres; createSessionSettings.genres = [session.genre_id]; createSessionSettings.timezone.label = session.timezone_description; @@ -547,7 +548,7 @@ data.legal_terms = true; data.language = createSessionSettings.language.value; if (createSessionSettings.createType == 'quick-start' || createSessionSettings.createType == 'immediately') { - data.start = new Date().toDateString() + ' ' + getFormattedTime(new Date(), false); + data.start = new Date().toDateString() + ' ' + context.JK.formatUtcTime(new Date(), false); data.duration = "30"; } else if (createSessionSettings.createType == 'rsvp') { @@ -856,30 +857,6 @@ } - function getFormattedTime(date, change) { - if (change) { - date.setMinutes(Math.ceil(date.getMinutes() / 30) * 30); - } - var h12h = date.getHours(); - var m12h = date.getMinutes(); - var ampm; - if (h12h >= 0 && h12h < 12) { - if (h12h === 0) { - h12h = 12; // 0 becomes 12 - } - ampm = "AM"; - } - else { - if (h12h > 12) { - h12h -= 12; // 13-23 becomes 1-11 - } - ampm = "PM"; - } - var timeString = ("00" + h12h).slice(-2) + ":" + ("00" + m12h).slice(-2) + " " + ampm; - - return timeString; - } - function toggleDate() { var selectedDate = new Date($('#session-start-date').val()); var currentDate = new Date(); @@ -889,7 +866,7 @@ currentDate.getMonth() == selectedDate.getMonth() && currentDate.getDate() == selectedDate.getDate()) { - var timeString = getFormattedTime(currentDate, true); + var timeString = context.JK.formatUtcTime(currentDate, true); startIndex = defaultTimeArray.indexOf(timeString); } $startTimeList.empty(); diff --git a/web/app/assets/javascripts/sessionList.js b/web/app/assets/javascripts/sessionList.js index 48e7d6032..eb9fc07b8 100644 --- a/web/app/assets/javascripts/sessionList.js +++ b/web/app/assets/javascripts/sessionList.js @@ -169,7 +169,7 @@ } } - if ( (openRsvps || hasInvitation) && openSlots && !hasApprovedRsvp && !currentUserHasRsvp ) { + if ( (openRsvps || hasInvitation) && openSlots && !hasApprovedRsvp && currentUserHasRsvp ) { showRsvpLink = true; } else { @@ -184,6 +184,12 @@ } var sessionVals = buildSessionObject(session, notationFileHtml, rsvpUsersHtml, openSlotsHtml, latencyHtml); + + // format scheduled start time + sessionVals.scheduled_start = new Date(session.scheduled_start).toDateString() + ', ' + + context.JK.formatUtcTime(new Date(session.scheduled_start), false);// + '-' + + //context.JK.formatUtcTime(new Date(session.scheduled_start + session.scheduled_duration), false); + sessionVals.rsvp_link_display_style = showRsvpLink ? "block" : "none"; var row = context.JK.fillTemplate($inactiveSessionTemplate.html(), sessionVals); diff --git a/web/app/assets/javascripts/utils.js b/web/app/assets/javascripts/utils.js index 592c06b06..7bec7aefa 100644 --- a/web/app/assets/javascripts/utils.js +++ b/web/app/assets/javascripts/utils.js @@ -520,6 +520,30 @@ return date.toLocaleTimeString(); } + context.JK.formatUtcTime = function(date, change) { + if (change) { + date.setMinutes(Math.ceil(date.getMinutes() / 30) * 30); + } + var h12h = date.getHours(); + var m12h = date.getMinutes(); + var ampm; + if (h12h >= 0 && h12h < 12) { + if (h12h === 0) { + h12h = 12; // 0 becomes 12 + } + ampm = "AM"; + } + else { + if (h12h > 12) { + h12h -= 12; // 13-23 becomes 1-11 + } + ampm = "PM"; + } + var timeString = ("00" + h12h).slice(-2) + ":" + ("00" + m12h).slice(-2) + " " + ampm; + + return timeString; + } + context.JK.prettyPrintElements = function ($elements) { $.each($elements, function (index, item) { var $item = $(item); diff --git a/web/app/assets/stylesheets/client/dialog.css.scss b/web/app/assets/stylesheets/client/dialog.css.scss index fa4c12d1a..b0ca88cb8 100644 --- a/web/app/assets/stylesheets/client/dialog.css.scss +++ b/web/app/assets/stylesheets/client/dialog.css.scss @@ -6,7 +6,7 @@ border: 1px solid $ColorScreenPrimary; color:#fff; min-width: 400px; - min-height: 450px; + min-height: 375px; z-index: 100; h2 { diff --git a/web/app/assets/stylesheets/client/screen_common.css.scss b/web/app/assets/stylesheets/client/screen_common.css.scss index 4f481ea62..aa6657686 100644 --- a/web/app/assets/stylesheets/client/screen_common.css.scss +++ b/web/app/assets/stylesheets/client/screen_common.css.scss @@ -172,7 +172,7 @@ small, .small {font-size:11px;} .bold {font-weight:bold;} .rsvp-instruments { - height:80px; + height:auto; overflow:auto; background-color:#202020; padding:8px; diff --git a/web/app/views/clients/_findSession.html.erb b/web/app/views/clients/_findSession.html.erb index 49c0110b1..170562148 100644 --- a/web/app/views/clients/_findSession.html.erb +++ b/web/app/views/clients/_findSession.html.erb @@ -1,78 +1,78 @@
-
-
-
- <%= image_tag "content/icon_search.png", :size => "19x19" %> -
+
+
+
+ <%= image_tag "content/icon_search.png", :size => "19x19" %> +
-

find a session

+

find a session

- <%= render "screen_navigation" %> -
-
-
-
-
-
-
Filter Session List:
- - -
- <%= render "genreSelector" %> -
- - - - - -
- -
- - - - -
- REFRESH -
-
-
-
-
-
- <%= render :partial => "sessionList", :locals => {:title => "current, active sessions", :category => "sessions-active"} %> -
-
- No active public sessions found. -
-
-
- <%= render :partial => "sessionList", :locals => {:title => "future, scheduled sessions", :category => "sessions-scheduled"} %> -
-
- No scheduled sessions found. -
-
- Next -
-
-
- -
- No more sessions. -
-
-
+ <%= render "screen_navigation" %>
+
+
+
+
+
+
Filter Session List:
+ + +
+ <%= render "genreSelector" %> +
+ + + + + +
+ +
+ + + + +
+ REFRESH +
+
+
+
+
+
+ <%= render :partial => "sessionList", :locals => {:title => "current, active sessions", :category => "sessions-active"} %> +
+
+ No active public sessions found. +
+
+
+ <%= render :partial => "sessionList", :locals => {:title => "future, scheduled sessions", :category => "sessions-scheduled"} %> +
+
+ No scheduled sessions found. +
+
+ Next +
+
+
+ +
+ No more sessions. +
+
+
+
@@ -160,6 +160,9 @@ Notation Files: {notation_files} + + {scheduled_start} + @@ -243,4 +246,5 @@ {latency_text} +
 
diff --git a/web/app/views/clients/_rsvpSubmitDialog.html.haml b/web/app/views/clients/_rsvpSubmitDialog.html.haml index 319313bc9..ee7ac355c 100644 --- a/web/app/views/clients/_rsvpSubmitDialog.html.haml +++ b/web/app/views/clients/_rsvpSubmitDialog.html.haml @@ -20,8 +20,7 @@ %br/ %br/ .left - %a.button-orange{:href => 'TBD', :rel => 'external', :target => '_blank'} HELP + %a.button-grey{:href => 'TBD', :rel => 'external', :target => '_blank'} HELP .right %a.button-grey{:id => 'btnCancel', 'layout-action' => 'close'} CANCEL - %a.button-orange{:id => 'btnSubmitRsvp'} SUBMIT RSVP - %br{:clear => "all"}/ \ No newline at end of file + %a.button-orange{:id => 'btnSubmitRsvp'} SUBMIT RSVP \ No newline at end of file