Add email config views

This commit is contained in:
Lance Edgar 2016-12-10 14:16:37 -06:00
parent c61f5c8053
commit 365d5847a4
5 changed files with 37 additions and 1 deletions

20
rattail_demo/config.py Normal file
View file

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
"""
Rattail Demo config extension
"""
from __future__ import unicode_literals, absolute_import
from rattail.config import ConfigExtension
class DemoConfigExtension(ConfigExtension):
"""
Rattail Demo config extension
"""
key = 'rattail-demo'
def configure(self, config):
# tell rattail where our stuff lives
config.setdefault('rattail.mail', 'emails', 'rattail_demo.emails')

9
rattail_demo/emails.py Normal file
View file

@ -0,0 +1,9 @@
# -*- coding: utf-8 -*-
"""
Email definitions
"""
from __future__ import unicode_literals, absolute_import
# just tempmon emails for now
from rattail_tempmon.emails import tempmon_low_temp, tempmon_high_temp, tempmon_critical_temp, tempmon_error

View file

@ -90,7 +90,7 @@
</li>
% endif
% if request.has_any_perm('users.list', 'roles.list', 'settings.list'):
% if request.has_any_perm('users.list', 'roles.list', 'emailprofiles.list', 'settings.list'):
<li>
<a>Admin</a>
<ul>
@ -100,6 +100,9 @@
% if request.has_perm('roles.list'):
<li>${h.link_to("Roles", url('roles'))}</li>
% endif
% if request.has_perm('emailprofiles.list'):
<li>${h.link_to("Email Profiles", url('emailprofiles'))}</li>
% endif
% if request.has_perm('settings.list'):
<li>${h.link_to("Settings", url('settings'))}</li>
% endif

View file

@ -33,6 +33,7 @@ def includeme(config):
config.include('tailbone.views.brands')
config.include('tailbone.views.customers')
config.include('tailbone.views.departments')
config.include('tailbone.views.email')
config.include('tailbone.views.employees')
config.include('tailbone.views.families')
config.include('rattail_demo.web.views.people')

View file

@ -76,5 +76,8 @@ setup(
'paste.app_factory': [
'main = rattail_demo.web.app:main',
],
'rattail.config.extensions': [
'rattail-demo = rattail_demo.config:DemoConfigExtension',
],
},
)