CC-5404 : colorpickers littering DOM
This commit is contained in:
parent
22d5df866c
commit
7f5e2bdefa
2 changed files with 96 additions and 99 deletions
|
@ -19,77 +19,6 @@ function scheduleRefetchEvents(json) {
|
|||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||
}
|
||||
|
||||
function openAddShowForm() {
|
||||
if($("#add-show-form").length == 1) {
|
||||
if( ($("#add-show-form").css('display')=='none')) {
|
||||
$("#add-show-form").show();
|
||||
var windowWidth = $(window).width();
|
||||
// margin on showform are 16 px on each side
|
||||
var calendarWidth = 100-(($("#schedule-add-show").width() + (16 * 4))/windowWidth*100);
|
||||
var widthPercent = parseInt(calendarWidth)+"%";
|
||||
$("#schedule_calendar").css("width", widthPercent);
|
||||
|
||||
// 200 px for top dashboard and 50 for padding on main content
|
||||
// this calculation was copied from schedule.js line 326
|
||||
var mainHeight = document.documentElement.clientHeight - 200 - 50;
|
||||
$('#schedule_calendar').fullCalendar('option', 'contentHeight', mainHeight);
|
||||
}
|
||||
$("#schedule-show-what").show(0, function(){
|
||||
$add_show_name = $("#add_show_name");
|
||||
$add_show_name.focus();
|
||||
$add_show_name.select();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function closeAddShowForm(event) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
||||
var $el = $("#add-show-form");
|
||||
|
||||
$el.hide();
|
||||
windowResize();
|
||||
|
||||
$.get(baseUrl+"Schedule/get-form", {format:"json"}, function(json) {
|
||||
|
||||
//need to clean up the color picker.
|
||||
$el.find("#schedule-show-style input").each(function(i, el){
|
||||
var $input = $(this),
|
||||
colId = $input.data("colorpickerId");
|
||||
|
||||
$("#"+colId).remove();
|
||||
$input.removeData();
|
||||
});
|
||||
|
||||
$el.empty().append(json.form);
|
||||
|
||||
setAddShowEvents();
|
||||
});
|
||||
|
||||
makeAddShowButton();
|
||||
}
|
||||
|
||||
function makeAddShowButton(){
|
||||
$('.fc-header-left')
|
||||
.append('<span class="fc-header-space"></span>')
|
||||
.append('<span class="fc-button"><a href="#" class="add-button"><span class="add-icon"></span>'+$.i18n._("Show")+'</a></span>')
|
||||
.find('span.fc-button:last > a')
|
||||
.click(function(){
|
||||
openAddShowForm();
|
||||
removeAddShowButton();
|
||||
});
|
||||
}
|
||||
|
||||
function removeAddShowButton(){
|
||||
var aTag = $('.fc-header-left')
|
||||
.find("span.fc-button:last > a");
|
||||
|
||||
var span = aTag.parent();
|
||||
span.prev().remove();
|
||||
span.remove();
|
||||
}
|
||||
|
||||
function makeTimeStamp(date){
|
||||
var sy, sm, sd, h, m, s, timestamp;
|
||||
sy = date.getFullYear();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue