Changeset - 432e86d1e555
[Not reviewed]
default
0 6 0
Mads Kiilerich - 12 years ago 2013-06-12 02:13:02
madski@unity3d.com
repo context bar: preserve current revision when navigating between changelog, changeset and file view
6 files changed with 26 insertions and 9 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/changelog.py
Show inline comments
 
@@ -145,6 +145,9 @@ class ChangelogController(BaseRepoContro
 
            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 @@ class ChangelogController(BaseRepoContro
 
                        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 @@ class ChangelogController(BaseRepoContro
 
            _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()
kallithea/controllers/files.py
Show inline comments
 
@@ -136,11 +136,11 @@ class FilesController(BaseRepoController
 
        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
kallithea/templates/base/base.html
Show inline comments
 
@@ -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">
kallithea/templates/changelog/changelog.html
Show inline comments
 
@@ -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 @@ ${self.repo_context_bar('changelog')}
 
                       <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)}"
kallithea/templates/changeset/changeset.html
Show inline comments
 
@@ -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">
kallithea/templates/files/files.html
Show inline comments
 
@@ -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">
0 comments (0 inline, 0 general)