From 02f762b4f17eff57f47ea4d4489bc3307218a115 Mon Sep 17 00:00:00 2001 From: Alyona Date: Wed, 14 Nov 2018 08:55:46 +0400 Subject: [PATCH 1/4] filter --- src/main/resources/public/js/papers.js | 10 ++++++++++ .../resources/templates/papers/papers.html | 20 ++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/main/resources/public/js/papers.js b/src/main/resources/public/js/papers.js index 3b78d8a..a06198e 100644 --- a/src/main/resources/public/js/papers.js +++ b/src/main/resources/public/js/papers.js @@ -62,6 +62,16 @@ 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': diff --git a/src/main/resources/templates/papers/papers.html b/src/main/resources/templates/papers/papers.html index 1c5322a..9a9ee7f 100644 --- a/src/main/resources/templates/papers/papers.html +++ b/src/main/resources/templates/papers/papers.html @@ -22,8 +22,26 @@ Добавить статью +
+

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

+ + + +
- + 1 From 5eff1bac819190e6f2caf8ce67c179f785bbabdb Mon Sep 17 00:00:00 2001 From: Alyona Date: Fri, 23 Nov 2018 14:10:36 +0400 Subject: [PATCH 2/4] =?UTF-8?q?Merge=20branch=20'master'=20of=20C:\Users\?= =?UTF-8?q?=D0=BA=D0=B0=D1=82=D1=8F\IdeaProjects\ng-tracker=20with=20confl?= =?UTF-8?q?icts.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/public/js/papers.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/resources/public/js/papers.js b/src/main/resources/public/js/papers.js index 3b78d8a..a06198e 100644 --- a/src/main/resources/public/js/papers.js +++ b/src/main/resources/public/js/papers.js @@ -62,6 +62,16 @@ 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': From f5068f8be94caa6d791ffd0b93f0970d30ae9bb7 Mon Sep 17 00:00:00 2001 From: Alyona Date: Fri, 23 Nov 2018 14:17:16 +0400 Subject: [PATCH 3/4] filter --- src/main/resources/public/js/papers.js | 86 ++++++++++--------- .../resources/templates/papers/papers.html | 58 +++++++------ 2 files changed, 79 insertions(+), 65 deletions(-) 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 @@ - + + + + + + From 13f9081aee467645bef58644fdee1aa38dffc73f Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Fri, 23 Nov 2018 20:37:24 +0400 Subject: [PATCH 4/4] fix failed commit --- src/main/resources/public/js/papers.js | 34 ++++++++++++++++--- .../resources/templates/papers/papers.html | 24 ++++++------- 2 files changed, 41 insertions(+), 17 deletions(-) diff --git a/src/main/resources/public/js/papers.js b/src/main/resources/public/js/papers.js index e2be107..8322440 100644 --- a/src/main/resources/public/js/papers.js +++ b/src/main/resources/public/js/papers.js @@ -7,17 +7,16 @@ function showPapers(papersElement, paperRowClass) { getFromRest(urlPapers, function (paperList) { paperList.forEach(function (paper, index) { $(papersElement).parent().append("
" + - "
" + + "
" + " \n" + " " + " " + " " + " " + paper.title + "
" + - "
" + - "" + + "'>" + (index + 1) + ". " + paper.title + "" + + "" + "" + - "
"); + "
"); }); $(paperRowClass).mouseenter(function (event) { @@ -110,11 +109,36 @@ function getPaperStatusClass(status) { 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 c41988a..cb492db 100644 --- a/src/main/resources/templates/papers/papers.html +++ b/src/main/resources/templates/papers/papers.html @@ -15,9 +15,14 @@ - - - - - + -