Resolve "Удаление конференции" #178

Merged
VladimirZarayskiy merged 1 commits from 58-delete-conf into dev 2019-04-15 21:32:23 +04:00
4 changed files with 44 additions and 23 deletions

View File

@ -66,8 +66,9 @@ public class ConferenceService {
@Transactional @Transactional
public void delete(Integer conferenceId) { public void delete(Integer conferenceId) {
// Conference conference = conferenceRepository.findOne(conferenceId); if (conferenceRepository.exists(conferenceId)) {
conferenceRepository.delete(conferenceId); conferenceRepository.delete(conferenceId);
}
} }
public void removeDeadline(ConferenceDto conferenceDto, Integer deadlineIndex) throws IOException { public void removeDeadline(ConferenceDto conferenceDto, Integer deadlineIndex) throws IOException {

View File

@ -2,6 +2,11 @@ body {
min-width: 400px; min-width: 400px;
} }
.conference-row .col:hover {
background-color: #eaeaea;
border-radius: .25rem;
}

View File

@ -1,27 +1,41 @@
$(document).ready(function () { $(document).ready(function () {
$('.data-href-js').click( function() { $(".conference-row").mouseenter(function (event) {
window.location = $(this).attr('data-href'); 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() { $('a[data-confirm]').click(function(ev) {
$(this).children('.circle').toggleClass('circle-active'); 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">&times;</span></button>\n' +
' </div>\n' +
$('.checkbox-js').parent().click( function() { ' <div class="modal-footer">\n' +
$(this).children('.checkbox').toggleClass('selected'); ' <a class="btn btn-primary" id="dataConfirmOK">Да</a>'+
}); ' <button class="btn primary" data-dismiss="modal" aria-hidden="true">Нет</button>'+
' </div>\n' +
$('#select-all-js').click( function() { ' </div>\n' +
$(this).toggleClass('selected'); ' </div>\n' +
' </div>');
var childNodes = $('.conference-item .form-check .checkbox') }
.each(function(i, elem) { $('#dataConfirmModal').find('#myModalLabel').text($(this).attr('data-confirm'));
if ($(this).hasClass('selected') && !$('#select-all-js').hasClass('selected')) { $('#dataConfirmOK').attr('href', href);
$(this).toggleClass('selected'); $('#dataConfirmModal').modal({show:true});
} else if (!$(this).hasClass('selected') && $('#select-all-js').hasClass('selected')){ return false;
$(this).toggleClass('selected');
}
});
}); });
}); });

View File

@ -3,6 +3,7 @@
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorator="default" xmlns:th=""> layout:decorator="default" xmlns:th="">
<head> <head>
<link rel="stylesheet" type="text/css" href="../css/conference.css"/>
</head> </head>
<body> <body>
@ -46,7 +47,7 @@
<div id="modalDelete"/> <div id="modalDelete"/>
</form> </form>
<script></script> <script src="../js/conference.js"></script>
</div> </div>
</body> </body>