Skip to content

Commit

Permalink
Merge pull request #362 from nhn/fix/day/workweek
Browse files Browse the repository at this point in the history
Fix/day/workweek
  • Loading branch information
유동식 committed Jul 29, 2019
2 parents 4afc40b + f1cc8cd commit 188b184
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 20 deletions.
16 changes: 0 additions & 16 deletions src/js/factory/calendar.js
Expand Up @@ -1802,10 +1802,6 @@ function _createController(options) {
* @private
*/
function _createWeekView(controller, container, dragHandler, options, viewName) {
if (viewName === 'day') {
_disableDayOptions(options.week);
}

return weekViewFactory(
controller,
container,
Expand Down Expand Up @@ -1851,18 +1847,6 @@ function _setOptionRecurseively(view, func) {
});
}

/**
* disable options for day view
* @param {WeekOptions} weekOptions - week options to disable
*/
function _disableDayOptions(weekOptions) {
if (!weekOptions) {
return;
}

weekOptions.workweek = false;
}

util.CustomEvents.mixin(Calendar);

module.exports = Calendar;
4 changes: 2 additions & 2 deletions src/js/factory/weekView.js
Expand Up @@ -85,7 +85,7 @@ var DEFAULT_PANELS = [
];

/* eslint-disable complexity*/
module.exports = function(baseController, layoutContainer, dragHandler, options) {
module.exports = function(baseController, layoutContainer, dragHandler, options, viewName) {
var panels = [],
vpanels = [];
var weekView, dayNameContainer, dayNameView, vLayoutContainer, vLayout;
Expand Down Expand Up @@ -139,7 +139,7 @@ module.exports = function(baseController, layoutContainer, dragHandler, options)

util.extend(options.week, {panels: panels});

weekView = new Week(null, options.week, layoutContainer, panels);
weekView = new Week(null, options.week, layoutContainer, panels, viewName);
weekView.handler = {
click: {},
dayname: {},
Expand Down
15 changes: 14 additions & 1 deletion src/js/view/week/week.js
Expand Up @@ -22,9 +22,10 @@ var View = require('../view');
* @param {string} [options.cssPrefix] - CSS classname prefix
* @param {HTMLElement} container The element to use container for this view.
* @param {object} panels - schedule panels like 'milestone', 'task', 'allday', 'time'
* @param {string} viewName - 'week', 'day'
* @extends {View}
*/
function Week(controller, options, container, panels) {
function Week(controller, options, container, panels, viewName) {
var range;

container = domutil.appendHTMLElement('div', container);
Expand Down Expand Up @@ -72,6 +73,10 @@ function Week(controller, options, container, panels) {
this.state = {
timezonesCollapsed: this.options.timezonesCollapsed
};

if (viewName === 'day') {
_disableDayOptions(this.options);
}
}

util.inherit(Week, View);
Expand Down Expand Up @@ -209,6 +214,14 @@ Week.prototype._getRenderDateRange = function(baseDate) {
};
};

/**
* disable options for day view
* @param {WeekOptions} options - week options to disable
*/
function _disableDayOptions(options) {
options.workweek = false;
}

util.CustomEvents.mixin(Week);

module.exports = Week;
2 changes: 1 addition & 1 deletion test/app/view/time.spec.js
Expand Up @@ -37,7 +37,7 @@ describe('View/Time', function() {
});

expect(result.left).toBe(50);
expect(result.width).toBe(null);
expect(result.width).toBe(0); // change null value to 0 to fit width 100%
});

it('_getScheduleViewBoundY()', function() {
Expand Down

0 comments on commit 188b184

Please sign in to comment.