Skip to content

Add UI for adding a comment to a series #1338

Closed
@php-coder

Description

@php-coder

On the src/main/webapp/WEB-INF/views/series/info.html page we should add another form to add a comment. It should have a single textarea and a submit button. Here is an example that can be helpful:

<div class="form-group js-comment collapse in" th:classappend="|${#fields.hasErrors('comment') ? 'has-error' : ''} ${addSeriesForm.comment != null ? 'js-has-data' : ''}|" sec:authorize="hasAuthority('ADD_COMMENTS_TO_SERIES')">
<label for="comment" class="control-label col-sm-3" th:text="#{t_comment}">
Comment
</label>
<div class="col-sm-5">
<textarea id="comment" class="form-control" cols="22" rows="3" th:field="*{comment}"></textarea>
<!--/*/
<span id="comment.errors" class="help-block" th:if="${#fields.hasErrors('comment')}" th:each="error : ${#fields.errors('comment')}" th:text="${error}"></span>
/*/-->
</div>
</div>

When we submit a form, it should send a PATCH request to API /series/{id} with

[
  { "op": "add", "path": "/comment", "value": "<user data>" }
]

and reload a page on success. It should show an error when server returns an error. Note that there can be 2 type of errors -- general (for a whole form) and validation error (for a particular field).

Part of #785

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions