# HG changeset patch # User RhodeCode Admin # Date 2023-03-20 20:04:33 # Node ID 184e6a0860db37283a7549de9e1ec91931cd3595 # Parent 6c82c462f8ec308d3e148ade39a57bc20cde6ffd ui: links to tags/branches/bookmarks render that in a context of summary page for better navigation. diff --git a/rhodecode/apps/_base/__init__.py b/rhodecode/apps/_base/__init__.py --- a/rhodecode/apps/_base/__init__.py +++ b/rhodecode/apps/_base/__init__.py @@ -242,6 +242,22 @@ class RepoAppView(BaseAppView): 'Requirements are missing for repository %s: %s', self.db_repo_name, safe_unicode(error)) + def _prepare_and_set_clone_url(self, c): + username = '' + if self._rhodecode_user.username != User.DEFAULT_USER: + username = self._rhodecode_user.username + + _def_clone_uri = c.clone_uri_tmpl + _def_clone_uri_id = c.clone_uri_id_tmpl + _def_clone_uri_ssh = c.clone_uri_ssh_tmpl + + c.clone_repo_url = self.db_repo.clone_url( + user=username, uri_tmpl=_def_clone_uri) + c.clone_repo_url_id = self.db_repo.clone_url( + user=username, uri_tmpl=_def_clone_uri_id) + c.clone_repo_url_ssh = self.db_repo.clone_url( + uri_tmpl=_def_clone_uri_ssh, ssh=True) + def _get_local_tmpl_context(self, include_app_defaults=True): _ = self.request.translate c = super(RepoAppView, self)._get_local_tmpl_context( @@ -359,6 +375,7 @@ class RepoAppView(BaseAppView): 'repo_files', repo_name=_repo_name, commit_id=commit.raw_id, f_path=readme_node.path), } + readme_data = self._render_readme_or_none(commit, readme_node, relative_urls) readme_filename = readme_node.unicode_path @@ -366,6 +383,7 @@ class RepoAppView(BaseAppView): readme_data, readme_filename = generate_repo_readme( db_repo.repo_id, landing_commit_id, db_repo.repo_name, path, renderer_type,) + compute_time = time.time() - start log.debug('Repo README for path %s generated and computed in %.4fs', path, compute_time) diff --git a/rhodecode/apps/repository/views/repo_bookmarks.py b/rhodecode/apps/repository/views/repo_bookmarks.py --- a/rhodecode/apps/repository/views/repo_bookmarks.py +++ b/rhodecode/apps/repository/views/repo_bookmarks.py @@ -25,7 +25,7 @@ from rhodecode.apps._base import BaseRef from rhodecode.lib import ext_json from rhodecode.lib import helpers as h from rhodecode.lib.auth import (LoginRequired, HasRepoPermissionAnyDecorator) - +from rhodecode.model.scm import ScmModel log = logging.getLogger(__name__) @@ -37,6 +37,9 @@ class RepoBookmarksView(BaseReferencesVi 'repository.read', 'repository.write', 'repository.admin') def bookmarks(self): c = self.load_default_context() + self._prepare_and_set_clone_url(c) + c.rhodecode_repo = self.rhodecode_vcs_repo + c.repository_forks = ScmModel().get_forks(self.db_repo) if not h.is_hg(self.db_repo): raise HTTPNotFound() diff --git a/rhodecode/apps/repository/views/repo_branches.py b/rhodecode/apps/repository/views/repo_branches.py --- a/rhodecode/apps/repository/views/repo_branches.py +++ b/rhodecode/apps/repository/views/repo_branches.py @@ -24,7 +24,7 @@ import logging from rhodecode.apps._base import BaseReferencesView from rhodecode.lib import ext_json from rhodecode.lib.auth import (LoginRequired, HasRepoPermissionAnyDecorator) - +from rhodecode.model.scm import ScmModel log = logging.getLogger(__name__) @@ -36,6 +36,9 @@ class RepoBranchesView(BaseReferencesVie 'repository.read', 'repository.write', 'repository.admin') def branches(self): c = self.load_default_context() + self._prepare_and_set_clone_url(c) + c.rhodecode_repo = self.rhodecode_vcs_repo + c.repository_forks = ScmModel().get_forks(self.db_repo) ref_items = self.rhodecode_vcs_repo.branches_all.items() data = self.load_refs_context( diff --git a/rhodecode/apps/repository/views/repo_summary.py b/rhodecode/apps/repository/views/repo_summary.py --- a/rhodecode/apps/repository/views/repo_summary.py +++ b/rhodecode/apps/repository/views/repo_summary.py @@ -79,22 +79,6 @@ class RepoSummaryView(RepoAppView): c.comments = self.db_repo.get_comments(page_ids) c.statuses = self.db_repo.statuses(page_ids) - def _prepare_and_set_clone_url(self, c): - username = '' - if self._rhodecode_user.username != User.DEFAULT_USER: - username = safe_str(self._rhodecode_user.username) - - _def_clone_uri = c.clone_uri_tmpl - _def_clone_uri_id = c.clone_uri_id_tmpl - _def_clone_uri_ssh = c.clone_uri_ssh_tmpl - - c.clone_repo_url = self.db_repo.clone_url( - user=username, uri_tmpl=_def_clone_uri) - c.clone_repo_url_id = self.db_repo.clone_url( - user=username, uri_tmpl=_def_clone_uri_id) - c.clone_repo_url_ssh = self.db_repo.clone_url( - uri_tmpl=_def_clone_uri_ssh, ssh=True) - @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') diff --git a/rhodecode/apps/repository/views/repo_tags.py b/rhodecode/apps/repository/views/repo_tags.py --- a/rhodecode/apps/repository/views/repo_tags.py +++ b/rhodecode/apps/repository/views/repo_tags.py @@ -23,6 +23,7 @@ import logging from rhodecode.apps._base import BaseReferencesView from rhodecode.lib import ext_json from rhodecode.lib.auth import (LoginRequired, HasRepoPermissionAnyDecorator) +from rhodecode.model.scm import ScmModel log = logging.getLogger(__name__) @@ -34,6 +35,9 @@ class RepoTagsView(BaseReferencesView): 'repository.read', 'repository.write', 'repository.admin') def tags(self): c = self.load_default_context() + self._prepare_and_set_clone_url(c) + c.rhodecode_repo = self.rhodecode_vcs_repo + c.repository_forks = ScmModel().get_forks(self.db_repo) ref_items = self.rhodecode_vcs_repo.tags.items() data = self.load_refs_context( diff --git a/rhodecode/templates/admin/my_account/my_account_bookmarks.mako b/rhodecode/templates/admin/my_account/my_account_bookmarks.mako --- a/rhodecode/templates/admin/my_account/my_account_bookmarks.mako +++ b/rhodecode/templates/admin/my_account/my_account_bookmarks.mako @@ -43,7 +43,7 @@ % if repo: - ${dt.repo_name(name=repo.repo_name, rtype=repo.repo_type,rstate=None,private=None,archived=False,fork_of=False)} + ${dt.repo_name(name=repo.repo_name, rtype=repo.repo_type,rstate=None,private=None,archived=False, fork_repo_name=None)} ${h.hidden('bookmark_repo', repo.repo_id)} % elif repo_group: ${dt.repo_group_name(repo_group.group_name)} diff --git a/rhodecode/templates/bookmarks/bookmarks.mako b/rhodecode/templates/bookmarks/bookmarks.mako --- a/rhodecode/templates/bookmarks/bookmarks.mako +++ b/rhodecode/templates/bookmarks/bookmarks.mako @@ -1,8 +1,9 @@ ## -*- coding: utf-8 -*- <%inherit file="/base/base.mako"/> +<%namespace name="components" file="/summary/components.mako"/> <%def name="title()"> - ${_('%s Bookmarks') % c.repo_name} + ${_('{} Bookmarks').format(c.repo_name)} %if c.rhodecode_name: · ${h.branding(c.rhodecode_name)} %endif @@ -19,6 +20,10 @@ <%def name="main()"> +
+ ${components.summary_detail(breadcrumbs_links=self.breadcrumbs_links(), show_downloads=False, simplified=True)} +
+
@@ -60,7 +65,7 @@ // object list $('#obj_list_table').DataTable({ - data: ${c.data|n}, + data: ${c.data | n}, dom: 'rtp', pageLength: ${c.visual.dashboard_items}, order: [[ 0, "asc" ]], diff --git a/rhodecode/templates/branches/branches.mako b/rhodecode/templates/branches/branches.mako --- a/rhodecode/templates/branches/branches.mako +++ b/rhodecode/templates/branches/branches.mako @@ -1,8 +1,9 @@ ## -*- coding: utf-8 -*- <%inherit file="/base/base.mako"/> +<%namespace name="components" file="/summary/components.mako"/> <%def name="title()"> - ${_('%s Branches') % c.repo_name} + ${_('{} Branches').format(c.repo_name)} %if c.rhodecode_name: · ${h.branding(c.rhodecode_name)} %endif @@ -19,6 +20,10 @@ <%def name="main()"> +
+ ${components.summary_detail(breadcrumbs_links=self.breadcrumbs_links(), show_downloads=False, simplified=True)} +
+
diff --git a/rhodecode/templates/data_table/_dt_elements.mako b/rhodecode/templates/data_table/_dt_elements.mako --- a/rhodecode/templates/data_table/_dt_elements.mako +++ b/rhodecode/templates/data_table/_dt_elements.mako @@ -78,7 +78,7 @@
-<%def name="repo_name(name,rtype,rstate,private,archived,fork_of,short_name=False,admin=False)"> +<%def name="repo_name(name,rtype,rstate,private,archived,fork_repo_name,short_name=False,admin=False)"> <% def get_name(name,short_name=short_name): if short_name: @@ -109,8 +109,8 @@ %endif ${get_name(name)} - %if fork_of: - + %if fork_repo_name: + %endif %if rstate == 'repo_state_pending': diff --git a/rhodecode/templates/files/files_source.mako b/rhodecode/templates/files/files_source.mako --- a/rhodecode/templates/files/files_source.mako +++ b/rhodecode/templates/files/files_source.mako @@ -64,7 +64,7 @@
- ${c.file} + ${c.file.name}
diff --git a/rhodecode/templates/summary/components.mako b/rhodecode/templates/summary/components.mako --- a/rhodecode/templates/summary/components.mako +++ b/rhodecode/templates/summary/components.mako @@ -50,7 +50,7 @@ %endif -<%def name="summary_detail(breadcrumbs_links, show_downloads=True)"> +<%def name="summary_detail(breadcrumbs_links, show_downloads=True, simplified=False)"> <% summary = lambda n:{False:'summary-short'}.get(n) %>
@@ -140,6 +140,8 @@
+ + % if not simplified: ## owner, description, downloads, statistics ## Owner @@ -266,11 +268,15 @@
- + % endif
-
+ % if simplified: +
+ %else: +
${_('Show More')} -
+
+ % endif diff --git a/rhodecode/templates/tags/tags.mako b/rhodecode/templates/tags/tags.mako --- a/rhodecode/templates/tags/tags.mako +++ b/rhodecode/templates/tags/tags.mako @@ -1,8 +1,9 @@ ## -*- coding: utf-8 -*- <%inherit file="/base/base.mako"/> +<%namespace name="components" file="/summary/components.mako"/> <%def name="title()"> - ${_('%s Tags') % c.repo_name} + ${_('{} Tags').format(c.repo_name)} %if c.rhodecode_name: · ${h.branding(c.rhodecode_name)} %endif @@ -19,6 +20,10 @@ <%def name="main()"> +
+ ${components.summary_detail(breadcrumbs_links=self.breadcrumbs_links(), show_downloads=False, simplified=True)} +
+