Resolve "Фильтр статей" #145

Merged
alefly merged 1 commits from 14-filter-frontend into master 2018-11-23 20:40:17 +04:00
2 changed files with 41 additions and 17 deletions
Showing only changes of commit 13f9081aee - Show all commits

View File

@ -7,15 +7,14 @@ function showPapers(papersElement, paperRowClass) {
getFromRest(urlPapers, function (paperList) { getFromRest(urlPapers, function (paperList) {
paperList.forEach(function (paper, index) { paperList.forEach(function (paper, index) {
$(papersElement).parent().append("<div class='row text-left paper-row'>" + $(papersElement).parent().append("<div class='row text-left paper-row'>" +
" <div class='col-md-11'>" + " <div class='col'>" +
" <span class='fa-stack fa-1x'>\n" + " <span class='fa-stack fa-1x'>\n" +
" <i class='fa fa-circle fa-stack-2x " + getPaperStatusClass(paper.status) + "'></i>" + " <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>" + " <i class='fa fa-file-text-o fa-stack-1x fa-inverse'></i>" +
" </span>" + " </span>" +
" <a href='paper?id=" + paper.id + "" + " <a href='paper?id=" + paper.id + "" +
"'><span>" + paper.title + "</span></a></div>" + "'><span>" + (index + 1) + ". " + paper.title + "</span></a>" +
"<div class='col-md-1'>" + "<span class='remove-paper d-none pull-right' onclick=\"deletePaper(" + paper.id + ",'" + papersElement + "', '" + paperRowClass + "')\">" +
"<span class='remove-paper d-none' onclick=\"deletePaper(" + paper.id + ",'" + papersElement + "', '" + paperRowClass + "')\">" +
"<i class=\"fa fa-trash\" aria-hidden=\"true\"></i></span>" + "<i class=\"fa fa-trash\" aria-hidden=\"true\"></i></span>" +
"</div></div>"); "</div></div>");
}); });
@ -110,11 +109,36 @@ function getPaperStatusClass(status) {
return "text-draft" return "text-draft"
case 'ON_PREPARATION': case 'ON_PREPARATION':
return "text-primary"; return "text-primary";
case 'ON_REVIEW':
return "text-primary";
case 'COMPLETED': case 'COMPLETED':
return "text-success"; return "text-success";
case 'ATTENTION': case 'ATTENTION':
return "text-warning"; return "text-warning";
case 'FAILED':
return "text-failed";
default: default:
return ""; return "";
} }
} }
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

@ -14,10 +14,15 @@
<h2 class="section-heading text-uppercase">Статьи</h2> <h2 class="section-heading text-uppercase">Статьи</h2>
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
<a href="./papers" class="btn btn-light toolbar-button"><i class="fa fa-list-alt"></i>
Список</a>
</div>
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3"> <div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
<a href="./dashboard" class="btn btn-light toolbar-button"><i class="fa fa-newspaper-o" <a href="./dashboard" class="btn btn-light toolbar-button"><i class="fa fa-newspaper-o"
aria-hidden="true"></i> Панель управления</a> aria-hidden="true"></i> Панель управления</a>
</div> </div>
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3"> <div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3">
<a href="./paper" class="btn btn-light toolbar-button"><i class="fa fa-plus-circle" aria-hidden="true"></i> <a href="./paper" class="btn btn-light toolbar-button"><i class="fa fa-plus-circle" aria-hidden="true"></i>
Добавить статью</a> Добавить статью</a>
@ -62,21 +67,16 @@
</div> </div>
</div> </div>
</div> </div>
<script src="/js/papers.js"></script>
<script>jQuery('.filter').on('change','#year',function(){
filterPapers("#paper-list", ".paper-row",'1','2018');
});
</script>
<script src="papers.js"></script>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
showPapers("#paper-list", ".paper-row"); showPapers("#paper-list", ".paper-row");
jQuery('.filter').on('change','#year',function(){
filterPapers("#paper-list", ".paper-row",'1','2018');
});
}); });
</script> </script>
</div> </div>
</body> </body>