diff --git a/kallithea/controllers/files.py b/kallithea/controllers/files.py --- a/kallithea/controllers/files.py +++ b/kallithea/controllers/files.py @@ -189,6 +189,15 @@ class FilesController(BaseRepoController if request.environ.get('HTTP_X_PARTIAL_XHR'): return render('files/files_ypjax.html') + # TODO: tags and bookmarks? + c.revision_options = [(c.changeset.raw_id, + _('%s at %s') % (c.changeset.branch, h.short_id(c.changeset.raw_id)))] + \ + [(n, b) for b, n in c.db_repo_scm_instance.branches.items()] + if c.db_repo_scm_instance.closed_branches: + prefix = _('(closed)') + ' ' + c.revision_options += [('-', '-')] + \ + [(n, prefix + b) for b, n in c.db_repo_scm_instance.closed_branches.items()] + return render('files/files.html') @LoginRequired() diff --git a/kallithea/templates/files/files.html b/kallithea/templates/files/files.html --- a/kallithea/templates/files/files.html +++ b/kallithea/templates/files/files.html @@ -29,8 +29,8 @@ ${self.repo_context_bar('files', c.revis
${self.breadcrumbs()}
@@ -239,6 +239,23 @@ $(document).ready(function(){ } } fileBrowserListeners(_State.url, _State.data.node_list_url, _State.data.url_base); + + // change branch filter + $("#branch_selector").select2({ + dropdownAutoWidth: true, + minimumInputLength: 1, + }); + + $("#branch_selector").change(function(e){ + var selected = e.currentTarget.options[e.currentTarget.selectedIndex].value; + if(selected && selected != "${c.changeset.raw_id}"){ + window.location = pyroutes.url('files_home', {'repo_name': "${h.safe_unicode(c.repo_name)}", 'revision': selected, 'f_path': "${h.safe_unicode(c.file.path)}"}); + $("#browserblock").hide(); + } else { + $("#branch_selector").val("${c.changeset.raw_id}"); + } + }); + }); diff --git a/kallithea/tests/functional/test_files.py b/kallithea/tests/functional/test_files.py --- a/kallithea/tests/functional/test_files.py +++ b/kallithea/tests/functional/test_files.py @@ -73,7 +73,7 @@ class TestFilesController(TestController revision='97e8b885c04894463c51898e14387d80c30ed1ee', f_path='/')) - response.mustcontain("""Branch: git""") + response.mustcontain("""""") def test_index_paging(self): self.log_user() @@ -105,7 +105,7 @@ Improved test to clone into uniq reposit removed extra unicode conversion in diff. """) - response.mustcontain("""Branch: default""") + response.mustcontain("""""") def test_file_source_history(self): self.log_user()