Skip to content

Commit

Permalink
warning: закрытие через ajax
Browse files Browse the repository at this point in the history
  • Loading branch information
maxcom committed Nov 4, 2024
1 parent b507faa commit f7d7928
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/main/webapp/WEB-INF/tags/warnings.tag
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@
<c:if test="${warning.closed}"></s>
(закрыт <lor:user user="${warning.closedBy}" link="true"/>)
</c:if>

<c:if test="${not warning.closed}">
&nbsp;
<form action="clear-warning" method="POST" style="display: inline-block">
<form class="clear-warning-form" action="clear-warning" method="POST" style="display: inline-block">
<lor:csrf/>
<input type="hidden" name="id" value="${warning.id}">
<button type="submit" class="btn btn-small btn-default">закрыть</button>
Expand Down
13 changes: 13 additions & 0 deletions src/main/webapp/js/lor.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,17 @@ $(document).ready(function() {
});
}

function initClearWarningForm() {
$script.ready('plugins', function() {
$('.clear-warning-form').ajaxForm({
success: function(responseText, statusText, xhr, form) {
form.hide();
form.parent().wrap("<s></s>")
}
});
});
}

function initReactionsUI() {
$script.ready('plugins', function() {
twemoji.parse(document.body, { 'base': 'https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/' });
Expand Down Expand Up @@ -505,6 +516,8 @@ $(document).ready(function() {

initSamepageCommentNavigation();
initScollupButton();
initClearWarningForm();


replace_state();
$(window).bind('hashchange', replace_state);
Expand Down

0 comments on commit f7d7928

Please sign in to comment.