diff --git a/pylons_app/config/routing.py b/pylons_app/config/routing.py --- a/pylons_app/config/routing.py +++ b/pylons_app/config/routing.py @@ -25,6 +25,7 @@ def make_map(config): #REST controllers map.resource('repo', 'repos', path_prefix='/_admin') map.resource('user', 'users', path_prefix='/_admin') + map.resource('permission', 'permissions', path_prefix='/_admin') #ADMIN with map.submapper(path_prefix='/_admin', controller='admin') as m: diff --git a/pylons_app/controllers/permissions.py b/pylons_app/controllers/permissions.py new file mode 100644 --- /dev/null +++ b/pylons_app/controllers/permissions.py @@ -0,0 +1,53 @@ +import logging + +from pylons import request, response, session, tmpl_context as c, url +from pylons.controllers.util import abort, redirect + +from pylons_app.lib.base import BaseController, render + +log = logging.getLogger(__name__) + +class PermissionsController(BaseController): + """REST Controller styled on the Atom Publishing Protocol""" + # To properly map this controller, ensure your config/routing.py + # file has a resource setup: + # map.resource('permission', 'permissions') + + def index(self, format='html'): + """GET /permissions: All items in the collection""" + # url('permissions') + return render('admin/permissions/permissions.html') + + def create(self): + """POST /permissions: Create a new item""" + # url('permissions') + + def new(self, format='html'): + """GET /permissions/new: Form to create a new item""" + # url('new_permission') + + def update(self, id): + """PUT /permissions/id: Update an existing item""" + # Forms posted to this method should contain a hidden field: + # + # Or using helpers: + # h.form(url('permission', id=ID), + # method='put') + # url('permission', id=ID) + + def delete(self, id): + """DELETE /permissions/id: Delete an existing item""" + # Forms posted to this method should contain a hidden field: + # + # Or using helpers: + # h.form(url('permission', id=ID), + # method='delete') + # url('permission', id=ID) + + def show(self, id, format='html'): + """GET /permissions/id: Show a specific item""" + # url('permission', id=ID) + + def edit(self, id, format='html'): + """GET /permissions/id/edit: Form to edit an existing item""" + # url('edit_permission', id=ID) diff --git a/pylons_app/public/css/monoblue_custom.css b/pylons_app/public/css/monoblue_custom.css --- a/pylons_app/public/css/monoblue_custom.css +++ b/pylons_app/public/css/monoblue_custom.css @@ -121,12 +121,12 @@ div.page-header h1 { font-weight: bold; font-family: sans-serif; letter-spacing: 1px; - color: #DDD; + color: #FFFFFF; } div.page-header h1 a { font-weight: bold; - color: #FFF; + color: #FFFFFF; } div.page-header a { diff --git a/pylons_app/templates/admin/admin.html b/pylons_app/templates/admin/admin.html --- a/pylons_app/templates/admin/admin.html +++ b/pylons_app/templates/admin/admin.html @@ -6,7 +6,6 @@ <%def name="breadcrumbs()"> ${h.link_to(u'Admin',h.url('admin_home'))} - / <%def name="page_nav()"> ${self.menu('admin')} diff --git a/pylons_app/templates/admin/permissions/permissions.html b/pylons_app/templates/admin/permissions/permissions.html new file mode 100644 --- /dev/null +++ b/pylons_app/templates/admin/permissions/permissions.html @@ -0,0 +1,21 @@ +## -*- coding: utf-8 -*- +<%inherit file="/base/base.html"/> + +<%def name="title()"> + ${_('Permissions administration')} + +<%def name="breadcrumbs()"> + ${h.link_to(u'Admin',h.url('admin_home'))} + / + ${_('Permissions')} + +<%def name="page_nav()"> + ${self.menu('admin')} + ${self.submenu('permissions')} + +<%def name="main()"> +
+

${_('Permissions')}

