[open-ils-commits] r134 - in servres/trunk/conifer: static syrup templates templates/admin templates/generic (gfawcett)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Mar 3 20:33:22 EST 2009


Author: gfawcett
Date: 2009-03-03 20:33:21 -0500 (Tue, 03 Mar 2009)
New Revision: 134

Modified:
   servres/trunk/conifer/static/main.css
   servres/trunk/conifer/syrup/urls.py
   servres/trunk/conifer/syrup/views.py
   servres/trunk/conifer/templates/admin/index.xhtml
   servres/trunk/conifer/templates/generic/index.xhtml
   servres/trunk/conifer/templates/welcome.xhtml
Log:
added news-item admin tool


Modified: servres/trunk/conifer/static/main.css
===================================================================
--- servres/trunk/conifer/static/main.css	2009-03-02 04:09:18 UTC (rev 133)
+++ servres/trunk/conifer/static/main.css	2009-03-04 01:33:21 UTC (rev 134)
@@ -180,6 +180,10 @@
 .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; }

Modified: servres/trunk/conifer/syrup/urls.py
===================================================================
--- servres/trunk/conifer/syrup/urls.py	2009-03-02 04:09:18 UTC (rev 133)
+++ servres/trunk/conifer/syrup/urls.py	2009-03-04 01:33:21 UTC (rev 134)
@@ -27,6 +27,7 @@
     (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<term_id>\d+)/$', 'admin_term_edit'),
 #     (r'^admin/terms/(?P<term_id>\d+)/delete$', 'admin_term_delete'),

Modified: servres/trunk/conifer/syrup/views.py
===================================================================
--- servres/trunk/conifer/syrup/views.py	2009-03-02 04:09:18 UTC (rev 133)
+++ servres/trunk/conifer/syrup/views.py	2009-03-04 01:33:21 UTC (rev 134)
@@ -462,3 +462,19 @@
 
 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)
+

Modified: servres/trunk/conifer/templates/admin/index.xhtml
===================================================================
--- servres/trunk/conifer/templates/admin/index.xhtml	2009-03-02 04:09:18 UTC (rev 133)
+++ servres/trunk/conifer/templates/admin/index.xhtml	2009-03-04 01:33:21 UTC (rev 134)
@@ -13,6 +13,7 @@
   <ul>
     <li><a href="depts/">Departments</a></li>
     <li><a href="terms/">Terms</a></li>
+    <li><a href="news/">News Items</a></li>
   </ul>
 </body>
 </html>

Modified: servres/trunk/conifer/templates/generic/index.xhtml
===================================================================
--- servres/trunk/conifer/templates/generic/index.xhtml	2009-03-02 04:09:18 UTC (rev 133)
+++ servres/trunk/conifer/templates/generic/index.xhtml	2009-03-04 01:33:21 UTC (rev 134)
@@ -8,6 +8,9 @@
 <xi:include href="../master.xhtml"/>
 <head>
   <title>${title}</title>
+  <script type="text/javascript">
+    $(function() { $('table').tablesorter(); });
+  </script>
 </head>
 <body>
   <h1>${title}</h1>

Modified: servres/trunk/conifer/templates/welcome.xhtml
===================================================================
--- servres/trunk/conifer/templates/welcome.xhtml	2009-03-02 04:09:18 UTC (rev 133)
+++ servres/trunk/conifer/templates/welcome.xhtml	2009-03-04 01:33:21 UTC (rev 134)
@@ -10,9 +10,10 @@
 </head>
 <body>
   <h1>News</h1>
-  <div class="newsitem" py:for="news in models.NewsItem.objects.all().order_by('-published')[0:5]">
+  <div class="newsitem" py:for="news in models.NewsItem.objects.all().order_by('-published','-id')[0:5]">
     <h2>${news.subject}</h2>
     <div>${news.generated_body()}</div>
+    <div class="newsdate">posted ${news.published.strftime('%c')}</div>
   </div>
 </body>
 </html>



More information about the open-ils-commits mailing list