On Sat, Feb 27, 2016 at 12:24 PM, Angel Ezquerra <[email protected]> wrote: > # HG changeset patch > # User Angel Ezquerra <[email protected]> > # Date 1456572240 -3600 > # Sat Feb 27 12:24:00 2016 +0100 > # Branch stable > # Node ID 58ee8a76b6a8ae0a69d3f50b2e3e3357780598c9 > # Parent a13394a91f352a982afcf0b9141ece5537caacb1 > changeset: improve the comment count information display > > Some recent revisions have changed the way comments are counted. We no longer > count "status change only comments" as comments on the changelog, etc. This > change tries to make the way we count comments on the changest details page > match the way we count them everywhere else. At the same time this tries to > > Change the way the comment count information is displayed as follows: > > - Separately count the number of status changes and the number of comment > changes (to match how comments are counted everywhere else) > - Only show the status and comment counts when needed (i.e. show nothing when > there are no comments or status changes) > - Visually separate the counts from the "First comment" link by adding a "|" > separator. > > diff --git a/kallithea/templates/changeset/changeset.html > b/kallithea/templates/changeset/changeset.html > --- a/kallithea/templates/changeset/changeset.html > +++ b/kallithea/templates/changeset/changeset.html > @@ -72,7 +72,7 @@ > ${c.context_url(request.GET)} > </div> > <div class="comments-number" > style="float:right;padding-right:5px"> > - ${comment.comment_count(c.inline_cnt, len(c.comments))} > + ${comment.comment_count(c.inline_cnt, c.comments)} > </div> > </div> > </div> > diff --git a/kallithea/templates/changeset/changeset_file_comment.html > b/kallithea/templates/changeset/changeset_file_comment.html > --- a/kallithea/templates/changeset/changeset_file_comment.html > +++ b/kallithea/templates/changeset/changeset_file_comment.html > @@ -100,13 +100,33 @@ > </%def> > > > -## show comment count as "x comments (y inline, z general)" > -<%def name="comment_count(inline_cnt, general_cnt)"> > - ${'%s (%s, %s)' % ( > - ungettext("%d comment", "%d comments", inline_cnt + general_cnt) % > (inline_cnt + general_cnt), > - ungettext("%d inline", "%d inline", inline_cnt) % inline_cnt, > - ungettext("%d general", "%d general", general_cnt) % general_cnt > - )} > +## show comment count as "w comments (x inline, y general), z status changes" > +<%def name="comment_count(inline_cnt, comments)"> > + <% > + general_cnt = len([cm for cm in comments if cm.text]) > + status_cnt = len([cm for cm in comments if cm.status_change]) > + comment_cnt = inline_cnt + general_cnt > + %> > + %if status_cnt: > + ${ungettext("%d status change", "%d status changes", status_cnt) % > status_cnt} > + %if comment_cnt: > + ${", "} > + %endif > + %endif > + %if inline_cnt > 0 and general_cnt > 0: > + ${'%s (%s, %s)' % ( > + ungettext("%d comment", "%d comments", inline_cnt + general_cnt) > % (inline_cnt + general_cnt), > + ungettext("%d inline", "%d inline", inline_cnt) % inline_cnt, > + ungettext("%d general", "%d general", general_cnt) % general_cnt, > + )} > + %elif inline_cnt > 0: > + ${ungettext("%d inline comment", "%d inline comments", inline_cnt) % > inline_cnt,} > + %elif general_cnt > 0: > + ${ungettext("%d general comment", "%d general comments", > general_cnt) % general_cnt,} > + %endif > + %if status_cnt + comment_cnt: > + | > + %endif > <span class="firstlink"></span> > </%def> > > @@ -125,7 +145,7 @@ > %endfor > > <div class="comments-number"> > - ${comment_count(c.inline_cnt, len(c.comments))} > + ${comment_count(c.inline_cnt, c.comments)} > </div> > > <div class="comments-list-general"> > diff --git a/kallithea/templates/pullrequests/pullrequest_show.html > b/kallithea/templates/pullrequests/pullrequest_show.html > --- a/kallithea/templates/pullrequests/pullrequest_show.html > +++ b/kallithea/templates/pullrequests/pullrequest_show.html > @@ -298,7 +298,7 @@ > <div class="table"> > <div id="changeset_compare_view_content"> > <div style="font-size:1.1em;font-weight: > bold;clear:both;padding-top:10px"> > - ${comment.comment_count(c.inline_cnt, len(c.comments))} > + ${comment.comment_count(c.inline_cnt, c.comments)} > </div> > ##CS > <div style="font-size:1.1em;font-weight: > bold;clear:both;padding-top:10px">
Hi, I just realized that this patch does not apply cleanly on the head of default (I tested it on stable). Please ignore until I send a fixed version. Sorry! Angel _______________________________________________ kallithea-general mailing list [email protected] http://lists.sfconservancy.org/mailman/listinfo/kallithea-general
