Skip to content

Commit

Permalink
fix: save new location and new state during schedule update
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanepilla committed Jul 16, 2018
1 parent 178f346 commit d5ac9fe
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
4 changes: 2 additions & 2 deletions examples/js/default.js
Expand Up @@ -252,9 +252,9 @@
bgColor: calendar.bgColor,
dragBgColor: calendar.bgColor,
borderColor: calendar.borderColor,
location: scheduleData.location,
raw: {
'class': scheduleData.raw['class'],
location: scheduleData.raw.location
class: scheduleData.raw['class']
},
state: scheduleData.state
};
Expand Down
10 changes: 9 additions & 1 deletion src/js/controller/base.js
Expand Up @@ -189,6 +189,14 @@ Base.prototype.updateSchedule = function(schedule, options) {
schedule.set('isFocused', options.isFocused);
}

if (options.location) {
schedule.set('location', options.location);
}

if (options.state) {
schedule.set('state', options.state);
}

this._removeFromMatrix(schedule);
this._addToMatrix(schedule);

Expand Down Expand Up @@ -363,7 +371,7 @@ Base.prototype.setTheme = function(theme) {
* @property {string|number} id - calendar id
* @property {string} name - calendar name
* @property {string} color - text color when schedule is displayed
* @property {string} bgColor - background color schedule is displayed
* @property {string} bgColor - background color schedule is displayed
* @property {string} borderColor - color of left border or bullet point when schedule is displayed
* @property {boolean} [checked] - whether to show calendar's schedules or not
*/
Expand Down
15 changes: 7 additions & 8 deletions src/js/view/popup/scheduleCreationPopup.js
Expand Up @@ -157,7 +157,7 @@ ScheduleCreationPopup.prototype._openDropdownMenuView = function(dropdown) {
/**
* If click dropdown menu item, close dropdown menu
* @param {HTMLElement} target click event target
* @returns {boolean} whether
* @returns {boolean} whether
*/
ScheduleCreationPopup.prototype._selectDropdownMenuItem = function(target) {
var itemClassName = config.classname('dropdown-menu-item');
Expand Down Expand Up @@ -287,9 +287,9 @@ ScheduleCreationPopup.prototype._onClickSaveSchedule = function(target) {
schedule: {
calendarId: calendarId,
title: title.value,
location: location.value,
raw: {
class: isPrivate ? 'private' : 'public',
location: location.value
class: isPrivate ? 'private' : 'public'
},
start: start,
end: end,
Expand All @@ -312,9 +312,9 @@ ScheduleCreationPopup.prototype._onClickSaveSchedule = function(target) {
this.fire('beforeCreateSchedule', {
calendarId: calendarId,
title: title.value,
location: location.value,
raw: {
class: isPrivate ? 'private' : 'public',
location: location.value
class: isPrivate ? 'private' : 'public'
},
start: new TZDate(startDate),
end: new TZDate(endDate),
Expand Down Expand Up @@ -378,7 +378,7 @@ ScheduleCreationPopup.prototype._makeEditModeData = function(viewModel) {
var id = schedule.id;
title = schedule.title;
isPrivate = raw['class'] === 'private';
location = raw.location;
location = schedule.location;
startDate = schedule.start;
endDate = schedule.end;
isAllDay = schedule.isAllDay;
Expand All @@ -402,8 +402,7 @@ ScheduleCreationPopup.prototype._makeEditModeData = function(viewModel) {
start: startDate,
end: endDate,
raw: {
location: location,
'class': isPrivate ? 'private' : 'public'
class: isPrivate ? 'private' : 'public'
},
zIndex: this.layer.zIndex + 5,
isEditMode: this._isEditMode
Expand Down

0 comments on commit d5ac9fe

Please sign in to comment.