##// END OF EJS Templates
pullrequests: use shared changelog_table implementation...
Mads Kiilerich -
r6775:00905ed0 default
parent child Browse files
Show More
@@ -1,7 +1,8 b''
1 ## Render changelog table with id 'changesets' with the range of changesets,
1 ## Render changelog table with id 'changesets' with the range of changesets,
2 ## statuses, and comments.
2 ## statuses, and comments.
3 ## Optionally, pass a js snippet to run whenever a table resize is triggered.
3 ## Optionally, pass a js snippet to run whenever a table resize is triggered.
4 <%def name="changelog(repo_name, cs_range, cs_statuses, cs_comments, show_checkbox=False, show_branch=True, resize_js='')">
4 <%def name="changelog(repo_name, cs_range, cs_statuses, cs_comments, show_checkbox=False, show_branch=True, show_index=False, resize_js='')">
5 <% num_cs = len(cs_range) %>
5 <table class="table" id="changesets">
6 <table class="table" id="changesets">
6 <tbody>
7 <tbody>
7 %for cnt,cs in enumerate(cs_range):
8 %for cnt,cs in enumerate(cs_range):
@@ -11,6 +12,22 b''
11 ${h.checkbox(cs.raw_id,class_="changeset_range")}
12 ${h.checkbox(cs.raw_id,class_="changeset_range")}
12 </td>
13 </td>
13 %endif
14 %endif
15 %if show_index:
16 <td class="changeset-logical-index">
17 <%
18 index = num_cs - cnt
19 if index == 1:
20 title = _('First (oldest) changeset in this list')
21 elif index == num_cs:
22 title = _('Last (most recent) changeset in this list')
23 else:
24 title = _('Position in this list of changesets')
25 %>
26 <span data-toggle="tooltip" title="${title}">
27 ${index}
28 </span>
29 </td>
30 %endif
14 <td class="status">
31 <td class="status">
15 %if cs_statuses.get(cs.raw_id):
32 %if cs_statuses.get(cs.raw_id):
16 %if cs_statuses.get(cs.raw_id)[2]:
33 %if cs_statuses.get(cs.raw_id)[2]:
@@ -1,4 +1,5 b''
1 ## Changesets table !
1 ## Changesets table with graph
2 <%namespace name="changelog_table" file="/changelog/changelog_table.html"/>
2 <div>
3 <div>
3 %if not c.cs_ranges:
4 %if not c.cs_ranges:
4 <span class="empty_data">${_('No changesets')}</span>
5 <span class="empty_data">${_('No changesets')}</span>
@@ -28,68 +29,9 b''
28 </div>
29 </div>
29
30
30 <div id="graph_content_pr">
31 <div id="graph_content_pr">
31
32 ${changelog_table.changelog(c.cs_repo.repo_name, list(reversed(c.cs_ranges)), c.cs_statuses, c.cs_comments,
32 <table class="table compare_view_commits">
33 show_index=True,
33 %for cnt, cs in enumerate(reversed(c.cs_ranges)):
34 resize_js='graph.render(jsdata)')}
34 <tr id="chg_${cnt+1}" class="${'mergerow' if len(cs.parents) > 1 else ''}">
35 <td>
36 %if cs.raw_id in c.cs_statuses:
37 <i class="icon-circle changeset-status-${c.cs_statuses[cs.raw_id][0]}" title="${_('Changeset status: %s') % c.cs_statuses[cs.raw_id][1]}"></i>
38 %endif
39 %if c.cs_comments.get(cs.raw_id):
40 <div class="comments-container">
41 <div class="comments-cnt" title="${_('Changeset has comments')}">
42 <a href="${c.cs_comments[cs.raw_id][0].url()}">
43 ${len(c.cs_comments[cs.raw_id])}
44 <i class="icon-comment"></i>
45 </a>
46 </div>
47 </div>
48 %endif
49 </td>
50 <td class="changeset-logical-index">
51 <%
52 num_cs = len(c.cs_ranges)
53 index = num_cs - cnt
54 if index == 1:
55 title = _('First (oldest) changeset in this list')
56 elif index == num_cs:
57 title = _('Last (most recent) changeset in this list')
58 else:
59 title = _('Position in this list of changesets')
60 %>
61 <span data-toggle="tooltip" title="${title}">
62 ${index}
63 </span>
64 </td>
65 <td><span data-toggle="tooltip" title="${h.age(cs.date)}">${cs.date}</span></td>
66 <td class="author">
67 ${h.gravatar(h.email_or_none(cs.author), size=16)}
68 <span data-toggle="tooltip" title="${cs.author}" class="user">${h.person(cs.author)}</span>
69 </td>
70 <td>${h.link_to(h.show_id(cs),h.url('changeset_home',repo_name=c.cs_repo.repo_name,revision=cs.raw_id), class_='changeset_hash')}</td>
71 <td>
72 %if cs.branch:
73 <span class="branchtag">${h.link_to(cs.branch,h.url('changelog_home',repo_name=c.cs_repo.repo_name,branch=cs.branch))}</span>
74 %endif
75 </td>
76 <td class="expand_commit" title="${_('Expand commit message')}">
77 <i class="icon-align-left"></i>
78 </td>
79 <td class="mid">
80 <div class="pull-right">
81 %for tag in cs.tags:
82 <span class="tagtag" title="${_('Tag %s') % tag}">
83 ${h.link_to(tag,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}
84 </span>
85 %endfor
86 </div>
87 <div class="message">${h.urlify_text(cs.message, c.repo_name)}</div>
88 </td>
89 </tr>
90 %endfor
91 </table>
92
93 </div>
35 </div>
94
36
95 %if c.is_ajax_preview:
37 %if c.is_ajax_preview:
@@ -6,8 +6,8 b' from kallithea.tests.fixture import Fixt'
6
6
7 fixture = Fixture()
7 fixture = Fixture()
8
8
9 def _commit_ref(sha, msg):
9 def _commit_ref(repo_name, sha, msg):
10 return '''<div class="message">%s</div>''' % msg
10 return '''<div class="message-firstline"><a class="message-link" href="/%s/changeset/%s">%s</a></div>''' % (repo_name, sha, msg)
11
11
12
12
13 class TestCompareController(TestController):
13 class TestCompareController(TestController):
@@ -65,8 +65,8 b' class TestCompareController(TestControll'
65 response.mustcontain("""Showing 2 commits""")
65 response.mustcontain("""Showing 2 commits""")
66 response.mustcontain("""1 file changed with 2 insertions and 0 deletions""")
66 response.mustcontain("""1 file changed with 2 insertions and 0 deletions""")
67
67
68 response.mustcontain(_commit_ref(cs1.raw_id, 'commit2'))
68 response.mustcontain(_commit_ref(repo2.repo_name, cs1.raw_id, 'commit2'))
69 response.mustcontain(_commit_ref(cs2.raw_id, 'commit3'))
69 response.mustcontain(_commit_ref(repo2.repo_name, cs2.raw_id, 'commit3'))
70
70
71 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
71 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
72 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
72 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
@@ -116,8 +116,8 b' class TestCompareController(TestControll'
116 response.mustcontain("""Showing 2 commits""")
116 response.mustcontain("""Showing 2 commits""")
117 response.mustcontain("""1 file changed with 2 insertions and 0 deletions""")
117 response.mustcontain("""1 file changed with 2 insertions and 0 deletions""")
118
118
119 response.mustcontain(_commit_ref(cs1.raw_id, 'commit2'))
119 response.mustcontain(_commit_ref(repo2.repo_name, cs1.raw_id, 'commit2'))
120 response.mustcontain(_commit_ref(cs2.raw_id, 'commit3'))
120 response.mustcontain(_commit_ref(repo2.repo_name, cs2.raw_id, 'commit3'))
121
121
122 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
122 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
123 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
123 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
@@ -175,8 +175,8 b' class TestCompareController(TestControll'
175 response.mustcontain("""Showing 2 commits""")
175 response.mustcontain("""Showing 2 commits""")
176 response.mustcontain("""1 file changed with 2 insertions and 0 deletions""")
176 response.mustcontain("""1 file changed with 2 insertions and 0 deletions""")
177
177
178 response.mustcontain(_commit_ref(cs1.raw_id, 'commit2'))
178 response.mustcontain(_commit_ref(repo2.repo_name, cs1.raw_id, 'commit2'))
179 response.mustcontain(_commit_ref(cs2.raw_id, 'commit3'))
179 response.mustcontain(_commit_ref(repo2.repo_name, cs2.raw_id, 'commit3'))
180
180
181 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
181 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
182 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
182 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
@@ -234,8 +234,8 b' class TestCompareController(TestControll'
234 response.mustcontain("""Showing 2 commits""")
234 response.mustcontain("""Showing 2 commits""")
235 response.mustcontain("""1 file changed with 2 insertions and 0 deletions""")
235 response.mustcontain("""1 file changed with 2 insertions and 0 deletions""")
236
236
237 response.mustcontain(_commit_ref(cs1.raw_id, 'commit2'))
237 response.mustcontain(_commit_ref(repo2.repo_name, cs1.raw_id, 'commit2'))
238 response.mustcontain(_commit_ref(cs2.raw_id, 'commit3'))
238 response.mustcontain(_commit_ref(repo2.repo_name, cs2.raw_id, 'commit3'))
239
239
240 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
240 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
241 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
241 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
@@ -302,9 +302,9 b' class TestCompareController(TestControll'
302 response.mustcontain("""Showing 3 commits""")
302 response.mustcontain("""Showing 3 commits""")
303 response.mustcontain("""1 file changed with 3 insertions and 0 deletions""")
303 response.mustcontain("""1 file changed with 3 insertions and 0 deletions""")
304
304
305 response.mustcontain(_commit_ref(cs2.raw_id, 'commit3'))
305 response.mustcontain(_commit_ref(repo1.repo_name, cs2.raw_id, 'commit3'))
306 response.mustcontain(_commit_ref(cs3.raw_id, 'commit4'))
306 response.mustcontain(_commit_ref(repo1.repo_name, cs3.raw_id, 'commit4'))
307 response.mustcontain(_commit_ref(cs4.raw_id, 'commit5'))
307 response.mustcontain(_commit_ref(repo1.repo_name, cs4.raw_id, 'commit5'))
308
308
309 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r2:%s</a>""" % (repo1.repo_name, cs2.raw_id, cs2.short_id))
309 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r2:%s</a>""" % (repo1.repo_name, cs2.raw_id, cs2.short_id))
310 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r3:%s</a>""" % (repo1.repo_name, cs3.raw_id, cs3.short_id))
310 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r3:%s</a>""" % (repo1.repo_name, cs3.raw_id, cs3.short_id))
@@ -368,9 +368,9 b' class TestCompareController(TestControll'
368 response.mustcontain("""Showing 3 commits""")
368 response.mustcontain("""Showing 3 commits""")
369 response.mustcontain("""1 file changed with 3 insertions and 0 deletions""")
369 response.mustcontain("""1 file changed with 3 insertions and 0 deletions""")
370
370
371 response.mustcontain(_commit_ref(cs3.raw_id, 'commit4'))
371 response.mustcontain(_commit_ref(repo1.repo_name, cs3.raw_id, 'commit4'))
372 response.mustcontain(_commit_ref(cs4.raw_id, 'commit5'))
372 response.mustcontain(_commit_ref(repo1.repo_name, cs4.raw_id, 'commit5'))
373 response.mustcontain(_commit_ref(cs5.raw_id, 'commit6'))
373 response.mustcontain(_commit_ref(repo1.repo_name, cs5.raw_id, 'commit6'))
374
374
375 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r3:%s</a>""" % (repo1.repo_name, cs3.raw_id, cs3.short_id))
375 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r3:%s</a>""" % (repo1.repo_name, cs3.raw_id, cs3.short_id))
376 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r4:%s</a>""" % (repo1.repo_name, cs4.raw_id, cs4.short_id))
376 response.mustcontain("""<a class="changeset_hash" href="/%s/changeset/%s">r4:%s</a>""" % (repo1.repo_name, cs4.raw_id, cs4.short_id))
General Comments 0
You need to be logged in to leave comments. Login now