[open-ils-commits] r99 - in servres/trunk/conifer: static syrup templates templates/auth

svn at svn.open-ils.org svn at svn.open-ils.org
Sat Jan 10 16:02:12 EST 2009


Author: gfawcett
Date: 2009-01-10 16:02:08 -0500 (Sat, 10 Jan 2009)
New Revision: 99

Added:
   servres/trunk/conifer/templates/tabbar_anonymous.xhtml
Modified:
   servres/trunk/conifer/static/main.css
   servres/trunk/conifer/syrup/views.py
   servres/trunk/conifer/templates/auth/login.xhtml
   servres/trunk/conifer/templates/master.xhtml
   servres/trunk/conifer/templates/tabbar.xhtml
   servres/trunk/conifer/templates/welcome.xhtml
Log:
Tightened up login-form, welcome page

* Added a tab-bar for anonymous users, and dropped the ugly right-side panel
* Login form returns with an error instead of an ugly text-message
* Logout returns you to the Home page
* Cleaned up the tab-bar a bit; some items there really belong elsewhere.


Modified: servres/trunk/conifer/static/main.css
===================================================================
--- servres/trunk/conifer/static/main.css	2009-01-10 21:01:42 UTC (rev 98)
+++ servres/trunk/conifer/static/main.css	2009-01-10 21:02:08 UTC (rev 99)
@@ -28,7 +28,9 @@
 
 #brandheader { background-color: white; padding: 8; }
 
-#header a { color: #fff; font-weight: bold;  }
+#header a { color: #fff; font-weight: bold;  padding: 8 6; }
+#header a.loginbutton { background-color: #a44; padding: 8 16; }
+#header a:hover { background-color: #fb7; color: black; text-decoration: none; }
 
 #footer {  
     margin-top: 12;
@@ -99,3 +101,11 @@
 .topheading th {
     background-color: #ddf;
 }
