Show More
@@ -37,8 +37,10 b' from pylons.i18n.translation import _' | |||
|
37 | 37 | import rhodecode.lib.helpers as h |
|
38 | 38 | from rhodecode.lib.auth import LoginRequired, NotAnonymous |
|
39 | 39 | from rhodecode.lib.base import BaseController, render |
|
40 | from rhodecode.model.db import UserLog, UserFollowing | |
|
40 | from rhodecode.model.db import UserLog, UserFollowing, Repository, User | |
|
41 | 41 | from rhodecode.model.meta import Session |
|
42 | from sqlalchemy.sql.expression import func | |
|
43 | from rhodecode.model.scm import ScmModel | |
|
42 | 44 | |
|
43 | 45 | log = logging.getLogger(__name__) |
|
44 | 46 | |
@@ -59,6 +61,13 b' class JournalController(BaseController):' | |||
|
59 | 61 | # Return a rendered template |
|
60 | 62 | p = int(request.params.get('page', 1)) |
|
61 | 63 | |
|
64 | c.user = User.get(self.rhodecode_user.user_id) | |
|
65 | all_repos = self.sa.query(Repository)\ | |
|
66 | .filter(Repository.user_id == c.user.user_id)\ | |
|
67 | .order_by(func.lower(Repository.repo_name)).all() | |
|
68 | ||
|
69 | c.user_repos = ScmModel().get_repos(all_repos) | |
|
70 | ||
|
62 | 71 | c.following = self.sa.query(UserFollowing)\ |
|
63 | 72 | .filter(UserFollowing.user_id == self.rhodecode_user.user_id)\ |
|
64 | 73 | .options(joinedload(UserFollowing.follows_repository))\ |
@@ -758,6 +758,10 b' div.options a {' | |||
|
758 | 758 | padding: 11px 0 11px 10px; |
|
759 | 759 | } |
|
760 | 760 | |
|
761 | #content div.box div.title .link-white{ | |
|
762 | color: #FFFFFF; | |
|
763 | } | |
|
764 | ||
|
761 | 765 | #content div.box div.title ul.links li { |
|
762 | 766 | list-style: none; |
|
763 | 767 | float: left; |
@@ -27,43 +27,147 b'' | |||
|
27 | 27 | </script> |
|
28 | 28 | <div id="journal">${c.journal_data}</div> |
|
29 | 29 | </div> |
|
30 | ||
|
31 | 30 | <div class="box box-right"> |
|
32 | 31 | <!-- box / title --> |
|
33 | 32 | <div class="title"> |
|
34 | <h5>${_('Following')}</h5> | |
|
33 | <h5> | |
|
34 | <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" value="${_('quick filter...')}"/> | |
|
35 | <a id="show_my" class="link-white" href="#my">${_('My repositories')}</a> / <a id="show_watched" class="link-white" href="#watched">${_('Watched')}</a> | |
|
36 | </h5> | |
|
37 | %if h.HasPermissionAny('hg.admin','hg.create.repository')(): | |
|
38 | <ul class="links"> | |
|
39 | <li> | |
|
40 | <span>${h.link_to(_('ADD REPOSITORY'),h.url('admin_settings_create_repository'))}</span> | |
|
41 | </li> | |
|
42 | </ul> | |
|
43 | %endif | |
|
44 | </div> | |
|
45 | <!-- end box / title --> | |
|
46 | <div id="my" class="table"> | |
|
47 | <table> | |
|
48 | <thead> | |
|
49 | <tr> | |
|
50 | <th class="left">${_('Name')}</th> | |
|
51 | <th class="left">${_('revision')}</th> | |
|
52 | <th colspan="2" class="left">${_('action')}</th> | |
|
53 | </thead> | |
|
54 | <tbody> | |
|
55 | %if c.user_repos: | |
|
56 | %for repo in c.user_repos: | |
|
57 | <tr> | |
|
58 | <td> | |
|
59 | %if repo['dbrepo']['repo_type'] =='hg': | |
|
60 | <img class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/> | |
|
61 | %elif repo['dbrepo']['repo_type'] =='git': | |
|
62 | <img class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/> | |
|
63 | %else: | |
|
64 | ||
|
65 | %endif | |
|
66 | %if repo['dbrepo']['private']: | |
|
67 | <img class="icon" alt="${_('private')}" src="${h.url('/images/icons/lock.png')}"/> | |
|
68 | %else: | |
|
69 | <img class="icon" alt="${_('public')}" src="${h.url('/images/icons/lock_open.png')}"/> | |
|
70 | %endif | |
|
71 | ||
|
72 | ${h.link_to(repo['name'], h.url('summary_home',repo_name=repo['name']),class_="repo_name")} | |
|
73 | %if repo['dbrepo_fork']: | |
|
74 | <a href="${h.url('summary_home',repo_name=repo['dbrepo_fork']['repo_name'])}"> | |
|
75 | <img class="icon" alt="${_('public')}" | |
|
76 | title="${_('Fork of')} ${repo['dbrepo_fork']['repo_name']}" | |
|
77 | src="${h.url('/images/icons/arrow_divide.png')}"/></a> | |
|
78 | %endif | |
|
79 | </td> | |
|
80 | <td><span class="tooltip" title="${repo['last_change']}">${("r%s:%s") % (repo['rev'],h.short_id(repo['tip']))}</span></td> | |
|
81 | <td><a href="${h.url('repo_settings_home',repo_name=repo['name'])}" title="${_('edit')}"><img class="icon" alt="${_('private')}" src="${h.url('/images/icons/application_form_edit.png')}"/></a></td> | |
|
82 | <td> | |
|
83 | ${h.form(url('repo_settings_delete', repo_name=repo['name']),method='delete')} | |
|
84 | ${h.submit('remove_%s' % repo['name'],'',class_="delete_icon action_button",onclick="return confirm('Confirm to delete this repository');")} | |
|
85 | ${h.end_form()} | |
|
86 | </td> | |
|
87 | </tr> | |
|
88 | %endfor | |
|
89 | %else: | |
|
90 | <div style="padding:5px 0px 10px 0px;"> | |
|
91 | ${_('No repositories yet')} | |
|
92 | %if h.HasPermissionAny('hg.admin','hg.create.repository')(): | |
|
93 | ${h.link_to(_('create one now'),h.url('admin_settings_create_repository'),class_="ui-button-small")} | |
|
94 | %endif | |
|
95 | </div> | |
|
96 | %endif | |
|
97 | </tbody> | |
|
98 | </table> | |
|
35 | 99 | </div> |
|
36 | <div> | |
|
37 | %if c.following: | |
|
38 | %for entry in c.following: | |
|
39 | <div class="currently_following"> | |
|
40 | %if entry.follows_user_id: | |
|
41 | <img title="${_('following user')}" alt="${_('user')}" src="${h.url('/images/icons/user.png')}"/> | |
|
42 | ${entry.follows_user.full_contact} | |
|
43 | %endif | |
|
44 | ||
|
45 |
|
|
|
46 |
|
|
|
47 | <div style="float:left;padding-right:5px"> | |
|
48 | <span id="follow_toggle_${entry.follows_repository.repo_id}" class="following" title="${_('Stop following this repository')}" | |
|
49 | onclick="javascript:toggleFollowingRepo(this,${entry.follows_repository.repo_id},'${str(h.get_token())}')"> | |
|
50 | </span> | |
|
51 |
|
|
|
52 | %if entry.follows_repository.private: | |
|
53 | <img class="icon" title="${_('private repository')}" alt="${_('private repository')}" src="${h.url('/images/icons/lock.png')}"/> | |
|
54 |
|
|
|
55 | <img class="icon" title="${_('public repository')}" alt="${_('public repository')}" src="${h.url('/images/icons/lock_open.png')}"/> | |
|
56 | %endif | |
|
57 | ||
|
58 | ${h.link_to(entry.follows_repository.repo_name,h.url('summary_home', | |
|
59 | repo_name=entry.follows_repository.repo_name))} | |
|
60 |
|
|
|
61 | %endif | |
|
62 | </div> | |
|
63 | %endfor | |
|
64 | %else: | |
|
65 | ${_('You are not following any users or repositories')} | |
|
66 | %endif | |
|
67 | </div> | |
|
68 | </div> | |
|
100 | ||
|
101 | <div id="watched" class="table" style="display:none"> | |
|
102 | <table> | |
|
103 | <thead> | |
|
104 | <tr> | |
|
105 | <th class="left">${_('Name')}</th> | |
|
106 | </thead> | |
|
107 | <tbody> | |
|
108 | %if c.following: | |
|
109 | %for entry in c.following: | |
|
110 | <tr> | |
|
111 | <td> | |
|
112 | %if entry.follows_user_id: | |
|
113 | <img title="${_('following user')}" alt="${_('user')}" src="${h.url('/images/icons/user.png')}"/> | |
|
114 | ${entry.follows_user.full_contact} | |
|
115 | %endif | |
|
116 | ||
|
117 | %if entry.follows_repo_id: | |
|
118 | ||
|
119 | <div style="float:right;padding-right:5px"> | |
|
120 | <span id="follow_toggle_${entry.follows_repository.repo_id}" class="following" title="${_('Stop following this repository')}" | |
|
121 | onclick="javascript:toggleFollowingRepo(this,${entry.follows_repository.repo_id},'${str(h.get_token())}')"> | |
|
122 | </span> | |
|
123 | </div> | |
|
124 | ||
|
125 | %if entry.follows_repository.repo_type == 'hg': | |
|
126 | <img class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/> | |
|
127 | %elif entry.follows_repository.repo_type == 'git': | |
|
128 | <img class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/> | |
|
129 | %endif | |
|
130 | ||
|
131 | %if entry.follows_repository.private: | |
|
132 | <img class="icon" title="${_('private repository')}" alt="${_('private repository')}" src="${h.url('/images/icons/lock.png')}"/> | |
|
133 | %else: | |
|
134 | <img class="icon" title="${_('public repository')}" alt="${_('public repository')}" src="${h.url('/images/icons/lock_open.png')}"/> | |
|
135 | %endif | |
|
136 | <span class="watched_repo"> | |
|
137 | ${h.link_to(entry.follows_repository.repo_name,h.url('summary_home',repo_name=entry.follows_repository.repo_name))} | |
|
138 | </span> | |
|
139 | %endif | |
|
140 | </td> | |
|
141 | </tr> | |
|
142 | %endfor | |
|
143 | %else: | |
|
144 | </tbody> | |
|
145 | ${_('You are not following any users or repositories')} | |
|
146 | %endif | |
|
147 | </table> | |
|
148 | </div> | |
|
149 | <script type="text/javascript"> | |
|
150 | YUE.on('show_my','click',function(e){ | |
|
151 | YUD.setStyle('watched','display','none'); | |
|
152 | YUD.setStyle('my','display',''); | |
|
153 | var nodes = YUQ('#my tr td a.repo_name'); | |
|
154 | var target = 'q_filter'; | |
|
155 | var func = function(node){ | |
|
156 | return node.parentNode.parentNode; | |
|
157 | } | |
|
158 | q_filter(target,nodes,func); | |
|
159 | YUE.preventDefault(e); | |
|
160 | }) | |
|
161 | YUE.on('show_watched','click',function(e){ | |
|
162 | YUD.setStyle('my','display','none'); | |
|
163 | YUD.setStyle('watched','display',''); | |
|
164 | var nodes = YUQ('#watched .watched_repo a'); | |
|
165 | var target = 'q_filter'; | |
|
166 | var func = function(node){ | |
|
167 | return node.parentNode.parentNode; | |
|
168 | } | |
|
169 | q_filter(target,nodes,func); | |
|
170 | YUE.preventDefault(e); | |
|
171 | }) | |
|
172 | </script> | |
|
69 | 173 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now