Dead simple user list. veekun-promotions/2010050901
authorEevee <git@veekun.com>
Sat, 8 May 2010 23:28:17 +0000 (16:28 -0700)
committerEevee <git@veekun.com>
Sat, 8 May 2010 23:28:17 +0000 (16:28 -0700)
spline/plugins/users/__init__.py
spline/plugins/users/controllers/users.py
spline/plugins/users/templates/users/list.mako [new file with mode: 0644]

index f0c8a33..e606823 100644 (file)
@@ -22,7 +22,8 @@ def add_routes_hook(map, *args, **kwargs):
     # Self-admin
     map.connect('/users/{id};{name}/edit', controller='users', action='profile_edit')
 
     # Self-admin
     map.connect('/users/{id};{name}/edit', controller='users', action='profile_edit')
 
-    # Public per-user pages
+    # Public user pages
+    map.connect('/users', controller='users', action='list')
     map.connect('/users/{id};{name}', controller='users', action='profile')
     map.connect('/users/{id}', controller='users', action='profile')
 
     map.connect('/users/{id};{name}', controller='users', action='profile')
     map.connect('/users/{id}', controller='users', action='profile')
 
index 4811aa0..4afb9cd 100644 (file)
@@ -41,11 +41,9 @@ class ProfileEditForm(Form):
 
 class UsersController(BaseController):
 
 
 class UsersController(BaseController):
 
-    def index(self):
-        # Return a rendered template
-        #   return render('/template.mako')
-        # or, Return a response
-        return 'stub'
+    def list(self):
+        c.users = meta.Session.query(model.User).order_by(model.User.id.asc())
+        return render('/users/list.mako')
 
     def profile(self, id, name=None):
         """Main user profile.
 
     def profile(self, id, name=None):
         """Main user profile.
diff --git a/spline/plugins/users/templates/users/list.mako b/spline/plugins/users/templates/users/list.mako
new file mode 100644 (file)
index 0000000..fc25241
--- /dev/null
@@ -0,0 +1,16 @@
+<%inherit file="/base.mako" />
+<%namespace name="userlib" file="/users/lib.mako" />
+
+<%def name="title()">Users</%def>
+
+<h1>Users</h1>
+
+<ul class="classic-list">
+    % for user in c.users:
+    <li>
+        <a href="${url(controller='users', action='profile', id=user.id, name=user.name)}">
+            ${userlib.color_bar(user)} ${user.name}
+        </a>
+    </li>
+    % endfor
+</ul>