Skip to content

Commit

Permalink
Add option to show last comment directly in comment column
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-stoehr committed Jul 26, 2024
1 parent ee97b68 commit 39c7489
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,11 @@ public enum ParameterCore implements ParameterInterface {
*/
OCR_URL(new Parameter<UndefinedParameter>("ocrUrl")),

/**
* Show most recent comment in process list and task list.
*/
SHOW_LAST_COMMENT(new Parameter<>("showLastComment", false)),

/**
* Process properties to display in process list.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,28 @@ public List<Comment> getComments(ProcessDTO processDTO) {
public List<Comment> getComments(TaskDTO taskDTO) {
return getComments(taskDTO.getProcess());
}

/**
* Get the most recent comment of the given process.
*
* @param processDTO process as ProcessDTO
* @return message of the comment
*/
public String getLastComment(ProcessDTO processDTO) {
List<Comment> comments = getComments(processDTO);
if (comments.isEmpty()) {
return "";
}
return comments.get(0).getMessage();
}

/**
* Get the most recent comment of process containing the given task.
*
* @param taskDTO task as TaskDTO
* @return message of the comment
*/
public String getLastComment(TaskDTO taskDTO) {
return getLastComment(taskDTO.getProcess());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.kitodo.config.ConfigCore;
import org.kitodo.config.enums.ParameterCore;
import org.kitodo.data.database.beans.Batch;
import org.kitodo.data.database.beans.Folder;
import org.kitodo.data.database.beans.Process;
Expand Down Expand Up @@ -817,4 +819,14 @@ public void downloadToHome(int processId) {
public FilterMenu getFilterMenu() {
return filterMenu;
}

/**
* Determine whether the last comment should be displayed in the comments column.
*
* @return boolean
*/
public boolean showLastComment() {
return ConfigCore.getBooleanParameterOrDefaultValue(ParameterCore.SHOW_LAST_COMMENT);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -1190,4 +1190,13 @@ public boolean processInAssignedProject(int processId) {
}
return false;
}

/**
* Determine whether the last comment should be displayed in the comments column.
*
* @return boolean
*/
public boolean showLastComment() {
return ConfigCore.getBooleanParameterOrDefaultValue(ParameterCore.SHOW_LAST_COMMENT);
}
}
7 changes: 7 additions & 0 deletions Kitodo/src/main/resources/kitodo_config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,13 @@ showOcrButton=false
# Base path to OCR, without parameters
ocrUrl=

# -----------------------------------
# Show last comment
# -----------------------------------
# Display the most recent comment of a process in the comments column.
# It will be displayed next to the comments icon in the process and task list.
showLastComment=false

# -----------------------------------
# Display process properties
# -----------------------------------
Expand Down
4 changes: 2 additions & 2 deletions Kitodo/src/main/webapp/WEB-INF/resources/css/kitodo.css
Original file line number Diff line number Diff line change
Expand Up @@ -1800,8 +1800,8 @@ Mass import
padding-right: var(--default-half-size);
}

.comment-column {
text-align: center;
.comment-column .fa {
margin-right: var(--default-half-size);
}

.comment-column .fa-comment {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@
#{process.correctionCommentStatus gt 0 ? 'fa-exclamation-circle correction' : 'fa-comment'}
#{process.correctionCommentStatus eq 1 ? 'corrected' : ''}"
rendered="#{process.hasComments()}"/>
<h:outputText value="#{commentTooltipView.getLastComment(process)}"
rendered="#{ProcessForm.showLastComment() and process.hasComments()}"/>
</h:panelGroup>
<p:tooltip for="commentIcon" styleClass="comments" trackMouse="true" rendered="#{process.hasComments()}">
<ui:include src="/WEB-INF/templates/includes/base/commentTooltip.xhtml">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@
#{item.correctionCommentStatus gt 0 ? 'fa-exclamation-circle correction' : 'fa-comment'}
#{item.correctionCommentStatus eq 1 ? 'corrected' : ''}"
rendered="#{item.getProcess().hasComments()}"/>
<h:outputText value="#{commentTooltipView.getLastComment(item)}"
rendered="#{CurrentTaskForm.showLastComment() and item.getProcess().hasComments()}"/>
</h:panelGroup>
<p:tooltip for="commentIcon" styleClass="comments" trackMouse="true">
<ui:include src="/WEB-INF/templates/includes/base/commentTooltip.xhtml">
Expand Down

0 comments on commit 39c7489

Please sign in to comment.