Skip to content

Commit

Permalink
Change color for scheduled and expired pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gagaro committed May 16, 2018
1 parent ea23b79 commit b0bfef9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
1.0.3 (unreleased)
==================

* Change color for scheduled and expired pages.
2 changes: 1 addition & 1 deletion wagtail_calendar/static/wagtail_calendar/js/planning.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ $(document).ready(function() {
var eventClick = function(event, jsEvent, view) {
var $event = $(this);
var $titleLink = $('<a>', {text: event.title, href: event.url});
$popup.find('#event-title').html('').append($titleLink);
$popup.find('#event-title').html('<i>(' + event.data.status + ')</i> ').append($titleLink);
$popup.find('#event-author').text(event.data.author);
$popup.find('#event-description').html(event.data.description);
$popup.show();
Expand Down
1 change: 1 addition & 0 deletions wagtail_calendar/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ def get_page_event_data(page):
'pk': page.pk,
'author': str(page.owner),
'description': page.search_description, # description can be HTML to allow more customization of the popup
'status': page.status_string,
}
8 changes: 7 additions & 1 deletion wagtail_calendar/wagtail_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,20 @@ def register_planned_events(request, start, end, events):
continue
if page.pk in ids:
continue # Avoid duplicated event
# Determine event color
color = '#e9b04d'
if page.expired:
color = '#f37e77'
elif page.approved_schedule:
color = '#358c8b'
ids.add(page.pk)
pages.append({
'id': page.pk,
'title': page.title,
'start': page.go_live_at.isoformat(),
'url': page.get_url(request),
'editable': permissions.for_page(page).can_publish(),
'color': '#e9b04d',
'color': color,
'data': get_page_event_data(page),
})
return events + pages
Expand Down

0 comments on commit b0bfef9

Please sign in to comment.