Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

feat(on-drill-down-click): rename to on-view-change-click. Closes #245

BREAKING CHANGE:
on-drill-down-click has been renamed to on-view-change-click
  • Loading branch information...
Matt Lewis
Matt Lewis committed Dec 30, 2015
1 parent 4e6d195 commit 25149756b3bb6b82f5758eb2e40d38a42a8d86da
@@ -181,9 +181,9 @@ An interpolated string in the form of hh:mm to end the day view at, e.g. setting

The number of chunks to split the day view hours up into. Can be either 10, 15 or 30. Default: 30

### on-drill-down-click
### on-view-change-click

An optional expression that is evaluated when the drilldown (clicking on a date to change the view) is triggered. Return false from the expression function to disable the drilldown. `calendarDate` can be used in the expression and contains the date that was selected. `calendarNextView` is the view that the calendar will be changed to.
An optional expression that is evaluated when the view is changed by clicking on a date. Return false from the expression function to disable the view change. `calendarDate` can be used in the expression and contains the date that was selected. `calendarNextView` is the view that the calendar will be changed to.

### cell-modifier

@@ -15,7 +15,7 @@ angular
vm.currentDay = newDay;
};

vm.drillDown = function(date) {
vm.dateClicked = function(date) {

var rawDate = moment(date).toDate();

@@ -25,7 +25,7 @@ angular
week: 'day'
};

if (vm.onDrillDownClick({calendarDate: rawDate, calendarNextView: nextView[vm.view]}) !== false) {
if (vm.onViewChangeClick({calendarDate: rawDate, calendarNextView: nextView[vm.view]}) !== false) {
vm.changeView(nextView[vm.view], rawDate);
}

@@ -126,7 +126,7 @@ angular
onEditEventClick: '&',
onDeleteEventClick: '&',
onTimespanClick: '&',
onDrillDownClick: '&',
onViewChangeClick: '&',
cellModifier: '&',
dayViewStart: '@',
dayViewEnd: '@',
@@ -20,7 +20,7 @@
<span
class="pull-right"
data-cal-date
ng-click="vm.calendarCtrl.drillDown(day.date)"
ng-click="vm.calendarCtrl.dateClicked(day.date)"
ng-bind="day.label">
</span>

@@ -16,7 +16,7 @@
<small>
<span
data-cal-date
ng-click="vm.calendarCtrl.drillDown(day.date)"
ng-click="vm.calendarCtrl.dateClicked(day.date)"
class="pointer"
ng-bind="day.dayLabel">
</span>
@@ -13,7 +13,7 @@
<span
class="pull-right"
data-cal-date
ng-click="vm.calendarCtrl.drillDown(month.date)"
ng-click="vm.calendarCtrl.dateClicked(month.date)"
ng-bind="month.label">
</span>

@@ -110,9 +110,9 @@ describe('mwlCalendar directive', function() {
expect(MwlCalendarCtrl.currentDay).to.equal(myDate);
});

it('should allow to drill down', function() {
it('should change the current view', function() {
var myDate = new Date();
MwlCalendarCtrl.drillDown(myDate);
MwlCalendarCtrl.dateClicked(myDate);
expect(MwlCalendarCtrl.view).to.equal('day');
expect(MwlCalendarCtrl.currentDay).to.eql(myDate);
});

0 comments on commit 2514975

Please sign in to comment.
You can’t perform that action at this time.