Mercurial > kallithea
changeset 4276:432e86d1e555
repo context bar: preserve current revision when navigating between changelog, changeset and file view
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Wed, 12 Jun 2013 02:13:02 +0200 |
parents | cdf89e722ef6 |
children | 452f3d4a9ceb |
files | kallithea/controllers/changelog.py kallithea/controllers/files.py kallithea/templates/base/base.html kallithea/templates/changelog/changelog.html kallithea/templates/changeset/changeset.html kallithea/templates/files/files.html |
diffstat | 6 files changed, 26 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/controllers/changelog.py Fri Jul 18 18:44:54 2014 +0200 +++ b/kallithea/controllers/changelog.py Wed Jun 12 02:13:02 2013 +0200 @@ -145,6 +145,9 @@ return redirect(url('changelog_file_home', repo_name=c.repo_name, revision=branch_name, f_path=f_path or '')) + if revision == 'tip': + revision = None + c.changelog_for_path = f_path try: @@ -164,13 +167,13 @@ redirect(h.url('changelog_home', repo_name=repo_name)) collection = list(reversed(collection)) else: - collection = c.db_repo_scm_instance.get_changesets(start=0, + collection = c.db_repo_scm_instance.get_changesets(start=0, end=revision, branch_name=branch_name) c.total_cs = len(collection) c.pagination = RepoPage(collection, page=p, item_count=c.total_cs, items_per_page=c.size, branch=branch_name,) - collection = list(c.pagination) + page_revisions = [x.raw_id for x in c.pagination] c.comments = c.db_repo.get_comments(page_revisions) c.statuses = c.db_repo.statuses(page_revisions) @@ -194,6 +197,8 @@ _revs = [x.revision for x in c.pagination] self._graph(c.db_repo_scm_instance, _revs, c.total_cs, c.size, p) + c.revision = revision # requested revision ref + c.first_revision = c.pagination[0] # pagination is never empty here! return render('changelog/changelog.html') @LoginRequired()
--- a/kallithea/controllers/files.py Fri Jul 18 18:44:54 2014 +0200 +++ b/kallithea/controllers/files.py Wed Jun 12 02:13:02 2013 +0200 @@ -136,11 +136,11 @@ if post_revision: cs = self.__get_cs_or_redirect(post_revision, repo_name) + c.revision = revision c.changeset = self.__get_cs_or_redirect(revision, repo_name) c.branch = request.GET.get('branch', None) c.f_path = f_path c.annotate = annotate - c.changeset = self.__get_cs_or_redirect(revision, repo_name) cur_rev = c.changeset.revision # prev link
--- a/kallithea/templates/base/base.html Fri Jul 18 18:44:54 2014 +0200 +++ b/kallithea/templates/base/base.html Wed Jun 12 02:13:02 2013 +0200 @@ -98,7 +98,8 @@ </ul> </%def> -<%def name="repo_context_bar(current=None)"> +<%def name="repo_context_bar(current=None, rev=None)"> + <% rev = None if rev == 'tip' else rev %> <% def follow_class(): if c.repository_following: @@ -143,8 +144,12 @@ --> <ul id="context-pages" class="horizontal-list"> <li ${is_current('summary')}><a href="${h.url('summary_home', repo_name=c.repo_name)}"><i class="icon-file-text"></i> ${_('Summary')}</a></li> + %if rev: + <li ${is_current('changelog')}><a href="${h.url('changelog_file_home', repo_name=c.repo_name, revision=rev, f_path='')}"><i class="icon-time"></i> ${_('Changelog')}</a></li> + %else: <li ${is_current('changelog')}><a href="${h.url('changelog_home', repo_name=c.repo_name)}"><i class="icon-time"></i> ${_('Changelog')}</a></li> - <li ${is_current('files')}><a href="${h.url('files_home', repo_name=c.repo_name)}"><i class="icon-file"></i> ${_('Files')}</a></li> + %endif + <li ${is_current('files')}><a href="${h.url('files_home', repo_name=c.repo_name, revision=rev or 'tip')}"><i class="icon-file"></i> ${_('Files')}</a></li> <li ${is_current('switch-to')}> <a href="#" id="branch_tag_switcher_2" class="dropdown"><i class="icon-random"></i> ${_('Switch To')}</a> <ul id="switch_to_list_2" class="switch_to submenu">
--- a/kallithea/templates/changelog/changelog.html Fri Jul 18 18:44:54 2014 +0200 +++ b/kallithea/templates/changelog/changelog.html Wed Jun 12 02:13:02 2013 +0200 @@ -18,6 +18,9 @@ %if c.changelog_for_path: - /${c.changelog_for_path} %endif + %if c.revision: + @ ${h.short_id(c.first_revision.raw_id)} + %endif - ${ungettext('showing %d out of %d revision', 'showing %d out of %d revisions', size) % (size, c.total_cs)} </%def> @@ -26,7 +29,7 @@ </%def> <%def name="main()"> -${self.repo_context_bar('changelog')} +${self.repo_context_bar('changelog', c.first_revision.raw_id if c.first_revision else None)} <div class="box"> <!-- box / title --> <div class="title"> @@ -41,7 +44,11 @@ <div class="info_box" style="text-align: right; float: right"> <a href="#" class="btn btn-mini" id="rev_range_container" style="display:none"></a> <a href="#" class="btn btn-mini" id="rev_range_clear" style="display:none">${_('Clear selection')}</a> - + %if c.revision: + <a class="btn btn-mini" href="${h.url('changelog_home', repo_name=c.repo_name)}"> + ${_('Go to tip of repository')} + </a> + %endif %if c.db_repo.fork: <a id="compare_fork" title="${_('Compare fork with %s' % c.db_repo.fork.repo_name)}"
--- a/kallithea/templates/changeset/changeset.html Fri Jul 18 18:44:54 2014 +0200 +++ b/kallithea/templates/changeset/changeset.html Wed Jun 12 02:13:02 2013 +0200 @@ -18,7 +18,7 @@ </%def> <%def name="main()"> -${self.repo_context_bar('changelog')} +${self.repo_context_bar('changelog', c.changeset.raw_id)} <div class="box"> <!-- box / title --> <div class="title">
--- a/kallithea/templates/files/files.html Fri Jul 18 18:44:54 2014 +0200 +++ b/kallithea/templates/files/files.html Wed Jun 12 02:13:02 2013 +0200 @@ -23,7 +23,7 @@ </%def> <%def name="main()"> -${self.repo_context_bar('files')} +${self.repo_context_bar('files', c.revision)} <div class="box"> <!-- box / title --> <div class="title">