From f03ee521fc60c06f32c1ffdfa615736a7019bbad Mon Sep 17 00:00:00 2001 From: Benjamin A Date: Mon, 10 Feb 2025 13:55:04 -0500 Subject: [PATCH] Add calendar event icons --- events/cal.py | 4 +++- events/models.py | 21 +++++++++++++++++++++ site_tmpl/events_cal.html | 29 +++++++++++++++++++++++------ 3 files changed, 47 insertions(+), 7 deletions(-) diff --git a/events/cal.py b/events/cal.py index f00001aa..d7d980a3 100644 --- a/events/cal.py +++ b/events/cal.py @@ -276,7 +276,8 @@ def generate_cal_json_publicfacing(queryset, from_date=None, to_date=None): objects_body = [] for event in queryset: field = { - "title": conditional_escape(event.cal_name()), + "title": conditional_escape("%icon% "+event.cal_name()), + "icon": '', "url": reverse('events:detail', args=[event.id]), "className": 'cal-status-' + slugify(event.status), "start": datetime_to_timestamp(event.cal_start() + timezone.timedelta(hours=-5)), @@ -309,6 +310,7 @@ def generate_cal_json(queryset, from_date=None, to_date=None): field = { "id": event.cal_guid(), "title": event.cal_name(), + "icon": '' + ('' if event.has_projection else ''), "url": reverse('events:detail', args=[event.id]), "className": 'cal-status-' + slugify(event.status), "start": datetime_to_timestamp(event.cal_start() + timezone.timedelta(hours=-5)), diff --git a/events/models.py b/events/models.py index 5dec46a4..b5747729 100755 --- a/events/models.py +++ b/events/models.py @@ -357,6 +357,27 @@ def status(self): return "Awaiting Payment" else: return "To Be Billed" # used to be "Open" git #245 + + @property + def icon(self): + if self.status == "Cancelled": + return "glyphicon-ban-circle" + elif self.status == "Closed": + return "glyphicon-ok-circle" + elif self.status == "Approved": + return "glyphicon-ok-sign" + elif self.status == "Awaiting Approval": + return "glyphicon-time" + elif self.status == "Awaiting Review": + return "glyphicon-exclamation-sign" + elif self.status == "Paid": + return "glyphicon-check" + elif self.status == "To Be Billed": + return "glyphicon-send" + elif self.status == "Awaiting Payment": + return "glyphicon-usd" + else: + return "glyphicon-question-sign" @property def unpaid(self): diff --git a/site_tmpl/events_cal.html b/site_tmpl/events_cal.html index 43532124..9ab2ef2a 100644 --- a/site_tmpl/events_cal.html +++ b/site_tmpl/events_cal.html @@ -33,7 +33,19 @@ border-color:rgb(42, 42, 42) !important } +.cal-status-cancelled .fc-event-title { text-decoration: line-through; } + +.cal-status-cancelled:hover .fc-event-title { text-decoration: none !important; } + .cal-status-awaiting-review { background-color: #e39c2b!important; border-color:#87572a !important} + +.fc-event-title-container .glyphicon { + margin-left: 0.4rem; + padding: 1px; + line-height: inherit !important; +} + +.key > span { padding: .3em .6em !important; }