changeset 6833:3c1cdd1c1736

changelog: simplify message expansion toggling Slightly simpler, slightly less html, slightly smaller DOM.
author Mads Kiilerich <mads@kiilerich.com>
date Thu, 24 Aug 2017 02:50:04 +0200
parents 689c346e39be
children 19f40a5088d4
files kallithea/templates/changelog/changelog.html kallithea/templates/compare/compare_cs.html
diffstat 2 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/templates/changelog/changelog.html	Sun Aug 06 20:39:33 2017 +0200
+++ b/kallithea/templates/changelog/changelog.html	Thu Aug 24 02:50:04 2017 +0200
@@ -104,12 +104,12 @@
                         <td class="date">
                             <div class="date" data-toggle="tooltip" title="${h.fmt_date(cs.date)}">${h.age(cs.date,True)}</div>
                         </td>
-                        <td class="expand_commit" data-commit_id="${cs.raw_id}" title="${_('Expand commit message')}">
+                        <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" id="C-${cs.raw_id}">${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">${h.urlify_text(cs.message, c.repo_name,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</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,8 +286,7 @@
                 });
 
                 $('.expand_commit').on('click',function(e){
-                    var cid = $(this).data('commit_id');
-                    $('#C-'+cid).toggleClass('expanded');
+                    $(this).next('.mid').find('.message').toggleClass('expanded');
 
                     //redraw the graph, r and jsdata are bound outside function
                     graph.render(jsdata);
--- a/kallithea/templates/compare/compare_cs.html	Sun Aug 06 20:39:33 2017 +0200
+++ b/kallithea/templates/compare/compare_cs.html	Thu Aug 24 02:50:04 2017 +0200
@@ -73,7 +73,7 @@
         <span class="branchtag">${h.link_to(cs.branch,h.url('changelog_home',repo_name=c.cs_repo.repo_name,branch=cs.branch))}</span>
         %endif
         </td>
-        <td class="expand_commit" data-commit_id="${cs.raw_id}" title="${_('Expand commit message')}">
+        <td class="expand_commit" title="${_('Expand commit message')}">
             <i class="icon-align-left"></i>
         </td>
         <td class="mid">
@@ -84,7 +84,7 @@
                     </span>
                 %endfor
             </div>
-            <div id="C-${cs.raw_id}" class="message">${h.urlify_text(cs.message, c.repo_name)}</div>
+            <div class="message">${h.urlify_text(cs.message, c.repo_name)}</div>
         </td>
       </tr>
     %endfor
@@ -132,8 +132,7 @@
         graph.render(jsdata);
 
         $('.expand_commit').click(function(e){
-            var cid = $(this).data('commit_id');
-            $('#C-'+cid).toggleClass('expanded');
+            $(this).next('.mid').find('.message').toggleClass('expanded');
             graph.render(jsdata);
         });
     });