|
@@ -69,22 +69,38 @@ public class HtmlRenderingService {
|
|
|
|
|
|
|
|
if (isAddition) {
|
|
if (isAddition) {
|
|
|
// Field was added (alt was empty, now has value)
|
|
// Field was added (alt was empty, now has value)
|
|
|
- return "<span class='cell-added'>" + escape(newVal) +
|
|
|
|
|
- "<div class='old'>hinzugefügt</div></span>";
|
|
|
|
|
|
|
+ return buildDiffContentHtml("added", "fa-plus", newVal, "hinzugefügt", oldVal);
|
|
|
} else if (isDeletion) {
|
|
} else if (isDeletion) {
|
|
|
// Field was deleted (alt had value, now is empty)
|
|
// Field was deleted (alt had value, now is empty)
|
|
|
- return "<span class='cell-deleted'>leer" +
|
|
|
|
|
- "<div class='old'>gelöscht (war: " + escape(oldVal) + ")" +
|
|
|
|
|
- buildCopyButton(oldVal) + "</div></span>";
|
|
|
|
|
|
|
+ return buildDiffContentHtml("deleted", "fa-minus", "leer", "war: " + escape(oldVal), oldVal);
|
|
|
} else {
|
|
} else {
|
|
|
// Field was changed (both old and new have values)
|
|
// Field was changed (both old and new have values)
|
|
|
String displayOldVal = (oldVal == null || oldVal.trim().isEmpty()) ? "leer" : oldVal;
|
|
String displayOldVal = (oldVal == null || oldVal.trim().isEmpty()) ? "leer" : oldVal;
|
|
|
- return "<span class='cell-changed'>" + escape(newVal) +
|
|
|
|
|
- "<div class='old'>geändert (war: " + escape(displayOldVal) + ")" +
|
|
|
|
|
- buildCopyButton(oldVal) + "</div></span>";
|
|
|
|
|
|
|
+ return buildDiffContentHtml("changed", "fa-exclamation", newVal, "geändert (war: " + escape(displayOldVal) + ")", oldVal);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Builds the new icon-based diff content HTML structure
|
|
|
|
|
+ */
|
|
|
|
|
+ private String buildDiffContentHtml(String changeType, String iconClass, String currentValue, String statusText, String oldValue) {
|
|
|
|
|
+ StringBuilder html = new StringBuilder();
|
|
|
|
|
+ html.append("<span class='cell-").append(changeType).append("'>");
|
|
|
|
|
+ html.append("<div class='diff-content'>");
|
|
|
|
|
+ html.append("<div class='diff-icon ").append(changeType).append("'>");
|
|
|
|
|
+ html.append("<i class='fas ").append(iconClass).append("'></i>");
|
|
|
|
|
+ html.append("</div>");
|
|
|
|
|
+ html.append("<div class='diff-text'>");
|
|
|
|
|
+ html.append("<span class='diff-current-value'>").append(escape(currentValue)).append("</span>");
|
|
|
|
|
+ html.append("<span class='diff-status-text'>").append(statusText);
|
|
|
|
|
+ html.append(buildCopyButton(oldValue));
|
|
|
|
|
+ html.append("</span>");
|
|
|
|
|
+ html.append("</div>");
|
|
|
|
|
+ html.append("</div>");
|
|
|
|
|
+ html.append("</span>");
|
|
|
|
|
+ return html.toString();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Builds a copy button for copying the old value to clipboard
|
|
* Builds a copy button for copying the old value to clipboard
|
|
|
*/
|
|
*/
|