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

Commit

Permalink
feat(cellAutoOpenDisabled): allow disabling the auto opening and clos…
Browse files Browse the repository at this point in the history
…ing of the slidebox

Allows full control over when the slidebox is opened and closed. This will probably become the default behaviour in a future release.

BREAKING CHANGE:

The `slide-box-disabled` option is deprecated and will be removed in the next release. Use the new `cell-auto-open-disabled` option instead.

Before:
```
slide-box-disabled="true"
```

After:
```
cell-auto-open-disabled="true"
```

Closes #426
  • Loading branch information
Matt Lewis committed Aug 21, 2016
1 parent a4bed3e commit 682b522
Show file tree
Hide file tree
Showing 40 changed files with 252 additions and 104 deletions.
1 change: 0 additions & 1 deletion docs/examples/all-day-events/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@ angular

vm.calendarView = 'day';
vm.viewDate = moment().toDate();
vm.isCellOpen = true;

});
3 changes: 1 addition & 2 deletions docs/examples/all-day-events/markup.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<mwl-calendar
events="vm.events"
view="vm.calendarView"
view-date="vm.viewDate"
cell-is-open="vm.isCellOpen">
view-date="vm.viewDate">
</mwl-calendar>
</div>
2 changes: 1 addition & 1 deletion docs/examples/badge-total/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ angular

vm.calendarView = 'month';
vm.viewDate = moment().startOf('month').toDate();
vm.isCellOpen = true;
vm.cellIsOpen = true;

});
3 changes: 2 additions & 1 deletion docs/examples/badge-total/markup.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
events="vm.events"
view="vm.calendarView"
view-date="vm.viewDate"
cell-is-open="vm.isCellOpen">
cell-is-open="vm.cellIsOpen"
cell-auto-open-disabled="true">
</mwl-calendar>
</div>
22 changes: 21 additions & 1 deletion docs/examples/cell-is-open/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,26 @@ angular

vm.calendarView = 'month';
vm.viewDate = moment().startOf('month').toDate();
vm.isCellOpen = true;
vm.cellIsOpen = true;

vm.timespanClicked = function(date, cell) {

if (vm.calendarView === 'month') {
if ((vm.cellIsOpen && moment(date).startOf('day').isSame(moment(vm.viewDate).startOf('day'))) || cell.events.length === 0 || !cell.inMonth) {
vm.cellIsOpen = false;
} else {
vm.cellIsOpen = true;
vm.viewDate = date;
}
} else if (vm.calendarView === 'year') {
if ((vm.cellIsOpen && moment(date).startOf('month').isSame(moment(vm.viewDate).startOf('month'))) || cell.events.length === 0) {
vm.cellIsOpen = false;
} else {
vm.cellIsOpen = true;
vm.viewDate = date;
}
}

};

});
6 changes: 4 additions & 2 deletions docs/examples/cell-is-open/markup.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<div ng-controller="CellIsOpenCtrl as vm">
<div class="alert alert-info">
The slidebox is <span ng-show="vm.isCellOpen">open</span><span ng-hide="vm.isCellOpen">closed</span>.
The slidebox is <span ng-show="vm.cellIsOpen">open</span><span ng-hide="vm.cellIsOpen">closed</span>.
</div>
<ng-include src="'calendarControls.html'"></ng-include>
<mwl-calendar
events="vm.events"
view="vm.calendarView"
view-date="vm.viewDate"
cell-is-open="vm.isCellOpen">
cell-is-open="vm.cellIsOpen"
cell-auto-open-disabled="true"
on-timespan-click="vm.timespanClicked(calendarDate, calendarCell)">
</mwl-calendar>
</div>
2 changes: 1 addition & 1 deletion docs/examples/clickable-events/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ angular

vm.calendarView = 'month';
vm.viewDate = moment().startOf('month').toDate();
vm.isCellOpen = true;
vm.cellIsOpen = true;

