Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose internal date and add support for events in calendar view #70

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions dist/angular-pickadate.css
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@
.pickadate-cell .pickadate-active {
background-color: #b52a00;
color: white; }
.pickadate-cell .pickadate-event-on-date {
position: relative; }
.pickadate-cell .pickadate-event-on-date::after {
position: absolute;
left: 0;
top: 0;
width: 0;
height: 0;
border-style: solid;
border-width: 10px 10px 0 0;
border-color: #007bff transparent transparent transparent;
content: ''; }
.pickadate-cell .pickadate-head {
border-top: 1px solid #DCDCDC;
background: #f3f3f3; }
Expand Down
14 changes: 12 additions & 2 deletions dist/angular-pickadate.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,9 @@
minDate: '=',
maxDate: '=',
disabledDates: '=',
weekStartsOn: '='
weekStartsOn: '=',
currentDate: '=',
datesWithEvents: '='
},

link: function(scope, element, attrs, ngModel) {
Expand Down Expand Up @@ -302,7 +304,13 @@
scope.classesFor = function(date) {
var formattedDates = map(selectedDates, 'formattedDate'),
classes = indexOf.call(formattedDates, date.formattedDate) >= 0 ? 'pickadate-active' : null;
return date.classNames.concat(classes);

var eventOnDay = null;
if(typeof scope.datesWithEvents !== 'undefined') {
eventOnDay = indexOf.call(scope.datesWithEvents, date.formattedDate) >= 0 ? 'pickadate-event-on-date' : null;
}

return date.classNames.concat(classes).concat(eventOnDay);
};

scope.changeMonth = function(offset) {
Expand Down Expand Up @@ -360,6 +368,8 @@

return date;
});

console.dir(scope.dates);
}

function setViewValue(value, options) {
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-pickadate.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions src/angular-pickadate.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,9 @@
minDate: '=',
maxDate: '=',
disabledDates: '=',
weekStartsOn: '='
weekStartsOn: '=',
currentDate: '=',
datesWithEvents: '='
},

link: function(scope, element, attrs, ngModel) {
Expand Down Expand Up @@ -302,7 +304,13 @@
scope.classesFor = function(date) {
var formattedDates = map(selectedDates, 'formattedDate'),
classes = indexOf.call(formattedDates, date.formattedDate) >= 0 ? 'pickadate-active' : null;
return date.classNames.concat(classes);

var eventOnDay = null;
if(typeof scope.datesWithEvents !== 'undefined') {
eventOnDay = indexOf.call(scope.datesWithEvents, date.formattedDate) >= 0 ? 'pickadate-event-on-date' : null;
}

return date.classNames.concat(classes).concat(eventOnDay);
};

scope.changeMonth = function(offset) {
Expand Down Expand Up @@ -360,6 +368,8 @@

return date;
});

console.dir(scope.dates);
}

function setViewValue(value, options) {
Expand Down
16 changes: 16 additions & 0 deletions src/angular-pickadate.scss
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,22 @@
background-color: #b52a00;
color: white;
}
.pickadate-event-on-date {
position: relative;
}
.pickadate-event-on-date::after {
position: absolute;
left: 0;
top: 0;
width: 0;
height: 0;

border-style: solid;
border-width: 10px 10px 0 0;
border-color: #007bff transparent transparent transparent;

content: '';
}
.pickadate-head {
border-top: 1px solid #DCDCDC;
background: #f3f3f3;
Expand Down