Show More
@@ -37,8 +37,10 b' from pylons.i18n.translation import _' | |||||
37 | import rhodecode.lib.helpers as h |
|
37 | import rhodecode.lib.helpers as h | |
38 | from rhodecode.lib.auth import LoginRequired, NotAnonymous |
|
38 | from rhodecode.lib.auth import LoginRequired, NotAnonymous | |
39 | from rhodecode.lib.base import BaseController, render |
|
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 | from rhodecode.model.meta import Session |
|
41 | from rhodecode.model.meta import Session | |
|
42 | from sqlalchemy.sql.expression import func | |||
|
43 | from rhodecode.model.scm import ScmModel | |||
42 |
|
44 | |||
43 | log = logging.getLogger(__name__) |
|
45 | log = logging.getLogger(__name__) | |
44 |
|
46 | |||
@@ -59,6 +61,13 b' class JournalController(BaseController):' | |||||
59 | # Return a rendered template |
|
61 | # Return a rendered template | |
60 | p = int(request.params.get('page', 1)) |
|
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 | c.following = self.sa.query(UserFollowing)\ |
|
71 | c.following = self.sa.query(UserFollowing)\ | |
63 | .filter(UserFollowing.user_id == self.rhodecode_user.user_id)\ |
|
72 | .filter(UserFollowing.user_id == self.rhodecode_user.user_id)\ | |
64 | .options(joinedload(UserFollowing.follows_repository))\ |
|
73 | .options(joinedload(UserFollowing.follows_repository))\ |
@@ -758,6 +758,10 b' div.options a {' | |||||
758 | padding: 11px 0 11px 10px; |
|
758 | padding: 11px 0 11px 10px; | |
759 | } |
|
759 | } | |
760 |
|
760 | |||
|
761 | #content div.box div.title .link-white{ | |||
|
762 | color: #FFFFFF; | |||
|
763 | } | |||
|
764 | ||||
761 | #content div.box div.title ul.links li { |
|
765 | #content div.box div.title ul.links li { | |
762 | list-style: none; |
|
766 | list-style: none; | |
763 | float: left; |
|
767 | float: left; |
@@ -27,43 +27,147 b'' | |||||
27 | </script> |
|
27 | </script> | |
28 | <div id="journal">${c.journal_data}</div> |
|
28 | <div id="journal">${c.journal_data}</div> | |
29 | </div> |
|
29 | </div> | |
30 |
|
||||
31 | <div class="box box-right"> |
|
30 | <div class="box box-right"> | |
32 | <!-- box / title --> |
|
31 | <!-- box / title --> | |
33 | <div class="title"> |
|
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 | </div> |
|
99 | </div> | |
36 | <div> |
|
100 | ||
37 | %if c.following: |
|
101 | <div id="watched" class="table" style="display:none"> | |
38 | %for entry in c.following: |
|
102 | <table> | |
39 | <div class="currently_following"> |
|
103 | <thead> | |
40 | %if entry.follows_user_id: |
|
104 | <tr> | |
41 | <img title="${_('following user')}" alt="${_('user')}" src="${h.url('/images/icons/user.png')}"/> |
|
105 | <th class="left">${_('Name')}</th> | |
42 | ${entry.follows_user.full_contact} |
|
106 | </thead> | |
43 | %endif |
|
107 | <tbody> | |
44 |
|
108 | %if c.following: | ||
45 |
|
|
109 | %for entry in c.following: | |
46 |
|
|
110 | <tr> | |
47 | <div style="float:left;padding-right:5px"> |
|
111 | <td> | |
48 | <span id="follow_toggle_${entry.follows_repository.repo_id}" class="following" title="${_('Stop following this repository')}" |
|
112 | %if entry.follows_user_id: | |
49 | onclick="javascript:toggleFollowingRepo(this,${entry.follows_repository.repo_id},'${str(h.get_token())}')"> |
|
113 | <img title="${_('following user')}" alt="${_('user')}" src="${h.url('/images/icons/user.png')}"/> | |
50 | </span> |
|
114 | ${entry.follows_user.full_contact} | |
51 |
|
|
115 | %endif | |
52 | %if entry.follows_repository.private: |
|
116 | ||
53 | <img class="icon" title="${_('private repository')}" alt="${_('private repository')}" src="${h.url('/images/icons/lock.png')}"/> |
|
117 | %if entry.follows_repo_id: | |
54 |
|
|
118 | ||
55 | <img class="icon" title="${_('public repository')}" alt="${_('public repository')}" src="${h.url('/images/icons/lock_open.png')}"/> |
|
119 | <div style="float:right;padding-right:5px"> | |
56 | %endif |
|
120 | <span id="follow_toggle_${entry.follows_repository.repo_id}" class="following" title="${_('Stop following this repository')}" | |
57 |
|
121 | onclick="javascript:toggleFollowingRepo(this,${entry.follows_repository.repo_id},'${str(h.get_token())}')"> | ||
58 | ${h.link_to(entry.follows_repository.repo_name,h.url('summary_home', |
|
122 | </span> | |
59 | repo_name=entry.follows_repository.repo_name))} |
|
123 | </div> | |
60 |
|
|
124 | ||
61 | %endif |
|
125 | %if entry.follows_repository.repo_type == 'hg': | |
62 | </div> |
|
126 | <img class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/> | |
63 | %endfor |
|
127 | %elif entry.follows_repository.repo_type == 'git': | |
64 | %else: |
|
128 | <img class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/> | |
65 | ${_('You are not following any users or repositories')} |
|
129 | %endif | |
66 | %endif |
|
130 | ||
67 | </div> |
|
131 | %if entry.follows_repository.private: | |
68 | </div> |
|
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 | </%def> |
|
173 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now