From b6c26a583b5a477da9bd6264e8596f3cad7c6cec Mon Sep 17 00:00:00 2001 From: Naomi Date: Thu, 10 Feb 2011 11:28:56 -0500 Subject: [PATCH] only have add show button on full calendar when the add show form isn't displayed. --- public/js/airtime/schedule/add-show.js | 3 +++ .../schedule/full-calendar-functions.js | 27 +++++++++++-------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/public/js/airtime/schedule/add-show.js b/public/js/airtime/schedule/add-show.js index d0fb0e2b2..0afe6f753 100644 --- a/public/js/airtime/schedule/add-show.js +++ b/public/js/airtime/schedule/add-show.js @@ -123,6 +123,9 @@ function setAddShowEvents() { $("#schedule_calendar").width(y+z+50); $("#schedule_calendar").fullCalendar('render'); $("#add-show-form").hide(); + + //in full-calendar-functions.js + makeAddShowButton(); }); $("#add-show-submit") diff --git a/public/js/airtime/schedule/full-calendar-functions.js b/public/js/airtime/schedule/full-calendar-functions.js index d5e0e5926..c547602a0 100644 --- a/public/js/airtime/schedule/full-calendar-functions.js +++ b/public/js/airtime/schedule/full-calendar-functions.js @@ -4,6 +4,21 @@ * */ +function makeAddShowButton(){ + $('.fc-header-left tbody tr:first') + .append('') + .append('Show') + .find('td:last > a') + .click(function(){ + $("#add-show-form").show(); + var y = $("#schedule_calendar").width(); + var z = $("#schedule-add-show").width(); + $("#schedule_calendar").width(y-z-50); + $("#schedule_calendar").fullCalendar('render'); + $(this).remove(); + }); +} + function makeTimeStamp(date){ var sy, sm, sd, h, m, s, timestamp; sy = date.getFullYear(); @@ -54,17 +69,7 @@ function viewDisplay( view ) { } if($("#add-show-form").length == 1 && $('.fc-header-left tbody td').length === 5) { - $('.fc-header-left tbody tr:first') - .append('') - .append('Show') - .find('td:last > a') - .click(function(){ - $("#add-show-form").show(); - var y = $("#schedule_calendar").width(); - var z = $("#schedule-add-show").width(); - $("#schedule_calendar").width(y-z-50); - $("#schedule_calendar").fullCalendar('render'); - }); + makeAddShowButton(); } }