Skip to content

Commit

Permalink
Merge pull request #82 from plone/tmassman-theme-order
Browse files Browse the repository at this point in the history
Show active theme at the top of the theme list.
  • Loading branch information
vangheem committed Sep 19, 2015
2 parents c1b968a + f304f25 commit 82fe41a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/plone/app/theming/browser/controlpanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ def themeList(self):
portalUrl = getToolByName(self.context, 'portal_url')()

complete = [];
active_theme = None

for theme in self.availableThemes:
if theme.__name__ == TEMPLATE_THEME:
Expand All @@ -451,19 +452,25 @@ def themeList(self):
theme.preview,
)

themes.append({
theme_data = {
'name': theme.__name__,
'title': theme.title,
'description': theme.description,
'override': override,
'editable': theme.__name__ in zodbNames,
'preview': "{0}/{1}".format(portalUrl, previewUrl),
'selected': theme.__name__ == self.selectedTheme,
})
}
if theme.__name__ == self.selectedTheme:
active_theme = theme_data
else:
themes.append(theme_data)

complete.append(theme.__name__)

themes.sort(key=lambda x: x['title'])
if active_theme:
themes.insert(0, active_theme)

return themes

Expand Down

0 comments on commit 82fe41a

Please sign in to comment.