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

Commit

Permalink
Release 0.10.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Lewis committed May 7, 2015
1 parent 63eb419 commit 72212b6
Show file tree
Hide file tree
Showing 11 changed files with 166 additions and 58 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-bootstrap-calendar",
"version": "0.10.0",
"version": "0.10.1",
"homepage": "https://github.com/mattlewis92/angular-bootstrap-calendar",
"authors": [
"Matt Lewis"
Expand Down
2 changes: 1 addition & 1 deletion dist/css/angular-bootstrap-calendar.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* angular-bootstrap-calendar - A pure AngularJS bootstrap themed responsive calendar that can display events and has views for year, month, week and day
* @version v0.10.0
* @version v0.10.1
* @link https://github.com/mattlewis92/angular-bootstrap-calendar
* @license MIT
*/
Expand Down
4 changes: 2 additions & 2 deletions dist/css/angular-bootstrap-calendar.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/css/angular-bootstrap-calendar.min.css.map

Large diffs are not rendered by default.

108 changes: 81 additions & 27 deletions dist/js/angular-bootstrap-calendar-tpls.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/js/angular-bootstrap-calendar-tpls.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/angular-bootstrap-calendar-tpls.min.js.map

Large diffs are not rendered by default.

92 changes: 73 additions & 19 deletions dist/js/angular-bootstrap-calendar.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* angular-bootstrap-calendar - A pure AngularJS bootstrap themed responsive calendar that can display events and has views for year, month, week and day
* @version v0.10.0
* @version v0.10.1
* @link https://github.com/mattlewis92/angular-bootstrap-calendar
* @license MIT
*/
Expand Down Expand Up @@ -428,6 +428,7 @@
function ($scope, moment, calendarHelper) {
var vm = this;
var firstRun = true;
vm.openEvents = [];
$scope.$on('calendar.refreshView', function () {
vm.view = calendarHelper.getYearView($scope.events, $scope.currentDay);
//Auto open the calendar to the current day if set
Expand All @@ -439,16 +440,38 @@
}
});
}
//if an event was deleted, remove it from the open events array
vm.openEvents = vm.openEvents.filter(function (event) {
return $scope.events.indexOf(event) > -1;
});
//Close the open year if no more events
if (vm.openEvents.length === 0) {
vm.openRowIndex = null;
vm.view.forEach(function (month) {
month.isOpened = false;
});
}
});
vm.monthClicked = function (month, monthClickedFirstRun) {
if (!monthClickedFirstRun) {
$scope.onTimespanClick({ calendarDate: month.date.toDate() });
}
vm.openEvents = month.events;
vm.view.forEach(function (yearMonth) {
if (yearMonth !== month) {
yearMonth.isOpened = false;
}
});
vm.openRowIndex = null;
if (vm.openEvents.length > 0) {
var monthIndex = vm.view.indexOf(month);
vm.openRowIndex = Math.floor(monthIndex / 4);
if (month.isOpened) {
vm.openEvents = [];
month.isOpened = false;
} else {
vm.openEvents = month.events;
if (vm.openEvents.length > 0) {
var monthIndex = vm.view.indexOf(month);
vm.openRowIndex = Math.floor(monthIndex / 4);
month.isOpened = true;
}
}
};
}
Expand All @@ -468,8 +491,7 @@
scope: {
events: '=',
currentDay: '=',
onEventClick: '=',
onTimespanClick: '='
onEventClick: '='
},
controller: [
'$scope',
Expand Down Expand Up @@ -552,6 +574,7 @@
function ($scope, moment, calendarHelper) {
var vm = this;
var firstRun = true;
vm.openEvents = [];
$scope.$on('calendar.refreshView', function () {
vm.weekDays = calendarHelper.getWeekDayNames();
vm.view = calendarHelper.getMonthView($scope.events, $scope.currentDay);
Expand All @@ -569,20 +592,38 @@
}
});
}
//if an event was deleted, remove it from the open events array
vm.openEvents = vm.openEvents.filter(function (event) {
return $scope.events.indexOf(event) > -1;
});
//close the open day if no more events
if (vm.openEvents.length === 0) {
vm.openRowIndex = null;
vm.view.forEach(function (day) {
day.isOpened = false;
});
}
});
vm.dayClicked = function (day, dayClickedFirstRun) {
if (!dayClickedFirstRun) {
$scope.onTimespanClick({ calendarDate: day.date.toDate() });
}
vm.view.forEach(function (monthDay) {
monthDay.isOpened = false;
if (monthDay !== day) {
monthDay.isOpened = false;
}
});
vm.openEvents = day.events;
vm.openRowIndex = null;
if (vm.openEvents.length > 0) {
var dayIndex = vm.view.indexOf(day);
vm.openRowIndex = Math.floor(dayIndex / 7);
day.isOpened = true;
if (day.isOpened) {
vm.openEvents = [];
day.isOpened = false;
} else {
vm.openEvents = day.events;
if (vm.openEvents.length > 0) {
var dayIndex = vm.view.indexOf(day);
vm.openRowIndex = Math.floor(dayIndex / 7);
day.isOpened = true;
}
}
};
vm.highlightEvent = function (event, shouldAddClass) {
Expand Down Expand Up @@ -614,9 +655,9 @@
events: '=',
currentDay: '=',
onEventClick: '=',
dayViewStart: '@',
dayViewEnd: '@',
dayViewSplit: '@'
dayViewStart: '=',
dayViewEnd: '=',
dayViewSplit: '='
},
controller: [
'$scope',
Expand Down Expand Up @@ -690,24 +731,37 @@
$scope.currentDay = newDay;
};
vm.drillDown = function (date) {
var rawDate = moment(date).toDate();
var nextView = {
'year': 'month',
'month': 'day',
'week': 'day'
};
if ($scope.onDrillDownClick({
calendarDate: moment(date).toDate(),
calendarDate: rawDate,
calendarNextView: nextView[$scope.view]
}) !== false) {
vm.changeView(nextView[$scope.view], date);
vm.changeView(nextView[$scope.view], rawDate);
}
};
var previousDate = moment($scope.currentDay);
var previousView = angular.copy($scope.view);
//Use a debounce to prevent it being called 3 times on initialisation
var refreshCalendar = calendarDebounce(function () {
if (calendarTitle[$scope.view]) {
$scope.viewTitle = calendarTitle[$scope.view]($scope.currentDay);
}
$scope.$broadcast('calendar.refreshView');
//if on-timespan-click="calendarDay = calendarDate" is set then dont update the view as nothing needs to change
var currentDate = moment($scope.currentDay);
var shouldUpdate = true;
if (previousDate.clone().startOf($scope.view).isSame(currentDate.clone().startOf($scope.view)) && !previousDate.isSame(currentDate) && $scope.view === previousView) {
shouldUpdate = false;
}
previousDate = currentDate;
previousView = angular.copy($scope.view);
if (shouldUpdate) {
$scope.$broadcast('calendar.refreshView');
}
}, 50);
//Auto update the calendar when the locale changes
var unbindLocaleWatcher = $scope.$watch(function () {
Expand Down
4 changes: 2 additions & 2 deletions dist/js/angular-bootstrap-calendar.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/angular-bootstrap-calendar.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-bootstrap-calendar",
"version": "0.10.0",
"version": "0.10.1",
"repository": "[email protected]:mattlewis92/angular-bootstrap-calendar.git",
"dependencies": {},
"devDependencies": {
Expand Down

0 comments on commit 72212b6

Please sign in to comment.