Skip to content

Commit

Permalink
ASTDiff GUI: Final fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pouryafard75 committed Jul 7, 2024
1 parent 2fbe01a commit b9c86f4
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/main/java/gui/webdiff/DirectoryDiffView.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void renderOn(HtmlCanvas html) throws IOException {
.body()
.div(class_("container-fluid").style("padding: 0;"))
.div(class_("row"))
.render(new MenuBar())
.render(new MenuBar(external))
._div()
.if_(!external)
.div(class_("row justify-content-center"))
Expand Down Expand Up @@ -271,13 +271,24 @@ public void renderOn(HtmlCanvas html) throws IOException {
}

private static class MenuBar implements Renderable {
private final boolean external;

public MenuBar(boolean external) {
this.external = external;
}

@Override
public void renderOn(HtmlCanvas html) throws IOException {
html
.div(class_("col"))
.div(class_("btn-toolbar justify-content-end"))
.div(class_("btn-group"))
.div(class_("btn-group").style("padding: 5px;"))
.if_(!external)
.a(class_("btn btn-default btn-sm btn-danger").href("/quit")).content("Quit")
._if()
.if_(external)
.a(class_("btn btn-default btn-sm btn-danger").href("/list")).content("Back")
._if()
._div()
._div()
._div();
Expand Down
21 changes: 21 additions & 0 deletions src/main/resources/web/dist/single.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
$(document).ready(function() {

function resizeAllIframes() {
$('iframe').each(function() {
var iframe = this;
$(iframe).on('load', function() {
var height = iframe.contentWindow.document.body.scrollHeight;
// console.log(height);
iframe.style.height = height + 'px';
});

});
}

$('iframe').on('load', function() {
resizeAllIframes();
});

$(window).resize(function() {
resizeAllIframes();
});

// Select all elements with an ID that starts with 'diff_row_'
$('[id^="diff_row_"]').each(function() {
// Update the href attribute of each selected element
Expand Down

0 comments on commit b9c86f4

Please sign in to comment.