Changeset - 5258b66bf5d7
[Not reviewed]
default
0 2 0
Mads Kiilerich - 9 years ago 2017-05-13 02:29:13
mads@kiilerich.com
pullrequests: fix "additional changes" js error - make sure all cs tables have a first column to align with (Issue #274)

A slight simplification of 16234f629cfb and fixing a JavaScript failure for
unauthenticated visits to PRs with pending available changesets.

nextFirstincell would be undefined becuase the "Current revision - no change"
line didn't have any elements in td, and nextFirstincell.offsetTop would thus
fail.

Fixed by adding a span around the text.

Also clarify that any element is fine - there is no need to check for
visibility.
2 files changed with 4 insertions and 3 deletions:
0 comments (0 inline, 0 general)
kallithea/public/js/graph.js
Show inline comments
 
@@ -103,26 +103,27 @@ function BranchRenderer(canvas_id, conte
 
			var extra = 0;
 

	
 
			cur = data[i];
 
			node = cur[0];
 
			in_l = cur[1];
 
			closing = cur[2];
 
			obsolete_node = cur[3];
 
			bumped_node = cur[4];
 
			divergent_node = cur[5];
 
			extinct_node = cur[6];
 
			unstable_node = cur[7];
 

	
 
			var firstincell = $(row).find('td>:visible')[0];
 
			var nextFirstincell = $(next).find('td>:visible')[0];
 
			// center dots on the first element in a td (not necessarily the first one, but there must be one)
 
			var firstincell = $(row).find('td>*')[0];
 
			var nextFirstincell = $(next).find('td>*')[0];
 
			var rowY = Math.floor(row.offsetTop + firstincell.offsetTop + firstincell.offsetHeight/2);
 
			var nextY = Math.floor((next == null) ? rowY + row.offsetHeight/2 : next.offsetTop + nextFirstincell.offsetTop + nextFirstincell.offsetHeight/2);
 

	
 
			for (var j in in_l) {
 
				line = in_l[j];
 
				start = line[0];
 
				end = line[1];
 
				color = line[2];
 
				obsolete_line = line[3];
 

	
 
				x = Math.floor(base_x - box_size * start);
 

	
kallithea/templates/pullrequests/pullrequest_show.html
Show inline comments
 
@@ -156,25 +156,25 @@ ${self.repo_context_bar('showpullrequest
 
                <div style="height:0;width:40px">
 
                  <canvas id="avail_graph_canvas" style="width:0"></canvas>
 
                </div>
 
                <table class="table" id="updaterevs-table" style="padding-left:50px">
 
                  %for cnt, cs in enumerate(c.avail_cs):
 
                    <tr id="chg_available_${cnt+1}" class="${'mergerow' if len(cs.parents) > 1 and not (editable and cs.revision in c.avail_revs) else ''}">
 
                      %if c.cs_ranges and cs.revision == c.cs_ranges[-1].revision:
 
                        <td>
 
                          %if editable:
 
                            ${h.radio(name='updaterev', value='', checked=True)}
 
                          %endif
 
                        </td>
 
                        <td colspan="4">${_("Current revision - no change")}</td>
 
                        <td colspan="4"><span>${_("Current revision - no change")}</span></td>
 
                      %else:
 
                        <td>
 
                          %if editable and cs.revision in c.avail_revs:
 
                            ${h.radio(name='updaterev', value=cs.raw_id)}
 
                          %endif
 
                        </td>
 
                        <td style="width: 120px"><span data-toggle="tooltip" title="${h.age(cs.date)}">${cs.date}</span></td>
 
                        <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>
 
                        <td>
 
                          <div class="pull-right" style="margin-top: -4px;">
 
                            %for tag in cs.tags:
 
                              <span class="tagtag" title="${_('Tag %s') % tag}">
0 comments (0 inline, 0 general)