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

Proposed by Tom Wardill on 2020-09-11
Status: Merged
Approved by: Tom Wardill on 2020-09-18
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 2020-09-11 Approve on 2020-09-15
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.
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'loggerhead/static/javascript/diff.js'
2--- loggerhead/static/javascript/diff.js 2020-09-11 10:05:41 +0000
3+++ loggerhead/static/javascript/diff.js 2020-09-11 10:05:41 +0000
4@@ -168,18 +168,18 @@
5 var original_diff_download_link = null;
6
7 function compute_diff_links() {
8- var numlines = $('#contextLines').value;
9+ var numlines = $('#contextLines').val();
10 $('.diff').each(
11 function(i, item)
12 {
13 item.collapsable.source = global_path + '+filediff/' + link_data[item.id] + '?context=' + numlines;
14 });
15- if(original_diff_download_link == null) original_diff_download_link = $('#download_link').href;
16- $('#download_link').href = original_diff_download_link + '?context=' + numlines;
17+ if(original_diff_download_link == null) original_diff_download_link = $('#download_link').attr('href');
18+ $('#download_link').attr('href', original_diff_download_link + '?context=' + numlines);
19 }
20
21 function get_num_lines() {
22- var numlines = $('#contextLines').value;
23+ var numlines = $('#contextLines').val();
24 return numlines;
25 }
26
27@@ -197,7 +197,7 @@
28 }
29 var diffs = $('.diff');
30 if (diffs == null) return;
31- var numlines = $('#contextLines').value;
32+ var numlines = $('#contextLines').val();
33 diffs.each(
34 function(i, item)
35 {
36@@ -206,7 +206,7 @@
37 'click',
38 function(e) {
39 e.preventDefault();
40- item.collapsable.source = global_path + '+filediff/' + link_data[item.id] + '?context=' + $('#contextLines').value;
41+ item.collapsable.source = global_path + '+filediff/' + link_data[item.id] + '?context=' + $('#contextLines').val();
42 collapsable.toggle();
43 });
44 var collapsable = new Collapsable(

Subscribers

People subscribed via source and target branches