+ todo :) +
+ diff --git a/pylons_app/templates/admin/repos/repo_add.html b/pylons_app/templates/admin/repos/repo_add.html --- a/pylons_app/templates/admin/repos/repo_add.html +++ b/pylons_app/templates/admin/repos/repo_add.html @@ -7,6 +7,7 @@ <%def name="breadcrumbs()"> ${h.link_to(u'Admin',h.url('admin_home'))} / + ${_('Repos')} <%def name="page_nav()"> ${self.menu('admin')} diff --git a/pylons_app/templates/admin/repos/repo_edit.html b/pylons_app/templates/admin/repos/repo_edit.html --- a/pylons_app/templates/admin/repos/repo_edit.html +++ b/pylons_app/templates/admin/repos/repo_edit.html @@ -7,6 +7,7 @@ <%def name="breadcrumbs()"> ${h.link_to(u'Admin',h.url('admin_home'))} / + ${_('Repos')} <%def name="page_nav()"> ${self.menu('admin')} @@ -15,7 +16,7 @@ <%def name="main()">

${_('Repositories')} - ${_('edit')}

- ${h.form(url('repo', id=ID),method='put'))} + ${h.form(url('repo', id=c.new_repo),method='put')} diff --git a/pylons_app/templates/admin/repos/repos.html b/pylons_app/templates/admin/repos/repos.html --- a/pylons_app/templates/admin/repos/repos.html +++ b/pylons_app/templates/admin/repos/repos.html @@ -7,6 +7,7 @@ <%def name="breadcrumbs()"> ${h.link_to(u'Admin',h.url('admin_home'))} / + ${_('Repos')} <%def name="page_nav()"> ${self.menu('admin')} diff --git a/pylons_app/templates/admin/users/user_add.html b/pylons_app/templates/admin/users/user_add.html --- a/pylons_app/templates/admin/users/user_add.html +++ b/pylons_app/templates/admin/users/user_add.html @@ -7,6 +7,7 @@ <%def name="breadcrumbs()"> ${h.link_to(u'Admin',h.url('admin_home'))} / + ${_('Users')} <%def name="page_nav()"> ${self.menu('admin')} diff --git a/pylons_app/templates/admin/users/user_edit.html b/pylons_app/templates/admin/users/user_edit.html --- a/pylons_app/templates/admin/users/user_edit.html +++ b/pylons_app/templates/admin/users/user_edit.html @@ -7,6 +7,7 @@ <%def name="breadcrumbs()"> ${h.link_to(u'Admin',h.url('admin_home'))} / + ${_('Users')} <%def name="page_nav()"> ${self.menu('admin')} diff --git a/pylons_app/templates/admin/users/users.html b/pylons_app/templates/admin/users/users.html --- a/pylons_app/templates/admin/users/users.html +++ b/pylons_app/templates/admin/users/users.html @@ -7,6 +7,7 @@ <%def name="breadcrumbs()"> ${h.link_to(u'Admin',h.url('admin_home'))} / + ${_('Users')} <%def name="page_nav()"> ${self.menu('admin')} diff --git a/pylons_app/tests/functional/test_permissions.py b/pylons_app/tests/functional/test_permissions.py new file mode 100644 --- /dev/null +++ b/pylons_app/tests/functional/test_permissions.py @@ -0,0 +1,43 @@ +from pylons_app.tests import * + +class TestPermissionsController(TestController): + + def test_index(self): + response = self.app.get(url('permissions')) + # Test response... + + def test_index_as_xml(self): + response = self.app.get(url('formatted_permissions', format='xml')) + + def test_create(self): + response = self.app.post(url('permissions')) + + def test_new(self): + response = self.app.get(url('new_permission')) + + def test_new_as_xml(self): + response = self.app.get(url('formatted_new_permission', format='xml')) + + def test_update(self): + response = self.app.put(url('permission', id=1)) + + def test_update_browser_fakeout(self): + response = self.app.post(url('permission', id=1), params=dict(_method='put')) + + def test_delete(self): + response = self.app.delete(url('permission', id=1)) + + def test_delete_browser_fakeout(self): + response = self.app.post(url('permission', id=1), params=dict(_method='delete')) + + def test_show(self): + response = self.app.get(url('permission', id=1)) + + def test_show_as_xml(self): + response = self.app.get(url('formatted_permission', id=1, format='xml')) + + def test_edit(self): + response = self.app.get(url('edit_permission', id=1)) + + def test_edit_as_xml(self): + response = self.app.get(url('formatted_edit_permission', id=1, format='xml'))
${_('Name')}