Allow linking to specific pages

This commit is contained in:
Maximilian Grundke
2018-03-14 08:54:33 +01:00
parent 1bf2757c44
commit 6252df3a74
3 changed files with 34 additions and 24 deletions

View File

@ -71,25 +71,29 @@ div.negative-result {
grid-auto-rows: 150px;
grid-gap: 10px;
> div {
border: 2px solid #0055ba;
border-radius: 5px;
background-color: #008cba;
padding: 1em;
> a {
color: #fff;
display: flex;
flex-flow: column-reverse;
text-align: center;
text-decoration: none;
> .data {
flex-grow: 1;
font-size: 40px;
vertical-align: middle;
line-height: 50px;
}
> div {
border: 2px solid #0055ba;
border-radius: 5px;
background-color: #008cba;
padding: 1em;
display: flex;
flex-flow: column-reverse;
text-align: center;
> .title {
height: 42px;
> .data {
flex-grow: 1;
font-size: 40px;
vertical-align: middle;
line-height: 50px;
}
> .title {
height: 42px;
}
}
}
}

View File

@ -25,12 +25,14 @@ module StatisticsHelper
{
key: 'internal_users',
name: t('activerecord.models.internal_user.other'),
data: InternalUser.count
data: InternalUser.count,
url: internal_users_path
},
{
key: 'external_users',
name: t('activerecord.models.external_user.other'),
data: ExternalUser.count
data: ExternalUser.count,
url: external_users_path
}
]
end
@ -40,7 +42,8 @@ module StatisticsHelper
{
key: 'exercises',
name: t('activerecord.models.exercise.other'),
data: Exercise.count
data: Exercise.count,
url: exercises_path
},
{
key: 'average_submissions',
@ -55,13 +58,15 @@ module StatisticsHelper
{
key: 'rfcs',
name: t('activerecord.models.request_for_comment.other'),
data: RequestForComment.count
data: RequestForComment.count,
url: request_for_comments_path
},
{
key: 'percent_solved',
name: t('statistics.entries.request_for_comments.percent_solved'),
data: (100.0 / RequestForComment.count * RequestForComment.where(solved: true).count).round(2),
unit: '%'
unit: '%',
url: request_for_comments_path + '?q%5Bsolved_not_eq%5D=0'
},
{
key: 'comments',

View File

@ -4,6 +4,7 @@
h2 = section[:name]
.statistics-wrapper data-key=section[:key]
- section[:entries].each do | entry |
div data-key=entry[:key]
.title = entry[:name]
.data = entry[:data].to_s + (entry[:unit] or '')
a href=entry[:url]
div data-key=entry[:key]
.title = entry[:name]
.data = entry[:data].to_s + (entry[:unit] or '')