Merge lp:~twom/loggerhead/javascript-context-selector into lp:loggerhead

Proposed by Tom Wardill
Status: Merged
Approved by: Tom Wardill
Approved revision: 509
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: lp:~twom/loggerhead/javascript-context-selector
Merge into: lp:loggerhead
Prerequisite: lp:~twom/loggerhead/side-by-side-js-fix
Diff against target: 44 lines (+6/-6)
1 file modified
loggerhead/static/javascript/diff.js (+6/-6)
To merge this branch: bzr merge lp:~twom/loggerhead/javascript-context-selector
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+390611@code.launchpad.net

Commit message

Fix context number

Description of the change

Entering a new value in the "Lines of context" box should update the relevant values.
There doesn't appear to be any method (that I can see) of this causing a reload of the data, so a manual refresh of the page is required.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'loggerhead/static/javascript/diff.js'
--- loggerhead/static/javascript/diff.js 2020-09-11 10:05:41 +0000
+++ loggerhead/static/javascript/diff.js 2020-09-11 10:05:41 +0000
@@ -168,18 +168,18 @@
168var original_diff_download_link = null;168var original_diff_download_link = null;
169169
170function compute_diff_links() {170function compute_diff_links() {
171 var numlines = $('#contextLines').value;171 var numlines = $('#contextLines').val();
172 $('.diff').each(172 $('.diff').each(
173 function(i, item)173 function(i, item)
174 {174 {
175 item.collapsable.source = global_path + '+filediff/' + link_data[item.id] + '?context=' + numlines;175 item.collapsable.source = global_path + '+filediff/' + link_data[item.id] + '?context=' + numlines;
176 });176 });
177 if(original_diff_download_link == null) original_diff_download_link = $('#download_link').href;177 if(original_diff_download_link == null) original_diff_download_link = $('#download_link').attr('href');
178 $('#download_link').href = original_diff_download_link + '?context=' + numlines;178 $('#download_link').attr('href', original_diff_download_link + '?context=' + numlines);
179}179}
180180
181function get_num_lines() {181function get_num_lines() {
182 var numlines = $('#contextLines').value;182 var numlines = $('#contextLines').val();
183 return numlines;183 return numlines;
184}184}
185185
@@ -197,7 +197,7 @@
197 }197 }
198 var diffs = $('.diff');198 var diffs = $('.diff');
199 if (diffs == null) return;199 if (diffs == null) return;
200 var numlines = $('#contextLines').value;200 var numlines = $('#contextLines').val();
201 diffs.each(201 diffs.each(
202 function(i, item)202 function(i, item)
203 {203 {
@@ -206,7 +206,7 @@
206 'click',206 'click',
207 function(e) {207 function(e) {
208 e.preventDefault();208 e.preventDefault();
209 item.collapsable.source = global_path + '+filediff/' + link_data[item.id] + '?context=' + $('#contextLines').value;209 item.collapsable.source = global_path + '+filediff/' + link_data[item.id] + '?context=' + $('#contextLines').val();
210 collapsable.toggle();210 collapsable.toggle();
211 });211 });
212 var collapsable = new Collapsable(212 var collapsable = new Collapsable(

Subscribers

People subscribed via source and target branches