Skip to content

Commit

Permalink
fix: breaking change for timegridDisplayPrimayTime
Browse files Browse the repository at this point in the history
  • Loading branch information
jungeun-cho committed Apr 16, 2019
1 parent 4adf431 commit 76b1ac6
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 12 deletions.
12 changes: 12 additions & 0 deletions examples/example15-template-for-timegrid.html
Expand Up @@ -152,6 +152,18 @@

return displayLabel;
},
timegridDisplayPrimayTime: function(time) {
/* will be deprecated. use 'timegridDisplayPrimaryTime' */
var meridiem = 'am';
var hour = time.hour;

if (time.hour > 12) {
meridiem = 'pm';
hour = time.hour - 12;
}

return hour + ' ' + meridiem;
},
timegridDisplayPrimaryTime: function(time) {
var meridiem = 'am';
var hour = time.hour;
Expand Down
15 changes: 14 additions & 1 deletion src/js/factory/calendar.js
Expand Up @@ -79,6 +79,7 @@ var mmin = Math.min;
* @property {function} [schedule] - The week/day schedule template function(When the schedule category attribute is milestone, task, or all day)
* @property {function} [collapseBtnTitle] - The week/day (exceed schedule more view) collapse button title template function
* @property {function} [timezoneDisplayLabel] - The timezone display label template function in time grid
* @property {function} [timegridDisplayPrimayTime] - Deprecated: use 'timegridDisplayPrimaryTime'
* @property {function} [timegridDisplayPrimaryTime] - The display label template function of primary timezone in time grid
* @property {function} [timegridDisplayTime] - The display time template function in time grid
* @property {function} [timegridCurrentTime] - The current time template function in time grid
Expand Down Expand Up @@ -211,7 +212,7 @@ var mmin = Math.min;
*
* return tpl;
* },
* collapseBtnTitle: function() { // ??? 어떤 템플릿인가요??
* collapseBtnTitle: function() {
* return '<span class="tui-full-calendar-icon tui-full-calendar-ic-arrow-solid-top"></span>';
* },
* timezoneDisplayLabel: function(timezoneOffset, displayLabel) {
Expand All @@ -226,6 +227,18 @@ var mmin = Math.min;
*
* return displayLabel;
* },
* timegridDisplayPrimayTime: function(time) {
* // will be deprecated. use 'timegridDisplayPrimaryTime'
* var meridiem = 'am';
* var hour = time.hour;
*
* if (time.hour > 12) {
* meridiem = 'pm';
* hour = time.hour - 12;
* }
*
* return hour + ' ' + meridiem;
* },
* timegridDisplayPrimaryTime: function(time) {
* var meridiem = 'am';
* var hour = time.hour;
Expand Down
12 changes: 2 additions & 10 deletions src/js/view/template/helper.js
Expand Up @@ -409,16 +409,8 @@ Handlebars.registerHelper({
},

'timegridDisplayPrimayTime-tmpl': function(time) {
/* TODO: 1.11.0 이후 버전부터 삭제 필요 (will be deprecate) */
var meridiem = 'am';
var hour = time.hour;

if (time.hour > 12) {
meridiem = 'pm';
hour = time.hour - 12;
}

return hour + ' ' + meridiem;
/* TODO: 삭제 필요 (will be deprecate) */
return this['timegridDisplayPrimaryTime-tmpl']();
},

'timegridDisplayPrimaryTime-tmpl': function(time) {
Expand Down
2 changes: 1 addition & 1 deletion src/js/view/template/week/timeGrid.hbs
Expand Up @@ -4,7 +4,7 @@
{{#if isPrimary}}
{{#each timeSlots ~}}
<div class="{{CSS_PREFIX}}timegrid-hour" style="height: {{@root.styles.oneHourHeight}}; color: {{color}}; font-weight: {{fontWeight}};">
<span style="{{#if hidden}}display:none{{/if}}">{{{timegridDisplayPrimaryTime-tmpl this}}}</span>
<span style="{{#if hidden}}display:none{{/if}}">{{{timegridDisplayPrimayTime-tmpl this}}}</span>
</div>
{{/each ~}}
{{#if @root.showHourMarker}}
Expand Down

3 comments on commit 76b1ac6

@Nirvana-cn
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an error.
this.timegridDisplayPrimaryTime-tmpl is not a function.

@Nirvana-cn
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

timegridDisplayPrimaryTime

miss 'r' in 'Primary'

timegridDisplayPrimayTime

@dongsik-yoo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Nirvana-cn I released the patch version for this.
https://github.com/nhn/tui.calendar/releases/tag/v1.11.2

Thank you for your cooperation!

Please sign in to comment.