diff --git a/src/main/resources/public/js/papers.js b/src/main/resources/public/js/papers.js index 88eaed1..e2be107 100644 --- a/src/main/resources/public/js/papers.js +++ b/src/main/resources/public/js/papers.js @@ -1,21 +1,23 @@ 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 + "" + - "" + + "'>" + paper.title + "
" + + "
" + + "" + "" + - "
"); + "
"); }); $(paperRowClass).mouseenter(function (event) { @@ -32,6 +34,47 @@ function showPapers(papersElement, paperRowClass) { }); } +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) { $("#remove-paper-modal").modal('show'); @@ -61,52 +104,17 @@ function addPaper(title, status, comment, locked) { }); } -function filterPaper(authorId, year) { - var paperData = JSON.stringify({ - "authors": title, - "": status - }); - 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 ""; } -} - -function showPaperDashboard(dashboardElement) { - getFromRest(urlPapers, function (paperList) { - paperList.forEach(function (paper, index) { - $(dashboardElement).append("
" + - "
" + - "
" + - "" + - "" + - "" + - "" + - "
" + - "
" + - "" + paper.title + "" + - "

" + paper.authorsString + "

" + - "
" + - "
" + - "
"); - }); - }); } \ No newline at end of file diff --git a/src/main/resources/templates/papers/papers.html b/src/main/resources/templates/papers/papers.html index b381204..c41988a 100644 --- a/src/main/resources/templates/papers/papers.html +++ b/src/main/resources/templates/papers/papers.html @@ -14,39 +14,36 @@

Статьи

-
- - Список -
Панель управления + aria-hidden="true"> Панель управления
-
Добавить статью +
-
-

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

- - - -
+
- 1 +
+
Фильтровать по:
+ + + +
+ @@ -65,12 +62,21 @@ - + + + + + +