Show More
@@ -0,0 +1,53 b'' | |||||
|
1 | import logging | |||
|
2 | ||||
|
3 | from pylons import request, response, session, tmpl_context as c, url | |||
|
4 | from pylons.controllers.util import abort, redirect | |||
|
5 | ||||
|
6 | from pylons_app.lib.base import BaseController, render | |||
|
7 | ||||
|
8 | log = logging.getLogger(__name__) | |||
|
9 | ||||
|
10 | class PermissionsController(BaseController): | |||
|
11 | """REST Controller styled on the Atom Publishing Protocol""" | |||
|
12 | # To properly map this controller, ensure your config/routing.py | |||
|
13 | # file has a resource setup: | |||
|
14 | # map.resource('permission', 'permissions') | |||
|
15 | ||||
|
16 | def index(self, format='html'): | |||
|
17 | """GET /permissions: All items in the collection""" | |||
|
18 | # url('permissions') | |||
|
19 | return render('admin/permissions/permissions.html') | |||
|
20 | ||||
|
21 | def create(self): | |||
|
22 | """POST /permissions: Create a new item""" | |||
|
23 | # url('permissions') | |||
|
24 | ||||
|
25 | def new(self, format='html'): | |||
|
26 | """GET /permissions/new: Form to create a new item""" | |||
|
27 | # url('new_permission') | |||
|
28 | ||||
|
29 | def update(self, id): | |||
|
30 | """PUT /permissions/id: Update an existing item""" | |||
|
31 | # Forms posted to this method should contain a hidden field: | |||
|
32 | # <input type="hidden" name="_method" value="PUT" /> | |||
|
33 | # Or using helpers: | |||
|
34 | # h.form(url('permission', id=ID), | |||
|
35 | # method='put') | |||
|
36 | # url('permission', id=ID) | |||
|
37 | ||||
|
38 | def delete(self, id): | |||
|
39 | """DELETE /permissions/id: Delete an existing item""" | |||
|
40 | # Forms posted to this method should contain a hidden field: | |||
|
41 | # <input type="hidden" name="_method" value="DELETE" /> | |||
|
42 | # Or using helpers: | |||
|
43 | # h.form(url('permission', id=ID), | |||
|
44 | # method='delete') | |||
|
45 | # url('permission', id=ID) | |||
|
46 | ||||
|
47 | def show(self, id, format='html'): | |||
|
48 | """GET /permissions/id: Show a specific item""" | |||
|
49 | # url('permission', id=ID) | |||
|
50 | ||||
|
51 | def edit(self, id, format='html'): | |||
|
52 | """GET /permissions/id/edit: Form to edit an existing item""" | |||
|
53 | # url('edit_permission', id=ID) |
@@ -0,0 +1,21 b'' | |||||
|
1 | ## -*- coding: utf-8 -*- | |||
|
2 | <%inherit file="/base/base.html"/> | |||
|
3 | ||||
|
4 | <%def name="title()"> | |||
|
5 | ${_('Permissions administration')} | |||
|
6 | </%def> | |||
|
7 | <%def name="breadcrumbs()"> | |||
|
8 | ${h.link_to(u'Admin',h.url('admin_home'))} | |||
|
9 | / | |||
|
10 | ${_('Permissions')} | |||
|
11 | </%def> | |||
|
12 | <%def name="page_nav()"> | |||
|
13 | ${self.menu('admin')} | |||
|
14 | ${self.submenu('permissions')} | |||
|
15 | </%def> | |||
|
16 | <%def name="main()"> | |||
|
17 | <div> | |||
|
18 | <h2>${_('Permissions')}</h2> | |||
|
19 | todo :) | |||
|
20 | </div> | |||
|
21 | </%def> |
@@ -0,0 +1,43 b'' | |||||
|
1 | from pylons_app.tests import * | |||
|
2 | ||||
|
3 | class TestPermissionsController(TestController): | |||
|
4 | ||||
|
5 | def test_index(self): | |||
|
6 | response = self.app.get(url('permissions')) | |||
|
7 | # Test response... | |||
|
8 | ||||
|
9 | def test_index_as_xml(self): | |||
|
10 | response = self.app.get(url('formatted_permissions', format='xml')) | |||
|
11 | ||||
|
12 | def test_create(self): | |||
|
13 | response = self.app.post(url('permissions')) | |||
|
14 | ||||
|
15 | def test_new(self): | |||
|
16 | response = self.app.get(url('new_permission')) | |||
|
17 | ||||
|
18 | def test_new_as_xml(self): | |||
|
19 | response = self.app.get(url('formatted_new_permission', format='xml')) | |||
|
20 | ||||
|
21 | def test_update(self): | |||
|
22 | response = self.app.put(url('permission', id=1)) | |||
|
23 | ||||
|
24 | def test_update_browser_fakeout(self): | |||
|
25 | response = self.app.post(url('permission', id=1), params=dict(_method='put')) | |||
|
26 | ||||
|
27 | def test_delete(self): | |||
|
28 | response = self.app.delete(url('permission', id=1)) | |||
|
29 | ||||
|
30 | def test_delete_browser_fakeout(self): | |||
|
31 | response = self.app.post(url('permission', id=1), params=dict(_method='delete')) | |||
|
32 | ||||
|
33 | def test_show(self): | |||
|
34 | response = self.app.get(url('permission', id=1)) | |||
|
35 | ||||
|
36 | def test_show_as_xml(self): | |||
|
37 | response = self.app.get(url('formatted_permission', id=1, format='xml')) | |||
|
38 | ||||
|
39 | def test_edit(self): | |||
|
40 | response = self.app.get(url('edit_permission', id=1)) | |||
|
41 | ||||
|
42 | def test_edit_as_xml(self): | |||
|
43 | response = self.app.get(url('formatted_edit_permission', id=1, format='xml')) |
@@ -25,6 +25,7 b' def make_map(config):' | |||||
25 | #REST controllers |
|
25 | #REST controllers | |
26 | map.resource('repo', 'repos', path_prefix='/_admin') |
|
26 | map.resource('repo', 'repos', path_prefix='/_admin') | |
27 | map.resource('user', 'users', path_prefix='/_admin') |
|
27 | map.resource('user', 'users', path_prefix='/_admin') | |
|
28 | map.resource('permission', 'permissions', path_prefix='/_admin') | |||
28 |
|
29 | |||
29 | #ADMIN |
|
30 | #ADMIN | |
30 | with map.submapper(path_prefix='/_admin', controller='admin') as m: |
|
31 | with map.submapper(path_prefix='/_admin', controller='admin') as m: |
@@ -121,12 +121,12 b' div.page-header h1 {' | |||||
121 | font-weight: bold; |
|
121 | font-weight: bold; | |
122 | font-family: sans-serif; |
|
122 | font-family: sans-serif; | |
123 | letter-spacing: 1px; |
|
123 | letter-spacing: 1px; | |
124 |
color: # |
|
124 | color: #FFFFFF; | |
125 | } |
|
125 | } | |
126 |
|
126 | |||
127 | div.page-header h1 a { |
|
127 | div.page-header h1 a { | |
128 | font-weight: bold; |
|
128 | font-weight: bold; | |
129 | color: #FFF; |
|
129 | color: #FFFFFF; | |
130 | } |
|
130 | } | |
131 |
|
131 | |||
132 | div.page-header a { |
|
132 | div.page-header a { |
@@ -6,7 +6,6 b'' | |||||
6 | </%def> |
|
6 | </%def> | |
7 | <%def name="breadcrumbs()"> |
|
7 | <%def name="breadcrumbs()"> | |
8 | ${h.link_to(u'Admin',h.url('admin_home'))} |
|
8 | ${h.link_to(u'Admin',h.url('admin_home'))} | |
9 | / |
|
|||
10 | </%def> |
|
9 | </%def> | |
11 | <%def name="page_nav()"> |
|
10 | <%def name="page_nav()"> | |
12 | ${self.menu('admin')} |
|
11 | ${self.menu('admin')} |
@@ -7,6 +7,7 b'' | |||||
7 | <%def name="breadcrumbs()"> |
|
7 | <%def name="breadcrumbs()"> | |
8 | ${h.link_to(u'Admin',h.url('admin_home'))} |
|
8 | ${h.link_to(u'Admin',h.url('admin_home'))} | |
9 | / |
|
9 | / | |
|
10 | ${_('Repos')} | |||
10 | </%def> |
|
11 | </%def> | |
11 | <%def name="page_nav()"> |
|
12 | <%def name="page_nav()"> | |
12 | ${self.menu('admin')} |
|
13 | ${self.menu('admin')} |
@@ -7,6 +7,7 b'' | |||||
7 | <%def name="breadcrumbs()"> |
|
7 | <%def name="breadcrumbs()"> | |
8 | ${h.link_to(u'Admin',h.url('admin_home'))} |
|
8 | ${h.link_to(u'Admin',h.url('admin_home'))} | |
9 | / |
|
9 | / | |
|
10 | ${_('Repos')} | |||
10 | </%def> |
|
11 | </%def> | |
11 | <%def name="page_nav()"> |
|
12 | <%def name="page_nav()"> | |
12 | ${self.menu('admin')} |
|
13 | ${self.menu('admin')} | |
@@ -15,7 +16,7 b'' | |||||
15 | <%def name="main()"> |
|
16 | <%def name="main()"> | |
16 | <div> |
|
17 | <div> | |
17 | <h2>${_('Repositories')} - ${_('edit')}</h2> |
|
18 | <h2>${_('Repositories')} - ${_('edit')}</h2> | |
18 |
${h.form(url('repo', id= |
|
19 | ${h.form(url('repo', id=c.new_repo),method='put')} | |
19 | <table> |
|
20 | <table> | |
20 | <tr> |
|
21 | <tr> | |
21 | <td>${_('Name')}</td> |
|
22 | <td>${_('Name')}</td> |
@@ -7,6 +7,7 b'' | |||||
7 | <%def name="breadcrumbs()"> |
|
7 | <%def name="breadcrumbs()"> | |
8 | ${h.link_to(u'Admin',h.url('admin_home'))} |
|
8 | ${h.link_to(u'Admin',h.url('admin_home'))} | |
9 | / |
|
9 | / | |
|
10 | ${_('Repos')} | |||
10 | </%def> |
|
11 | </%def> | |
11 | <%def name="page_nav()"> |
|
12 | <%def name="page_nav()"> | |
12 | ${self.menu('admin')} |
|
13 | ${self.menu('admin')} |
@@ -7,6 +7,7 b'' | |||||
7 | <%def name="breadcrumbs()"> |
|
7 | <%def name="breadcrumbs()"> | |
8 | ${h.link_to(u'Admin',h.url('admin_home'))} |
|
8 | ${h.link_to(u'Admin',h.url('admin_home'))} | |
9 | / |
|
9 | / | |
|
10 | ${_('Users')} | |||
10 | </%def> |
|
11 | </%def> | |
11 | <%def name="page_nav()"> |
|
12 | <%def name="page_nav()"> | |
12 | ${self.menu('admin')} |
|
13 | ${self.menu('admin')} |
@@ -7,6 +7,7 b'' | |||||
7 | <%def name="breadcrumbs()"> |
|
7 | <%def name="breadcrumbs()"> | |
8 | ${h.link_to(u'Admin',h.url('admin_home'))} |
|
8 | ${h.link_to(u'Admin',h.url('admin_home'))} | |
9 | / |
|
9 | / | |
|
10 | ${_('Users')} | |||
10 | </%def> |
|
11 | </%def> | |
11 | <%def name="page_nav()"> |
|
12 | <%def name="page_nav()"> | |
12 | ${self.menu('admin')} |
|
13 | ${self.menu('admin')} |
@@ -7,6 +7,7 b'' | |||||
7 | <%def name="breadcrumbs()"> |
|
7 | <%def name="breadcrumbs()"> | |
8 | ${h.link_to(u'Admin',h.url('admin_home'))} |
|
8 | ${h.link_to(u'Admin',h.url('admin_home'))} | |
9 | / |
|
9 | / | |
|
10 | ${_('Users')} | |||
10 | </%def> |
|
11 | </%def> | |
11 | <%def name="page_nav()"> |
|
12 | <%def name="page_nav()"> | |
12 | ${self.menu('admin')} |
|
13 | ${self.menu('admin')} |
General Comments 0
You need to be logged in to leave comments.
Login now