vm.eventClicked = function(event) {
alert.show('Clicked', event);
Expand Down
3 changes: 2 additions & 1 deletion docs/examples/clickable-events/markup.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
events="vm.events"
view="vm.calendarView"
view-date="vm.viewDate"
cell-is-open="vm.isCellOpen"
cell-is-open="vm.cellIsOpen"
cell-auto-open-disabled="true"
on-event-click="vm.eventClicked(calendarEvent);">
</mwl-calendar>
</div>
2 changes: 1 addition & 1 deletion docs/examples/custom-event-class/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ angular

vm.calendarView = 'month';
vm.viewDate = moment().startOf('month').toDate();
vm.isCellOpen = true;
vm.cellIsOpen = true;

});
3 changes: 2 additions & 1 deletion docs/examples/custom-event-class/markup.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
events="vm.events"
view="vm.calendarView"
view-date="vm.viewDate"
cell-is-open="vm.isCellOpen">
cell-is-open="vm.cellIsOpen"
cell-auto-open-disabled="true">
</mwl-calendar>
</div>
23 changes: 22 additions & 1 deletion docs/examples/draggable-events/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,31 @@ angular

vm.calendarView = 'month';
vm.viewDate = moment().startOf('month').toDate();
vm.isCellOpen = true;
vm.cellIsOpen = true;

vm.eventTimesChanged = function(event) {
vm.viewDate = event.startsAt;
alert.show('Dragged and dropped', event);
};

vm.timespanClicked = function(date, cell) {

if (vm.calendarView === 'month') {
if ((vm.cellIsOpen && moment(date).startOf('day').isSame(moment(vm.viewDate).startOf('day'))) || cell.events.length === 0 || !cell.inMonth) {
vm.cellIsOpen = false;
} else {
vm.cellIsOpen = true;
vm.viewDate = date;
}
} else if (vm.calendarView === 'year') {
if ((vm.cellIsOpen && moment(date).startOf('month').isSame(moment(vm.viewDate).startOf('month'))) || cell.events.length === 0) {
vm.cellIsOpen = false;
} else {
vm.cellIsOpen = true;
vm.viewDate = date;
}
}

};

});
6 changes: 4 additions & 2 deletions docs/examples/draggable-events/markup.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
events="vm.events"
view="vm.calendarView"
view-date="vm.viewDate"
cell-is-open="vm.isCellOpen"
on-event-times-changed="vm.eventTimesChanged(calendarEvent); calendarEvent.startsAt = calendarNewEventStart; calendarEvent.endsAt = calendarNewEventEnd">
cell-is-open="vm.cellIsOpen"
cell-auto-open-disabled="true"
on-timespan-click="vm.timespanClicked(calendarDate, calendarCell)"
on-event-times-changed="calendarEvent.startsAt = calendarNewEventStart; calendarEvent.endsAt = calendarNewEventEnd; vm.eventTimesChanged(calendarEvent)">
</mwl-calendar>
</div>
4 changes: 3 additions & 1 deletion docs/examples/draggable-external-events/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ angular

vm.calendarView = 'month';
vm.viewDate = moment().startOf('month').toDate();
vm.isCellOpen = true;
vm.cellIsOpen = false;

vm.eventDropped = function(event, start, end) {
var externalIndex = vm.externalEvents.indexOf(event);
Expand All @@ -37,6 +37,8 @@ angular
if (end) {
event.endsAt = end;
}
vm.viewDate = start;
vm.cellIsOpen = true;
};

});
3 changes: 2 additions & 1 deletion docs/examples/draggable-external-events/markup.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
events="vm.events"
view="vm.calendarView"
view-date="vm.viewDate"
cell-is-open="vm.isCellOpen"
cell-is-open="vm.cellIsOpen"
cell-auto-open-disabled="true"
on-event-times-changed="vm.eventDropped(calendarEvent, calendarNewEventStart, calendarNewEventEnd)">
</mwl-calendar>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/editable-deletable-events/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ angular

