read dashboard

This commit is contained in:
Anton Romanov 2018-11-14 15:15:23 +04:00
parent eaf03daba3
commit 06864c7ec8
3 changed files with 38 additions and 129 deletions

View File

@ -8,6 +8,7 @@ import ru.ulstu.user.model.UserDto;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.Set;
import java.util.stream.Collectors;
import static ru.ulstu.core.util.StreamApiUtils.convert;
@ -121,4 +122,11 @@ public class PaperDto {
public Set<UserDto> getAuthors() {
return authors;
}
public String getAuthorsString() {
return authors
.stream()
.map(author -> author.getLastName() + author.getFirstName())
.collect(Collectors.joining(", "));
}
}

View File

@ -12,7 +12,7 @@ function showPapers(papersElement, paperRowClass) {
" <i class='fa fa-file-text-o fa-stack-1x fa-inverse'></i>" +
" </span>" +
" <a href='paper?id=" + paper.id + "" +
"'><span>" + paper.title + "</span></a></div>" +
"'><span>" + (index+1) + ". " + paper.title + "</span></a></div>" +
"<div class='col-md-1'>" +
"<span class='remove-paper d-none' onclick=\"deletePaper(" + paper.id + ",'" + papersElement + "', '" + paperRowClass + "')\">" +
"<i class=\"fa fa-trash\" aria-hidden=\"true\"></i></span>" +
@ -75,4 +75,25 @@ function getPaperStatusClass(status) {
default:
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 text-primary\"></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

@ -15,137 +15,17 @@
<h2 class="section-heading text-uppercase">Dashboard</h2>
</div>
</div>
<div class="row justify-content-center">
<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 text-primary"></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">Название статьи</h7>
<p class="text-muted">Список авторов И.О.</p>
</div>
</div>
</div>
<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 text-primary"></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">Название статьи</h7>
<p class="text-muted">Список авторов И.О.</p>
</div>
</div>
</div>
<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 text-primary"></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">Название статьи</h7>
<p class="text-muted">Список авторов И.О.</p>
</div>
</div>
</div>
<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 text-primary"></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">Название статьи</h7>
<p class="text-muted">Список авторов И.О.</p>
</div>
</div>
</div>
<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 text-primary"></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">Название статьи</h7>
<p class="text-muted">Список авторов И.О.</p>
</div>
</div>
</div>
<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 text-primary"></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">Название статьи</h7>
<p class="text-muted">Список авторов И.О.</p>
</div>
</div>
</div>
<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 text-primary"></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">Название статьи</h7>
<p class="text-muted">Список авторов И.О.</p>
</div>
</div>
</div>
<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 text-primary"></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">Название статьи</h7>
<p class="text-muted">Список авторов И.О.</p>
</div>
</div>
</div>
<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 text-primary"></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">Название статьи</h7>
<p class="text-muted">Список авторов И.О.</p>
</div>
</div>
</div>
<div class="row justify-content-center" id="dashboard">
</div>
</div>
</section>
<script src="/js/papers.js"></script>
<script>
$(document).ready(function () {
showPaperDashboard("#dashboard");
});
</script>
</div>
</body>