diff --git a/RIGS/templates/calendar.html b/RIGS/templates/calendar.html index 75ee8dc5..7bf854cf 100644 --- a/RIGS/templates/calendar.html +++ b/RIGS/templates/calendar.html @@ -27,15 +27,12 @@ calendar = new FullCalendar.Calendar(calendarEl, { themeSystem: 'bootstrap', - //defaultView: 'dayGridMonth', This is now default aspectRatio: 1.5, eventTimeFormat: { 'hour': '2-digit', 'minute': '2-digit', 'hour12': false }, - //nowIndicator: true, - //firstDay: 1, headerToolbar: false, editable: false, dayMaxEventRows: true, // allow "more" link when too many events @@ -58,8 +55,10 @@ }; $(doc).each(function() { end = $(this).attr('latest') + allDay = false if(end.indexOf("T") < 0){ //If latest does not contain a time - end = moment(end).add(1, 'days') //End date is non-inclusive, so add a day + end = moment(end + " 23:59").format("YYYY-MM-DD[T]HH:mm:ss") + allDay = true } thisEvent = { @@ -67,7 +66,8 @@ 'end': end, 'className': 'modal-href', 'title': $(this).attr('title'), - 'url': $(this).attr('url') + 'url': $(this).attr('url'), + 'allDay': allDay } if($(this).attr('is_rig')===true || $(this).attr('status') === "Cancelled"){ diff --git a/RIGS/views/ical.py b/RIGS/views/ical.py index c9834b25..087cd594 100644 --- a/RIGS/views/ical.py +++ b/RIGS/views/ical.py @@ -93,7 +93,7 @@ class CalendarICS(ICalFeed): title += item.name # Add the status - title += ' (' + str(item.get_status_display()) + ')' + title += f' ({item.get_status_display()})' return title @@ -101,9 +101,8 @@ class CalendarICS(ICalFeed): return item.earliest_time def item_end_datetime(self, item): - if isinstance(item.latest_time, datetime.date): # Ical end_datetime is non-inclusive, so add a day - return item.latest_time + datetime.timedelta(days=1) - + # if isinstance(item.latest_time, datetime.date): # Ical end_datetime is non-inclusive, so add a day + # return item.latest_time + datetime.timedelta(days=1) return item.latest_time def item_location(self, item): @@ -115,13 +114,13 @@ class CalendarICS(ICalFeed): tz = pytz.timezone(self.timezone) - desc = 'Rig ID = ' + str(item.pk) + '\n' - desc += 'Event = ' + item.name + '\n' + desc = f'Rig ID = {item.display_id}\n' + desc += f'Event = {item.name}\n' desc += 'Venue = ' + (item.venue.name if item.venue else '---') + '\n' if item.is_rig and item.person: desc += 'Client = ' + item.person.name + ( (' for ' + item.organisation.name) if item.organisation else '') + '\n' - desc += 'Status = ' + str(item.get_status_display()) + '\n' + desc += f'Status = {item.get_status_display()}\n' desc += 'MIC = ' + (item.mic.name if item.mic else '---') + '\n' desc += '\n' @@ -140,23 +139,18 @@ class CalendarICS(ICalFeed): desc += '\n' if item.description: - desc += 'Event Description:\n' + item.description + '\n\n' + desc += f'Event Description:\n{item.description}\n\n' # if item.notes: // Need to add proper keyholder checks before this gets put back # desc += 'Notes:\n'+item.notes+'\n\n' - base_url = "https://rigs.nottinghamtec.co.uk" - desc += 'URL = ' + base_url + str(item.get_absolute_url()) + desc += f'URL = https://rigs.nottinghamtec.co.uk{item.get_absolute_url()}' return desc def item_link(self, item): # Make a link to the event in the web interface - # base_url = "https://pyrigs.nottinghamtec.co.uk" return item.get_absolute_url() - # def item_created(self, item): #TODO - Implement created date-time (using django-reversion?) - not really necessary though - # return '' - def item_updated(self, item): # some ical clients will display this return item.last_edited_at