Skip to content

Commit

Permalink
fixed non-monthly events
Browse files Browse the repository at this point in the history
  • Loading branch information
christine_lu authored and christine_lu committed May 15, 2015
1 parent 15884b1 commit 8d089d9
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions js/bootstrap-datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@

this.monthsWithEvents = [1,2,3,4,5,6,7,8,9,10,11,12];
this.selectedNonMonthlyEvents = {};
this.nonMonthlyEvents = [];

this.element = $(element);
this.isInline = false;
Expand Down Expand Up @@ -595,9 +596,10 @@

setSelectedEvents: function(){
var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
this.selectedNonMonthlyEvents = {}

for (index in args) {
var event = args[index]
this.selectedNonMonthlyEvents = {}
this.selectedNonMonthlyEvents[event.EventId] = event.EventName;
}

Expand All @@ -610,8 +612,14 @@
return this;
},

setNonMonthlyEvents: function() {
this.nonMonthlyEvents = arguments[0];
},

renderEvents: function() {
var specialEvents = arguments[0]
var specialEvents = arguments[0];
this.nonMonthlyEvents = specialEvents

var html = '<td colspan="7">';
for (var _i = 0; _i < specialEvents.length; _i++){
var tempEvent = specialEvents[_i];
Expand Down Expand Up @@ -1148,6 +1156,7 @@

var elem = $(this.element).closest('[ng-controller]')
var controller = angular.element(elem).controller()

var specialEvents = _.filter(controller.events, function(event) {
return event.EventDesc != "Monthly";
})
Expand Down Expand Up @@ -1179,11 +1188,12 @@

var elem = $(this.element).closest('[ng-controller]')
var controller = angular.element(elem).controller()

var specialEvents = _.filter(controller.events, function(event) {
return event.EventDesc != "Monthly";
return !event.Monthly;
})

this.renderEvents(specialEvents)
this.renderEvents(specialEvents);

break;
case 'switchMonths':
Expand All @@ -1204,7 +1214,7 @@
var eventId = $(target).data('eventid')
var eventName = $(target).html()

if (!this.o.multidate) {
if (!this.o.multievent) {
controller.setEventById($(target).data('eventid'))
this.selectedNonMonthlyEvents = {}
this.selectedNonMonthlyEvents[eventId] = eventName
Expand Down

0 comments on commit 8d089d9

Please sign in to comment.