vm.calendarView = 'month';
vm.viewDate = moment().startOf('month').toDate();
vm.isCellOpen = true;
vm.cellIsOpen = true;

});
3 changes: 2 additions & 1 deletion docs/examples/editable-deletable-events/markup.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
events="vm.events"
view="vm.calendarView"
view-date="vm.viewDate"
cell-is-open="vm.isCellOpen">
cell-is-open="vm.cellIsOpen"
cell-auto-open-disabled="true">
</mwl-calendar>
</div>
2 changes: 1 addition & 1 deletion docs/examples/grouping-events/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ angular

vm.calendarView = 'month';
vm.viewDate = moment().startOf('month').toDate();
vm.isCellOpen = true;
vm.cellIsOpen = true;

vm.groupEvents = function(cell) {
cell.groups = {};
Expand Down
5 changes: 3 additions & 2 deletions docs/examples/grouping-events/markup.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
events="vm.events"
view="vm.calendarView"
view-date="vm.viewDate"
cell-is-open="vm.isCellOpen"
cell-modifier="vm.groupEvents(calendarCell)">
cell-is-open="vm.cellIsOpen"
cell-modifier="vm.groupEvents(calendarCell)"
cell-auto-open-disabled="true">
</mwl-calendar>
</div>
22 changes: 21 additions & 1 deletion docs/examples/kitchen-sink/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ angular
}
];

vm.isCellOpen = true;
vm.cellIsOpen = true;

vm.addEvent = function() {
vm.events.push({
Expand Down Expand Up @@ -82,4 +82,24 @@ angular
event[field] = !event[field];
};

vm.timespanClicked = function(date, cell) {

if (vm.calendarView === 'month') {
if ((vm.cellIsOpen && moment(date).startOf('day').isSame(moment(vm.viewDate).startOf('day'))) || cell.events.length === 0 || !cell.inMonth) {
vm.cellIsOpen = false;
} else {
vm.cellIsOpen = true;
vm.viewDate = date;
}
} else if (vm.calendarView === 'year') {
if ((vm.cellIsOpen && moment(date).startOf('month').isSame(moment(vm.viewDate).startOf('month'))) || cell.events.length === 0) {
vm.cellIsOpen = false;
} else {
vm.cellIsOpen = true;
vm.viewDate = date;
}
}

};

});
23 changes: 14 additions & 9 deletions docs/examples/kitchen-sink/markup.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,24 @@ <h2 class="text-center">{{ vm.calendarTitle }}</h2>
class="btn btn-primary"
mwl-date-modifier
date="vm.viewDate"
decrement="vm.calendarView">
decrement="vm.calendarView"
ng-click="vm.cellIsOpen = false">
Previous
</button>
<button
class="btn btn-default"
mwl-date-modifier
date="vm.viewDate"
set-to-today>
set-to-today
ng-click="vm.cellIsOpen = false">
Today
</button>
<button
class="btn btn-primary"
mwl-date-modifier
date="vm.viewDate"
increment="vm.calendarView">
increment="vm.calendarView"
ng-click="vm.cellIsOpen = false">
Next
</button>
</div>
Expand All @@ -34,10 +37,10 @@ <h2 class="text-center">{{ vm.calendarTitle }}</h2>

<div class="col-md-6 text-center">
<div class="btn-group">
<label class="btn btn-primary" ng-model="vm.calendarView" uib-btn-radio="'year'">Year</label>
<label class="btn btn-primary" ng-model="vm.calendarView" uib-btn-radio="'month'">Month</label>
<label class="btn btn-primary" ng-model="vm.calendarView" uib-btn-radio="'week'">Week</label>
<label class="btn btn-primary" ng-model="vm.calendarView" uib-btn-radio="'day'">Day</label>
<label class="btn btn-primary" ng-model="vm.calendarView" uib-btn-radio="'year'" ng-click="vm.cellIsOpen = false">Year</label>
<label class="btn btn-primary" ng-model="vm.calendarView" uib-btn-radio="'month'" ng-click="vm.cellIsOpen = false">Month</label>
<label class="btn btn-primary" ng-model="vm.calendarView" uib-btn-radio="'week'" ng-click="vm.cellIsOpen = false">Week</label>
<label class="btn btn-primary" ng-model="vm.calendarView" uib-btn-radio="'day'" ng-click="vm.cellIsOpen = false">Day</label>
</div>
</div>

