Show More
@@ -237,6 +237,8 b' class RepoAppView(BaseAppView):' | |||
|
237 | 237 | c.rhodecode_db_repo = self.db_repo |
|
238 | 238 | c.repo_name = self.db_repo_name |
|
239 | 239 | c.repository_pull_requests = self.db_repo_pull_requests |
|
240 | c.repository_is_user_following = ScmModel().is_following_repo( | |
|
241 | self.db_repo_name, self._rhodecode_user.user_id) | |
|
240 | 242 | self.path_filter = PathFilter(None) |
|
241 | 243 | |
|
242 | 244 | c.repository_requirements_missing = {} |
@@ -297,8 +297,7 b' class JournalView(BaseAppView):' | |||
|
297 | 297 | user_id = self.request.POST.get('follows_user_id') |
|
298 | 298 | if user_id: |
|
299 | 299 | try: |
|
300 | ScmModel().toggle_following_user( | |
|
301 | user_id, self._rhodecode_user.user_id) | |
|
300 | ScmModel().toggle_following_user(user_id, self._rhodecode_user.user_id) | |
|
302 | 301 | Session().commit() |
|
303 | 302 | return 'ok' |
|
304 | 303 | except Exception: |
@@ -307,8 +306,7 b' class JournalView(BaseAppView):' | |||
|
307 | 306 | repo_id = self.request.POST.get('follows_repo_id') |
|
308 | 307 | if repo_id: |
|
309 | 308 | try: |
|
310 | ScmModel().toggle_following_repo( | |
|
311 | repo_id, self._rhodecode_user.user_id) | |
|
309 | ScmModel().toggle_following_repo(repo_id, self._rhodecode_user.user_id) | |
|
312 | 310 | Session().commit() |
|
313 | 311 | return 'ok' |
|
314 | 312 | except Exception: |
@@ -360,7 +360,7 b' class MyAccountView(BaseAppView, DataGri' | |||
|
360 | 360 | 'repository.read', 'repository.write', 'repository.admin']) |
|
361 | 361 | |
|
362 | 362 | repos_data = RepoModel().get_repos_as_dict( |
|
363 | repo_list=repo_list, admin=admin) | |
|
363 | repo_list=repo_list, admin=admin, short_name=False) | |
|
364 | 364 | # json used to render the grid |
|
365 | 365 | return json.dumps(repos_data) |
|
366 | 366 |
@@ -233,8 +233,6 b' class RepoSummaryView(RepoAppView):' | |||
|
233 | 233 | c.enable_downloads = self.db_repo.enable_downloads |
|
234 | 234 | c.repository_followers = scm_model.get_followers(self.db_repo) |
|
235 | 235 | c.repository_forks = scm_model.get_forks(self.db_repo) |
|
236 | c.repository_is_user_following = scm_model.is_following_repo( | |
|
237 | self.db_repo_name, self._rhodecode_user.user_id) | |
|
238 | 236 | |
|
239 | 237 | # first interaction with the VCS instance after here... |
|
240 | 238 | if c.repository_requirements_missing: |
@@ -199,7 +199,7 b' class RepoModel(BaseModel):' | |||
|
199 | 199 | repo.update_commit_cache() |
|
200 | 200 | |
|
201 | 201 | def get_repos_as_dict(self, repo_list=None, admin=False, |
|
202 | super_user_actions=False): | |
|
202 | super_user_actions=False, short_name=None): | |
|
203 | 203 | _render = get_current_request().get_partial_renderer( |
|
204 | 204 | 'rhodecode:templates/data_table/_dt_elements.mako') |
|
205 | 205 | c = _render.get_call_context() |
@@ -208,8 +208,12 b' class RepoModel(BaseModel):' | |||
|
208 | 208 | return _render('quick_menu', repo_name) |
|
209 | 209 | |
|
210 | 210 | def repo_lnk(name, rtype, rstate, private, archived, fork_of): |
|
211 | if short_name is not None: | |
|
212 | short_name_var = short_name | |
|
213 | else: | |
|
214 | short_name_var = not admin | |
|
211 | 215 | return _render('repo_name', name, rtype, rstate, private, archived, fork_of, |
|
212 |
short_name= |
|
|
216 | short_name=short_name_var, admin=False) | |
|
213 | 217 | |
|
214 | 218 | def last_change(last_change): |
|
215 | 219 | if admin and isinstance(last_change, datetime.datetime) and not last_change.tzinfo: |
@@ -17,56 +17,42 b'' | |||
|
17 | 17 | // # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
18 | 18 | |
|
19 | 19 | var onSuccessFollow = function(target){ |
|
20 |
var |
|
|
21 | var f_cnt = $('#current_followers_count'); | |
|
20 | var targetEl = $(target); | |
|
22 | 21 | |
|
23 | if(f.hasClass('follow')){ | |
|
24 | f.removeClass('follow'); | |
|
25 |
f. |
|
|
26 | f.attr('title', _gettext('Stop following this repository')); | |
|
27 | $(f).html(_gettext('Unfollow')); | |
|
28 | if(f_cnt.length){ | |
|
29 | var cnt = Number(f_cnt.html())+1; | |
|
30 | f_cnt.html(cnt); | |
|
31 | } | |
|
32 | } | |
|
33 | else{ | |
|
34 | f.removeClass('following'); | |
|
35 | f.addClass('follow'); | |
|
36 | f.attr('title', _gettext('Start following this repository')); | |
|
37 | $(f).html(_gettext('Follow')); | |
|
38 | if(f_cnt.length){ | |
|
39 | var cnt = Number(f_cnt.html())-1; | |
|
40 | f_cnt.html(cnt); | |
|
41 | } | |
|
22 | var callback = function () { | |
|
23 | targetEl.animate({'opacity': 1.00}, 200); | |
|
24 | if (targetEl.hasClass('watching')) { | |
|
25 | targetEl.removeClass('watching'); | |
|
26 | targetEl.attr('title', _gettext('Stopped watching this repository')); | |
|
27 | $(targetEl).html(_gettext('Watch')); | |
|
28 | } else { | |
|
29 | targetEl.addClass('watching'); | |
|
30 | targetEl.attr('title', _gettext('Started watching this repository')); | |
|
31 | $(targetEl).html(_gettext('Unwatch')); | |
|
42 | 32 | } |
|
43 | 33 | }; |
|
34 | targetEl.animate({'opacity': 0.15}, 200, callback); | |
|
35 | }; | |
|
44 | 36 | |
|
45 | // TODO:: check if the function is needed. 0 usage found | |
|
46 |
var toggleFollowingUser = function(target,follows_user_id |
|
|
37 | ||
|
38 | var toggleFollowingUser = function (target, follows_user_id) { | |
|
47 | 39 | var args = { |
|
48 | 40 | 'follows_user_id': follows_user_id, |
|
49 | 'auth_token': token, | |
|
50 | 41 | 'csrf_token': CSRF_TOKEN |
|
51 | 42 | }; |
|
52 | if(user_id != undefined){ | |
|
53 | args.user_id = user_id | |
|
54 | } | |
|
43 | ||
|
55 | 44 | ajaxPOST(pyroutes.url('toggle_following'), args, function(){ |
|
56 | 45 | onSuccessFollow(target); |
|
57 | 46 | }); |
|
58 | 47 | return false; |
|
59 | 48 | }; |
|
60 | 49 | |
|
61 |
var toggleFollowingRepo = function(target,follows_repo_id |
|
|
50 | var toggleFollowingRepo = function (target, follows_repo_id) { | |
|
62 | 51 | var args = { |
|
63 | 52 | 'follows_repo_id': follows_repo_id, |
|
64 | 'auth_token': token, | |
|
65 | 53 | 'csrf_token': CSRF_TOKEN |
|
66 | 54 | }; |
|
67 | if(user_id != undefined){ | |
|
68 | args.user_id = user_id | |
|
69 | } | |
|
55 | ||
|
70 | 56 | ajaxPOST(pyroutes.url('toggle_following'), args, function(){ |
|
71 | 57 | onSuccessFollow(target); |
|
72 | 58 | }); |
@@ -217,6 +217,15 b'' | |||
|
217 | 217 | <div class="pull-right"> |
|
218 | 218 | %if c.rhodecode_user.username != h.DEFAULT_USER: |
|
219 | 219 | <a href="${h.route_path('atom_feed_home', repo_name=c.rhodecode_db_repo.repo_name, _query=dict(auth_token=c.rhodecode_user.feed_token))}" title="${_('RSS Feed')}" class="btn btn-sm"><i class="icon-rss-sign"></i>RSS</a> |
|
220 | ||
|
221 | <a href="#WatchRepo" onclick="toggleFollowingRepo(this, templateContext.repo_id); return false" title="${_('Watch this Repository and actions on it in your personalized journal')}" class="btn btn-sm ${('watching' if c.repository_is_user_following else '')}"> | |
|
222 | % if c.repository_is_user_following: | |
|
223 | Unwatch | |
|
224 | % else: | |
|
225 | Watch | |
|
226 | % endif | |
|
227 | ||
|
228 | </a> | |
|
220 | 229 | %else: |
|
221 | 230 | <a href="${h.route_path('atom_feed_home', repo_name=c.rhodecode_db_repo.repo_name)}" title="${_('RSS Feed')}" class="btn btn-sm"><i class="icon-rss-sign"></i>RSS</a> |
|
222 | 231 | %endif |
General Comments 0
You need to be logged in to leave comments.
Login now