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 49 insertions and 7 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/files.py
Show inline comments
 
@@ -54,34 +54,49 @@ class FilesController(BaseController):
 
        super(FilesController, self).__before__()
 
        c.cut_off_limit = self.cut_off_limit
 

	
 
    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
 

	
 
        c.f_path = f_path
 

	
 
        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
 

	
 
            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)
 
            except RepositoryError, e:
 
                h.flash(str(e), category='warning')
 
                redirect(h.url('files_home', repo_name=repo_name, revision=revision))
rhodecode/public/css/style.css
Show inline comments
 
@@ -1611,25 +1611,34 @@ background:#f8f8f8;
 
font-size:100%;
 
line-height:125%;
 
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 {
 
margin-left:25px;
 
font-weight:700;
 
}
 
 
div.browserblock .browser-body {
 
background:#EEE;
 
border-top:1px solid #CCC;
 
}
 
 
table.code-browser {
 
border-collapse:collapse;
 
width:100%;
 
}
rhodecode/templates/files/files_browser.html
Show inline comments
 
@@ -14,12 +14,30 @@
 
          ${h.text('at_rev',value=c.changeset.revision,size=3)}
 
          <a href="${c.url_next}" title="${_('next revision')}">&raquo;</a>
 
          ${h.submit('view','view')}
 
	    </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>
 
		             <tr>
 
		                 <th>${_('Name')}</th>
 
		                 <th>${_('Size')}</th>
0 comments (0 inline, 0 general)