Merge branch '58-delete-conf' into 'dev'
Resolve "Удаление конференции" Closes #58 See merge request romanov73/ng-tracker!51
This commit is contained in:
commit
06b5d66d3e
@ -5,6 +5,7 @@ import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@ -60,6 +61,12 @@ public class ConferenceController {
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/delete/{conference-id}")
|
||||
public String delete(@PathVariable("conference-id") Integer conferenceId) throws IOException {
|
||||
conferenceService.delete(conferenceId);
|
||||
return String.format(REDIRECT_TO, CONFERENCES_PAGE);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/conference", params = "addDeadline")
|
||||
public String addDeadline(@Valid ConferenceDto conferenceDto, Errors errors) {
|
||||
filterEmptyDeadlines(conferenceDto);
|
||||
|
@ -64,6 +64,13 @@ public class ConferenceService {
|
||||
return conference.getId();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void delete(Integer conferenceId) {
|
||||
if (conferenceRepository.exists(conferenceId)) {
|
||||
conferenceRepository.delete(conferenceId);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeDeadline(ConferenceDto conferenceDto, Integer deadlineIndex) throws IOException {
|
||||
if (conferenceDto.getDeadlines().get(deadlineIndex).getId() != null) {
|
||||
conferenceDto.getRemovedDeadlineIds().add(conferenceDto.getDeadlines().get(deadlineIndex).getId());
|
||||
|
@ -2,6 +2,11 @@ body {
|
||||
min-width: 400px;
|
||||
}
|
||||
|
||||
.conference-row .col:hover {
|
||||
background-color: #eaeaea;
|
||||
border-radius: .25rem;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,27 +1,41 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
$('.data-href-js').click( function() {
|
||||
window.location = $(this).attr('data-href');
|
||||
$(".conference-row").mouseenter(function (event) {
|
||||
var conferenceRow = $(event.target).closest(".conference-row");
|
||||
$(conferenceRow).css("background-color", "#f8f9fa");
|
||||
$(conferenceRow).find(".remove-conference").removeClass("d-none");
|
||||
|
||||
});
|
||||
$(".conference-row").mouseleave(function (event) {
|
||||
var conferenceRow = $(event.target).closest(".conference-row");
|
||||
$(conferenceRow).css("background-color", "white");
|
||||
$(conferenceRow).closest(".conference-row").find(".remove-conference").addClass("d-none");
|
||||
});
|
||||
|
||||
$('.circle').parent().click( function() {
|
||||
$(this).children('.circle').toggleClass('circle-active');
|
||||
});
|
||||
$('a[data-confirm]').click(function(ev) {
|
||||
var href = $(this).attr('href');
|
||||
if (!$('#dataConfirmModal').length) {
|
||||
$('#modalDelete').append('<div class="modal fade" id="dataConfirmModal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true"\n' +
|
||||
' >\n' +
|
||||
' <div class="modal-dialog modal-sm">\n' +
|
||||
' <div class="modal-content">\n' +
|
||||
' <div class="modal-header">\n' +
|
||||
' <h8 class="modal-title" id="myModalLabel">Удалить конференцию?</h8>\n' +
|
||||
' <button type="button" class="close" data-dismiss="modal" aria-label="Закрыть"><span\n' +
|
||||
' aria-hidden="true">×</span></button>\n' +
|
||||
' </div>\n' +
|
||||
|
||||
$('.checkbox-js').parent().click( function() {
|
||||
$(this).children('.checkbox').toggleClass('selected');
|
||||
});
|
||||
|
||||
$('#select-all-js').click( function() {
|
||||
$(this).toggleClass('selected');
|
||||
|
||||
var childNodes = $('.conference-item .form-check .checkbox')
|
||||
.each(function(i, elem) {
|
||||
if ($(this).hasClass('selected') && !$('#select-all-js').hasClass('selected')) {
|
||||
$(this).toggleClass('selected');
|
||||
} else if (!$(this).hasClass('selected') && $('#select-all-js').hasClass('selected')){
|
||||
$(this).toggleClass('selected');
|
||||
}
|
||||
});
|
||||
' <div class="modal-footer">\n' +
|
||||
' <a class="btn btn-primary" id="dataConfirmOK">Да</a>'+
|
||||
' <button class="btn primary" data-dismiss="modal" aria-hidden="true">Нет</button>'+
|
||||
' </div>\n' +
|
||||
' </div>\n' +
|
||||
' </div>\n' +
|
||||
' </div>');
|
||||
}
|
||||
$('#dataConfirmModal').find('#myModalLabel').text($(this).attr('data-confirm'));
|
||||
$('#dataConfirmOK').attr('href', href);
|
||||
$('#dataConfirmModal').modal({show:true});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
@ -3,6 +3,7 @@
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorator="default" xmlns:th="">
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="../css/conference.css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@ -46,7 +47,7 @@
|
||||
|
||||
<div id="modalDelete"/>
|
||||
</form>
|
||||
<script></script>
|
||||
<script src="../js/conference.js"></script>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
@ -4,13 +4,13 @@
|
||||
<meta charset="UTF-8"/>
|
||||
</head>
|
||||
<body>
|
||||
<div th:fragment="confLine (conference)" class="row text-left paper-row" style="background-color: white;">
|
||||
<div th:fragment="confLine (conference)" class="row text-left conference-row h3" style="background-color: white;">
|
||||
<div class="col">
|
||||
<a th:href="@{'conference?id='+${conference.id}}">
|
||||
<span class="h6" th:text="${conference.title}"/>
|
||||
<span class="h5" th:text="${conference.title}"/>
|
||||
</a>
|
||||
<input class="id-class" type="hidden"/>
|
||||
<a class="remove-paper pull-right d-none"
|
||||
<input class="id-class" type="hidden" th:value="${conference.id}"/>
|
||||
<a class="remove-paper pull-right" th:href="@{'/conferences/delete/'+${conference.id}}"
|
||||
data-confirm="Удалить статью?">
|
||||
<i class="fa fa-trash" aria-hidden="true"></i>
|
||||
</a>
|
||||
|
Loading…
Reference in New Issue
Block a user