fix scripts

This commit is contained in:
Anton Romanov 2018-12-18 19:40:23 +04:00
parent dc5abe1508
commit ec1e3ff052
6 changed files with 40 additions and 82 deletions

View File

@ -50,7 +50,7 @@ section {
} }
section h2.section-heading { section h2.section-heading {
font-size: 3vw; font-size: 3.5vw;
margin-top: 0; margin-top: 0;
margin-bottom: 15px; margin-bottom: 15px;
} }

View File

@ -1,33 +1,42 @@
function deletePaper() { /*<![CDATA[*/
$("#remove-paper-modal").modal('show'); $(document).ready(function () {
$(".paper-row").mouseenter(function (event) {
var paperRow = $(event.target).closest(".paper-row");
$(paperRow).css("background-color", "#f8f9fa");
$(paperRow).find(".remove-paper").removeClass("d-none");
$("#modal-btn-yes").on("click", function () { });
return true; $(".paper-row").mouseleave(function (event) {
var paperRow = $(event.target).closest(".paper-row");
$(paperRow).css("background-color", "white");
$(paperRow).closest(".paper-row").find(".remove-paper").addClass("d-none");
}); });
$("#modal-btn-no").on("click", function () { $('a[data-confirm]').click(function(ev) {
$("#remove-paper-modal").modal('hide'); 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' +
' <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; return false;
}
function showPaperDashboard(dashboardElement) {
getFromRest(urlPapers, function (paperList) {
paperList.forEach(function (paper, index) {
$(dashboardElement).append("<div class=\"col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card\">" +
"<div class=\"row\">" +
"<div class=\"col-2\">" +
"<span class=\"fa-stack fa-1x\">" +
"<i class=\"fa fa-circle fa-stack-2x " + getPaperStatusClass(paper.status) + "\"></i>" +
"<i class=\"fa fa-file-text-o fa-stack-1x fa-inverse\"></i>" +
"</span>" +
"</div>" +
"<div class=\"col col-10 text-right\">" +
"<h7 class=\"service-heading\">" + paper.title + "</h7>" +
"<p class=\"text-muted\">" + paper.authorsString + "</p>" +
"</div>" +
"</div>" +
"</div>");
}); });
}); });
} /*]]>*/

View File

@ -175,7 +175,6 @@
</div> </div>
</section> </section>
<script type="text/javascript" src="/js/file-loader.js"></script> <script type="text/javascript" src="/js/file-loader.js"></script>
<script src="/js/papers.js"></script>
<script> <script>
/*<![CDATA[*/ /*<![CDATA[*/
$(document).ready(function () { $(document).ready(function () {

View File

@ -7,7 +7,6 @@
<body> <body>
<div class="container" layout:fragment="content"> <div class="container" layout:fragment="content">
<!-- Services -->
<section id="services"> <section id="services">
<div class="container"> <div class="container">
<div class="col-lg-12 text-center"> <div class="col-lg-12 text-center">
@ -21,13 +20,6 @@
</div> </div>
</div> </div>
</section> </section>
<script src="/js/papers.js"></script>
<script>
$(document).ready(function () {
showPaperDashboard("#dashboard");
});
</script>
</div> </div>
</body> </body>
</html> </html>

View File

@ -57,11 +57,11 @@
<input type="date" class="form-control" name="deadline" <input type="date" class="form-control" name="deadline"
th:field="*{deadlines[__${rowStat.index}__].date}"/> th:field="*{deadlines[__${rowStat.index}__].date}"/>
</div> </div>
<div class="col-5"> <div class="col-4">
<input class="form-control" type="text" placeholder="Описание" <input class="form-control" type="text" placeholder="Описание"
th:field="*{deadlines[__${rowStat.index}__].description}"/> th:field="*{deadlines[__${rowStat.index}__].description}"/>
</div> </div>
<div class="col-1"> <div class="col-2">
<a class="btn btn-danger float-right" <a class="btn btn-danger float-right"
th:onclick="|$('#deadlines${rowStat.index}\\.description').val(''); th:onclick="|$('#deadlines${rowStat.index}\\.description').val('');
$('#deadlines${rowStat.index}\\.date').val(''); $('#deadlines${rowStat.index}\\.date').val('');
@ -138,7 +138,6 @@
</div> </div>
</section> </section>
<script type="text/javascript" src="/js/file-loader.js"></script> <script type="text/javascript" src="/js/file-loader.js"></script>
<script src="/js/papers.js"></script>
<script> <script>
/*<![CDATA[*/ /*<![CDATA[*/
$(document).ready(function () { $(document).ready(function () {

View File

@ -47,48 +47,7 @@
<script src="/js/papers.js"></script> <script src="/js/papers.js"></script>
<script type="text/javascript"> <script type="text/javascript">
/*<![CDATA[*/
$(document).ready(function () {
$(".paper-row").mouseenter(function (event) {
var paperRow = $(event.target).closest(".paper-row");
$(paperRow).css("background-color", "#f8f9fa");
$(paperRow).find(".remove-paper").removeClass("d-none");
});
$(".paper-row").mouseleave(function (event) {
var paperRow = $(event.target).closest(".paper-row");
$(paperRow).css("background-color", "white");
$(paperRow).closest(".paper-row").find(".remove-paper").addClass("d-none");
});
$('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">&times;</span></button>\n' +
' </div>\n' +
' <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;
});
});
/*]]>*/
</script> </script>
</div> </div>