##// END OF EJS Templates
Updated new Journal with users and dates aggregates
marcink -
r1041:98be43b8 beta
parent child Browse files
Show More
@@ -24,13 +24,14 b''
24 24 # along with this program; if not, write to the Free Software
25 25 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
26 26 # MA 02110-1301, USA.
27
28 27 import logging
29 from sqlalchemy import or_
30 28
31 from pylons import request, response, session, tmpl_context as c, url
29 from sqlalchemy import or_
30 from sqlalchemy.orm import joinedload, make_transient
31 from webhelpers.paginate import Page
32 32
33 from webhelpers.paginate import Page
33 from paste.httpexceptions import HTTPInternalServerError
34 from pylons import request, response, session, tmpl_context as c, url
34 35
35 36 from rhodecode.lib.auth import LoginRequired, NotAnonymous
36 37 from rhodecode.lib.base import BaseController, render
@@ -38,9 +39,6 b' from rhodecode.lib.helpers import get_to'
38 39 from rhodecode.model.db import UserLog, UserFollowing
39 40 from rhodecode.model.scm import ScmModel
40 41
41 from paste.httpexceptions import HTTPInternalServerError
42 from sqlalchemy.orm import joinedload
43
44 42 log = logging.getLogger(__name__)
45 43
46 44 class JournalController(BaseController):
@@ -53,12 +51,12 b' class JournalController(BaseController):'
53 51
54 52 def index(self):
55 53 # Return a rendered template
56
57 54 c.following = self.sa.query(UserFollowing)\
58 55 .filter(UserFollowing.user_id == c.rhodecode_user.user_id)\
59 56 .options(joinedload(UserFollowing.follows_repository))\
60 57 .all()
61 58
59
62 60 repo_ids = [x.follows_repository.repo_id for x in c.following
63 61 if x.follows_repository is not None]
64 62 user_ids = [x.follows_user.user_id for x in c.following
@@ -76,6 +74,8 b' class JournalController(BaseController):'
76 74
77 75 if filtering_criterion is not None:
78 76 journal = self.sa.query(UserLog)\
77 .options(joinedload(UserLog.user))\
78 .options(joinedload(UserLog.repository))\
79 79 .filter(filtering_criterion)\
80 80 .order_by(UserLog.action_date.desc())
81 81 else:
@@ -95,7 +95,12 b' class JournalController(BaseController):'
95 95 from itertools import groupby
96 96 groups = []
97 97 for k, g in groupby(journal, lambda x:x.action_as_day):
98 groups.append((k, list(g),)) # Store group iterator as a list
98 user_group = []
99 for k2, g2 in groupby(list(g), lambda x:x.user.email):
100 l = list(g2)
101 user_group.append((l[0].user, l))
102
103 groups.append((k, user_group,))
99 104
100 105 return groups
101 106
@@ -475,6 +475,7 b' def action_parser(user_log):'
475 475 repo_name=repo_name, revision=rev),
476 476 title=message(rev), class_='tooltip')
477 477 for rev in revs[revs_limit:revs_top_limit]]))
478 cs_links += _(' into')
478 479 if len(revs) > 1:
479 480 cs_links += compare_view
480 481 return cs_links
@@ -489,18 +490,18 b' def action_parser(user_log):'
489 490 repo_name=repo.name,),
490 491 title=dbrepo.description)
491 492
492 map = {'user_deleted_repo':(_('User [deleted] repository'), None),
493 'user_created_repo':(_('User [created] repository'), None),
494 'user_forked_repo':(_('User [forked] repository as:'), get_fork_name),
495 'user_updated_repo':(_('User [updated] repository'), None),
496 'admin_deleted_repo':(_('Admin [delete] repository'), None),
497 'admin_created_repo':(_('Admin [created] repository'), None),
498 'admin_forked_repo':(_('Admin [forked] repository'), None),
499 'admin_updated_repo':(_('Admin [updated] repository'), None),
500 'push':(_('[Pushed]'), get_cs_links),
501 'pull':(_('[Pulled]'), None),
502 'started_following_repo':(_('User [started following] repository'), None),
503 'stopped_following_repo':(_('User [stopped following] repository'), None),
493 map = {'user_deleted_repo':(_('[deleted] repository'), None),
494 'user_created_repo':(_('[created] repository'), None),
495 'user_forked_repo':(_('[forked] repository as:'), get_fork_name),
496 'user_updated_repo':(_('[updated] repository'), None),
497 'admin_deleted_repo':(_('[delete] repository'), None),
498 'admin_created_repo':(_('[created] repository'), None),
499 'admin_forked_repo':(_('[forked] repository'), None),
500 'admin_updated_repo':(_('[updated] repository'), None),
501 'push':(_('[pushed]'), get_cs_links),
502 'pull':(_('[pulled]'), None),
503 'started_following_repo':(_('[started following] repository'), None),
504 'stopped_following_repo':(_('[stopped following] repository'), None),
504 505 }
505 506
506 507 action_str = map.get(action, action)
@@ -1413,20 +1413,28 b' margin-left:10px;'
1413 1413 margin-right:10px;
1414 1414 }
1415 1415
1416 #journal .journal_action{
1417 padding-top:4px;
1418 min-height:15px;
1416 #journal .journal_user{
1417 color: #747474;
1418 font-size: 14px;
1419 font-weight: bold;
1420 height: 30px;
1419 1421 }
1420
1421 1422 #journal .journal_icon{
1422 1423 float: left;
1423 1424 padding-top: 4px;
1424 1425 padding-left:12px;
1426 padding-right: 4px;
1427 clear: both;
1425 1428 }
1426
1429 #journal .journal_action{
1430 padding-top:4px;
1431 min-height:2px;
1432 float:left
1433 }
1427 1434 #journal .journal_repo{
1428 margin-left: 38px;
1429 padding-top: 5px;
1435 float: left;
1436 margin-left: 6px;
1437 padding-top: 3px;
1430 1438 }
1431 1439
1432 1440 #journal .journal_repo .journal_repo_name{
@@ -1434,9 +1442,14 b' font-weight: bold;'
1434 1442 font-size: 1.1em;
1435 1443 }
1436 1444 #journal .compare_view{
1437 padding: 5px 0px 5px 38px;
1445 padding: 5px 0px 5px 3px;
1438 1446 width: 95px;
1439 1447 }
1448 .journal_highlight{
1449 font-weight: bold;
1450 padding: 0 2px;
1451 vertical-align: bottom;
1452 }
1440 1453 .trending_language_tbl,.trending_language_tbl td {
1441 1454 border:0 !important;
1442 1455 margin:0 !important;
@@ -1901,11 +1914,6 b' padding-left: 10px;'
1901 1914 padding-bottom:5px;
1902 1915 }
1903 1916
1904 .journal_highlight{
1905 font-weight: bold;
1906 text-decoration: underline;
1907 }
1908
1909 1917 .add_icon {
1910 1918 background:url("../images/icons/add.png") no-repeat scroll 3px;
1911 1919 height:16px;
@@ -3,14 +3,15 b''
3 3 %if c.journal_day_aggreagate:
4 4 %for day,items in c.journal_day_aggreagate:
5 5 <div class="journal_day">${day}</div>
6 % for entry in items:
6 % for user,entries in items:
7 7 <div style="padding:10px">
8 8 <div class="gravatar">
9 <img alt="gravatar" src="${h.gravatar_url(entry.user.email,24)}"/>
9 <img alt="gravatar" src="${h.gravatar_url(user.email,24)}"/>
10 10 </div>
11 <div>${entry.user.name} ${entry.user.lastname}</div>
11 <div class="journal_user">${user.name} ${user.lastname}</div>
12 % for entry in entries:
13 <div class="journal_icon"> ${h.action_parser_icon(entry)}</div>
12 14 <div class="journal_action">${h.action_parser(entry)}</div>
13 <div class="journal_icon">${h.action_parser_icon(entry)}</div>
14 15 <div class="journal_repo">
15 16 <span class="journal_repo_name">
16 17 %if entry.repository:
@@ -21,6 +22,7 b''
21 22 %endif
22 23 </span> - <span title="${entry.action_date}">${h.age(entry.action_date)}</span>
23 24 </div>
25 %endfor
24 26 </div>
25 27 <div style="clear:both;border-bottom:1px dashed #DDD;padding:3px 3px;margin:0px 10px 0px 10px"></div>
26 28 %endfor
General Comments 0
You need to be logged in to leave comments. Login now