Skip to content

Commit

Permalink
feat: Add a switch to select document comparison tool (#545)
Browse files Browse the repository at this point in the history
Fixes #438
  • Loading branch information
kesara authored Oct 23, 2024
1 parent 4e2f04a commit 483d992
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions static/iddiff.html
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,18 @@ <h1 class="text-center">IETF Author Tools - iddiff</h1>
</div>
</div>
</div>
<div class="row mt-2">
<div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="switchDiffTool" id="switchRfcDiff" checked>
<label class="form-check-label" for="switchRfcDiff">Use rfcdiff</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="switchDiffTool" id="switchIdDiff">
<label class="form-check-label" for="switchIdDiff">Use iddiff</label>
</div>
</div>
</div>
<div class="row mt-2">
<div class="d-grid gap-2 d-md-flex justify-content-md-center">
<button class="btn btn-primary btn-lg flex-grow-1" type="button" value="compare" id="buttonCompare" data-title="Compare (side by side)" data-bs-toggle2="tooltip" data-bs-placement="bottom">Compare (side by side)</button>
Expand Down
8 changes: 8 additions & 0 deletions static/scripts/iddiff.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const buttonOpen = document.getElementById('buttonOpen');
const buttonShare = document.getElementById('buttonShare');
const tabLinks = document.getElementsByClassName('tab-link');
const switchRaw = document.getElementById('switchRaw');
const switchIdDiff = document.getElementById('switchIdDiff');

// enable Bootstrap/Popper tooltips
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle2="tooltip"]'));
Expand Down Expand Up @@ -137,6 +138,10 @@ function getShareableURL(button) {
url += '&raw=1'
}

if (switchIdDiff.checked) {
url += '&iddiff=1'
}

return url;
}

Expand Down Expand Up @@ -207,6 +212,9 @@ function compare(event) {
if (switchRaw.checked) {
formData.append('raw', 1);
}
if (switchIdDiff.checked) {
formData.append('iddiff', 1);
}

const apiCall = '/api/iddiff';

Expand Down

0 comments on commit 483d992

Please sign in to comment.