##// END OF EJS Templates
Html changes and cleanups, made folders for html templates, implemented tags and branches pages
marcink -
r127:20dc7a5e default
parent child Browse files
Show More
@@ -0,0 +1,46 b''
1 <%inherit file="/base/base.html"/>
2 <%! from pylons_app.lib import filters %>
3 <%def name="title()">
4 ${_('Branches')}
5 </%def>
6 <%def name="breadcrumbs()">
7 ${h.link_to(u'Home',h.url('/'))}
8 /
9 ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
10 /
11 ${_('branches')}
12 </%def>
13 <%def name="page_nav()">
14 <form action="log">
15 <dl class="search">
16 <dt><label>Search: </label></dt>
17 <dd><input type="text" name="rev" /></dd>
18 </dl>
19 </form>
20
21 ${self.menu('branches')}
22 </%def>
23 <%def name="main()">
24
25 <h2 class="no-link no-border">${_('Branches')}</h2>
26
27 <table>
28 %for cnt,branch in enumerate(c.repo_branches):
29 <tr class="parity${cnt%2}">
30 <td>${branch._ctx.date()|n,filters.age}</td>
31 <td></td>
32 <td>
33 <span class="logtags">
34 <span class="branchtag">${h.link_to(branch.branch,h.url('changeset_home',repo_name=c.repo_name,revision=branch._short))}</span>
35 </span>
36 </td>
37 <td class="nowrap">
38 ${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=branch._short))}
39 |
40 ${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=branch._short))}
41 </td>
42 </tr>
43 %endfor
44 </table>
45
46 </%def> No newline at end of file
@@ -0,0 +1,48 b''
1 <%inherit file="/base/base.html"/>
2 <%!
3 from pylons_app.lib import filters
4 %>
5 <%def name="title()">
6 ${_('Tags')}
7 </%def>
8 <%def name="breadcrumbs()">
9 ${h.link_to(u'Home',h.url('/'))}
10 /
11 ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
12 /
13 ${_('tags')}
14 </%def>
15 <%def name="page_nav()">
16 <form action="log">
17 <dl class="search">
18 <dt><label>Search: </label></dt>
19 <dd><input type="text" name="rev" /></dd>
20 </dl>
21 </form>
22
23 ${self.menu('tags')}
24 </%def>
25 <%def name="main()">
26
27 <h2 class="no-link no-border">${_('Tags')}</h2>
28
29 <table>
30 %for cnt,tag in enumerate(c.repo_tags):
31 <tr class="parity${cnt%2}">
32 <td>${tag._ctx.date()|n,filters.age}</td>
33 <td></td>
34 <td>
35 <span class="logtags">
36 <span class="tagtag">${h.link_to(tag.tags[-1],h.url('changeset_home',repo_name=c.repo_name,revision=tag._short))}</span>
37 </span>
38 </td>
39 <td class="nowrap">
40 ${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=tag._short))}
41 |
42 ${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=tag._short))}
43 </td>
44 </tr>
45 %endfor
46 </table>
47
48 </%def> No newline at end of file
@@ -1,100 +1,100 b''
1 import logging
1 import logging
2
2
3 from pylons import request, response, session, tmpl_context as c, url, app_globals as g
3 from pylons import request, response, session, tmpl_context as c, url, app_globals as g
4 from pylons.controllers.util import abort, redirect
4 from pylons.controllers.util import abort, redirect
5
5
6 from pylons_app.lib.base import BaseController, render
6 from pylons_app.lib.base import BaseController, render
7 import os
7 import os
8 from pylons_app.lib import auth
8 from pylons_app.lib import auth
9 from pylons_app.model.forms import LoginForm
9 from pylons_app.model.forms import LoginForm
10 import formencode
10 import formencode
11 import formencode.htmlfill as htmlfill
11 import formencode.htmlfill as htmlfill
12 from pylons_app.model import meta
12 from pylons_app.model import meta
13 from pylons_app.model.db import Users, UserLogs
13 from pylons_app.model.db import Users, UserLogs
14 from webhelpers.paginate import Page
14 from webhelpers.paginate import Page
15 from pylons_app.lib.utils import check_repo
15 from pylons_app.lib.utils import check_repo
16 log = logging.getLogger(__name__)
16 log = logging.getLogger(__name__)
17
17
18 class AdminController(BaseController):
18 class AdminController(BaseController):
19
19
20 def __before__(self):
20 def __before__(self):
21
21
22 c.admin_user = session.get('admin_user', False)
22 c.admin_user = session.get('admin_user', False)
23 c.admin_username = session.get('admin_username')
23 c.admin_username = session.get('admin_username')
24
24
25 def index(self):
25 def index(self):
26 # Return a rendered template
26 # Return a rendered template
27 if request.POST:
27 if request.POST:
28 #import Login Form validator class
28 #import Login Form validator class
29 login_form = LoginForm()
29 login_form = LoginForm()
30
30
31 try:
31 try:
32 c.form_result = login_form.to_python(dict(request.params))
32 c.form_result = login_form.to_python(dict(request.params))
33 if auth.admin_auth(c.form_result['username'], c.form_result['password']):
33 if auth.admin_auth(c.form_result['username'], c.form_result['password']):
34 session['admin_user'] = True
34 session['admin_user'] = True
35 session['admin_username'] = c.form_result['username']
35 session['admin_username'] = c.form_result['username']
36 session.save()
36 session.save()
37 return redirect(url('admin_home'))
37 return redirect(url('admin_home'))
38 else:
38 else:
39 raise formencode.Invalid('Login Error', None, None,
39 raise formencode.Invalid('Login Error', None, None,
40 error_dict={'username':'invalid login',
40 error_dict={'username':'invalid login',
41 'password':'invalid password'})
41 'password':'invalid password'})
42
42
43 except formencode.Invalid, error:
43 except formencode.Invalid, error:
44 c.form_result = error.value
44 c.form_result = error.value
45 c.form_errors = error.error_dict or {}
45 c.form_errors = error.error_dict or {}
46 html = render('/admin.html')
46 html = render('admin/admin.html')
47
47
48 return htmlfill.render(
48 return htmlfill.render(
49 html,
49 html,
50 defaults=c.form_result,
50 defaults=c.form_result,
51 encoding="UTF-8"
51 encoding="UTF-8"
52 )
52 )
53 if c.admin_user:
53 if c.admin_user:
54 sa = meta.Session
54 sa = meta.Session
55
55
56 users_log = sa.query(UserLogs)\
56 users_log = sa.query(UserLogs)\
57 .order_by(UserLogs.action_date.desc())
57 .order_by(UserLogs.action_date.desc())
58 p = int(request.params.get('page', 1))
58 p = int(request.params.get('page', 1))
59 c.users_log = Page(users_log, page=p, items_per_page=10)
59 c.users_log = Page(users_log, page=p, items_per_page=10)
60 c.log_data = render('admin_log.html')
60 c.log_data = render('admin/admin_log.html')
61 if request.params.get('partial'):
61 if request.params.get('partial'):
62 return c.log_data
62 return c.log_data
63 return render('/admin.html')
63 return render('admin/admin.html')
64
64
65 def hgrc(self, dirname):
65 def hgrc(self, dirname):
66 filename = os.path.join(dirname, '.hg', 'hgrc')
66 filename = os.path.join(dirname, '.hg', 'hgrc')
67 return filename
67 return filename
68
68
69 def add_repo(self, new_repo):
69 def add_repo(self, new_repo):
70
70
71
71
72 #extra check it can be add since it's the command
72 #extra check it can be add since it's the command
73 if new_repo == '_admin':
73 if new_repo == '_admin':
74 c.msg = 'DENIED'
74 c.msg = 'DENIED'
75 c.new_repo = ''
75 c.new_repo = ''
76 return render('add.html')
76 return render('add.html')
77
77
78 new_repo = new_repo.replace(" ", "_")
78 new_repo = new_repo.replace(" ", "_")
79 new_repo = new_repo.replace("-", "_")
79 new_repo = new_repo.replace("-", "_")
80
80
81 try:
81 try:
82 self._create_repo(new_repo)
82 self._create_repo(new_repo)
83 c.new_repo = new_repo
83 c.new_repo = new_repo
84 c.msg = 'added repo'
84 c.msg = 'added repo'
85 except Exception as e:
85 except Exception as e:
86 c.new_repo = 'Exception when adding: %s' % new_repo
86 c.new_repo = 'Exception when adding: %s' % new_repo
87 c.msg = str(e)
87 c.msg = str(e)
88
88
89 return render('add.html')
89 return render('add.html')
90
90
91
91
92 def _create_repo(self, repo_name):
92 def _create_repo(self, repo_name):
93 if repo_name in [None, '', 'add']:
93 if repo_name in [None, '', 'add']:
94 raise Exception('undefined repo_name of repo')
94 raise Exception('undefined repo_name of repo')
95
95
96 if check_repo(repo_name, g.base_path):
96 if check_repo(repo_name, g.base_path):
97 log.info('creating repo %s in %s', repo_name, self.repo_path)
97 log.info('creating repo %s in %s', repo_name, self.repo_path)
98 cmd = """mkdir %s && hg init %s""" \
98 cmd = """mkdir %s && hg init %s""" \
99 % (self.repo_path, self.repo_path)
99 % (self.repo_path, self.repo_path)
100 os.popen(cmd)
100 os.popen(cmd)
@@ -1,16 +1,22 b''
1 import logging
1 import logging
2
2
3 from pylons import request, response, session, tmpl_context as c, url
3 from pylons import tmpl_context as c, app_globals as g, session, request, config, url
4 from pylons.controllers.util import abort, redirect
4 from pylons.controllers.util import abort, redirect
5
5
6 from pylons_app.lib.base import BaseController, render
6 from pylons_app.lib.base import BaseController, render
7 from pylons_app.lib.utils import get_repo_slug
8 from pylons_app.model.hg_model import HgModel
9 log = logging.getLogger(__name__)
7
10
8 log = logging.getLogger(__name__)
9
11
10 class BranchesController(BaseController):
12 class BranchesController(BaseController):
13 def __before__(self):
14 c.repos_prefix = config['repos_name']
15 c.repo_name = get_repo_slug(request)
11
16
12 def index(self):
17 def index(self):
13 # Return a rendered template
18 hg_model = HgModel()
14 #return render('/branches.mako')
19 c.repo_info = hg_model.get_repo(c.repo_name)
15 # or, return a string
20 c.repo_branches = c.repo_info.branches
16 return 'Hello World'
21
22 return render('branches/branches.html')
@@ -1,29 +1,27 b''
1 import logging
1 import logging
2
2
3 from pylons import tmpl_context as c, app_globals as g, session, request, config, url
3 from pylons import tmpl_context as c, app_globals as g, session, request, config, url
4 from pylons.controllers.util import abort, redirect
4 from pylons.controllers.util import abort, redirect
5
5
6 from pylons_app.lib.base import BaseController, render
6 from pylons_app.lib.base import BaseController, render
7 from pylons_app.lib.utils import get_repo_slug
7 from pylons_app.lib.utils import get_repo_slug
8 from pylons_app.model.hg_model import HgModel
8 from pylons_app.model.hg_model import HgModel
9 from webhelpers.paginate import Page
9 from webhelpers.paginate import Page
10
10
11 log = logging.getLogger(__name__)
11 log = logging.getLogger(__name__)
12
12
13 class ChangelogController(BaseController):
13 class ChangelogController(BaseController):
14 def __before__(self):
14 def __before__(self):
15 c.repos_prefix = config['repos_name']
15 c.repos_prefix = config['repos_name']
16
17 c.repo_name = get_repo_slug(request)
16 c.repo_name = get_repo_slug(request)
18
17
19
20 def index(self):
18 def index(self):
21 hg_model = HgModel()
19 hg_model = HgModel()
22 p = int(request.params.get('page', 1))
20 p = int(request.params.get('page', 1))
23 repo = hg_model.get_repo(c.repo_name)
21 repo = hg_model.get_repo(c.repo_name)
24 c.repo_changesets = Page(repo, page=p, items_per_page=20)
22 c.repo_changesets = Page(repo, page=p, items_per_page=20)
25 c.shortlog_data = render('shortlog_data.html')
23 c.shortlog_data = render('shortlog/shortlog_data.html')
26 if request.params.get('partial'):
24 if request.params.get('partial'):
27 return c.shortlog_data
25 return c.shortlog_data
28 r = render('/shortlog.html')
26 r = render('shortlog/shortlog.html')
29 return r
27 return r
@@ -1,76 +1,76 b''
1 import logging
1 import logging
2 import os
2 import os
3 from pylons import request, response, session, tmpl_context as c, url, app_globals as g
3 from pylons import request, response, session, tmpl_context as c, url, app_globals as g
4 from pylons.controllers.util import abort, redirect
4 from pylons.controllers.util import abort, redirect
5 from pylons_app.lib import auth
5 from pylons_app.lib import auth
6 from pylons_app.lib.base import BaseController, render
6 from pylons_app.lib.base import BaseController, render
7 from pylons_app.model import meta
7 from pylons_app.model import meta
8 from pylons_app.model.db import Users, UserLogs
8 from pylons_app.model.db import Users, UserLogs
9 from pylons_app.lib.auth import authenticate
9 from pylons_app.lib.auth import authenticate
10 from pylons_app.model.hg_model import HgModel
10 from pylons_app.model.hg_model import HgModel
11 from operator import itemgetter
11 from operator import itemgetter
12 import shutil
12 import shutil
13 log = logging.getLogger(__name__)
13 log = logging.getLogger(__name__)
14
14
15 class ReposController(BaseController):
15 class ReposController(BaseController):
16 """REST Controller styled on the Atom Publishing Protocol"""
16 """REST Controller styled on the Atom Publishing Protocol"""
17 # To properly map this controller, ensure your config/routing.py
17 # To properly map this controller, ensure your config/routing.py
18 # file has a resource setup:
18 # file has a resource setup:
19 # map.resource('repo', 'repos')
19 # map.resource('repo', 'repos')
20
20
21 @authenticate
21 @authenticate
22 def __before__(self):
22 def __before__(self):
23
23
24 c.admin_user = session.get('admin_user')
24 c.admin_user = session.get('admin_user')
25 c.admin_username = session.get('admin_username')
25 c.admin_username = session.get('admin_username')
26 self.sa = meta.Session
26 self.sa = meta.Session
27
27
28 def index(self, format='html'):
28 def index(self, format='html'):
29 """GET /repos: All items in the collection"""
29 """GET /repos: All items in the collection"""
30 # url('repos')
30 # url('repos')
31 hg_model = HgModel()
31 hg_model = HgModel()
32 c.repos_list = list(hg_model.get_repos())
32 c.repos_list = list(hg_model.get_repos())
33 c.repos_list.sort(key=itemgetter('name'))
33 c.repos_list.sort(key=itemgetter('name'))
34 return render('/repos.html')
34 return render('admin/repos/repos.html')
35
35
36 def create(self):
36 def create(self):
37 """POST /repos: Create a new item"""
37 """POST /repos: Create a new item"""
38 # url('repos')
38 # url('repos')
39
39
40 def new(self, format='html'):
40 def new(self, format='html'):
41 """GET /repos/new: Form to create a new item"""
41 """GET /repos/new: Form to create a new item"""
42 # url('new_repo')
42 # url('new_repo')
43
43
44 def update(self, id):
44 def update(self, id):
45 """PUT /repos/id: Update an existing item"""
45 """PUT /repos/id: Update an existing item"""
46 # Forms posted to this method should contain a hidden field:
46 # Forms posted to this method should contain a hidden field:
47 # <input type="hidden" name="_method" value="PUT" />
47 # <input type="hidden" name="_method" value="PUT" />
48 # Or using helpers:
48 # Or using helpers:
49 # h.form(url('repo', id=ID),
49 # h.form(url('repo', id=ID),
50 # method='put')
50 # method='put')
51 # url('repo', id=ID)
51 # url('repo', id=ID)
52
52
53 def delete(self, id):
53 def delete(self, id):
54 """DELETE /repos/id: Delete an existing item"""
54 """DELETE /repos/id: Delete an existing item"""
55 # Forms posted to this method should contain a hidden field:
55 # Forms posted to this method should contain a hidden field:
56 # <input type="hidden" name="_method" value="DELETE" />
56 # <input type="hidden" name="_method" value="DELETE" />
57 # Or using helpers:
57 # Or using helpers:
58 # h.form(url('repo', id=ID),
58 # h.form(url('repo', id=ID),
59 # method='delete')
59 # method='delete')
60 # url('repo', id=ID)
60 # url('repo', id=ID)
61 from datetime import datetime
61 from datetime import datetime
62 path = g.paths[0][1].replace('*', '')
62 path = g.paths[0][1].replace('*', '')
63 rm_path = os.path.join(path, id)
63 rm_path = os.path.join(path, id)
64 log.info("Removing %s", rm_path)
64 log.info("Removing %s", rm_path)
65 shutil.move(os.path.join(rm_path, '.hg'), os.path.join(rm_path, 'rm__.hg'))
65 shutil.move(os.path.join(rm_path, '.hg'), os.path.join(rm_path, 'rm__.hg'))
66 shutil.move(rm_path, os.path.join(path, 'rm__%s-%s' % (datetime.today(), id)))
66 shutil.move(rm_path, os.path.join(path, 'rm__%s-%s' % (datetime.today(), id)))
67 return redirect(url('repos'))
67 return redirect(url('repos'))
68
68
69
69
70 def show(self, id, format='html'):
70 def show(self, id, format='html'):
71 """GET /repos/id: Show a specific item"""
71 """GET /repos/id: Show a specific item"""
72 # url('repo', id=ID)
72 # url('repo', id=ID)
73 return render('/repos_show.html')
73 return render('/repos_show.html')
74 def edit(self, id, format='html'):
74 def edit(self, id, format='html'):
75 """GET /repos/id/edit: Form to edit an existing item"""
75 """GET /repos/id/edit: Form to edit an existing item"""
76 # url('edit_repo', id=ID)
76 # url('edit_repo', id=ID)
@@ -1,29 +1,27 b''
1 import logging
1 import logging
2
2
3 from pylons import tmpl_context as c, app_globals as g, session, request, config, url
3 from pylons import tmpl_context as c, app_globals as g, session, request, config, url
4 from pylons.controllers.util import abort, redirect
4 from pylons.controllers.util import abort, redirect
5
5
6 from pylons_app.lib.base import BaseController, render
6 from pylons_app.lib.base import BaseController, render
7 from pylons_app.lib.utils import get_repo_slug
7 from pylons_app.lib.utils import get_repo_slug
8 from pylons_app.model.hg_model import HgModel
8 from pylons_app.model.hg_model import HgModel
9 from webhelpers.paginate import Page
9 from webhelpers.paginate import Page
10
10
11 log = logging.getLogger(__name__)
11 log = logging.getLogger(__name__)
12
12
13 class ShortlogController(BaseController):
13 class ShortlogController(BaseController):
14 def __before__(self):
14 def __before__(self):
15 c.repos_prefix = config['repos_name']
15 c.repos_prefix = config['repos_name']
16
17 c.repo_name = get_repo_slug(request)
16 c.repo_name = get_repo_slug(request)
18
17
19
20 def index(self):
18 def index(self):
21 hg_model = HgModel()
19 hg_model = HgModel()
22 p = int(request.params.get('page', 1))
20 p = int(request.params.get('page', 1))
23 repo = hg_model.get_repo(c.repo_name)
21 repo = hg_model.get_repo(c.repo_name)
24 c.repo_changesets = Page(repo, page=p, items_per_page=20)
22 c.repo_changesets = Page(repo, page=p, items_per_page=20)
25 c.shortlog_data = render('shortlog_data.html')
23 c.shortlog_data = render('shortlog/shortlog_data.html')
26 if request.params.get('partial'):
24 if request.params.get('partial'):
27 return c.shortlog_data
25 return c.shortlog_data
28 r = render('/shortlog.html')
26 r = render('shortlog/shortlog.html')
29 return r
27 return r
@@ -1,32 +1,31 b''
1 import logging
1 import logging
2
2
3 from pylons import tmpl_context as c, app_globals as g, session, request, config, url
3 from pylons import tmpl_context as c, app_globals as g, session, request, config, url
4 from pylons.controllers.util import abort, redirect
4 from pylons.controllers.util import abort, redirect
5
5
6 from pylons_app.lib.base import BaseController, render
6 from pylons_app.lib.base import BaseController, render
7 from pylons_app.lib.utils import get_repo_slug
7 from pylons_app.lib.utils import get_repo_slug
8 from pylons_app.model.hg_model import HgModel
8 from pylons_app.model.hg_model import HgModel
9 log = logging.getLogger(__name__)
9 log = logging.getLogger(__name__)
10
10
11 class SummaryController(BaseController):
11 class SummaryController(BaseController):
12 def __before__(self):
12 def __before__(self):
13 c.repos_prefix = config['repos_name']
13 c.repos_prefix = config['repos_name']
14
15 c.repo_name = get_repo_slug(request)
14 c.repo_name = get_repo_slug(request)
16
15
17 def index(self):
16 def index(self):
18 hg_model = HgModel()
17 hg_model = HgModel()
19 c.repo_info = hg_model.get_repo(c.repo_name)
18 c.repo_info = hg_model.get_repo(c.repo_name)
20 c.repo_changesets = c.repo_info.get_changesets(10)
19 c.repo_changesets = c.repo_info.get_changesets(10)
21
20
22 e = request.environ
21 e = request.environ
23 uri = r'%(protocol)s://%(user)s@%(host)s/%(repo_name)s' % {
22 uri = r'%(protocol)s://%(user)s@%(host)s/%(repo_name)s' % {
24 'protocol': e.get('wsgi.url_scheme'),
23 'protocol': e.get('wsgi.url_scheme'),
25 'user':e.get('REMOTE_USER'),
24 'user':e.get('REMOTE_USER'),
26 'host':e.get('HTTP_HOST'),
25 'host':e.get('HTTP_HOST'),
27 'repo_name':c.repo_name,
26 'repo_name':c.repo_name,
28 }
27 }
29 c.clone_repo_url = url(uri)
28 c.clone_repo_url = url(uri)
30 c.repo_tags = c.repo_info.tags[:10]
29 c.repo_tags = c.repo_info.tags[:10]
31 c.repo_branches = c.repo_info.branches[:10]
30 c.repo_branches = c.repo_info.branches[:10]
32 return render('/summary.html')
31 return render('/summary.html')
@@ -1,16 +1,22 b''
1 import logging
1 import logging
2
2
3 from pylons import request, response, session, tmpl_context as c, url
3 from pylons import tmpl_context as c, app_globals as g, session, request, config, url
4 from pylons.controllers.util import abort, redirect
4 from pylons.controllers.util import abort, redirect
5
5
6 from pylons_app.lib.base import BaseController, render
6 from pylons_app.lib.base import BaseController, render
7 from pylons_app.lib.utils import get_repo_slug
8 from pylons_app.model.hg_model import HgModel
9 log = logging.getLogger(__name__)
7
10
8 log = logging.getLogger(__name__)
9
11
10 class TagsController(BaseController):
12 class TagsController(BaseController):
13 def __before__(self):
14 c.repos_prefix = config['repos_name']
15 c.repo_name = get_repo_slug(request)
11
16
12 def index(self):
17 def index(self):
13 # Return a rendered template
18 hg_model = HgModel()
14 #return render('/tags.mako')
19 c.repo_info = hg_model.get_repo(c.repo_name)
15 # or, return a string
20 c.repo_tags = c.repo_info.tags
16 return 'Hello World'
21
22 return render('tags/tags.html')
@@ -1,114 +1,114 b''
1 import logging
1 import logging
2
2
3 from pylons import request, response, session, tmpl_context as c, url, app_globals as g
3 from pylons import request, response, session, tmpl_context as c, url, app_globals as g
4 from pylons.controllers.util import abort, redirect
4 from pylons.controllers.util import abort, redirect
5
5
6 from pylons_app.lib.base import BaseController, render
6 from pylons_app.lib.base import BaseController, render
7 from formencode import htmlfill
7 from formencode import htmlfill
8 from pylons_app.model import meta
8 from pylons_app.model import meta
9 from pylons_app.model.db import Users, UserLogs
9 from pylons_app.model.db import Users, UserLogs
10 from pylons_app.lib.auth import authenticate
10 from pylons_app.lib.auth import authenticate
11 import crypt
11 import crypt
12
12
13 log = logging.getLogger(__name__)
13 log = logging.getLogger(__name__)
14
14
15 class UsersController(BaseController):
15 class UsersController(BaseController):
16 """REST Controller styled on the Atom Publishing Protocol"""
16 """REST Controller styled on the Atom Publishing Protocol"""
17 # To properly map this controller, ensure your config/routing.py
17 # To properly map this controller, ensure your config/routing.py
18 # file has a resource setup:
18 # file has a resource setup:
19 # map.resource('user', 'users')
19 # map.resource('user', 'users')
20
20
21 @authenticate
21 @authenticate
22 def __before__(self):
22 def __before__(self):
23
23
24 c.admin_user = session.get('admin_user')
24 c.admin_user = session.get('admin_user')
25 c.admin_username = session.get('admin_username')
25 c.admin_username = session.get('admin_username')
26 self.sa = meta.Session
26 self.sa = meta.Session
27
27
28 def index(self, format='html'):
28 def index(self, format='html'):
29 """GET /users: All items in the collection"""
29 """GET /users: All items in the collection"""
30 # url('users')
30 # url('users')
31
31
32 c.users_list = self.sa.query(Users).all()
32 c.users_list = self.sa.query(Users).all()
33 return render('/users.html')
33 return render('admin/users/users.html')
34
34
35 def create(self):
35 def create(self):
36 """POST /users: Create a new item"""
36 """POST /users: Create a new item"""
37 # url('users')
37 # url('users')
38 params = dict(request.params)
38 params = dict(request.params)
39
39
40 try:
40 try:
41 new_user = Users()
41 new_user = Users()
42 new_user.active = params.get('active', False)
42 new_user.active = params.get('active', False)
43 new_user.username = params.get('username')
43 new_user.username = params.get('username')
44 new_user.password = crypt.crypt(params.get('password'), '6a')
44 new_user.password = crypt.crypt(params.get('password'), '6a')
45 new_user.admin = False
45 new_user.admin = False
46 self.sa.add(new_user)
46 self.sa.add(new_user)
47 self.sa.commit()
47 self.sa.commit()
48 except:
48 except:
49 self.sa.rollback()
49 self.sa.rollback()
50 raise
50 raise
51
51
52 return redirect(url('users'))
52 return redirect(url('users'))
53
53
54 def new(self, format='html'):
54 def new(self, format='html'):
55 """GET /users/new: Form to create a new item"""
55 """GET /users/new: Form to create a new item"""
56 # url('new_user')
56 # url('new_user')
57 return render('/user_add.html')
57 return render('admin/users/user_add.html')
58
58
59 def update(self, id):
59 def update(self, id):
60 """PUT /users/id: Update an existing item"""
60 """PUT /users/id: Update an existing item"""
61 # Forms posted to this method should contain a hidden field:
61 # Forms posted to this method should contain a hidden field:
62 # <input type="hidden" name="_method" value="PUT" />
62 # <input type="hidden" name="_method" value="PUT" />
63 # Or using helpers:
63 # Or using helpers:
64 # h.form(url('user', id=ID),
64 # h.form(url('user', id=ID),
65 # method='put')
65 # method='put')
66 # url('user', id=ID)
66 # url('user', id=ID)
67 params = dict(request.params)
67 params = dict(request.params)
68
68
69 try:
69 try:
70 new_user = self.sa.query(Users).get(id)
70 new_user = self.sa.query(Users).get(id)
71 new_user.active = params.get('active', False)
71 new_user.active = params.get('active', False)
72 new_user.username = params.get('username')
72 new_user.username = params.get('username')
73 if params.get('new_password'):
73 if params.get('new_password'):
74 new_user.password = crypt.crypt(params.get('new_password'), '6a')
74 new_user.password = crypt.crypt(params.get('new_password'), '6a')
75 self.sa.add(new_user)
75 self.sa.add(new_user)
76 self.sa.commit()
76 self.sa.commit()
77 except:
77 except:
78 self.sa.rollback()
78 self.sa.rollback()
79 raise
79 raise
80
80
81 return redirect(url('users'))
81 return redirect(url('users'))
82
82
83 def delete(self, id):
83 def delete(self, id):
84 """DELETE /users/id: Delete an existing item"""
84 """DELETE /users/id: Delete an existing item"""
85 # Forms posted to this method should contain a hidden field:
85 # Forms posted to this method should contain a hidden field:
86 # <input type="hidden" name="_method" value="DELETE" />
86 # <input type="hidden" name="_method" value="DELETE" />
87 # Or using helpers:
87 # Or using helpers:
88 # h.form(url('user', id=ID),
88 # h.form(url('user', id=ID),
89 # method='delete')
89 # method='delete')
90 # url('user', id=ID)
90 # url('user', id=ID)
91 try:
91 try:
92 self.sa.delete(self.sa.query(Users).get(id))
92 self.sa.delete(self.sa.query(Users).get(id))
93 self.sa.commit()
93 self.sa.commit()
94 except:
94 except:
95 self.sa.rollback()
95 self.sa.rollback()
96 raise
96 raise
97 return redirect(url('users'))
97 return redirect(url('users'))
98
98
99 def show(self, id, format='html'):
99 def show(self, id, format='html'):
100 """GET /users/id: Show a specific item"""
100 """GET /users/id: Show a specific item"""
101 # url('user', id=ID)
101 # url('user', id=ID)
102
102
103
103
104 def edit(self, id, format='html'):
104 def edit(self, id, format='html'):
105 """GET /users/id/edit: Form to edit an existing item"""
105 """GET /users/id/edit: Form to edit an existing item"""
106 # url('edit_user', id=ID)
106 # url('edit_user', id=ID)
107 c.user = self.sa.query(Users).get(id)
107 c.user = self.sa.query(Users).get(id)
108 defaults = c.user.__dict__
108 defaults = c.user.__dict__
109 return htmlfill.render(
109 return htmlfill.render(
110 render('/user_edit.html'),
110 render('admin/users/user_edit.html'),
111 defaults=defaults,
111 defaults=defaults,
112 encoding="UTF-8",
112 encoding="UTF-8",
113 force_defaults=False
113 force_defaults=False
114 )
114 )
1 NO CONTENT: file renamed from pylons_app/templates/add.html to pylons_app/templates/admin/add.html
NO CONTENT: file renamed from pylons_app/templates/add.html to pylons_app/templates/admin/add.html
@@ -1,68 +1,68 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="base/base.html"/>
2 <%inherit file="/base/base.html"/>
3 <%def name="get_form_error(element)">
3 <%def name="get_form_error(element)">
4 %if hasattr(c,'form_errors'):
4 %if hasattr(c,'form_errors'):
5 %if type(c.form_errors) == dict:
5 %if type(c.form_errors) == dict:
6 %if c.form_errors.get(element,False):
6 %if c.form_errors.get(element,False):
7 <span class="error-message">
7 <span class="error-message">
8 ${c.form_errors.get(element,'')}
8 ${c.form_errors.get(element,'')}
9 </span>
9 </span>
10 %endif
10 %endif
11 %endif
11 %endif
12 %endif
12 %endif
13 </%def>
13 </%def>
14 <%def name="title()">
14 <%def name="title()">
15 ${_('Repository managment')}
15 ${_('Repository managment')}
16 </%def>
16 </%def>
17 <%def name="breadcrumbs()">
17 <%def name="breadcrumbs()">
18 ${h.link_to(u'Home',h.url('/'))}
18 ${h.link_to(u'Home',h.url('/'))}
19 /
19 /
20 ${h.link_to(u'Admin',h.url('admin_home'))}
20 ${h.link_to(u'Admin',h.url('admin_home'))}
21 </%def>
21 </%def>
22 <%def name="page_nav()">
22 <%def name="page_nav()">
23 <li>${h.link_to(u'Home',h.url('/'))}</li>
23 <li>${h.link_to(u'Home',h.url('/'))}</li>
24 <li class="current">${_('Admin')}</li>
24 <li class="current">${_('Admin')}</li>
25 </%def>
25 </%def>
26 <%def name="main()">
26 <%def name="main()">
27 %if c.admin_user:
27 %if c.admin_user:
28 <ul class="submenu">
28 <ul class="submenu">
29 <li>
29 <li>
30 ${h.link_to(u'Repos',h.url('repos'))}
30 ${h.link_to(u'Repos',h.url('repos'))}
31 </li>
31 </li>
32 <li>
32 <li>
33 ${h.link_to(u'Users',h.url('users'))}
33 ${h.link_to(u'Users',h.url('users'))}
34 </li>
34 </li>
35 </ul>
35 </ul>
36 <br/>
36 <br/>
37 <div>
37 <div>
38 <h2>Welcome ${c.admin_username}</h2>
38 <h2>Welcome ${c.admin_username}</h2>
39 <div id="user_log">
39 <div id="user_log">
40 ${c.log_data}
40 ${c.log_data}
41 </div>
41 </div>
42 </div>
42 </div>
43 %else:
43 %else:
44 <div>
44 <div>
45 <br />
45 <br />
46 <h2>${_('Login')}</h2>
46 <h2>${_('Login')}</h2>
47 ${h.form(h.url.current())}
47 ${h.form(h.url.current())}
48 <table>
48 <table>
49 <tr>
49 <tr>
50 <td>${_('Username')}</td>
50 <td>${_('Username')}</td>
51 <td>${h.text('username')}</td>
51 <td>${h.text('username')}</td>
52 <td>${get_form_error('username')} </td>
52 <td>${get_form_error('username')} </td>
53 </tr>
53 </tr>
54 <tr>
54 <tr>
55 <td>${_('Password')}</td>
55 <td>${_('Password')}</td>
56 <td>${h.password('password')}</td>
56 <td>${h.password('password')}</td>
57 <td>${get_form_error('password')}</td>
57 <td>${get_form_error('password')}</td>
58 </tr>
58 </tr>
59 <tr>
59 <tr>
60 <td></td>
60 <td></td>
61 <td>${h.submit('login','login')}</td>
61 <td>${h.submit('login','login')}</td>
62 </tr>
62 </tr>
63 </table>
63 </table>
64 ${h.end_form()}
64 ${h.end_form()}
65 </div>
65 </div>
66 %endif
66 %endif
67
67
68 </%def> No newline at end of file
68 </%def>
1 NO CONTENT: file renamed from pylons_app/templates/admin_log.html to pylons_app/templates/admin/admin_log.html
NO CONTENT: file renamed from pylons_app/templates/admin_log.html to pylons_app/templates/admin/admin_log.html
1 NO CONTENT: file renamed from pylons_app/templates/repo_edit.html to pylons_app/templates/admin/repos/repo_edit.html
NO CONTENT: file renamed from pylons_app/templates/repo_edit.html to pylons_app/templates/admin/repos/repo_edit.html
@@ -1,41 +1,41 b''
1 <%inherit file="base/base.html"/>
1 <%inherit file="/base/base.html"/>
2 <%def name="title()">
2 <%def name="title()">
3 ${_('Repository managment')}
3 ${_('Repository managment')}
4 </%def>
4 </%def>
5 <%def name="breadcrumbs()">
5 <%def name="breadcrumbs()">
6 ${h.link_to(u'Home',h.url('/'))}
6 ${h.link_to(u'Home',h.url('/'))}
7 /
7 /
8 ${h.link_to(u'Admin',h.url('admin_home'))}
8 ${h.link_to(u'Admin',h.url('admin_home'))}
9 /
9 /
10 ${h.link_to(u'Repos managment',h.url('repos'))}
10 ${h.link_to(u'Repos managment',h.url('repos'))}
11 </%def>
11 </%def>
12 <%def name="page_nav()">
12 <%def name="page_nav()">
13 <li>${h.link_to(u'Home',h.url('/'))}</li>
13 <li>${h.link_to(u'Home',h.url('/'))}</li>
14 <li class="current">${_('Admin')}</li>
14 <li class="current">${_('Admin')}</li>
15 </%def>
15 </%def>
16 <%def name="main()">
16 <%def name="main()">
17 <ul class="submenu">
17 <ul class="submenu">
18 <li>
18 <li>
19 ${h.link_to(u'Repos',h.url('repos'), class_="current_submenu")}
19 ${h.link_to(u'Repos',h.url('repos'), class_="current_submenu")}
20 </li>
20 </li>
21 <li>
21 <li>
22 ${h.link_to(u'Users',h.url('users'))}
22 ${h.link_to(u'Users',h.url('users'))}
23 </li>
23 </li>
24 </ul>
24 </ul>
25 <div>
25 <div>
26 <h2>${_('Mercurial repos')}</h2>
26 <h2>${_('Mercurial repos')}</h2>
27 <table>
27 <table>
28 %for cnt,repo in enumerate(c.repos_list):
28 %for cnt,repo in enumerate(c.repos_list):
29 <tr class="parity${cnt%2}">
29 <tr class="parity${cnt%2}">
30 <td><a href="/${repo['name']}">${repo['name']}</a></td>
30 <td>${h.link_to(repo['name'],h.url('summary_home',repo_name=repo['name']))}</td>
31 <td>r${repo['rev']}:${repo['tip']}</td>
31 <td>r${repo['rev']}:${repo['tip']}</td>
32 <td>
32 <td>
33 ${h.form(url('repo', id=repo['name']),method='delete')}
33 ${h.form(url('repo', id=repo['name']),method='delete')}
34 ${h.submit('remove','remove',class_="submit",onclick="return confirm('Confirm to delete this repository');")}
34 ${h.submit('remove','remove',class_="submit",onclick="return confirm('Confirm to delete this repository');")}
35 ${h.end_form()}
35 ${h.end_form()}
36 </td>
36 </td>
37 </tr>
37 </tr>
38 %endfor
38 %endfor
39 </table>
39 </table>
40 </div>
40 </div>
41 </%def> No newline at end of file
41 </%def>
@@ -1,50 +1,50 b''
1 <%inherit file="base/base.html"/>
1 <%inherit file="/base/base.html"/>
2 <%def name="title()">
2 <%def name="title()">
3 ${_('User')} - ${_('add new')}
3 ${_('User')} - ${_('add new')}
4 </%def>
4 </%def>
5 <%def name="breadcrumbs()">
5 <%def name="breadcrumbs()">
6 ${h.link_to(u'Home',h.url('/'))}
6 ${h.link_to(u'Home',h.url('/'))}
7 /
7 /
8 ${h.link_to(u'Admin',h.url('admin_home'))}
8 ${h.link_to(u'Admin',h.url('admin_home'))}
9 /
9 /
10 ${h.link_to(u'Users',h.url('users'))}
10 ${h.link_to(u'Users',h.url('users'))}
11 </%def>
11 </%def>
12 <%def name="page_nav()">
12 <%def name="page_nav()">
13 <li>${h.link_to(u'Home',h.url('/'))}</li>
13 <li>${h.link_to(u'Home',h.url('/'))}</li>
14 <li class="current">${_('Admin')}</li>
14 <li class="current">${_('Admin')}</li>
15 </%def>
15 </%def>
16 <%def name="main()">
16 <%def name="main()">
17 <ul class="submenu">
17 <ul class="submenu">
18 <li>
18 <li>
19 ${h.link_to(u'Repos',h.url('repos'))}
19 ${h.link_to(u'Repos',h.url('repos'))}
20 </li>
20 </li>
21 <li class="current_submenu">
21 <li class="current_submenu">
22 ${h.link_to(u'Users',h.url('users'))}
22 ${h.link_to(u'Users',h.url('users'))}
23 </li>
23 </li>
24 </ul>
24 </ul>
25 <div>
25 <div>
26 <h2>${_('User')} - ${_('add new')}</h2>
26 <h2>${_('User')} - ${_('add new')}</h2>
27 ${h.form(url('users'))}
27 ${h.form(url('users'))}
28 <table>
28 <table>
29 <tr>
29 <tr>
30 <td>${_('Username')}</td>
30 <td>${_('Username')}</td>
31 <td>${h.text('username')}</td>
31 <td>${h.text('username')}</td>
32 </tr>
32 </tr>
33 <tr>
33 <tr>
34 <td>${_('password')}</td>
34 <td>${_('password')}</td>
35 <td>${h.text('password')}</td>
35 <td>${h.text('password')}</td>
36 </tr>
36 </tr>
37 <tr>
37 <tr>
38 <td>${_('Active')}</td>
38 <td>${_('Active')}</td>
39 <td>${h.checkbox('active')}</td>
39 <td>${h.checkbox('active')}</td>
40 </tr>
40 </tr>
41 <tr>
41 <tr>
42 <td></td>
42 <td></td>
43 <td>${h.submit('add','add')}</td>
43 <td>${h.submit('add','add')}</td>
44 </tr>
44 </tr>
45
45
46 </table>
46 </table>
47
47
48 ${h.end_form()}
48 ${h.end_form()}
49 </div>
49 </div>
50 </%def> No newline at end of file
50 </%def>
@@ -1,50 +1,50 b''
1 <%inherit file="base/base.html"/>
1 <%inherit file="/base/base.html"/>
2 <%def name="title()">
2 <%def name="title()">
3 ${_('User')} - ${c.user.username}
3 ${_('User')} - ${c.user.username}
4 </%def>
4 </%def>
5 <%def name="breadcrumbs()">
5 <%def name="breadcrumbs()">
6 ${h.link_to(u'Home',h.url('/'))}
6 ${h.link_to(u'Home',h.url('/'))}
7 /
7 /
8 ${h.link_to(u'Admin',h.url('admin_home'))}
8 ${h.link_to(u'Admin',h.url('admin_home'))}
9 /
9 /
10 ${h.link_to(u'Users',h.url('users'))}
10 ${h.link_to(u'Users',h.url('users'))}
11 </%def>
11 </%def>
12 <%def name="page_nav()">
12 <%def name="page_nav()">
13 <li>${h.link_to(u'Home',h.url('/'))}</li>
13 <li>${h.link_to(u'Home',h.url('/'))}</li>
14 <li class="current">${_('Admin')}</li>
14 <li class="current">${_('Admin')}</li>
15 </%def>
15 </%def>
16 <%def name="main()">
16 <%def name="main()">
17 <ul class="submenu">
17 <ul class="submenu">
18 <li>
18 <li>
19 ${h.link_to(u'Repos',h.url('repos'))}
19 ${h.link_to(u'Repos',h.url('repos'))}
20 </li>
20 </li>
21 <li class="current_submenu">
21 <li class="current_submenu">
22 ${h.link_to(u'Users',h.url('users'))}
22 ${h.link_to(u'Users',h.url('users'))}
23 </li>
23 </li>
24 </ul>
24 </ul>
25 <div>
25 <div>
26 <h2>${_('User')} - ${c.user.username}</h2>
26 <h2>${_('User')} - ${c.user.username}</h2>
27 ${h.form(url('user', id=c.user.user_id),method='put')}
27 ${h.form(url('user', id=c.user.user_id),method='put')}
28 <table>
28 <table>
29 <tr>
29 <tr>
30 <td>${_('Username')}</td>
30 <td>${_('Username')}</td>
31 <td>${h.text('username')}</td>
31 <td>${h.text('username')}</td>
32 </tr>
32 </tr>
33 <tr>
33 <tr>
34 <td>${_('New password')}</td>
34 <td>${_('New password')}</td>
35 <td>${h.text('new_password')}</td>
35 <td>${h.text('new_password')}</td>
36 </tr>
36 </tr>
37 <tr>
37 <tr>
38 <td>${_('Active')}</td>
38 <td>${_('Active')}</td>
39 <td>${h.checkbox('active',value=True)}</td>
39 <td>${h.checkbox('active',value=True)}</td>
40 </tr>
40 </tr>
41 <tr>
41 <tr>
42 <td></td>
42 <td></td>
43 <td>${h.submit('save','save')}</td>
43 <td>${h.submit('save','save')}</td>
44 </tr>
44 </tr>
45
45
46 </table>
46 </table>
47
47
48 ${h.end_form()}
48 ${h.end_form()}
49 </div>
49 </div>
50 </%def> No newline at end of file
50 </%def>
@@ -1,52 +1,52 b''
1 <%inherit file="base/base.html"/>
1 <%inherit file="/base/base.html"/>
2 <%def name="title()">
2 <%def name="title()">
3 ${_('Repository managment')}
3 ${_('Repository managment')}
4 </%def>
4 </%def>
5 <%def name="breadcrumbs()">
5 <%def name="breadcrumbs()">
6 ${h.link_to(u'Home',h.url('/'))}
6 ${h.link_to(u'Home',h.url('/'))}
7 /
7 /
8 ${h.link_to(u'Admin',h.url('admin_home'))}
8 ${h.link_to(u'Admin',h.url('admin_home'))}
9 /
9 /
10 ${h.link_to(u'Users managment',h.url('users'))}
10 ${h.link_to(u'Users managment',h.url('users'))}
11 </%def>
11 </%def>
12 <%def name="page_nav()">
12 <%def name="page_nav()">
13 <li>${h.link_to(u'Home',h.url('/'))}</li>
13 <li>${h.link_to(u'Home',h.url('/'))}</li>
14 <li class="current">${_('Admin')}</li>
14 <li class="current">${_('Admin')}</li>
15 </%def>
15 </%def>
16 <%def name="main()">
16 <%def name="main()">
17 <ul class="submenu">
17 <ul class="submenu">
18 <li>
18 <li>
19 ${h.link_to(u'Repos',h.url('repos'))}
19 ${h.link_to(u'Repos',h.url('repos'))}
20 </li>
20 </li>
21 <li>
21 <li>
22 ${h.link_to(u'Users',h.url('users'), class_="current_submenu")}
22 ${h.link_to(u'Users',h.url('users'), class_="current_submenu")}
23 </li>
23 </li>
24 </ul>
24 </ul>
25 <div>
25 <div>
26 <h2>${_('Mercurial users')}</h2>
26 <h2>${_('Mercurial users')}</h2>
27 <table>
27 <table>
28 <tr>
28 <tr>
29 <th>Id</th>
29 <th>Id</th>
30 <th>Username</th>
30 <th>Username</th>
31 <th>Active</th>
31 <th>Active</th>
32 <th>Admin</th>
32 <th>Admin</th>
33 <th>Action</th>
33 <th>Action</th>
34 </tr>
34 </tr>
35 %for user in c.users_list:
35 %for user in c.users_list:
36 <tr>
36 <tr>
37 <td>${user.user_id}</td>
37 <td>${user.user_id}</td>
38 <td>${h.link_to(user.username,h.url('edit_user', id=user.user_id))}</td>
38 <td>${h.link_to(user.username,h.url('edit_user', id=user.user_id))}</td>
39 <td>${user.active}</td>
39 <td>${user.active}</td>
40 <td>${user.admin}</td>
40 <td>${user.admin}</td>
41 <td>
41 <td>
42 ${h.form(url('user', id=user.user_id),method='delete')}
42 ${h.form(url('user', id=user.user_id),method='delete')}
43 ${h.submit('remove','remove',class_="submit")}
43 ${h.submit('remove','remove',class_="submit")}
44 ${h.end_form()}
44 ${h.end_form()}
45 </td>
45 </td>
46 </tr>
46 </tr>
47 %endfor
47 %endfor
48 </table>
48 </table>
49 <h3>${h.link_to(u'Add user',h.url('new_user'))}</h3>
49 <h3>${h.link_to(u'Add user',h.url('new_user'))}</h3>
50 </div>
50 </div>
51
51
52 </%def> No newline at end of file
52 </%def>
@@ -1,112 +1,112 b''
1 <%inherit file="base/base.html"/>
1 <%inherit file="/base/base.html"/>
2
2
3 <%def name="title()">
3 <%def name="title()">
4 ${_('Repository managment')}
4 ${_('Repository managment')}
5 </%def>
5 </%def>
6 <%def name="breadcrumbs()">
6 <%def name="breadcrumbs()">
7 ${h.link_to(u'Home',h.url('/'))}
7 ${h.link_to(u'Home',h.url('/'))}
8 /
8 /
9 ${h.link_to(c.repo_name,h.url('graph_home',repo_name=c.repo_name))}
9 ${h.link_to(c.repo_name,h.url('graph_home',repo_name=c.repo_name))}
10 /
10 /
11 ${_('graph')}
11 ${_('graph')}
12 </%def>
12 </%def>
13 <%def name="page_nav()">
13 <%def name="page_nav()">
14 <form action="log">
14 <form action="log">
15 <dl class="search">
15 <dl class="search">
16 <dt><label>Search: </label></dt>
16 <dt><label>Search: </label></dt>
17 <dd><input type="text" name="rev" /></dd>
17 <dd><input type="text" name="rev" /></dd>
18 </dl>
18 </dl>
19 </form>
19 </form>
20
20
21 ${self.menu('graph')}
21 ${self.menu('graph')}
22 </%def>
22 </%def>
23
23
24 <%def name="main()">
24 <%def name="main()">
25
25
26 <h2 class="no-link no-border">${_('Graph')} - ${_('showing ')} ${c.size} ${_('revisions')}</h2>
26 <h2 class="no-link no-border">${_('Graph')} - ${_('showing ')} ${c.size} ${_('revisions')}</h2>
27 <noscript>${_('The revision graph only works with JavaScript-enabled browsers.')}</noscript>
27 <noscript>${_('The revision graph only works with JavaScript-enabled browsers.')}</noscript>
28 <div>
28 <div>
29 ${h.form(h.url.current(),method='get')}
29 ${h.form(h.url.current(),method='get')}
30 ${_('Show')}: ${h.text('size',size=10,value=c.size)} ${_('revisions')}
30 ${_('Show')}: ${h.text('size',size=10,value=c.size)} ${_('revisions')}
31 ${h.submit('','set')}
31 ${h.submit('','set')}
32 ${h.end_form()}
32 ${h.end_form()}
33 </div>
33 </div>
34 <div id="wrapper">
34 <div id="wrapper">
35 <ul id="nodebgs"></ul>
35 <ul id="nodebgs"></ul>
36 <canvas id="graph" width="224" height="${c.canvasheight}"></canvas>
36 <canvas id="graph" width="224" height="${c.canvasheight}"></canvas>
37 <ul id="graphnodes"></ul>
37 <ul id="graphnodes"></ul>
38 </div>
38 </div>
39
39
40 <script type="text/javascript" src="/js/graph.js"></script>
40 <script type="text/javascript" src="/js/graph.js"></script>
41 <script>
41 <script>
42 <!-- hide script content
42 <!-- hide script content
43
43
44 var data = ${c.jsdata|n};
44 var data = ${c.jsdata|n};
45 var graph = new Graph();
45 var graph = new Graph();
46 graph.scale(39);
46 graph.scale(39);
47
47
48 graph.edge = function(x0, y0, x1, y1, color) {
48 graph.edge = function(x0, y0, x1, y1, color) {
49
49
50 this.setColor(color, 0.0, 0.65);
50 this.setColor(color, 0.0, 0.65);
51 this.ctx.beginPath();
51 this.ctx.beginPath();
52 this.ctx.moveTo(x0, y0);
52 this.ctx.moveTo(x0, y0);
53 this.ctx.lineTo(x1, y1);
53 this.ctx.lineTo(x1, y1);
54 this.ctx.stroke();
54 this.ctx.stroke();
55
55
56 }
56 }
57
57
58 var revlink = '<li style="_STYLE"><span class="desc">';
58 var revlink = '<li style="_STYLE"><span class="desc">';
59 revlink += '<a class="list" href="/${c.repo_name}/changeset/_NODEID" title="_NODEID"><b>_DESC</b></a>';
59 revlink += '<a class="list" href="/${c.repo_name}/changeset/_NODEID" title="_NODEID"><b>_DESC</b></a>';
60 revlink += '</span> _TAGS';
60 revlink += '</span> _TAGS';
61 revlink += '<span class="info">_DATE, by _USER</span></li>';
61 revlink += '<span class="info">_DATE, by _USER</span></li>';
62
62
63 graph.vertex = function(x, y, color, parity, cur) {
63 graph.vertex = function(x, y, color, parity, cur) {
64
64
65 this.ctx.beginPath();
65 this.ctx.beginPath();
66 color = this.setColor(color, 0.25, 0.75);
66 color = this.setColor(color, 0.25, 0.75);
67 this.ctx.arc(x, y, radius, 0, Math.PI * 2, true);
67 this.ctx.arc(x, y, radius, 0, Math.PI * 2, true);
68 this.ctx.fill();
68 this.ctx.fill();
69
69
70 var bg = '<li class="bg parity' + parity + '"></li>';
70 var bg = '<li class="bg parity' + parity + '"></li>';
71 var left = (this.columns + 1) * this.bg_height;
71 var left = (this.columns + 1) * this.bg_height;
72 var nstyle = 'padding-left: ' + left + 'px;';
72 var nstyle = 'padding-left: ' + left + 'px;';
73 var item = revlink.replace(/_STYLE/, nstyle);
73 var item = revlink.replace(/_STYLE/, nstyle);
74 item = item.replace(/_PARITY/, 'parity' + parity);
74 item = item.replace(/_PARITY/, 'parity' + parity);
75 item = item.replace(/_NODEID/, cur[0]);
75 item = item.replace(/_NODEID/, cur[0]);
76 item = item.replace(/_NODEID/, cur[0]);
76 item = item.replace(/_NODEID/, cur[0]);
77 item = item.replace(/_DESC/, cur[3]);
77 item = item.replace(/_DESC/, cur[3]);
78 item = item.replace(/_USER/, cur[4]);
78 item = item.replace(/_USER/, cur[4]);
79 item = item.replace(/_DATE/, cur[5]);
79 item = item.replace(/_DATE/, cur[5]);
80
80
81 var tagspan = '';
81 var tagspan = '';
82 if (cur[7].length || (cur[6][0] != 'default' || cur[6][1])) {
82 if (cur[7].length || (cur[6][0] != 'default' || cur[6][1])) {
83 tagspan = '<span class="logtags">';
83 tagspan = '<span class="logtags">';
84 if (cur[6][1]) {
84 if (cur[6][1]) {
85 tagspan += '<span class="branchtag" title="' + cur[6][0] + '">';
85 tagspan += '<span class="branchtag" title="' + cur[6][0] + '">';
86 tagspan += cur[6][0] + '</span> ';
86 tagspan += cur[6][0] + '</span> ';
87 } else if (!cur[6][1] && cur[6][0] != 'default') {
87 } else if (!cur[6][1] && cur[6][0] != 'default') {
88 tagspan += '<span class="inbranchtag" title="' + cur[6][0] + '">';
88 tagspan += '<span class="inbranchtag" title="' + cur[6][0] + '">';
89 tagspan += cur[6][0] + '</span> ';
89 tagspan += cur[6][0] + '</span> ';
90 }
90 }
91 if (cur[7].length) {
91 if (cur[7].length) {
92 for (var t in cur[7]) {
92 for (var t in cur[7]) {
93 var tag = cur[7][t];
93 var tag = cur[7][t];
94 tagspan += '<span class="tagtag">' + tag + '</span> ';
94 tagspan += '<span class="tagtag">' + tag + '</span> ';
95 }
95 }
96 }
96 }
97 tagspan += '</span>';
97 tagspan += '</span>';
98 }
98 }
99
99
100 item = item.replace(/_TAGS/, tagspan);
100 item = item.replace(/_TAGS/, tagspan);
101 return [bg, item];
101 return [bg, item];
102
102
103 }
103 }
104
104
105 graph.render(data);
105 graph.render(data);
106
106
107 // stop hiding script -->
107 // stop hiding script -->
108 </script>
108 </script>
109 <div>
109 <div>
110 <h2>${c.pagination.pager('$link_previous ~2~ $link_next')}</h2>
110 <h2>${c.pagination.pager('$link_previous ~2~ $link_next')}</h2>
111 </div>
111 </div>
112 </%def> No newline at end of file
112 </%def>
@@ -1,30 +1,30 b''
1 <%inherit file="base/base.html"/>
1 <%inherit file="/base/base.html"/>
2
2
3 <%def name="title()">
3 <%def name="title()">
4 ${_('Repository managment')}
4 ${_('Repository managment')}
5 </%def>
5 </%def>
6 <%def name="breadcrumbs()">
6 <%def name="breadcrumbs()">
7 ${h.link_to(u'Home',h.url('/'))}
7 ${h.link_to(u'Home',h.url('/'))}
8 /
8 /
9 ${h.link_to(c.repo_name,h.url('shortlog_home',repo_name=c.repo_name))}
9 ${h.link_to(c.repo_name,h.url('shortlog_home',repo_name=c.repo_name))}
10 /
10 /
11 ${_('shortlog')}
11 ${_('shortlog')}
12 </%def>
12 </%def>
13 <%def name="page_nav()">
13 <%def name="page_nav()">
14 <form action="log">
14 <form action="log">
15 <dl class="search">
15 <dl class="search">
16 <dt><label>Search: </label></dt>
16 <dt><label>Search: </label></dt>
17 <dd><input type="text" name="rev" /></dd>
17 <dd><input type="text" name="rev" /></dd>
18 </dl>
18 </dl>
19 </form>
19 </form>
20
20
21 ${self.menu('changelog')}
21 ${self.menu('changelog')}
22 </%def>
22 </%def>
23 <%def name="main()">
23 <%def name="main()">
24
24
25 <h2 class="no-link no-border">${_('Shortlog')}</h2>
25 <h2 class="no-link no-border">${_('Shortlog')}</h2>
26
26
27 <div id="shortlog_data">
27 <div id="shortlog_data">
28 ${c.shortlog_data}
28 ${c.shortlog_data}
29 </div>
29 </div>
30 </%def> No newline at end of file
30 </%def>
1 NO CONTENT: file renamed from pylons_app/templates/shortlog_data.html to pylons_app/templates/shortlog/shortlog_data.html
NO CONTENT: file renamed from pylons_app/templates/shortlog_data.html to pylons_app/templates/shortlog/shortlog_data.html
@@ -1,115 +1,115 b''
1 <%inherit file="base/base.html"/>
1 <%inherit file="/base/base.html"/>
2 <%!
2 <%!
3 from pylons_app.lib import filters
3 from pylons_app.lib import filters
4 %>
4 %>
5 <%def name="title()">
5 <%def name="title()">
6 ${_('Repository managment')}
6 ${_('Repository managment')}
7 </%def>
7 </%def>
8 <%def name="breadcrumbs()">
8 <%def name="breadcrumbs()">
9 ${h.link_to(u'Home',h.url('/'))}
9 ${h.link_to(u'Home',h.url('/'))}
10 /
10 /
11 ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
11 ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
12 /
12 /
13 ${_('summary')}
13 ${_('summary')}
14 </%def>
14 </%def>
15 <%def name="page_nav()">
15 <%def name="page_nav()">
16 <form action="log">
16 <form action="log">
17 <dl class="search">
17 <dl class="search">
18 <dt><label>Search: </label></dt>
18 <dt><label>Search: </label></dt>
19 <dd><input type="text" name="rev" /></dd>
19 <dd><input type="text" name="rev" /></dd>
20 </dl>
20 </dl>
21 </form>
21 </form>
22
22
23 ${self.menu('summary')}
23 ${self.menu('summary')}
24 </%def>
24 </%def>
25 <%def name="main()">
25 <%def name="main()">
26
26
27 <h2 class="no-link no-border">${_('Mercurial Repository Overview')}</h2>
27 <h2 class="no-link no-border">${_('Mercurial Repository Overview')}</h2>
28 <dl class="overview">
28 <dl class="overview">
29 <dt>${_('name')}</dt>
29 <dt>${_('name')}</dt>
30 <dd>${c.repo_info.name}</dd>
30 <dd>${c.repo_info.name}</dd>
31 <dt>${_('description')}</dt>
31 <dt>${_('description')}</dt>
32 <dd>${c.repo_info.description}</dd>
32 <dd>${c.repo_info.description}</dd>
33 <dt>${_('contact')}</dt>
33 <dt>${_('contact')}</dt>
34 <dd>${c.repo_info.contact}</dd>
34 <dd>${c.repo_info.contact}</dd>
35 <dt>${_('last change')}</dt>
35 <dt>${_('last change')}</dt>
36 <dd>${c.repo_info.last_change|n,filters.rfc822date} - ${c.repo_info.last_change|n,filters.age}</dd>
36 <dd>${c.repo_info.last_change|n,filters.rfc822date} - ${c.repo_info.last_change|n,filters.age}</dd>
37 <dt>${_('url')}</dt>
37 <dt>${_('url')}</dt>
38 <dd><pre>hg clone <a href="${c.clone_repo_url}">${c.clone_repo_url}</a></pre></dd>
38 <dd><pre>hg clone <a href="${c.clone_repo_url}">${c.clone_repo_url}</a></pre></dd>
39 <dt>${_('Download')}</dt>
39 <dt>${_('Download')}</dt>
40 <dd>
40 <dd>
41 %for archive in c.repo_info._get_archives():
41 %for archive in c.repo_info._get_archives():
42 | <a href="/${c.repo_info.name}/archive/${archive['node']}${archive['extension']}">
42 | <a href="/${c.repo_info.name}/archive/${archive['node']}${archive['extension']}">
43 ${c.repo_info.name}.${archive['type']}
43 ${c.repo_info.name}.${archive['type']}
44 </a>
44 </a>
45 %endfor
45 %endfor
46 |
46 |
47 </dd>
47 </dd>
48 </dl>
48 </dl>
49
49
50 <h2>${h.link_to(_('Changes'),h.url('changelog_home',repo_name=c.repo_name))}</h2>
50 <h2>${h.link_to(_('Changes'),h.url('changelog_home',repo_name=c.repo_name))}</h2>
51 <table>
51 <table>
52 %for cnt,cs in enumerate(c.repo_changesets):
52 %for cnt,cs in enumerate(c.repo_changesets):
53 <tr class="parity${cnt%2}">
53 <tr class="parity${cnt%2}">
54 <td>${cs._ctx.date()|n,filters.age}</td>
54 <td>${cs._ctx.date()|n,filters.age}</td>
55 <td>${cs.author}</td>
55 <td>${cs.author}</td>
56 <td>
56 <td>
57
57
58 ${h.link_to(cs.message,h.url('changeset_home',repo_name=c.repo_name,revision=cs._short))}
58 ${h.link_to(cs.message,h.url('changeset_home',repo_name=c.repo_name,revision=cs._short))}
59 <span class="logtags">
59 <span class="logtags">
60 <span class="branchtag">${cs.branch}</span>
60 <span class="branchtag">${cs.branch}</span>
61 %for tag in cs.tags:
61 %for tag in cs.tags:
62 <span class="tagtag">${tag}</span>
62 <span class="tagtag">${tag}</span>
63 %endfor
63 %endfor
64 </span>
64 </span>
65 </td>
65 </td>
66 <td class="nowrap">
66 <td class="nowrap">
67 ${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=cs._short))}
67 ${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=cs._short))}
68 |
68 |
69 ${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=cs._short))}
69 ${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=cs._short))}
70 </td>
70 </td>
71 </tr>
71 </tr>
72 %endfor
72 %endfor
73 </table>
73 </table>
74
74
75 <h2>${h.link_to(_('Tags'),h.url('tags_home',repo_name=c.repo_name))}</h2>
75 <h2>${h.link_to(_('Tags'),h.url('tags_home',repo_name=c.repo_name))}</h2>
76 <table>
76 <table>
77 %for cnt,tag in enumerate(c.repo_tags):
77 %for cnt,tag in enumerate(c.repo_tags):
78 <tr class="parity${cnt%2}">
78 <tr class="parity${cnt%2}">
79 <td>${tag._ctx.date()|n,filters.age}</td>
79 <td>${tag._ctx.date()|n,filters.age}</td>
80 <td></td>
80 <td></td>
81 <td>
81 <td>
82 <span class="logtags">
82 <span class="logtags">
83 <span class="tagtag">${h.link_to(tag.tags[-1],h.url('changeset_home',repo_name=c.repo_name,revision=tag._short))}</span>
83 <span class="tagtag">${h.link_to(tag.tags[-1],h.url('changeset_home',repo_name=c.repo_name,revision=tag._short))}</span>
84 </span>
84 </span>
85 </td>
85 </td>
86 <td class="nowrap">
86 <td class="nowrap">
87 ${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=tag._short))}
87 ${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=tag._short))}
88 |
88 |
89 ${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=tag._short))}
89 ${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=tag._short))}
90 </td>
90 </td>
91 </tr>
91 </tr>
92 %endfor
92 %endfor
93 </table>
93 </table>
94
94
95 <h2>${h.link_to(_('Branches'),h.url('branches_home',repo_name=c.repo_name))}</h2>
95 <h2>${h.link_to(_('Branches'),h.url('branches_home',repo_name=c.repo_name))}</h2>
96 <table>
96 <table>
97 %for cnt,branch in enumerate(c.repo_branches):
97 %for cnt,branch in enumerate(c.repo_branches):
98 <tr class="parity${cnt%2}">
98 <tr class="parity${cnt%2}">
99 <td>${branch._ctx.date()|n,filters.age}</td>
99 <td>${branch._ctx.date()|n,filters.age}</td>
100 <td></td>
100 <td></td>
101 <td>
101 <td>
102 <span class="logtags">
102 <span class="logtags">
103 <span class="branchtag">${h.link_to(branch.branch,h.url('changeset_home',repo_name=c.repo_name,revision=branch._short))}</span>
103 <span class="branchtag">${h.link_to(branch.branch,h.url('changeset_home',repo_name=c.repo_name,revision=branch._short))}</span>
104 </span>
104 </span>
105 </td>
105 </td>
106 <td class="nowrap">
106 <td class="nowrap">
107 ${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=branch._short))}
107 ${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=branch._short))}
108 |
108 |
109 ${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=branch._short))}
109 ${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=branch._short))}
110 </td>
110 </td>
111 </tr>
111 </tr>
112 %endfor
112 %endfor
113 </table>
113 </table>
114
114
115 </%def> No newline at end of file
115 </%def>
@@ -1,38 +1,38 b''
1 try:
1 try:
2 from setuptools import setup, find_packages
2 from setuptools import setup, find_packages
3 except ImportError:
3 except ImportError:
4 from ez_setup import use_setuptools
4 from ez_setup import use_setuptools
5 use_setuptools()
5 use_setuptools()
6 from setuptools import setup, find_packages
6 from setuptools import setup, find_packages
7
7
8 setup(
8 setup(
9 name = 'pylons_app',
9 name='pylons_app',
10 version = '1.0',
10 version='1.0',
11 description = '',
11 description='',
12 author = 'marcin kuzminski',
12 author='marcin kuzminski',
13 author_email = 'marcin@python-blog.com',
13 author_email='marcin@python-blog.com',
14 url = '',
14 url='',
15 install_requires = [
15 install_requires=[
16 "Pylons>=0.9.7,<=0.9.7.99",
16 "Pylons>=1.0.0",
17 "SQLAlchemy>=0.5,<=0.5.99",
17 "SQLAlchemy>=0.6",
18 "Mako>=0.2.2,<=0.2.99",
18 "Mako>=0.3.2",
19 ],
19 ],
20 setup_requires = ["PasteScript>=1.6.3"],
20 setup_requires=["PasteScript>=1.6.3"],
21 packages = find_packages(exclude = ['ez_setup']),
21 packages=find_packages(exclude=['ez_setup']),
22 include_package_data = True,
22 include_package_data=True,
23 test_suite = 'nose.collector',
23 test_suite='nose.collector',
24 package_data = {'pylons_app': ['i18n/*/LC_MESSAGES/*.mo']},
24 package_data={'pylons_app': ['i18n/*/LC_MESSAGES/*.mo']},
25 message_extractors = {'pylons_app': [
25 message_extractors={'pylons_app': [
26 ('**.py', 'python', None),
26 ('**.py', 'python', None),
27 ('templates/**.mako', 'mako', {'input_encoding': 'utf-8'}),
27 ('templates/**.mako', 'mako', {'input_encoding': 'utf-8'}),
28 ('public/**', 'ignore', None)]},
28 ('public/**', 'ignore', None)]},
29 zip_safe = False,
29 zip_safe=False,
30 paster_plugins = ['PasteScript', 'Pylons'],
30 paster_plugins=['PasteScript', 'Pylons'],
31 entry_points = """
31 entry_points="""
32 [paste.app_factory]
32 [paste.app_factory]
33 main = pylons_app.config.middleware:make_app
33 main = pylons_app.config.middleware:make_app
34
34
35 [paste.app_install]
35 [paste.app_install]
36 main = pylons.util:PylonsInstaller
36 main = pylons.util:PylonsInstaller
37 """,
37 """,
38 )
38 )
General Comments 0
You need to be logged in to leave comments. Login now