Mercurial > kallithea
comparison rhodecode/controllers/journal.py @ 995:d14723711d17 beta
fixes for journal, added paging now it's possible to view whole journal
fixed tooltip events for shortlog and journal paging. Moved journal to it's own templates
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 04 Feb 2011 17:36:41 +0100 |
parents | 7f9d23f6a526 |
children | 229437211bef |
comparison
equal
deleted
inserted
replaced
994:7f9d23f6a526 | 995:d14723711d17 |
---|---|
28 import logging | 28 import logging |
29 from sqlalchemy import or_ | 29 from sqlalchemy import or_ |
30 | 30 |
31 from pylons import request, response, session, tmpl_context as c, url | 31 from pylons import request, response, session, tmpl_context as c, url |
32 | 32 |
33 from webhelpers.paginate import Page | |
34 | |
33 from rhodecode.lib.auth import LoginRequired, NotAnonymous | 35 from rhodecode.lib.auth import LoginRequired, NotAnonymous |
34 from rhodecode.lib.base import BaseController, render | 36 from rhodecode.lib.base import BaseController, render |
35 from rhodecode.lib.helpers import get_token | 37 from rhodecode.lib.helpers import get_token |
36 from rhodecode.lib.utils import OrderedDict | |
37 from rhodecode.model.db import UserLog, UserFollowing | 38 from rhodecode.model.db import UserLog, UserFollowing |
38 from rhodecode.model.scm import ScmModel | 39 from rhodecode.model.scm import ScmModel |
39 | 40 |
40 from paste.httpexceptions import HTTPInternalServerError | 41 from paste.httpexceptions import HTTPInternalServerError |
41 | 42 |
63 journal = self.sa.query(UserLog)\ | 64 journal = self.sa.query(UserLog)\ |
64 .filter(or_( | 65 .filter(or_( |
65 UserLog.repository_id.in_(repo_ids), | 66 UserLog.repository_id.in_(repo_ids), |
66 UserLog.user_id.in_(user_ids), | 67 UserLog.user_id.in_(user_ids), |
67 ))\ | 68 ))\ |
68 .order_by(UserLog.action_date.desc())\ | 69 .order_by(UserLog.action_date.desc()) |
69 .limit(30)\ | |
70 .all() | |
71 | 70 |
72 c.journal_day_aggreagate = self._get_daily_aggregate(journal) | |
73 | 71 |
74 return render('/journal.html') | 72 p = int(request.params.get('page', 1)) |
73 c.journal_pager = Page(journal, page=p, items_per_page=10) | |
74 c.journal_day_aggreagate = self._get_daily_aggregate(c.journal_pager) | |
75 c.journal_data = render('journal/journal_data.html') | |
76 if request.params.get('partial'): | |
77 return c.journal_data | |
78 | |
79 return render('journal/journal.html') | |
75 | 80 |
76 | 81 |
77 def _get_daily_aggregate(self, journal): | 82 def _get_daily_aggregate(self, journal): |
78 from itertools import groupby | 83 from itertools import groupby |
79 groups = [] | 84 groups = [] |