Changeset - 322b53be49cc
[Not reviewed]
beta
0 3 0
Marcin Kuzminski - 15 years ago 2010-12-28 18:17:04
marcin@python-works.com
Fixed url bug when using numeric revision in file browser,
added follow branch checkbox for browsing only changesets from current branch
3 files changed with 48 insertions and 6 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/files.py
Show inline comments
 
@@ -57,28 +57,43 @@ class FilesController(BaseController):
 
    def index(self, repo_name, revision, f_path):
 
        hg_model = ScmModel()
 
        c.repo = hg_model.get_repo(c.repo_name)
 
        revision = request.POST.get('at_rev', None) or revision
 

	
 
        try:
 
            #reditect to given revision from form
 
            post_revision = request.POST.get('at_rev', None)
 
            if post_revision:
 
                post_revision = c.repo.get_changeset(post_revision).raw_id
 
                redirect(url('files_home', repo_name=c.repo_name,
 
                             revision=post_revision, f_path=f_path))
 

	
 
            c.branch = request.GET.get('branch', None)
 

	
 
        c.f_path = f_path
 

	
 
        try:
 
            c.changeset = c.repo.get_changeset(revision)
 
            cur_rev = c.changeset.revision
 

	
 
            #prev link
 
            try:
 
                prev_rev = c.repo.get_changeset(cur_rev).prev().raw_id
 
                prev_rev = c.repo.get_changeset(cur_rev).prev(c.branch).raw_id
 
                c.url_prev = url('files_home', repo_name=c.repo_name,
 
                             revision=prev_rev, f_path=f_path)
 
                if c.branch:
 
                    c.url_prev += '?branch=%s' % c.branch
 
            except ChangesetDoesNotExistError:
 
                c.url_prev = '#'
 

	
 
            #next link
 
            try:
 
                next_rev = c.repo.get_changeset(cur_rev).next().raw_id
 
                next_rev = c.repo.get_changeset(cur_rev).next(c.branch).raw_id
 
                c.url_next = url('files_home', repo_name=c.repo_name,
 
                         revision=next_rev, f_path=f_path)
 
                if c.branch:
 
                    c.url_next += '?branch=%s' % c.branch
 
            except ChangesetDoesNotExistError:
 
                c.url_next = '#'
 

	
 
            #files
 
            try:
 
                c.files_list = c.changeset.get_node(f_path)
 
                c.file_history = self._get_history(c.repo, c.files_list, f_path)
rhodecode/public/css/style.css
Show inline comments
 
@@ -1614,10 +1614,18 @@ padding:0;
 
}
 
 
div.browserblock .browser-header {
 
border-bottom:1px solid #CCC;
 
background:#FFF;
 
color:blue;
 
padding:10px 0;
 
float:left;
 
}
 
 
div.browserblock .browser-branch {
 
background:#FFF;
 
padding:20px 0 0 0;
 
float:left;
 
}
 
div.browserblock .browser-branch label {
 
color:#4A4A4A;	
 
}
 
 
div.browserblock .browser-header span {
 
@@ -1627,6 +1635,7 @@ font-weight:700;
 
 
div.browserblock .browser-body {
 
background:#EEE;
 
border-top:1px solid #CCC;
 
}
 
 
table.code-browser {
rhodecode/templates/files/files_browser.html
Show inline comments
 
@@ -17,6 +17,24 @@
 
	    </div>           
 
		${h.end_form()}
 
	</div>
 
    <div class="browser-branch">
 
       ${h.checkbox('stay_at_branch',c.changeset.branch,c.changeset.branch==c.branch)}
 
       <label>${_('follow current branch')}</label>
 
       <script type="text/javascript">
 
        YUE.on('stay_at_branch','click',function(e){
 
        	if(e.target.checked){
 
        		var uri = "${h.url.current(branch='__BRANCH__')}"
 
        		uri = uri.replace('__BRANCH__',e.target.value);
 
        		window.location = uri;
 
        	}
 
        	else{
 
        		window.location = "${h.url.current()}";
 
        	}
 
        	
 
        })
 
       </script>
 
    </div>
 
    <div style="clear:both"></div>
 
	<div class="browser-body">
 
		<table class="code-browser">
 
		         <thead>
0 comments (0 inline, 0 general)