Mercurial > kallithea
changeset 2456:51b203e44202 beta
Add authors into file view
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Thu, 14 Jun 2012 11:48:51 +0200 |
parents | f71d40380768 |
children | 01e005cabd4d 6af1e0d5ff9d |
files | rhodecode/controllers/files.py rhodecode/public/css/style.css rhodecode/templates/files/files_source.html |
diffstat | 3 files changed, 45 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/controllers/files.py Thu Jun 14 02:41:05 2012 +0200 +++ b/rhodecode/controllers/files.py Thu Jun 14 11:48:51 2012 +0200 @@ -154,9 +154,14 @@ 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 @@ 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"))
--- a/rhodecode/public/css/style.css Thu Jun 14 02:41:05 2012 +0200 +++ b/rhodecode/public/css/style.css Thu Jun 14 11:48:51 2012 +0200 @@ -2252,6 +2252,20 @@ 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; }
--- a/rhodecode/templates/files/files_source.html Thu Jun 14 02:41:05 2012 +0200 +++ b/rhodecode/templates/files/files_source.html Thu Jun 14 11:48:51 2012 +0200 @@ -1,15 +1,27 @@ <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">