1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-29 10:24:20 +01:00

fix bug: cant click machines event in < today and > first day of week

This commit is contained in:
Peng DU 2016-07-01 13:16:01 +02:00
parent 066458ca70
commit dbc9a388a8

View File

@ -13,6 +13,7 @@ Application.Controllers.controller "CalendarController", ["$scope", "$state", "$
availabilitySource =
url: "/api/availabilities/public?#{$.param({available_type: availableTypes})}"
textColor: 'black'
currentMachineEvent = null
### PUBLIC SCOPE ###
@ -53,6 +54,7 @@ Application.Controllers.controller "CalendarController", ["$scope", "$state", "$
## current calendar object
calendar = uiCalendarConfig.calendars.calendar
if event.available_type == 'machines'
currentMachineEvent = event
calendar.fullCalendar('changeView', 'agendaDay')
calendar.fullCalendar('gotoDate', event.start)
else
@ -68,7 +70,7 @@ Application.Controllers.controller "CalendarController", ["$scope", "$state", "$
# set defaultView, because when we change slotEventOverlap
# ui-calendar will trigger rerender calendar
$scope.calendarConfig.defaultView = view.type
today = moment().utc().startOf('day')
today = currentMachineEvent or moment().utc().startOf('day')
if today > view.start and today <= view.end and today != view.start
$scope.calendarConfig.defaultDate = today
else