# HG changeset patch # User Marcin Kuzminski # Date 1271582590 -7200 # Node ID db39d0ca5308edb0202283b4c65338318f36528f # Parent 670713507d03007ef4d888c35da696f8d6c0a9ab implemented Shortlog as seperate controller, filters rewrite. Little html fixes diff -r 670713507d03 -r db39d0ca5308 development.ini --- a/development.ini Sun Apr 18 00:31:58 2010 +0200 +++ b/development.ini Sun Apr 18 11:23:10 2010 +0200 @@ -19,6 +19,7 @@ #error_message = 'mercurial crash !' [server:main] +threadpool_workers = 5 use = egg:Paste#http host = 127.0.0.1 port = 5000 diff -r 670713507d03 -r db39d0ca5308 production.ini --- a/production.ini Sun Apr 18 00:31:58 2010 +0200 +++ b/production.ini Sun Apr 18 11:23:10 2010 +0200 @@ -19,6 +19,7 @@ #error_message = 'mercurial crash !' [server:main] +threadpool_workers = 10 use = egg:Paste#http host = 127.0.0.1 port = 8001 diff -r 670713507d03 -r db39d0ca5308 pylons_app/config/routing.py --- a/pylons_app/config/routing.py Sun Apr 18 00:31:58 2010 +0200 +++ b/pylons_app/config/routing.py Sun Apr 18 11:23:10 2010 +0200 @@ -31,6 +31,7 @@ map.connect('summary_home', '/{repo_name}/_summary', controller='summary') + map.connect('shortlog_home', '/{repo_name}/_shortlog', controller='shortlog') map.connect('hg', '/{path_info:.*}', controller='hg', action="view", path_info='/') diff -r 670713507d03 -r db39d0ca5308 pylons_app/controllers/shortlog.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pylons_app/controllers/shortlog.py Sun Apr 18 11:23:10 2010 +0200 @@ -0,0 +1,35 @@ +import logging + +from pylons import tmpl_context as c, app_globals as g, session, request, config, url +from pylons.controllers.util import abort, redirect + +from pylons_app.lib.base import BaseController, render +from pylons_app.lib.utils import get_repo_slug +from pylons_app.model.hg_model import HgModel +from webhelpers.paginate import Page +log = logging.getLogger(__name__) + +class ShortlogController(BaseController): + def __before__(self): + c.repos_prefix = config['repos_name'] + c.staticurl = g.statics + c.repo_name = get_repo_slug(request) + + + def index(self): + hg_model = HgModel() + lim = 20 + p = int(request.params.get('page', 1)) + repo = hg_model.get_repo(c.repo_name) + cnt = repo.revisions[-1] + gen = repo.get_changesets(None) + repo_changesets = list(gen) + repo_changesets2 = list(gen) + repo_changesets3 = list(gen) + repo_changesets4 = list(gen) + + c.repo_changesets = Page(repo_changesets, page=p, item_count=cnt, items_per_page=lim) + c.shortlog_data = render('shortlog_data.html') + if request.params.get('partial'): + return c.shortlog_data + return render('/shortlog.html') diff -r 670713507d03 -r db39d0ca5308 pylons_app/lib/filters.py --- a/pylons_app/lib/filters.py Sun Apr 18 00:31:58 2010 +0200 +++ b/pylons_app/lib/filters.py Sun Apr 18 11:23:10 2010 +0200 @@ -1,14 +1,15 @@ from mercurial import util -from mercurial.templatefilters import age as _age +from mercurial.templatefilters import age as _age, person as _person -age = lambda context, x:_age(x) +age = lambda x:_age(x) capitalize = lambda x: x.capitalize() date = lambda x: util.datestr(x) email = util.email -hgdate = lambda context, x: "%d %d" % x -isodate = lambda context, x: util.datestr(x, '%Y-%m-%d %H:%M %1%2') -isodatesec = lambda context, x: util.datestr(x, '%Y-%m-%d %H:%M:%S %1%2') -localdate = lambda context, x: (x[0], util.makedate()[1]) -rfc822date = lambda context, x: util.datestr(x, "%a, %d %b %Y %H:%M:%S %1%2") -rfc3339date = lambda context, x: util.datestr(x, "%Y-%m-%dT%H:%M:%S%1:%2") -time_ago = lambda context, x: util.datestr(_age(x), "%a, %d %b %Y %H:%M:%S %1%2") +person = lambda x: _person(x) +hgdate = lambda x: "%d %d" % x +isodate = lambda x: util.datestr(x, '%Y-%m-%d %H:%M %1%2') +isodatesec = lambda x: util.datestr(x, '%Y-%m-%d %H:%M:%S %1%2') +localdate = lambda x: (x[0], util.makedate()[1]) +rfc822date = lambda x: util.datestr(x, "%a, %d %b %Y %H:%M:%S %1%2") +rfc3339date = lambda x: util.datestr(x, "%Y-%m-%dT%H:%M:%S%1:%2") +time_ago = lambda x: util.datestr(_age(x), "%a, %d %b %Y %H:%M:%S %1%2") diff -r 670713507d03 -r db39d0ca5308 pylons_app/templates/admin_log.html --- a/pylons_app/templates/admin_log.html Sun Apr 18 00:31:58 2010 +0200 +++ b/pylons_app/templates/admin_log.html Sun Apr 18 11:23:10 2010 +0200 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- %if c.users_log: @@ -17,11 +18,19 @@ %endfor + - + success:function(o){YAHOO.util.Dom.get(data_div).innerHTML=o.responseText; + YAHOO.util.Event.addListener(YAHOO.util.Dom.getElementsByClassName('pager_link'),"click",function(){ + YAHOO.util.Dom.setStyle(data_div,'opacity','0.3');}); + YAHOO.util.Dom.setStyle(data_div,'opacity','1');}},null); return false;""")} +
${c.users_log.pager('$link_previous ~2~ $link_next', onclick="""YAHOO.util.Connect.asyncRequest('GET','$partial_url',{ - success:function(o){YAHOO.util.Dom.get('user_log').innerHTML=o.responseText;} - },null); return false;""")}
%else: diff -r 670713507d03 -r db39d0ca5308 pylons_app/templates/base/base.html --- a/pylons_app/templates/base/base.html Sun Apr 18 00:31:58 2010 +0200 +++ b/pylons_app/templates/base/base.html Sun Apr 18 11:23:10 2010 +0200 @@ -1,7 +1,4 @@ ## -*- coding: utf-8 -*- -##filters definition -<%namespace name="f" module="pylons_app.lib.filters" inheritable="True"/> - diff -r 670713507d03 -r db39d0ca5308 pylons_app/templates/index.html --- a/pylons_app/templates/index.html Sun Apr 18 00:31:58 2010 +0200 +++ b/pylons_app/templates/index.html Sun Apr 18 11:23:10 2010 +0200 @@ -1,5 +1,7 @@ ## -*- coding: utf-8 -*- - +<%! +from pylons_app.lib import filters +%> <%inherit file="base/base.html"/> <%def name="title()"> ${c.repos_prefix} Mercurial Repositories @@ -38,7 +40,7 @@ ${h.link(repo['name'],h.url('summary_home',repo_name=repo['name']))} ${repo['description']} - ${repo['last_change']|n,self.f.age} + ${repo['last_change']|n,filters.age} r${repo['rev']}:${repo['tip']} ${repo['contact']} diff -r 670713507d03 -r db39d0ca5308 pylons_app/templates/shortlog.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pylons_app/templates/shortlog.html Sun Apr 18 11:23:10 2010 +0200 @@ -0,0 +1,38 @@ +<%inherit file="base/base.html"/> + +<%def name="title()"> + ${_('Repository managment')} + +<%def name="breadcrumbs()"> + ${h.link_to(u'Home',h.url('/'))} + / + ${h.link_to(c.repo_name,h.url('shortlog_home',repo_name=c.repo_name))} + / + ${_('shortlog')} + +<%def name="page_nav()"> +
+ +
+ + + +<%def name="main()"> + + + +
+ ${c.shortlog_data} +
+ \ No newline at end of file diff -r 670713507d03 -r db39d0ca5308 pylons_app/templates/shortlog_data.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pylons_app/templates/shortlog_data.html Sun Apr 18 11:23:10 2010 +0200 @@ -0,0 +1,32 @@ +## -*- coding: utf-8 -*- +<%! +from pylons_app.lib import filters +%> + +%for cnt,cs in enumerate(c.repo_changesets): + + + + + + +%endfor + + + + +
${cs._ctx.date()|n,filters.age}${cs.author|n,filters.person}${h.link_to(cs.message,h.url('rev/'+str(cs._ctx)))} + ${h.link_to(_('changeset'),h.url('file/'+str(cs._ctx)))} + | + ${h.link_to(_('files'),h.url('file/'+str(cs._ctx)))} +
${c.repo_changesets.pager('$link_previous ~2~ $link_next', + onclick="""YAHOO.util.Connect.asyncRequest('GET','$partial_url',{ + success:function(o){YAHOO.util.Dom.get(data_div).innerHTML=o.responseText; + YAHOO.util.Event.addListener(YAHOO.util.Dom.getElementsByClassName('pager_link'),"click",function(){ + YAHOO.util.Dom.setStyle(data_div,'opacity','0.3');}); + YAHOO.util.Dom.setStyle(data_div,'opacity','1');}},null); return false;""")}
\ No newline at end of file diff -r 670713507d03 -r db39d0ca5308 pylons_app/templates/summary.html --- a/pylons_app/templates/summary.html Sun Apr 18 00:31:58 2010 +0200 +++ b/pylons_app/templates/summary.html Sun Apr 18 11:23:10 2010 +0200 @@ -1,5 +1,7 @@ <%inherit file="base/base.html"/> - +<%! +from pylons_app.lib import filters +%> <%def name="title()"> ${_('Repository managment')} @@ -19,8 +21,8 @@