from allura.lib.plugin import ThemeProvider as AlluraThemeProvider
import pkg_resources
import os
import logging
from ming.utils import LazyProperty
logging.info('Opensource projects theme plugin is loading')
class ThemeProvider(AlluraThemeProvider):
"""
The OpenSourceProjects theme
"""
master_template = 'opensourceprojects:templates/jinja_master/master.html'
jinja_macros = 'opensourceprojects:templates/jinja_master/theme_macros.html'
nav_menu = 'opensourceprojects:templates/jinja_master/nav_menu.html'
top_nav = 'opensourceprojects:templates/jinja_master/top_nav.html'
sidebar_menu = 'opensourceprojects:templates/jinja_master/sidebar_menu.html'
@classmethod
def register_ew_resources(cls, manager, name):
# FIXME: we are still pulling from the original allura theme
manager.register_directory( 'theme/%s' % name,
pkg_resources.resource_filename('opensourceprojects', os.path.join('nf', name)))
# The original allura theme
# manager.register_directory('theme/%s' % name,
# pkg_resources.resource_filename('allura', os.path.join('nf', 'allura')))
# The following are currently not supported
@LazyProperty
def upload_key_form(self):
return None
@LazyProperty
def add_user_skill(self):
return None
@LazyProperty
def remove_user_skill(self):
return None
@LazyProperty
def add_timeslot_form(self):
return None
@LazyProperty
def remove_timeslot_form(self):
return None
@LazyProperty
def add_inactive_period_form(self):
return None
@LazyProperty
def remove_inactive_period_form(self):
return None
def app_icon_url(self, app, size):
if size == 32:
size = 24
return AlluraThemeProvider.app_icon_url(self, app, size)