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,12 +71,15 @@ div.negative-result {
grid-auto-rows: 150px; grid-auto-rows: 150px;
grid-gap: 10px; grid-gap: 10px;
> a {
color: #fff;
text-decoration: none;
> div { > div {
border: 2px solid #0055ba; border: 2px solid #0055ba;
border-radius: 5px; border-radius: 5px;
background-color: #008cba; background-color: #008cba;
padding: 1em; padding: 1em;
color: #fff;
display: flex; display: flex;
flex-flow: column-reverse; flex-flow: column-reverse;
text-align: center; text-align: center;
@ -93,3 +96,4 @@ div.negative-result {
} }
} }
} }
}

View File

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

View File

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