From b54f05e7a004ae762006bebf043d8cfa8da7b808 Mon Sep 17 00:00:00 2001 From: gfawcett Date: Wed, 4 Mar 2009 01:33:21 +0000 Subject: [PATCH] added news-item admin tool git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@134 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- conifer/static/main.css | 4 ++++ conifer/syrup/urls.py | 1 + conifer/syrup/views.py | 16 ++++++++++++++++ conifer/templates/admin/index.xhtml | 1 + conifer/templates/generic/index.xhtml | 3 +++ conifer/templates/welcome.xhtml | 3 ++- 6 files changed, 27 insertions(+), 1 deletion(-) diff --git a/conifer/static/main.css b/conifer/static/main.css index fd6a3c9..7596901 100644 --- a/conifer/static/main.css +++ b/conifer/static/main.css @@ -180,6 +180,10 @@ p.todo, div.todo { background-color: #fdd; padding: 6; margin: 12; border-left: .newsitem { max-width: 600; } +.newsitem .newsdate { + margin: 4 0 8 0; text-align: right; + font-size: 80%; color: navy; +} .menublockopener { color: gray !important; font-weight: normal !important; } .menublock { background-color: #f0f0e0; font-size: 95%; padding: 1 4; } diff --git a/conifer/syrup/urls.py b/conifer/syrup/urls.py index c5e21f8..5e1f6a1 100644 --- a/conifer/syrup/urls.py +++ b/conifer/syrup/urls.py @@ -27,6 +27,7 @@ urlpatterns = patterns('conifer.syrup.views', (r'^admin/$', 'admin_index'), (r'^admin/terms/' + GENERIC_REGEX, 'admin_terms'), (r'^admin/depts/' + GENERIC_REGEX, 'admin_depts'), + (r'^admin/news/' + GENERIC_REGEX, 'admin_news'), # (r'^admin/terms/(?P\d+)/$', 'admin_term_edit'), # (r'^admin/terms/(?P\d+)/delete$', 'admin_term_delete'), diff --git a/conifer/syrup/views.py b/conifer/syrup/views.py index ffb423e..ddfd243 100644 --- a/conifer/syrup/views.py +++ b/conifer/syrup/views.py @@ -462,3 +462,19 @@ class DeptForm(ModelForm): admin_depts = generic_handler(DeptForm) + +class NewsForm(ModelForm): + class Meta: + model = models.NewsItem + + class Index: + title = 'News Items' + all = models.NewsItem.objects.order_by('-id').all + cols = ['id', 'subject', 'published'] + links = [0, 1] + + clean_subject = strip_and_nonblank('subject') + clean_body = strip_and_nonblank('body') + +admin_news = generic_handler(NewsForm) + diff --git a/conifer/templates/admin/index.xhtml b/conifer/templates/admin/index.xhtml index a4a7150..9d2250a 100644 --- a/conifer/templates/admin/index.xhtml +++ b/conifer/templates/admin/index.xhtml @@ -13,6 +13,7 @@ title = 'Administrative Options' diff --git a/conifer/templates/generic/index.xhtml b/conifer/templates/generic/index.xhtml index ecab82f..819129a 100644 --- a/conifer/templates/generic/index.xhtml +++ b/conifer/templates/generic/index.xhtml @@ -8,6 +8,9 @@ title = index.title ${title} +

${title}

diff --git a/conifer/templates/welcome.xhtml b/conifer/templates/welcome.xhtml index dac15ff..57cfcc0 100644 --- a/conifer/templates/welcome.xhtml +++ b/conifer/templates/welcome.xhtml @@ -10,9 +10,10 @@ title = 'Welcome!'

News

-
+

${news.subject}

${news.generated_body()}
+
posted ${news.published.strftime('%c')}
-- 2.11.0