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