##// END OF EJS Templates
ui: links to tags/branches/bookmarks render that in a context of summary page for better navigation.
super-admin -
r4977:184e6a08 default
parent child Browse files
Show More
@@ -242,6 +242,22 b' class RepoAppView(BaseAppView):'
242 'Requirements are missing for repository %s: %s',
242 'Requirements are missing for repository %s: %s',
243 self.db_repo_name, safe_unicode(error))
243 self.db_repo_name, safe_unicode(error))
244
244
245 def _prepare_and_set_clone_url(self, c):
246 username = ''
247 if self._rhodecode_user.username != User.DEFAULT_USER:
248 username = self._rhodecode_user.username
249
250 _def_clone_uri = c.clone_uri_tmpl
251 _def_clone_uri_id = c.clone_uri_id_tmpl
252 _def_clone_uri_ssh = c.clone_uri_ssh_tmpl
253
254 c.clone_repo_url = self.db_repo.clone_url(
255 user=username, uri_tmpl=_def_clone_uri)
256 c.clone_repo_url_id = self.db_repo.clone_url(
257 user=username, uri_tmpl=_def_clone_uri_id)
258 c.clone_repo_url_ssh = self.db_repo.clone_url(
259 uri_tmpl=_def_clone_uri_ssh, ssh=True)
260
245 def _get_local_tmpl_context(self, include_app_defaults=True):
261 def _get_local_tmpl_context(self, include_app_defaults=True):
246 _ = self.request.translate
262 _ = self.request.translate
247 c = super(RepoAppView, self)._get_local_tmpl_context(
263 c = super(RepoAppView, self)._get_local_tmpl_context(
@@ -359,6 +375,7 b' class RepoAppView(BaseAppView):'
359 'repo_files', repo_name=_repo_name,
375 'repo_files', repo_name=_repo_name,
360 commit_id=commit.raw_id, f_path=readme_node.path),
376 commit_id=commit.raw_id, f_path=readme_node.path),
361 }
377 }
378
362 readme_data = self._render_readme_or_none(commit, readme_node, relative_urls)
379 readme_data = self._render_readme_or_none(commit, readme_node, relative_urls)
363 readme_filename = readme_node.unicode_path
380 readme_filename = readme_node.unicode_path
364
381
@@ -366,6 +383,7 b' class RepoAppView(BaseAppView):'
366
383
367 readme_data, readme_filename = generate_repo_readme(
384 readme_data, readme_filename = generate_repo_readme(
368 db_repo.repo_id, landing_commit_id, db_repo.repo_name, path, renderer_type,)
385 db_repo.repo_id, landing_commit_id, db_repo.repo_name, path, renderer_type,)
386
369 compute_time = time.time() - start
387 compute_time = time.time() - start
370 log.debug('Repo README for path %s generated and computed in %.4fs',
388 log.debug('Repo README for path %s generated and computed in %.4fs',
371 path, compute_time)
389 path, compute_time)
@@ -25,7 +25,7 b' from rhodecode.apps._base import BaseRef'
25 from rhodecode.lib import ext_json
25 from rhodecode.lib import ext_json
26 from rhodecode.lib import helpers as h
26 from rhodecode.lib import helpers as h
27 from rhodecode.lib.auth import (LoginRequired, HasRepoPermissionAnyDecorator)
27 from rhodecode.lib.auth import (LoginRequired, HasRepoPermissionAnyDecorator)
28
28 from rhodecode.model.scm import ScmModel
29
29
30 log = logging.getLogger(__name__)
30 log = logging.getLogger(__name__)
31
31
@@ -37,6 +37,9 b' class RepoBookmarksView(BaseReferencesVi'
37 'repository.read', 'repository.write', 'repository.admin')
37 'repository.read', 'repository.write', 'repository.admin')
38 def bookmarks(self):
38 def bookmarks(self):
39 c = self.load_default_context()
39 c = self.load_default_context()
40 self._prepare_and_set_clone_url(c)
41 c.rhodecode_repo = self.rhodecode_vcs_repo
42 c.repository_forks = ScmModel().get_forks(self.db_repo)
40
43
41 if not h.is_hg(self.db_repo):
44 if not h.is_hg(self.db_repo):
42 raise HTTPNotFound()
45 raise HTTPNotFound()
@@ -24,7 +24,7 b' import logging'
24 from rhodecode.apps._base import BaseReferencesView
24 from rhodecode.apps._base import BaseReferencesView
25 from rhodecode.lib import ext_json
25 from rhodecode.lib import ext_json
26 from rhodecode.lib.auth import (LoginRequired, HasRepoPermissionAnyDecorator)
26 from rhodecode.lib.auth import (LoginRequired, HasRepoPermissionAnyDecorator)
27
27 from rhodecode.model.scm import ScmModel
28
28
29 log = logging.getLogger(__name__)
29 log = logging.getLogger(__name__)
30
30
@@ -36,6 +36,9 b' class RepoBranchesView(BaseReferencesVie'
36 'repository.read', 'repository.write', 'repository.admin')
36 'repository.read', 'repository.write', 'repository.admin')
37 def branches(self):
37 def branches(self):
38 c = self.load_default_context()
38 c = self.load_default_context()
39 self._prepare_and_set_clone_url(c)
40 c.rhodecode_repo = self.rhodecode_vcs_repo
41 c.repository_forks = ScmModel().get_forks(self.db_repo)
39
42
40 ref_items = self.rhodecode_vcs_repo.branches_all.items()
43 ref_items = self.rhodecode_vcs_repo.branches_all.items()
41 data = self.load_refs_context(
44 data = self.load_refs_context(
@@ -79,22 +79,6 b' class RepoSummaryView(RepoAppView):'
79 c.comments = self.db_repo.get_comments(page_ids)
79 c.comments = self.db_repo.get_comments(page_ids)
80 c.statuses = self.db_repo.statuses(page_ids)
80 c.statuses = self.db_repo.statuses(page_ids)
81
81
82 def _prepare_and_set_clone_url(self, c):
83 username = ''
84 if self._rhodecode_user.username != User.DEFAULT_USER:
85 username = safe_str(self._rhodecode_user.username)
86
87 _def_clone_uri = c.clone_uri_tmpl
88 _def_clone_uri_id = c.clone_uri_id_tmpl
89 _def_clone_uri_ssh = c.clone_uri_ssh_tmpl
90
91 c.clone_repo_url = self.db_repo.clone_url(
92 user=username, uri_tmpl=_def_clone_uri)
93 c.clone_repo_url_id = self.db_repo.clone_url(
94 user=username, uri_tmpl=_def_clone_uri_id)
95 c.clone_repo_url_ssh = self.db_repo.clone_url(
96 uri_tmpl=_def_clone_uri_ssh, ssh=True)
97
98 @LoginRequired()
82 @LoginRequired()
99 @HasRepoPermissionAnyDecorator(
83 @HasRepoPermissionAnyDecorator(
100 'repository.read', 'repository.write', 'repository.admin')
84 'repository.read', 'repository.write', 'repository.admin')
@@ -23,6 +23,7 b' import logging'
23 from rhodecode.apps._base import BaseReferencesView
23 from rhodecode.apps._base import BaseReferencesView
24 from rhodecode.lib import ext_json
24 from rhodecode.lib import ext_json
25 from rhodecode.lib.auth import (LoginRequired, HasRepoPermissionAnyDecorator)
25 from rhodecode.lib.auth import (LoginRequired, HasRepoPermissionAnyDecorator)
26 from rhodecode.model.scm import ScmModel
26
27
27 log = logging.getLogger(__name__)
28 log = logging.getLogger(__name__)
28
29
@@ -34,6 +35,9 b' class RepoTagsView(BaseReferencesView):'
34 'repository.read', 'repository.write', 'repository.admin')
35 'repository.read', 'repository.write', 'repository.admin')
35 def tags(self):
36 def tags(self):
36 c = self.load_default_context()
37 c = self.load_default_context()
38 self._prepare_and_set_clone_url(c)
39 c.rhodecode_repo = self.rhodecode_vcs_repo
40 c.repository_forks = ScmModel().get_forks(self.db_repo)
37
41
38 ref_items = self.rhodecode_vcs_repo.tags.items()
42 ref_items = self.rhodecode_vcs_repo.tags.items()
39 data = self.load_refs_context(
43 data = self.load_refs_context(
@@ -43,7 +43,7 b''
43 </div>
43 </div>
44
44
45 % if repo:
45 % if repo:
46 ${dt.repo_name(name=repo.repo_name, rtype=repo.repo_type,rstate=None,private=None,archived=False,fork_of=False)}
46 ${dt.repo_name(name=repo.repo_name, rtype=repo.repo_type,rstate=None,private=None,archived=False, fork_repo_name=None)}
47 ${h.hidden('bookmark_repo', repo.repo_id)}
47 ${h.hidden('bookmark_repo', repo.repo_id)}
48 % elif repo_group:
48 % elif repo_group:
49 ${dt.repo_group_name(repo_group.group_name)}
49 ${dt.repo_group_name(repo_group.group_name)}
@@ -1,8 +1,9 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.mako"/>
2 <%inherit file="/base/base.mako"/>
3 <%namespace name="components" file="/summary/components.mako"/>
3
4
4 <%def name="title()">
5 <%def name="title()">
5 ${_('%s Bookmarks') % c.repo_name}
6 ${_('{} Bookmarks').format(c.repo_name)}
6 %if c.rhodecode_name:
7 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
8 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
9 %endif
@@ -19,6 +20,10 b''
19 </%def>
20 </%def>
20
21
21 <%def name="main()">
22 <%def name="main()">
23 <div id="repo-summary" class="summary">
24 ${components.summary_detail(breadcrumbs_links=self.breadcrumbs_links(), show_downloads=False, simplified=True)}
25 </div>
26
22 <div class="box">
27 <div class="box">
23 <div class="title">
28 <div class="title">
24
29
@@ -1,8 +1,9 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.mako"/>
2 <%inherit file="/base/base.mako"/>
3 <%namespace name="components" file="/summary/components.mako"/>
3
4
4 <%def name="title()">
5 <%def name="title()">
5 ${_('%s Branches') % c.repo_name}
6 ${_('{} Branches').format(c.repo_name)}
6 %if c.rhodecode_name:
7 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
8 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
9 %endif
@@ -19,6 +20,10 b''
19 </%def>
20 </%def>
20
21
21 <%def name="main()">
22 <%def name="main()">
23 <div id="repo-summary" class="summary">
24 ${components.summary_detail(breadcrumbs_links=self.breadcrumbs_links(), show_downloads=False, simplified=True)}
25 </div>
26
22 <div class="box">
27 <div class="box">
23 <div class="title">
28 <div class="title">
24
29
@@ -78,7 +78,7 b''
78 </div>
78 </div>
79 </%def>
79 </%def>
80
80
81 <%def name="repo_name(name,rtype,rstate,private,archived,fork_of,short_name=False,admin=False)">
81 <%def name="repo_name(name,rtype,rstate,private,archived,fork_repo_name,short_name=False,admin=False)">
82 <%
82 <%
83 def get_name(name,short_name=short_name):
83 def get_name(name,short_name=short_name):
84 if short_name:
84 if short_name:
@@ -109,8 +109,8 b''
109 %endif
109 %endif
110 ${get_name(name)}
110 ${get_name(name)}
111 </a>
111 </a>
112 %if fork_of:
112 %if fork_repo_name:
113 <a href="${h.route_path('repo_summary',repo_name=fork_of.repo_name)}"><i class="icon-code-fork"></i></a>
113 <a href="${h.route_path('repo_summary',repo_name=fork_repo_name)}"><i class="icon-code-fork"></i></a>
114 %endif
114 %endif
115 %if rstate == 'repo_state_pending':
115 %if rstate == 'repo_state_pending':
116 <span class="creation_in_progress tooltip" title="${_('This repository is being created in a background task')}">
116 <span class="creation_in_progress tooltip" title="${_('This repository is being created in a background task')}">
@@ -64,7 +64,7 b''
64 <div class="codeblock">
64 <div class="codeblock">
65 <div class=" codeblock-header">
65 <div class=" codeblock-header">
66 <div class="file-filename">
66 <div class="file-filename">
67 <i class="icon-file"></i> ${c.file}
67 <i class="icon-file"></i> ${c.file.name}
68 </div>
68 </div>
69
69
70 <div class="file-stats">
70 <div class="file-stats">
@@ -50,7 +50,7 b''
50 %endif
50 %endif
51 </%def>
51 </%def>
52
52
53 <%def name="summary_detail(breadcrumbs_links, show_downloads=True)">
53 <%def name="summary_detail(breadcrumbs_links, show_downloads=True, simplified=False)">
54 <% summary = lambda n:{False:'summary-short'}.get(n) %>
54 <% summary = lambda n:{False:'summary-short'}.get(n) %>
55
55
56 <div id="summary-menu-stats" class="summary-detail">
56 <div id="summary-menu-stats" class="summary-detail">
@@ -140,6 +140,8 b''
140 </div>
140 </div>
141 </div>
141 </div>
142 </div>
142 </div>
143
144 % if not simplified:
143 ## owner, description, downloads, statistics
145 ## owner, description, downloads, statistics
144
146
145 ## Owner
147 ## Owner
@@ -266,11 +268,15 b''
266
268
267 </div>
269 </div>
268 </div>
270 </div>
269
271 % endif
270
272
271 </div><!--end summary-detail-->
273 </div><!--end summary-detail-->
272
274
275 % if simplified:
276 <div style="height: 25px"></div>
277 %else:
273 <div id="summary_details_expand" class="btn-collapse" data-toggle="summary-details">
278 <div id="summary_details_expand" class="btn-collapse" data-toggle="summary-details">
274 ${_('Show More')}
279 ${_('Show More')}
275 </div>
280 </div>
281 % endif
276 </%def>
282 </%def>
@@ -1,8 +1,9 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.mako"/>
2 <%inherit file="/base/base.mako"/>
3 <%namespace name="components" file="/summary/components.mako"/>
3
4
4 <%def name="title()">
5 <%def name="title()">
5 ${_('%s Tags') % c.repo_name}
6 ${_('{} Tags').format(c.repo_name)}
6 %if c.rhodecode_name:
7 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
8 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
9 %endif
@@ -19,6 +20,10 b''
19 </%def>
20 </%def>
20
21
21 <%def name="main()">
22 <%def name="main()">
23 <div id="repo-summary" class="summary">
24 ${components.summary_detail(breadcrumbs_links=self.breadcrumbs_links(), show_downloads=False, simplified=True)}
25 </div>
26
22 <div class="box">
27 <div class="box">
23 <div class="title">
28 <div class="title">
24
29
General Comments 0
You need to be logged in to leave comments. Login now