changeset 6849:f92d08061a24

summary: use shared changelog_table implementation on summary page The main purpose of this change is to simplify code and avoid duplication. Using the shared implementation also happens to give a slightly different view of the changesets. There will be no table headers, the columns are shown in different order, author gravatars are shown, commit messages can be expanded, and there is slightly different styling. Small remaining amounts of template code is moved from changelog_summary_data.html to summary.html. Patch modified by Mads Kiilerich.
author domruf <dominikruf@gmail.com>
date Thu, 03 Nov 2016 20:03:03 +0100
parents e6e69ed2c89e
children 00905ed03136
files kallithea/templates/changelog/changelog_summary_data.html kallithea/templates/summary/summary.html
diffstat 2 files changed, 32 insertions(+), 104 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/templates/changelog/changelog_summary_data.html	Sun Aug 27 17:11:03 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-## -*- coding: utf-8 -*-
-%if c.cs_pagination:
-<table class="table">
-    <tr>
-        <th class="left"></th>
-        <th class="left"></th>
-        <th class="left">${_('Revision')}</th>
-        <th class="left">${_('Commit Message')}</th>
-        <th class="left">${_('Age')}</th>
-        <th class="left">${_('Author')}</th>
-        <th class="left">${_('Refs')}</th>
-    </tr>
-%for cnt,cs in enumerate(c.cs_pagination):
-    <tr class="parity${cnt%2} ${'mergerow' if len(cs.parents) > 1 else ''}">
-        <td class="compact">
-              %if c.cs_statuses.get(cs.raw_id):
-                %if c.cs_statuses.get(cs.raw_id)[2]:
-                  <a data-toggle="tooltip" title="${_('Changeset status: %s by %s\nClick to open associated pull request %s') % (c.cs_statuses.get(cs.raw_id)[1], c.cs_statuses.get(cs.raw_id)[5].username, c.cs_statuses.get(cs.raw_id)[4])}" href="${h.url('pullrequest_show',repo_name=c.cs_statuses.get(cs.raw_id)[3],pull_request_id=c.cs_statuses.get(cs.raw_id)[2])}">
-                    <i class="icon-circle changeset-status-${c.cs_statuses.get(cs.raw_id)[0]}"></i>
-                  </a>
-                %else:
-                  <a data-toggle="tooltip" title="${_('Changeset status: %s by %s') % (c.cs_statuses.get(cs.raw_id)[1], c.cs_statuses.get(cs.raw_id)[5].username)}"
-                     href="${c.cs_comments[cs.raw_id][0].url()}">
-                    <i class="icon-circle changeset-status-${c.cs_statuses.get(cs.raw_id)[0]}"></i>
-                  </a>
-                %endif
-              %endif
-        </td>
-        <td class="compact">
-              %if c.cs_comments.get(cs.raw_id,[]):
-               <div class="comments-container">
-                   <div title="${('comments')}">
-                       <a href="${c.cs_comments[cs.raw_id][0].url()}">
-                          <i class="icon-comment"></i>${len(c.cs_comments[cs.raw_id])}
-                       </a>
-                   </div>
-               </div>
-              %endif
-        </td>
-        <td>
-            <a href="${h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id)}" class="revision-link">${h.show_id(cs)}</a>
-        </td>
-        <td>
-            ${h.urlify_text(h.chop_at(cs.message,'\n'),c.repo_name, h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}
-        </td>
-        <td><span data-toggle="tooltip" title="${h.fmt_date(cs.date)}">
-                      ${h.age(cs.date)}</span>
-        </td>
-        <td title="${cs.author}">${h.person(cs.author)}</td>
-        <td>
-            %for book in cs.bookmarks:
-                <span class="booktag" title="${_('Bookmark %s') % book}">
-                    ${h.link_to(book,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}
-                </span>
-            %endfor
-            %for tag in cs.tags:
-             <span class="tagtag" title="${_('Tag %s') % tag}">
-                 ${h.link_to(tag,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}
-             </span>
-            %endfor
-            %if cs.branch:
-             <span class="branchtag" title="${_('Branch %s' % cs.branch)}">
-                 ${h.link_to(cs.branch,h.url('changelog_home',repo_name=c.repo_name,branch=cs.branch))}
-             </span>
-            %endif
-        </td>
-    </tr>
-%endfor
-
-</table>
-
-${c.cs_pagination.pager()}
-
-%else:
-
-%if h.HasRepoPermissionLevel('write')(c.repo_name):
-<h4>${_('Add or upload files directly via Kallithea')}</h4>
-<div>
-  <div id="add_node_id" class="add_node">
-      <a class="btn btn-default btn-xs" href="${h.url('files_add_home',repo_name=c.repo_name,revision=0,f_path='', anchor='edit')}">${_('Add New File')}</a>
-  </div>
-</div>
-%endif
-
-
-<h4>${_('Push new repository')}</h4>
-<pre>
-    ${c.db_repo_scm_instance.alias} clone ${c.clone_repo_url}
-    ${c.db_repo_scm_instance.alias} add README # add first file
-    ${c.db_repo_scm_instance.alias} commit -m "Initial" # commit with message
-    ${c.db_repo_scm_instance.alias} push ${'origin master' if h.is_git(c.db_repo_scm_instance) else ''} # push changes back
-</pre>
-
-<h4>${_('Existing repository?')}</h4>
-<pre>
-%if h.is_git(c.db_repo_scm_instance):
-    git remote add origin ${c.clone_repo_url}
-    git push -u origin master
-%else:
-    hg push ${c.clone_repo_url}
-%endif
-</pre>
-%endif
--- a/kallithea/templates/summary/summary.html	Sun Aug 27 17:11:03 2017 +0200
+++ b/kallithea/templates/summary/summary.html	Thu Nov 03 20:03:03 2016 +0100
@@ -1,4 +1,5 @@
 <%inherit file="/base/base.html"/>
+<%namespace name="changelog_table" file="/changelog/changelog_table.html"/>
 
 <%block name="title">
     ${_('%s Summary') % c.repo_name}
@@ -179,7 +180,37 @@
     </div>
     <div class="panel-body">
         <div id="shortlog_data">
-            <%include file='../changelog/changelog_summary_data.html'/>
+            %if c.cs_pagination:
+                ${changelog_table.changelog(c.repo_name, c.cs_pagination, c.cs_statuses, c.cs_comments, show_checkbox=False)}
+                ${c.cs_pagination.pager()}
+            %else:
+                %if h.HasRepoPermissionLevel('write')(c.repo_name):
+                <h4>${_('Add or upload files directly via Kallithea')}</h4>
+                <div>
+                  <div id="add_node_id" class="add_node">
+                      <a class="btn btn-default btn-xs" href="${h.url('files_add_home',repo_name=c.repo_name,revision=0,f_path='', anchor='edit')}">${_('Add New File')}</a>
+                  </div>
+                </div>
+                %endif
+
+                <h4>${_('Push new repository')}</h4>
+                <pre>
+                    ${c.db_repo_scm_instance.alias} clone ${c.clone_repo_url}
+                    ${c.db_repo_scm_instance.alias} add README # add first file
+                    ${c.db_repo_scm_instance.alias} commit -m "Initial" # commit with message
+                    ${c.db_repo_scm_instance.alias} push ${'origin master' if h.is_git(c.db_repo_scm_instance) else ''} # push changes back
+                </pre>
+
+                <h4>${_('Existing repository?')}</h4>
+                <pre>
+                %if h.is_git(c.db_repo_scm_instance):
+                    git remote add origin ${c.clone_repo_url}
+                    git push -u origin master
+                %else:
+                    hg push ${c.clone_repo_url}
+                %endif
+                </pre>
+            %endif
         </div>
     </div>
 </div>