# HG changeset patch # User Mads Kiilerich # Date 1503844775 -7200 # Node ID 52adce4ffe89975a4744a85ca53ea7d6e682ed46 # Parent cb3bdf43647309c7643166d79e4c61b0a935e8ea changelog: make the table a re-usable template element This moves the changelog table to a separate template file, without further changes, except the necessary renaming to make it fully parameterized without accessing c directly. Based on work by Dominik Ruf. diff -r cb3bdf436473 -r 52adce4ffe89 kallithea/templates/changelog/changelog.html --- a/kallithea/templates/changelog/changelog.html Sun Aug 27 16:39:35 2017 +0200 +++ b/kallithea/templates/changelog/changelog.html Sun Aug 27 16:39:35 2017 +0200 @@ -2,6 +2,8 @@ <%inherit file="/base/base.html"/> +<%namespace name="changelog_table" file="changelog_table.html"/> + <%block name="title"> ${_('%s Changelog') % c.repo_name} %if c.changelog_for_path: @@ -67,114 +69,13 @@
+
- - - - %for cnt,cs in enumerate(c.cs_pagination): - - %if not c.changelog_for_path: - - %endif - - - - - <% message_lines = cs.message.splitlines() %> - %if len(message_lines) > 1: - - %else: - - %endif - - - %endfor - -
- ${h.checkbox(cs.raw_id,class_="changeset_range")} - - %if c.cs_statuses.get(cs.raw_id): - %if c.cs_statuses.get(cs.raw_id)[2]: - - - - %else: - - - - %endif - %endif - - ${h.gravatar(h.email_or_none(cs.author), size=16)} - ${h.person(cs.author)} - - ${h.link_to(h.show_id(cs),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id), class_='changeset_hash')} - -
${h.age(cs.date,True)}
-
- - -
-
-
${h.urlify_text(message_lines[0], c.repo_name,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}
- %if len(message_lines) > 1: - - %endif -
-
- %if c.cs_comments.get(cs.raw_id): - - ${len(c.cs_comments[cs.raw_id])} - - - %endif - %if cs.bumped: - - Bumped - - %endif - %if cs.divergent: - - Divergent - - %endif - %if cs.extinct: - - Extinct - - %endif - %if cs.unstable: - - Unstable - - %endif - %if cs.phase: - - ${cs.phase} - - %endif - %for book in cs.bookmarks: - - ${h.link_to(book,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))} - - %endfor - %for tag in cs.tags: - - ${h.link_to(tag,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))} - - %endfor - %if (not c.branch_name) and cs.branch: - - ${h.link_to(cs.branch,h.url('changelog_home',repo_name=c.repo_name,branch=cs.branch))} - - %endif -
-
-
- - - + ${changelog_table.changelog(c.repo_name, c.cs_pagination, c.cs_statuses, c.cs_comments, + show_checkbox=not c.changelog_for_path, + show_branch=not c.branch_name, + resize_js='graph.render(jsdata)')} +
${c.cs_pagination.pager()} @@ -291,13 +192,6 @@ } }); - $('.expand_commit').on('click',function(e){ - $(this).next('.mid').find('.message > div').toggleClass('hidden'); - - //redraw the graph, r and jsdata are bound outside function - graph.render(jsdata); - }); - // change branch filter $("#branch_filter").select2({ dropdownAutoWidth: true, diff -r cb3bdf436473 -r 52adce4ffe89 kallithea/templates/changelog/changelog_table.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kallithea/templates/changelog/changelog_table.html Sun Aug 27 16:39:35 2017 +0200 @@ -0,0 +1,120 @@ +## Render changelog table with id 'changesets' with the range of changesets, +## statuses, and comments. +## Optionally, pass a js snippet to run whenever a table resize is triggered. +<%def name="changelog(repo_name, cs_range, cs_statuses, cs_comments, show_checkbox=False, show_branch=True, resize_js='')"> + + + %for cnt,cs in enumerate(cs_range): + + %if show_checkbox: + + %endif + + + + + <% message_lines = cs.message.splitlines() %> + %if len(message_lines) > 1: + + %else: + + %endif + + + %endfor + +
+ ${h.checkbox(cs.raw_id,class_="changeset_range")} + + %if cs_statuses.get(cs.raw_id): + %if cs_statuses.get(cs.raw_id)[2]: + + + + %else: + + + + %endif + %endif + + ${h.gravatar(h.email_or_none(cs.author), size=16)} + ${h.person(cs.author)} + + ${h.link_to(h.show_id(cs),h.url('changeset_home',repo_name=repo_name,revision=cs.raw_id), class_='changeset_hash')} + +
${h.age(cs.date,True)}
+
+ + +
+
+
${h.urlify_text(message_lines[0], c.repo_name,h.url('changeset_home',repo_name=repo_name,revision=cs.raw_id))}
+ %if len(message_lines) > 1: + + %endif +
+
+ %if cs_comments.get(cs.raw_id): + + ${len(cs_comments[cs.raw_id])} + + + %endif + %if cs.bumped: + + Bumped + + %endif + %if cs.divergent: + + Divergent + + %endif + %if cs.extinct: + + Extinct + + %endif + %if cs.unstable: + + Unstable + + %endif + %if cs.phase: + + ${cs.phase} + + %endif + %for book in cs.bookmarks: + + ${h.link_to(book,h.url('changeset_home',repo_name=repo_name,revision=cs.raw_id))} + + %endfor + %for tag in cs.tags: + + ${h.link_to(tag,h.url('changeset_home',repo_name=repo_name,revision=cs.raw_id))} + + %endfor + %if show_branch and cs.branch: + + ${h.link_to(cs.branch,h.url('changelog_home',repo_name=repo_name,branch=cs.branch))} + + %endif +
+
+
+ + +