mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Move big statistics to a partial
This commit is contained in:
parent
1eff57d3ac
commit
3af4dd5aac
6 changed files with 41 additions and 98 deletions
|
|
@ -236,6 +236,7 @@ linters:
|
|||
- "app/views/schedules/events.html.haml"
|
||||
- "app/views/schedules/show.html.haml"
|
||||
- "app/views/schedules/show.xml.haml"
|
||||
- "app/views/shared/_big_statistic.haml"
|
||||
- "app/views/shared/_changelog_actions.haml"
|
||||
- "app/views/shared/_dynamic_association.html.haml"
|
||||
- "app/views/shared/_media_item.html.haml"
|
||||
|
|
|
|||
|
|
@ -18,12 +18,6 @@
|
|||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
.dashbox .icon {
|
||||
padding-left: 8px;
|
||||
display: block;
|
||||
font-size: 3.8em;
|
||||
}
|
||||
|
||||
.dashbox label {
|
||||
display: block;
|
||||
font-size: 1.1em;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,16 @@ module FormatHelper
|
|||
end
|
||||
end
|
||||
|
||||
def variant_from_delta(delta, reverse: false)
|
||||
if delta.to_i.positive?
|
||||
reverse ? 'warning' : 'success'
|
||||
elsif delta.to_i.negative?
|
||||
reverse ? 'success' : 'warning'
|
||||
else
|
||||
'info'
|
||||
end
|
||||
end
|
||||
|
||||
def target_progress_color(progress)
|
||||
progress = progress.to_i
|
||||
result =
|
||||
|
|
|
|||
|
|
@ -1,53 +1,17 @@
|
|||
= javascript_include_tag 'Chart'
|
||||
.row
|
||||
.col-sm-3.col-xs-3
|
||||
.dashbox.text-center
|
||||
%span.fa.fa-user.fa-lg
|
||||
%span.fa.fa-lg
|
||||
= @total_user
|
||||
%p
|
||||
%small
|
||||
#{'User'.pluralize(@total_user)}
|
||||
- if @new_user
|
||||
%span.label.label-success{ title: "+ #{@new_user} since you last logged in!" }
|
||||
+
|
||||
= @new_user
|
||||
= render "shared/big_statistic",
|
||||
icon: "user", subtitle: "User", value: @total_user, delta: @new_user
|
||||
.col-sm-3.col-xs-3
|
||||
.dashbox.text-center
|
||||
%span.fa.fa-check-square.fa-lg
|
||||
%span.fa.fa-lg
|
||||
= @total_reg
|
||||
%p
|
||||
%small
|
||||
#{'Registration'.pluralize(@total_reg)}
|
||||
- if @new_reg
|
||||
%span.label.label-success{ title: "+#{@new_reg} since you last logged in!" }
|
||||
+
|
||||
= @new_reg
|
||||
= render "shared/big_statistic",
|
||||
icon: "check-square", subtitle: "Registration", value: @total_reg, delta: @new_reg
|
||||
.col-sm-3.col-xs-3
|
||||
.dashbox.text-center
|
||||
%span.fa.fa-file-text.fa-lg
|
||||
%span.fa.fa-lg
|
||||
= @total_submissions
|
||||
%p
|
||||
%small
|
||||
#{'Submission'.pluralize(@total_submissions)}
|
||||
- if @new_submissions
|
||||
%span.label.label-success{ title: "+#{@new_submissions} since you last logged in!" }
|
||||
+
|
||||
= @new_submissions
|
||||
= render "shared/big_statistic",
|
||||
icon: "file-text", subtitle: "Submission", value: @total_submissions, delta: @new_submissions
|
||||
.col-sm-3.col-xs-3
|
||||
.dashbox.text-center
|
||||
%span.fa.fa-archive.fa-lg
|
||||
%span.fa.fa-lg
|
||||
= @total_withdrawn
|
||||
%p
|
||||
%small
|
||||
#{'Withdrawn'.pluralize(@total_withdrawn)}
|
||||
- if @new_withdrawn
|
||||
%span.label.label-success{ title: "+#{@new_withdrawn} since you last logged in!" }
|
||||
+
|
||||
= @new_withdrawn
|
||||
= render "shared/big_statistic",
|
||||
icon: "archive", subtitle: "Withdrawn", value: @total_withdrawn, delta: @new_withdrawn, reverse: true
|
||||
|
||||
.row#registrations
|
||||
.col-md-8
|
||||
|
|
|
|||
|
|
@ -6,56 +6,17 @@
|
|||
%hr
|
||||
.row
|
||||
.col-sm-3.col-xs-3
|
||||
.dashbox.text-center
|
||||
%span.fa.fa-user.fa-lg
|
||||
%span.fa.fa-lg
|
||||
= @total_reg
|
||||
%p
|
||||
%small
|
||||
#{'Registration'.pluralize(@total_reg)}
|
||||
- if @new_reg
|
||||
%span.label.label-success{ title: "+#{@new_reg} since you last logged in!" }
|
||||
+
|
||||
= @new_reg
|
||||
|
||||
= render "shared/big_statistic",
|
||||
icon: "user", subtitle: "Registration", value: @total_reg, delta: @new_reg
|
||||
.col-sm-3.col-xs-3
|
||||
.dashbox.text-center
|
||||
%span.fa.fa-check-square.fa-lg
|
||||
%span.fa.fa-lg
|
||||
= @total_submissions
|
||||
%p
|
||||
%small
|
||||
#{'Submission'.pluralize(@total_submissions)}
|
||||
- if @new_submissions
|
||||
%span.label.label-success{ title: "+#{@new_submissions} since you last logged in!" }
|
||||
+
|
||||
= @new_submissions
|
||||
|
||||
= render "shared/big_statistic",
|
||||
icon: "check-square", subtitle: "Submission", value: @total_submissions, delta: @new_submissions
|
||||
.col-sm-3.col-xs-3
|
||||
.dashbox.text-center
|
||||
%span.fa.fa-file-text.fa-lg
|
||||
%span.fa.fa-lg
|
||||
= @program_length
|
||||
%p
|
||||
%small
|
||||
#{'Hour'.pluralize(@program_length)}
|
||||
- if @new_reg
|
||||
%span.label.label-success{ title: "+#{@new_program_length} since you last logged in!" }
|
||||
+
|
||||
= @new_program_length
|
||||
|
||||
= render "shared/big_statistic",
|
||||
icon: "file-text", subtitle: "Hour", value: @program_length, delta: @new_program_length
|
||||
.col-sm-3.col-xs-3
|
||||
.dashbox.text-center
|
||||
%span.fa.fa-archive.fa-lg
|
||||
%span.fa.fa-lg
|
||||
= @total_withdrawn
|
||||
%p
|
||||
%small
|
||||
#{'Withdrawn'.pluralize(@total_withdrawn)}
|
||||
- if @new_withdrawn
|
||||
%span.label.label-success{ title: "+#{@new_withdrawn} since you last logged in!" }
|
||||
+
|
||||
= @new_withdrawn
|
||||
= render "shared/big_statistic",
|
||||
icon: "archive", subtitle: "Withdrawn", value: @total_withdrawn, delta: @new_withdrawn
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
|
|
|
|||
13
app/views/shared/_big_statistic.haml
Normal file
13
app/views/shared/_big_statistic.haml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
- reverse ||= false
|
||||
- variant = variant_from_delta(delta, reverse: reverse)
|
||||
.dashbox.text-center
|
||||
%span.fa
|
||||
= fa_icon(icon)
|
||||
= value
|
||||
%p.text-nowrap
|
||||
%small
|
||||
= subtitle.pluralize(value)
|
||||
%span.label{ class: "label-#{variant}" }
|
||||
= delta
|
||||
since you last logged in
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue