From 5c401cb472ea3ff3f497d1dc3272338c9cf4218f Mon Sep 17 00:00:00 2001 From: James Date: Wed, 25 Apr 2012 16:04:36 -0400 Subject: [PATCH] CC-3671: add show on week/day view doesn't get start time/end time filled in - fixed - moved pad function into common.js --- .../public/js/airtime/common/common.js | 9 +++++++ .../public/js/airtime/schedule/add-show.js | 9 ------- .../schedule/full-calendar-functions.js | 24 ++----------------- 3 files changed, 11 insertions(+), 31 deletions(-) diff --git a/airtime_mvc/public/js/airtime/common/common.js b/airtime_mvc/public/js/airtime/common/common.js index 81af8b06d..e6b62f89a 100644 --- a/airtime_mvc/public/js/airtime/common/common.js +++ b/airtime_mvc/public/js/airtime/common/common.js @@ -82,4 +82,13 @@ function openPreviewWindow(url) { //var elemID = "spl_"+elemIndexString; //$('#'+elemID+' div.list-item-container a span').attr("class", "ui-icon ui-icon-pause"); return false; +} + +function pad(number, length) { + var str = '' + number; + while (str.length < length) { + str = '0' + str; + } + + return str; } \ No newline at end of file diff --git a/airtime_mvc/public/js/airtime/schedule/add-show.js b/airtime_mvc/public/js/airtime/schedule/add-show.js index e33b6fbea..212ae7dec 100644 --- a/airtime_mvc/public/js/airtime/schedule/add-show.js +++ b/airtime_mvc/public/js/airtime/schedule/add-show.js @@ -447,15 +447,6 @@ function setAddShowEvents() { } $('#add_show_duration').val(duration); } - - function pad(number, length) { - var str = '' + number; - while (str.length < length) { - str = '0' + str; - } - - return str; - } } function showErrorSections() { diff --git a/airtime_mvc/public/js/airtime/schedule/full-calendar-functions.js b/airtime_mvc/public/js/airtime/schedule/full-calendar-functions.js index 7e5f8b53a..1129bd020 100644 --- a/airtime_mvc/public/js/airtime/schedule/full-calendar-functions.js +++ b/airtime_mvc/public/js/airtime/schedule/full-calendar-functions.js @@ -58,17 +58,6 @@ function removeAddShowButton(){ span.remove(); } -function pad(number, length) { - - var str = '' + number; - while (str.length < length) { - str = '0' + str; - } - - return str; - -} - function makeTimeStamp(date){ var sy, sm, sd, h, m, s, timestamp; sy = date.getFullYear(); @@ -82,15 +71,6 @@ function makeTimeStamp(date){ return timestamp; } -function pad(number, length) { - var str = '' + number; - while (str.length < length) { - str = '0' + str; - } - - return str; -} - function dayClick(date, allDay, jsEvent, view){ // The show from will be preloaded if the user is admin or program manager. // Hence, if the user if DJ then it won't open anything. @@ -141,7 +121,7 @@ function dayClick(date, allDay, jsEvent, view){ }else{ // if in day or week view, selected has all the time info as well // so we don't ahve to calculate it explicitly - startTime_string = selected.getHours()+":"+selected.getMinutes() + startTime_string = pad(selected.getHours(),2)+":"+pad(selected.getMinutes(),2) startTime = 0 } @@ -155,7 +135,7 @@ function dayClick(date, allDay, jsEvent, view){ $("#add_show_end_date_no_repeat").val(endDateFormat); $("#add_show_end_date").val(endDateFormat); if(view.name !== "month") { - var endTimeString = endDateTime.getHours()+":"+endDateTime.getMinutes(); + var endTimeString = pad(endDateTime.getHours(),2)+":"+pad(endDateTime.getMinutes(),2); $("#add_show_start_time").val(startTime_string) $("#add_show_end_time").val(endTimeString) }