+
+
+p.todo, div.todo { background-color: #fdd; padding: 6; margin: 12; border-left: #d99 6px solid; }
+
+
+.newsitem { 
+    max-width: 600;
+}
\ No newline at end of file

Modified: servres/trunk/conifer/syrup/views.py
===================================================================
--- servres/trunk/conifer/syrup/views.py	2009-01-10 21:01:42 UTC (rev 98)
+++ servres/trunk/conifer/syrup/views.py	2009-01-10 21:02:08 UTC (rev 99)
@@ -11,24 +11,36 @@
 
 
 #------------------------------------------------------------
+# Authentication
 
 def auth_handler(request, path):
     if path == 'login/':
         if request.method == 'GET':
-            return g.render('auth/login.xhtml')
+            next=request.GET.get('next', '/syrup/')
+            if request.user.is_authenticated():
+                return HttpResponseRedirect(next)
+            else:
+                return g.render('auth/login.xhtml', 
+                                next=request.GET.get('next'),
+                                err=None # fixme, this shouldn't be
+                                         # necessary. Genshi should treat
+                                         # missing names as None, but something
+                                         # is wrong.
+                                )
         else:
             userid, password = request.POST['userid'], request.POST['password']
+            next = request.POST['next']
             user = authenticate(username=userid, password=password)
             if user is None:
-                return HttpResponse('invalid login.')
+                return g.render('auth/login.xhtml', err='Invalid username or password. Please try again.', next=next)
             elif not user.is_active:
-                return HttpResponse('disabled account.')
+                return g.render('auth/login.xhtml', err='Sorry, this account has been disabled.', next=next)
             else:
                 login(request, user)
-                return HttpResponseRedirect(request.POST['next'])
+                return HttpResponseRedirect(request.POST.get('next', '/syrup/'))
     elif path == 'logout':
         logout(request)
-        return HttpResponse('Logged out. Thanks for coming!')
+        return HttpResponseRedirect('/syrup/')
     else:
         return HttpResponse('auth_handler: ' + path)
 

Modified: servres/trunk/conifer/templates/auth/login.xhtml
===================================================================
--- servres/trunk/conifer/templates/auth/login.xhtml	2009-01-10 21:01:42 UTC (rev 98)
+++ servres/trunk/conifer/templates/auth/login.xhtml	2009-01-10 21:02:08 UTC (rev 99)
@@ -14,7 +14,8 @@
 <body>
   <h1>Please log in.</h1>
   <form action="." method="post">
-    <input type="hidden" name="next" value="${request.GET['next']}"/>
+    <input type="hidden" name="next" value="${next}"/>
+    <div class="errors" py:if="err">${err}</div>
   <table>
     <tr>
       <th>User ID:</th>

Modified: servres/trunk/conifer/templates/master.xhtml
===================================================================
--- servres/trunk/conifer/templates/master.xhtml	2009-01-10 21:01:42 UTC (rev 98)
+++ servres/trunk/conifer/templates/master.xhtml	2009-01-10 21:02:08 UTC (rev 99)
@@ -45,9 +45,11 @@
       </span>
       <span py:if="not user.is_authenticated()">
 	<strong style="padding-right: 18;">Welcome!</strong>
+	<a class="loginbutton" href="/accounts/login/">Log In</a>
       </span>
     </div>
       <xi:include py:if="user.is_authenticated()" href="tabbar.xhtml"/>
+      <xi:include py:if="not user.is_authenticated()" href="tabbar_anonymous.xhtml"/>
       <div id="mainpanel">
 	${select('*|text()')}
       </div>

Modified: servres/trunk/conifer/templates/tabbar.xhtml
===================================================================
--- servres/trunk/conifer/templates/tabbar.xhtml	2009-01-10 21:01:42 UTC (rev 98)
+++ servres/trunk/conifer/templates/tabbar.xhtml	2009-01-10 21:02:08 UTC (rev 99)
@@ -8,10 +8,10 @@
 -->
 <ul id="tabbar">
   <li><a href="/syrup/">Home</a></li>
+  <li><a href="/syrup/browse/">Browse</a></li>
   <li class="active"><a href="/syrup/course/">My Courses</a></li>
-  <li><a href="/syrup">Add a Reserve</a></li>
-  <li><a href="/syrup/join/">Join Course</a></li>
-  <li><a href="/syrup">Manage Users</a></li>
-  <li><a href="/syrup">Preferences</a></li>
+  <li><a href="/syrup/join/">Join a Course</a></li>
+  <!-- <li><a href="/syrup">Add a Reserve</a></li> -->
+  <!-- <li><a href="/syrup">Manage Users</a></li> -->
 </ul>
 </html>

Added: servres/trunk/conifer/templates/tabbar_anonymous.xhtml
===================================================================
--- servres/trunk/conifer/templates/tabbar_anonymous.xhtml	                        (rev 0)
+++ servres/trunk/conifer/templates/tabbar_anonymous.xhtml	2009-01-10 21:02:08 UTC (rev 99)
@@ -0,0 +1,13 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:py="http://genshi.edgewall.org/"
+      xmlns:xi="http://www.w3.org/2001/XInclude"
+      py:strip="">
+<!--
+    eventually these should be customized based on user level
+    use one for now
+-->
+<ul id="tabbar">
+  <li><a href="/syrup/">Home</a></li>
+  <li><a href="/syrup/browse/">Browse</a></li>
+</ul>
+</html>

Modified: servres/trunk/conifer/templates/welcome.xhtml
===================================================================
--- servres/trunk/conifer/templates/welcome.xhtml	2009-01-10 21:01:42 UTC (rev 98)
+++ servres/trunk/conifer/templates/welcome.xhtml	2009-01-10 21:02:08 UTC (rev 99)
@@ -9,12 +9,8 @@
   <title>${title}</title>
 </head>
 <body>
-  <div style="float: right; margin: 0 24; background-color: #feb; padding: 24;">
-    <p py:if="not user.is_authenticated()"><a href="/accounts/login/?next=/syrup/">Log in</a></p>
-    <p><a href="browse">Browse</a></p> 
-  </div>
   <h1>News</h1>
-  <div 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')[0:5]">
     <h2>${news.subject}</h2>
     <div>${news.body}</div>
   </div>



More information about the open-ils-commits mailing list