Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Add workflow admin features to fluent pages admin listing, re #156
Browse files Browse the repository at this point in the history
Add the workflow state columns and filtering by status & assigned user
to the fluent pages admin listing.

This required jumping through some hoops and tiptoeing around class
loading problems to get the new `ICEkitFluentPagesParentAdmin` mixin
class used by Fluent Pages to work, so it is delicate but seems okay.
  • Loading branch information
jmurty committed Nov 23, 2016
1 parent 6252b4d commit 22e9d24
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
29 changes: 29 additions & 0 deletions icekit/admin_mixins.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
from django.contrib import admin

from fluent_contents.admin import PlaceholderEditorAdmin
from fluent_contents.models import PlaceholderData

from icekit.workflow.admin import WorkflowMixinAdmin, \
WorkflowStateTabularInline


class FluentLayoutsMixin(PlaceholderEditorAdmin):
"""
Expand Down Expand Up @@ -33,6 +37,7 @@ def get_placeholder_data(self, request, obj):
data = obj.layout.get_placeholder_data()
return data


class HeroMixinAdmin(admin.ModelAdmin):
raw_id_fields = ('hero_image',)

Expand All @@ -57,3 +62,27 @@ class ListableMixinAdmin(admin.ModelAdmin):
)
}),
)


# This import must go here to avoid class loading errors
from icekit.publishing.admin import ICEKitFluentPagesParentAdminMixin


# WARNING: Beware of very closely named classes here
class ICEkitFluentPagesParentAdmin(
ICEKitFluentPagesParentAdminMixin, WorkflowMixinAdmin):
"""
A base for Fluent Pages parent admins that will include ICEkit features:
- publishing
- workflow
"""
# Go through contortions here to make sure the 'actions_column' is last
list_display = [
display_column for display_column in (
ICEKitFluentPagesParentAdminMixin.list_display +
WorkflowMixinAdmin.list_display)
if display_column != 'actions_column'] + ['actions_column']
list_filter = ICEKitFluentPagesParentAdminMixin.list_filter + \
WorkflowMixinAdmin.list_filter
inlines = [WorkflowStateTabularInline]
6 changes: 6 additions & 0 deletions icekit/dashboard/static/admin/css/icekit_dashboard.less
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,12 @@ fieldset.collapse {
.jqtree-django .col-author {
width: 120px;
}
.jqtree-django .col-last_edited_by_column {
width: 240px;
}
.jqtree-django .col-workflow_states_column {
width: 300px;
}
.jqtree-django .col-language_column,
.jqtree-django .col-sub_page_count {
width: 100px;
Expand Down
4 changes: 2 additions & 2 deletions icekit/project/settings/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@
FLUENT_MARKUP_MARKDOWN_EXTRAS = ()

FLUENT_PAGES_PARENT_ADMIN_MIXIN = \
'icekit.publishing.admin.ICEKitFluentPagesParentAdminMixin'
'icekit.admin_mixins.ICEkitFluentPagesParentAdmin'

# Avoid an exception because fluent-pages wants `TEMPLATE_DIRS[0]` to be
# defined, even though that setting is going away. This might not be necessary
Expand Down Expand Up @@ -663,8 +663,8 @@
'icekit.dashboard', # Must come before `django.contrib.admin` and `flat`
'icekit.integration.reversion',
'icekit.layouts',
'icekit.publishing',
'icekit.workflow',
'icekit.publishing',
'icekit.response_pages',
'icekit.content_collections',
'notifications',
Expand Down

0 comments on commit 22e9d24

Please sign in to comment.