changeset 6839:90282e663313

changelog: avoid cutting off commit messages Split commit message into 2 <div> elements: one with just the first line, and one with the full message. This makes it easier to handle the toggling of showing the whole commit message. This way, we no longer have to mess with the line height, and we avoid problems with cutting off parts of the text below the text baseline. Also stop cutting off the first line if it is too long for the table column. It adds a bit of overhead to store the first line twice, but having them separate make things simpler and is worth it. Patch modified by Mads Kiilerich.
author domruf <dominikruf@gmail.com>
date Mon, 03 Jul 2017 21:45:37 +0200
parents fa55523f3790
children 95e5d449f702
files kallithea/public/css/style.css kallithea/templates/changelog/changelog.html
diffstat 2 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/public/css/style.css	Mon Aug 28 05:25:39 2017 +0200
+++ b/kallithea/public/css/style.css	Mon Jul 03 21:45:37 2017 +0200
@@ -1510,10 +1510,9 @@
 
 #graph_content tr td.mid .message,
 #graph_content_pr .compare_view_commits .message {
-    white-space: pre-wrap;
+    white-space: nowrap;
     padding: 0;
     overflow: hidden;
-    height: 1.2em;
 }
 
 #graph_content_pr .compare_view_commits .message {
--- a/kallithea/templates/changelog/changelog.html	Mon Aug 28 05:25:39 2017 +0200
+++ b/kallithea/templates/changelog/changelog.html	Mon Jul 03 21:45:37 2017 +0200
@@ -104,12 +104,16 @@
                         <td class="date">
                             <div class="date" data-toggle="tooltip" title="${h.fmt_date(cs.date)}">${h.age(cs.date,True)}</div>
                         </td>
+                        <% message_lines = cs.message.splitlines() %>
                         <td class="expand_commit" title="${_('Expand commit message')}">
                             <i class="icon-align-left"></i>
                         </td>
                         <td class="mid">
                             <div class="log-container">
-                                <div class="message">${h.urlify_text(cs.message, c.repo_name,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</div>
+                                <div class="message">
+                                    <div class="message-firstline">${h.urlify_text(message_lines[0], c.repo_name,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</div>
+                                    <div class="message-full hidden">${h.urlify_text(cs.message, c.repo_name)}</div>
+                                </div>
                                 <div class="extra-container">
                                     %if c.comments.get(cs.raw_id):
                                         <a class="comments-container comments-cnt" href="${c.comments[cs.raw_id][0].url()}" data-toggle="tooltip" title="${_('%s comments') % len(c.comments[cs.raw_id])}">
@@ -286,7 +290,7 @@
                 });
 
                 $('.expand_commit').on('click',function(e){
-                    $(this).next('.mid').find('.message').toggleClass('expanded');
+                    $(this).next('.mid').find('.message > div').toggleClass('hidden');
 
                     //redraw the graph, r and jsdata are bound outside function
                     graph.render(jsdata);