Skip to content
This repository has been archived by the owner on Jun 19, 2018. It is now read-only.

Commit

Permalink
feat(onTimespanClick): expose the cell that was clicked for the month…
Browse files Browse the repository at this point in the history
… or year view

Closes #270
  • Loading branch information
Matt Lewis committed Jan 27, 2016
1 parent 0ffc774 commit 7184960
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ This expression is called when an event delete link is clicked on the calendar.

### on-timespan-click

This expression is called when a month, day or hour on the calendar is clicked on the year, month and day views respectively. `calendarDate` can be used in the expression and contains the start of the month, day or hour that was clicked on.
This expression is called when a month, day or hour on the calendar is clicked on the year, month and day views respectively. `calendarDate` can be used in the expression and contains the start of the month, day or hour that was clicked on. If on the month or year view `calendarCell` will contain cell data for the clicked day or month which you can then modify.

### cell-is-open

Expand Down
1 change: 1 addition & 0 deletions src/directives/mwlCalendarMonth.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ angular
if (!dayClickedFirstRun) {
vm.onTimespanClick({
calendarDate: day.date.toDate(),
calendarCell: day,
$event: $event
});
if ($event && $event.defaultPrevented) {
Expand Down
1 change: 1 addition & 0 deletions src/directives/mwlCalendarYear.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ angular
if (!monthClickedFirstRun) {
vm.onTimespanClick({
calendarDate: month.date.toDate(),
calendarCell: month,
$event: $event
});
if ($event && $event.defaultPrevented) {
Expand Down
3 changes: 2 additions & 1 deletion test/unit/directives/mwlCalendarMonth.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ describe('mwlCalendarMonth directive', function() {
expect(MwlCalendarCtrl.openDayIndex).to.equal(0);
expect(showModal).to.have.been.calledWith('Day clicked', {
calendarDate: MwlCalendarCtrl.view[0].date.toDate(),
$event: undefined
$event: undefined,
calendarCell: MwlCalendarCtrl.view[0]
});

//Close event list
Expand Down
3 changes: 2 additions & 1 deletion test/unit/directives/mwlCalendarYear.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ describe('mwlCalendarYear directive', function() {
expect(MwlCalendarCtrl.openMonthIndex).to.equal(0);
expect(showModal).to.have.been.calledWith('Day clicked', {
calendarDate: MwlCalendarCtrl.view[0].date.toDate(),
$event: undefined
$event: undefined,
calendarCell: MwlCalendarCtrl.view[0]
});

//Close event list
Expand Down

1 comment on commit 7184960

@diguifi
Copy link

Choose a reason for hiding this comment

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

Such a simple commit for such powerful feature.

Please sign in to comment.