Fix Add Show button bug and update styling
This commit is contained in:
parent
a9cddde877
commit
6d883d2fa4
4 changed files with 138 additions and 121 deletions
|
@ -31,24 +31,26 @@ function openAddShowForm() {
|
|||
}
|
||||
}
|
||||
|
||||
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 makeAddShowButton() {
|
||||
if($('.add-button').length === 0) {
|
||||
$('.fc-header-left')
|
||||
.append('<span class="fc-header-space"></span>')
|
||||
.append('<span class="fc-button">' +
|
||||
'<button onclick="showForm()" class="add-button">' +
|
||||
'<span class="add-icon"></span>' + $.i18n._("Create New Show") +
|
||||
'</button>' +
|
||||
'</span>');
|
||||
}
|
||||
}
|
||||
|
||||
function removeAddShowButton(){
|
||||
var aTag = $('.fc-header-left')
|
||||
.find("span.fc-button:last > a");
|
||||
function showForm() {
|
||||
openAddShowForm();
|
||||
toggleAddShowButton();
|
||||
}
|
||||
|
||||
var span = aTag.parent();
|
||||
span.prev().remove();
|
||||
span.remove();
|
||||
function toggleAddShowButton(){
|
||||
var aTag = $('.add-button');
|
||||
aTag.prop('disabled', function(i, v) { return !v; });
|
||||
}
|
||||
|
||||
//$el is DOM element #add-show-form
|
||||
|
@ -79,11 +81,11 @@ function closeAddShowForm(event) {
|
|||
windowResize();
|
||||
|
||||
$.get(baseUrl+"Schedule/get-form", {format:"json"}, function(json) {
|
||||
|
||||
|
||||
redrawAddShowForm($el, json.form);
|
||||
});
|
||||
|
||||
makeAddShowButton();
|
||||
toggleAddShowButton();
|
||||
}
|
||||
|
||||
//dateText mm-dd-yy
|
||||
|
@ -162,7 +164,7 @@ function beginEditShow(data){
|
|||
}
|
||||
|
||||
redrawAddShowForm($("#add-show-form"), data.newForm);
|
||||
removeAddShowButton();
|
||||
toggleAddShowButton();
|
||||
openAddShowForm();
|
||||
}
|
||||
|
||||
|
@ -777,20 +779,20 @@ function setAddShowEvents(form) {
|
|||
.fullCalendar('render');
|
||||
|
||||
$addShowForm.hide();
|
||||
toggleAddShowButton();
|
||||
$.get(baseUrl+"Schedule/get-form", {format:"json"}, function(json){
|
||||
redrawAddShowForm($addShowForm, json.form);
|
||||
});
|
||||
makeAddShowButton();
|
||||
} else {
|
||||
redrawAddShowForm($addShowForm, json.newForm);
|
||||
scheduleRefetchEvents(json);
|
||||
$addShowForm.hide();
|
||||
toggleAddShowButton();
|
||||
}
|
||||
|
||||
/* CC-6062: Resize the window to avoid stretching the last column */
|
||||
windowResize();
|
||||
makeAddShowButton();
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue