diff --git a/src/main/resources/public/js/papers.js b/src/main/resources/public/js/papers.js index bb621c5..c8982df 100644 --- a/src/main/resources/public/js/papers.js +++ b/src/main/resources/public/js/papers.js @@ -1,127 +1,14 @@ -var urlPapers = "/api/1.0/papers"; -var urlPaperStatuses = "/api/1.0/papers/statuses"; -var urlDeletePaper = "/api/1.0/papers/"; -var urlFilterPaper = "/api/1.0/papers/filter" - -function showPapers(papersElement, paperRowClass) { - getFromRest(urlPapers, function (paperList) { - paperList.forEach(function (paper, index) { - $(papersElement).parent().append("
" + - "
" + - " \n" + - " " + - " " + - " " + - " " + (index + 1) + ". " + paper.title + "" + - "" + - "" + - "
"); - }); - - $(paperRowClass).mouseenter(function (event) { - var paperRow = $(event.target).closest(paperRowClass); - $(paperRow).css("background-color", "#f8f9fa"); - $(paperRow).find(".remove-paper").removeClass("d-none"); - - }); - $(paperRowClass).mouseleave(function (event) { - var paperRow = $(event.target).closest(paperRowClass); - $(paperRow).css("background-color", "white"); - $(paperRow).closest(paperRowClass).find(".remove-paper").addClass("d-none"); - }); - }); -} - - -function filterPapers(papersElement, paperRowClass, authorId, year) { - var paperData = JSON.stringify({ - "authorId": authorId, - "year": year - }); - postToRest(urlFilterPaper, paperData, function (data) { - $(paperRowClass).remove(); - if(data.length > 0){ - data.forEach(function (paper, index) { - $(papersElement).parent().append("
" + - "
" + - " \n" + - " " + - " " + - " " + - " " + paper.title + "
" + - "
" + - "" + - "" + - "
"); - }); - - - $(paperRowClass).mouseenter(function (event) { - var paperRow = $(event.target).closest(paperRowClass); - $(paperRow).css("background-color", "#f8f9fa"); - $(paperRow).find(".remove-paper").removeClass("d-none"); - - }); - $(paperRowClass).mouseleave(function (event) { - var paperRow = $(event.target).closest(paperRowClass); - $(paperRow).css("background-color", "white"); - $(paperRow).closest(paperRowClass).find(".remove-paper").addClass("d-none"); - }); - } - }); - - -} - -function deletePaper(id, papersElement, paperRowClass) { - var id = $(idElement).parent().find('.id-class').val(); +function deletePaper() { $("#remove-paper-modal").modal('show'); $("#modal-btn-yes").on("click", function () { - deleteFromRest(urlDeletePaper + id, function () { - showFeedbackMessage("Статья удалена"); - $(paperRowClass).remove(); - showPapers(papersElement, paperRowClass); - }); - $("#remove-paper-modal").modal('hide'); + return true; }); $("#modal-btn-no").on("click", function () { $("#remove-paper-modal").modal('hide'); }); -} - -function addPaper(title, status, datePublish, dateUpdate, deadline, comment, locked, tmpFileName, authors) { - var paperData = JSON.stringify({ - "title": title, - "status": status, - "deadlineDate":deadline, - "comment": comment - }); - postToRest(urlPapers, paperData, function (data) { - alert(data); - }); -} - -function getPaperStatusClass(status) { - switch (status) { - case 'DRAFT': - return "text-draft" - case 'ON_PREPARATION': - return "text-primary"; - case 'ON_REVIEW': - return "text-primary"; - case 'COMPLETED': - return "text-success"; - case 'ATTENTION': - return "text-warning"; - case 'FAILED': - return "text-failed"; - default: - return ""; - } + return false; } function showPaperDashboard(dashboardElement) { diff --git a/src/main/resources/templates/papers/fragments/paperLineFragment.html b/src/main/resources/templates/papers/fragments/paperLineFragment.html index cf1e00a..b71c1b3 100644 --- a/src/main/resources/templates/papers/fragments/paperLineFragment.html +++ b/src/main/resources/templates/papers/fragments/paperLineFragment.html @@ -31,9 +31,10 @@ - - - + + + diff --git a/src/main/resources/templates/papers/papers.html b/src/main/resources/templates/papers/papers.html index 477e232..e401f23 100644 --- a/src/main/resources/templates/papers/papers.html +++ b/src/main/resources/templates/papers/papers.html @@ -7,55 +7,43 @@
-
-
-
-
-

Статьи

+
+ +
+
+
+
+

Статьи

-
-
-
Фильтровать по:
- - - +
+
+
Фильтровать по:
+ + + +
+ +
+
- -
- -
-
+
- +
+