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

Commit

Permalink
fix: remove deprecated event.type
Browse files Browse the repository at this point in the history
BREAKING CHANGE:

The deprecated `event.type` property has been removed.

See 0.22.0 release notes for migration instructions
  • Loading branch information
Matt Lewis committed Aug 10, 2016
1 parent a7eee2a commit c53d4c8
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 136 deletions.
4 changes: 0 additions & 4 deletions src/directives/mwlCalendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ angular
}
}

if (event.type && !event.color) {
$log.warn(LOG_PREFIX, 'Event type is deprecated, please see the changelog on how to upgrade: ' + CHANGELOG_LINK, event);
}

return true;
}

Expand Down
1 change: 0 additions & 1 deletion src/directives/mwlCalendarMonth.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ angular
if (shouldAddClass) {
var dayContainsEvent = day.events.indexOf(event) > -1;
if (dayContainsEvent) {
day.highlightClass = 'day-highlight dh-event-' + event.type;
day.backgroundColor = event.color ? event.color.secondary : '';
}
}
Expand Down
19 changes: 0 additions & 19 deletions src/less/day.less
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,4 @@
overflow: hidden;
text-overflow: ellipsis;
}
.day-highlight.dh-event-important {
border: 1px solid @eventImportantColor;
}
.day-highlight.dh-event-warning {
border: 1px solid @eventWarningColor;
}
.day-highlight.dh-event-info {
border: 1px solid @eventInfoColor;
}
.day-highlight.dh-event-inverse {
border: 1px solid @eventInverseColor;
}
.day-highlight.dh-event-success {
border: 1px solid @eventSuccessColor;
}
.day-highlight.dh-event-special {
background-color: @eventHiliteSpecial;
border: 1px solid @eventSpecialColor;
}
}
56 changes: 1 addition & 55 deletions src/less/events.less
Original file line number Diff line number Diff line change
Expand Up @@ -22,61 +22,7 @@
margin-top: 3px;
}

.event-important {
background-color: @eventImportantColor;
}

.event-info {
background-color: @eventInfoColor;
}

.event-warning {
background-color: @eventWarningColor;
}

.event-inverse {
background-color: @eventInverseColor;
}

.event-success {
background-color: @eventSuccessColor;
}

.event-special {
background-color: @eventSpecialColor;
}

.day-highlight:hover,
.day-highlight {
background-color: @eventHiliteStandart;
}

.day-highlight.dh-event-important:hover,
.day-highlight.dh-event-important {
background-color: @eventHiliteImportant;
}

.day-highlight.dh-event-warning:hover,
.day-highlight.dh-event-warning {
background-color: @eventHiliteWarning;
}

.day-highlight.dh-event-info:hover,
.day-highlight.dh-event-info {
background-color: @eventHiliteInfo;
}

.day-highlight.dh-event-inverse:hover,
.day-highlight.dh-event-inverse {
background-color: @eventHiliteInverse;
}

.day-highlight.dh-event-success:hover,
.day-highlight.dh-event-success {
background-color: @eventHiliteSuccess;
}

.day-highlight.dh-event-special:hover,
.day-highlight.dh-event-special {
background-color: @eventHiliteSpecial;
}
}
18 changes: 1 addition & 17 deletions src/less/variables.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,8 @@
@rowHeightYear: 60px;

// Events

@eventStandardColor: #c3c3c3;
@eventImportantColor: #ad2121;
@eventInfoColor: dodgerblue;
@eventWarningColor: #e3bc08;
@eventSuccessColor: darkgreen;
@eventInverseColor: #1b1b1b;
@eventSpecialColor: #800080;

@eventHiliteStandart: #dddddd;
@eventHiliteImportant: lighten(@eventImportantColor, 53%);
@eventHiliteInfo: lighten(@eventInfoColor, 35%);
@eventHiliteWarning: lighten(@eventWarningColor, 40%);
@eventHiliteSuccess: lighten(@eventSuccessColor, 70%);
@eventHiliteInverse: lighten(@eventInverseColor, 65%);
@eventHiliteSpecial: lighten(@eventSpecialColor, 70%);

// MONTH
@rowHover: #fafafa;
Expand All @@ -32,6 +18,4 @@
@eventBorderColor: #ffffff;
@eventBorderRadius:8px;
@eventMargin: 2px;
@eventSize: 12px;

