Changeset - 51b203e44202
[Not reviewed]
beta
0 3 0
Marcin Kuzminski - 13 years ago 2012-06-14 11:48:51
marcin@python-works.com
Add authors into file view
3 files changed with 45 insertions and 13 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/files.py
Show inline comments
 
@@ -154,9 +154,14 @@ class FilesController(BaseRepoController
 
            c.file = c.changeset.get_node(f_path)
 

	
 
            if c.file.is_file():
 
                c.file_history = self._get_node_history(c.changeset, f_path)
 
                _hist = c.changeset.get_file_history(f_path)
 
                c.file_history = self._get_node_history(c.changeset, f_path,
 
                                                        _hist)
 
                c.authors = []
 
                for a in set([x.author for x in _hist]):
 
                    c.authors.append((h.email(a), h.person(a)))
 
            else:
 
                c.file_history = []
 
                c.authors = c.file_history = []
 
        except RepositoryError, e:
 
            h.flash(str(e), category='warning')
 
            redirect(h.url('files_home', repo_name=repo_name,
 
@@ -454,8 +459,9 @@ class FilesController(BaseRepoController
 

	
 
        return render('files/file_diff.html')
 

	
 
    def _get_node_history(self, cs, f_path):
 
        changesets = cs.get_file_history(f_path)
 
    def _get_node_history(self, cs, f_path, changesets=None):
 
        if changesets is None:
 
            changesets = cs.get_file_history(f_path)
 
        hist_l = []
 

	
 
        changesets_group = ([], _("Changesets"))
rhodecode/public/css/style.css
Show inline comments
 
@@ -2252,6 +2252,20 @@ h3.files_location {
 
	padding: 5px !important;
 
}
 
 
.file_history{
 
	padding-top:10px;
 
	font-size:16px;
 
}
 
.file_author{
 
	float: left;
 
}
 
 
.file_author .item{
 
	float:left;
 
	padding:5px;
 
	color: #888;
 
}
 
 
.tablerow0 {
 
	background-color: #F8F8F8;
 
}
rhodecode/templates/files/files_source.html
Show inline comments
 
<dl>
 
	<dt style="padding-top:10px;font-size:16px">${_('History')}</dt>
 
	<dt class="file_history">${_('History')}</dt>
 
	<dd>
 
		<div>
 
		${h.form(h.url('files_diff_home',repo_name=c.repo_name,f_path=c.f_path),method='get')}
 
		${h.hidden('diff2',c.file.changeset.raw_id)}
 
		${h.select('diff1',c.file.changeset.raw_id,c.file_history)}
 
		${h.submit('diff',_('diff to revision'),class_="ui-btn")}
 
		${h.submit('show_rev',_('show at revision'),class_="ui-btn")}
 
		${h.end_form()}
 
		</div>
 
        <div>
 
    		<div style="float:left">
 
    		${h.form(h.url('files_diff_home',repo_name=c.repo_name,f_path=c.f_path),method='get')}
 
    		${h.hidden('diff2',c.file.changeset.raw_id)}
 
    		${h.select('diff1',c.file.changeset.raw_id,c.file_history)}
 
    		${h.submit('diff',_('diff to revision'),class_="ui-btn")}
 
    		${h.submit('show_rev',_('show at revision'),class_="ui-btn")}
 
    		${h.end_form()}
 
    		</div>
 
            <div class="file_author">
 
                <div class="item">${h.literal(ungettext(u'%s author',u'%s authors',len(c.authors)) % ('<b>%s</b>' % len(c.authors))) }</div>
 
                %for email, user in c.authors:
 
                  <div class="contributor tooltip" style="float:left" title="${h.tooltip(user)}">
 
                    <div class="gravatar" style="margin:1px"><img alt="gravatar" src="${h.gravatar_url(email, 20)}"/> </div>
 
                  </div>
 
                %endfor       
 
            </div>
 
        </div>
 
        <div style="clear:both"></div>
 
	</dd>
 

	
 
</dl>
 

	
 
<div id="body" class="codeblock">
0 comments (0 inline, 0 general)