Skip to content

Commit

Permalink
fix: prevent missing view error on toggling popup options (fix #699) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Dohyung Ahn authored Feb 17, 2022
1 parent d5483ec commit f172f3a
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 45 deletions.
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"jsdoc": "^3.5.5",
"karma": "^6.3.14",
"karma-chrome-launcher": "^2.2.0",
"karma-cli": "^1.0.1",
"karma-cli": "^2.0.0",
"karma-coverage": "^2.0.3",
"karma-fixture": "^0.2.6",
"karma-html2js-preprocessor": "^1.1.0",
Expand Down
14 changes: 0 additions & 14 deletions src/css/weekday.styl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
margin-left: 2px

+prefix-classes(weekday)
.container,
.grid,
.grid-line
height: 100%
Expand All @@ -38,11 +37,6 @@
.border
border-top: 1px solid #ddd

.container
position: relative
&>div
height: 100%

.grid-line
position: absolute
padding: 3px
Expand All @@ -57,10 +51,6 @@
line-height: 27px
text-align: center

.grid-date-title
line-height: 27px
margin-right: 5px

.grid-more-schedules
float: right
display: inline-block
Expand All @@ -85,10 +75,6 @@
font-size: 12px
overflow-y: scroll

.schedules-height-span
width: 1px
margin-left: -1px

.schedule-block
position: absolute

Expand Down
2 changes: 1 addition & 1 deletion src/js/common/floatingLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var config = require('../config'),
* @constructor
* @extends {View}
* @param {object} options - options for floating layer module
* @param {HTMLElement} container - parent continer for floating layer
* @param {HTMLElement} container - parent container for floating layer
*/
function FloatingLayer(options, container) {
var sibling = container[FloatingLayer.PROP_KEY],
Expand Down
8 changes: 4 additions & 4 deletions src/js/factory/monthView.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function createMonthView(baseController, layoutContainer, dragHandler, options)

// binding popup for schedule detail
if (options.useDetailPopup) {
detailView = new ScheduleDetailPopup(layoutContainer, baseController.calendars);
detailView = new ScheduleDetailPopup(layoutContainer);
onShowDetailPopup = function(eventData) {
var scheduleId = eventData.schedule.calendarId;
eventData.calendar = common.find(baseController.calendars, function(calendar) {
Expand Down Expand Up @@ -209,19 +209,19 @@ function createMonthView(baseController, layoutContainer, dragHandler, options)
});
});

if (options.useCreationPopup && options.useDetailPopup) {
if (options.useCreationPopup && options.useDetailPopup && createView && detailView) {
createView.off('beforeUpdateSchedule', onUpdateSchedule);
}

if (options.useCreationPopup) {
if (options.useCreationPopup && createView) {
if (creationHandler) {
creationHandler.off('beforeCreateSchedule', onShowCreationPopup);
}
createView.off('saveSchedule', onSaveNewSchedule);
createView.destroy();
}

if (options.useDetailPopup) {
if (options.useDetailPopup && detailView) {
clickHandler.off('clickSchedule', onShowDetailPopup);
detailView.off('beforeUpdateSchedule', onUpdateSchedule);
detailView.off('beforeDeleteSchedule', onDeleteSchedule);
Expand Down
6 changes: 3 additions & 3 deletions src/js/factory/weekView.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ module.exports = function(baseController, layoutContainer, dragHandler, options,

// binding popup for schedule detail
if (options.useDetailPopup) {
detailView = new ScheduleDetailPopup(layoutContainer, baseController.calendars);
detailView = new ScheduleDetailPopup(layoutContainer);
onShowDetailPopup = function(eventData) {
var scheduleId = eventData.schedule.calendarId;
eventData.calendar = common.find(baseController.calendars, function(calendar) {
Expand Down Expand Up @@ -320,12 +320,12 @@ module.exports = function(baseController, layoutContainer, dragHandler, options,
});
});

if (options.useCreationPopup) {
if (options.useCreationPopup && createView) {
createView.off('beforeCreateSchedule', onSaveNewSchedule);
createView.destroy();
}

if (options.useDetailPopup) {
if (options.useDetailPopup && detailView) {
detailView.off('beforeDeleteSchedule', onDeleteSchedule);
detailView.destroy();
}
Expand Down
2 changes: 2 additions & 0 deletions src/js/theme/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ var common = require('../common/common');

/**
* Theme manager
*
* @constructor
* @param {object} customTheme - custom theme
*/
function Theme(customTheme) {
Expand Down
7 changes: 1 addition & 6 deletions src/js/view/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,14 @@ var View = require('./view');
function Layout(container, theme) {
container = domutil.appendHTMLElement('div', container, config.classname('layout'));

/**
* @type {HTMLElement}
*/
this.container = container;
View.call(this, container);

/*eslint-disable*/
/**
* @type {Collection} Child view collection.
*/
this.children = new Collection(function(childView) {
return childView.viewName;
});
/* eslint-enable*/

/**
* @type {Theme}
Expand Down
2 changes: 1 addition & 1 deletion src/js/view/template/week/dayGridSchedule.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="{{CSS_PREFIX}}weekday-schedules {{collapsed}}"style="top:{{@root.scheduleContainerTop}}px;">
<div class="{{CSS_PREFIX}}weekday-schedules" style="top:{{@root.scheduleContainerTop}}px;">
{{#each matrices ~}}
{{#each this ~}} {{! matrix }}
{{#each this ~}} {{! column }}
Expand Down
6 changes: 1 addition & 5 deletions src/js/view/week/dayGridSchedule.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var mmax = Math.max;
* make create easy.
* @param {number} [options.scheduleHeight=18] - height of each schedule block.
* @param {number} [options.scheduleGutter=2] - gutter height of each schedule block.
* @param {HTMLDIVElement} container - DOM element to use container for this
* @param {HTMLDivElement} container - DOM element to use container for this
* view.
*/
function DayGridSchedule(options, container) {
Expand Down Expand Up @@ -69,10 +69,6 @@ DayGridSchedule.prototype._getMinHeight = function(maxScheduleInDay) {
var contentHeight = (maxScheduleInDay * opt.scheduleHeight)
+ ((maxScheduleInDay - 1) * opt.scheduleGutter);

// if (this.collapsed && this.aboutMe.maxHeight >= contentHeight + opt.containerBottomGutter) {
// contentHeight += opt.containerBottomGutter;
// }

return contentHeight;
};

Expand Down

0 comments on commit f172f3a

Please sign in to comment.