@calendarImagesPath: "../img";
@eventSize: 12px;
4 changes: 2 additions & 2 deletions src/templates/calendarDayView.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="col-xs-12">
<div class="cal-row-fluid">
<div
class="cal-cell-6 day-highlight dh-event-{{ event.type }}"
class="cal-cell-6 day-highlight"
ng-style="{backgroundColor: event.color.secondary}"
data-event-class
ng-repeat="event in vm.allDayEvents track by event.$id">
Expand Down Expand Up @@ -45,7 +45,7 @@
<div
class="pull-left day-event day-highlight"
ng-repeat="dayEvent in vm.nonAllDayEvents track by dayEvent.event.$id"
ng-class="'dh-event-' + dayEvent.event.type + ' ' + dayEvent.event.cssClass"
ng-class="dayEvent.event.cssClass"
ng-style="{
top: dayEvent.top - 1 + 'px',
left: dayEvent.left + 60 + 'px',
Expand Down
2 changes: 1 addition & 1 deletion src/templates/calendarMonthCellEvents.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
href="javascript:;"
ng-click="$event.stopPropagation(); vm.onEventClick({calendarEvent: event})"
class="pull-left event"
ng-class="'event-' + event.type + ' ' + event.cssClass"
ng-class="event.cssClass"
ng-style="{backgroundColor: event.color.primary}"
ng-mouseenter="vm.highlightEvent(event, true)"
ng-mouseleave="vm.highlightEvent(event, false)"
Expand Down
2 changes: 1 addition & 1 deletion src/templates/calendarSlideBox.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
ng-class="event.cssClass"
mwl-draggable="event.draggable === true"
drop-data="{event: event}">
<span class="pull-left event" ng-class="'event-' + event.type" ng-style="{backgroundColor: event.color.primary}"></span>
<span class="pull-left event" ng-style="{backgroundColor: event.color.primary}"></span>
&nbsp;
<a
href="javascript:;"
Expand Down
2 changes: 1 addition & 1 deletion src/templates/calendarWeekView.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
}">
<div
class="day-highlight"
ng-class="['dh-event-' + eventRow.event.type, eventRow.event.cssClass, !vm.showTimes && eventRow.startsBeforeWeek ? '' : 'border-left-rounded', !vm.showTimes && eventRow.endsAfterWeek ? '' : 'border-right-rounded']"
ng-class="[eventRow.event.cssClass, !vm.showTimes && eventRow.startsBeforeWeek ? '' : 'border-left-rounded', !vm.showTimes && eventRow.endsAfterWeek ? '' : 'border-right-rounded']"
ng-style="{backgroundColor: eventRow.event.color.secondary}"
data-event-class
mwl-draggable="eventRow.event.draggable === true"
Expand Down
14 changes: 0 additions & 14 deletions test/unit/directives/mwlCalendar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,20 +187,6 @@ describe('mwlCalendar directive', function() {
expect($log.warn).to.have.been.calledOnce;
});

it('should log a warning if the deprecated event type is used', function() {
$log.warn = sinon.spy();
scope.vm.events = [{title: 'title', startsAt: new Date(), type: 'success'}];
scope.$apply();
expect($log.warn).to.have.been.calledOnce;
});

it('should not log a warning if the deprecated event type is not used', function() {
$log.warn = sinon.spy();
scope.vm.events = [{title: 'title', startsAt: new Date(), color: {primary: 'blue', secondary: 'lightblue'}}];
scope.$apply();
expect($log.warn).not.to.have.been.called;
});

afterEach(function() {
clock.restore();
});
Expand Down
21 changes: 0 additions & 21 deletions test/unit/directives/mwlCalendarMonth.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,27 +141,6 @@ describe('mwlCalendarMonth directive', function() {
expect(MwlCalendarCtrl.openDayIndex).to.be.undefined;
});

it('should highlight an event across multiple days', function() {
var monthView = [{
date: moment(calendarDay),
inMonth: true,
events: [scope.events[0]]
}, {
date: moment(calendarDay),
inMonth: true,
events: [scope.events[0]]
}, {
date: moment(calendarDay),
inMonth: true,
events: [scope.events[1]]
}];

MwlCalendarCtrl.view = monthView;
MwlCalendarCtrl.highlightEvent(scope.events[0], true);
expect(monthView[0].highlightClass).to.equal('day-highlight dh-event-warning');
expect(monthView[1].highlightClass).to.equal('day-highlight dh-event-warning');
});

it('should highlight the month with the events color', function() {

scope.events[0].color = {
Expand Down

0 comments on commit c53d4c8

Please sign in to comment.