Expand All @@ -52,11 +55,13 @@ <h2 class="text-center">{{ vm.calendarTitle }}</h2>
view-date="vm.viewDate"
on-event-click="vm.eventClicked(calendarEvent)"
on-event-times-changed="vm.eventTimesChanged(calendarEvent); calendarEvent.startsAt = calendarNewEventStart; calendarEvent.endsAt = calendarNewEventEnd"
cell-is-open="vm.isCellOpen"
cell-is-open="vm.cellIsOpen"
day-view-start="06:00"
day-view-end="22:59"
day-view-split="30"
cell-modifier="vm.modifyCell(calendarCell)">
cell-modifier="vm.modifyCell(calendarCell)"
cell-auto-open-disabled="true"
on-timespan-click="vm.timespanClicked(calendarDate, calendarCell)">
</mwl-calendar>

<br><br><br>
Expand Down
22 changes: 21 additions & 1 deletion docs/examples/recurring-events/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ angular
vm.events = [];
vm.calendarView = 'month';
vm.viewDate = moment().toDate();
vm.isCellOpen = true;
vm.cellIsOpen = true;

$scope.$watchGroup([
'vm.calendarView',
Expand Down Expand Up @@ -45,4 +45,24 @@ angular

});

vm.timespanClicked = function(date, cell) {

if (vm.calendarView === 'month') {
if ((vm.cellIsOpen && moment(date).startOf('day').isSame(moment(vm.viewDate).startOf('day'))) || cell.events.length === 0 || !cell.inMonth) {
vm.cellIsOpen = false;
} else {
vm.cellIsOpen = true;
vm.viewDate = date;
}
} else if (vm.calendarView === 'year') {
if ((vm.cellIsOpen && moment(date).startOf('month').isSame(moment(vm.viewDate).startOf('month'))) || cell.events.length === 0) {
vm.cellIsOpen = false;
} else {
vm.cellIsOpen = true;
vm.viewDate = date;
}
}

};

});
6 changes: 4 additions & 2 deletions docs/examples/recurring-events/markup.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ <h1 class="text-center">{{ vm.calendarTitle }}</h1>
events="vm.events"
view="vm.calendarView"
view-date="vm.viewDate"
cell-is-open="vm.isCellOpen"
view-title="vm.calendarTitle">
cell-is-open="vm.cellIsOpen"
cell-auto-open-disabled="true"
view-title="vm.calendarTitle"
on-timespan-click="vm.timespanClicked(calendarDate, calendarCell)">
</mwl-calendar>
</div>
1 change: 0 additions & 1 deletion docs/examples/resizable-events/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ angular

vm.calendarView = 'week';
vm.viewDate = moment().startOf('month').toDate();
vm.isCellOpen = true;

vm.eventTimesChanged = function(event) {
alert.show('Resized', event);
Expand Down
1 change: 0 additions & 1 deletion docs/examples/resizable-events/markup.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
events="vm.events"
view="vm.calendarView"
view-date="vm.viewDate"
cell-is-open="vm.isCellOpen"
on-event-times-changed="vm.eventTimesChanged(calendarEvent); calendarEvent.startsAt = calendarNewEventStart; calendarEvent.endsAt = calendarNewEventEnd">
</mwl-calendar>
</div>
1 change: 0 additions & 1 deletion docs/examples/select-range/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ angular
vm.events = [];
vm.calendarView = 'day';
vm.viewDate = moment().startOf('month').toDate();
vm.isCellOpen = true;

vm.rangeSelected = function(startDate, endDate) {
vm.firstDateClicked = startDate;
Expand Down
1 change: 0 additions & 1 deletion docs/examples/select-range/markup.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
events="vm.events"
view="vm.calendarView"
view-date="vm.viewDate"
cell-is-open="vm.isCellOpen"
on-date-range-select="vm.rangeSelected(calendarRangeStartDate, calendarRangeEndDate)">
</mwl-calendar>
</div>
Loading

0 comments on commit 682b522

Please sign in to comment.