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

Commit

Permalink
Merge pull request #50 from simpixelated/timespanclick
Browse files Browse the repository at this point in the history
starts #42; call timespan click from drillDown
  • Loading branch information
mattlewis92 committed Apr 9, 2015
2 parents 7dd703b + 8ba1e58 commit 564dd01
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/directives/mwlCalendarMonth.js
Expand Up @@ -62,7 +62,10 @@ angular
};

$scope.drillDown = function(day) {
$scope.calendarCtrl.changeView('day', moment($scope.currentDay).clone().date(day).toDate());
var date = moment($scope.currentDay).clone().date(day).toDate();
if ($scope.timespanClick({calendarDate: date}) !== false) {
$scope.calendarCtrl.changeView('day', date);
}
};

$scope.highlightEvent = function(event, shouldAddClass) {
Expand Down
8 changes: 6 additions & 2 deletions src/directives/mwlCalendarWeek.js
Expand Up @@ -12,15 +12,19 @@ angular
events: '=calendarEvents',
currentDay: '=calendarCurrentDay',
eventClick: '=calendarEventClick',
useIsoWeek: '=calendarUseIsoWeek'
useIsoWeek: '=calendarUseIsoWeek',
timespanClick: '=calendarTimespanClick'
},
controller: function($scope, moment, calendarHelper) {
function updateView() {
$scope.view = calendarHelper.getWeekView($scope.events, $scope.currentDay, $scope.useIsoWeek);
}

$scope.drillDown = function(day) {
$scope.calendarCtrl.changeView('day', moment($scope.currentDay).clone().date(day).toDate());
var date = moment($scope.currentDay).clone().date(day).toDate();
if ($scope.timespanClick({calendarDate: date}) !== false) {
$scope.calendarCtrl.changeView('day', date);
}
};

$scope.$watch('currentDay', updateView);
Expand Down
5 changes: 4 additions & 1 deletion src/directives/mwlCalendarYear.js
Expand Up @@ -58,7 +58,10 @@ angular
};

$scope.drillDown = function(month) {
$scope.calendarCtrl.changeView('month', moment($scope.currentDay).clone().month(month).toDate());
var date = moment($scope.currentDay).clone().month(month).toDate();
if ($scope.timespanClick({calendarDate: date}) !== false) {
$scope.calendarCtrl.changeView('month', date);
}
};
},
link: function(scope, element, attrs, calendarCtrl) {
Expand Down
1 change: 1 addition & 0 deletions templates/main.html
Expand Up @@ -34,6 +34,7 @@
calendar-current-day="currentDay"
calendar-event-click="eventClick"
calendar-use-iso-week="useIsoWeek"
calendar-timespan-click="timespanClick"
ng-switch-when="week"
></mwl-calendar-week>

Expand Down

0 comments on commit 564dd01

Please sign in to comment.