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/events.html.haml"
|
||||||
- "app/views/schedules/show.html.haml"
|
- "app/views/schedules/show.html.haml"
|
||||||
- "app/views/schedules/show.xml.haml"
|
- "app/views/schedules/show.xml.haml"
|
||||||
|
- "app/views/shared/_big_statistic.haml"
|
||||||
- "app/views/shared/_changelog_actions.haml"
|
- "app/views/shared/_changelog_actions.haml"
|
||||||
- "app/views/shared/_dynamic_association.html.haml"
|
- "app/views/shared/_dynamic_association.html.haml"
|
||||||
- "app/views/shared/_media_item.html.haml"
|
- "app/views/shared/_media_item.html.haml"
|
||||||
|
|
@ -664,4 +665,4 @@ linters:
|
||||||
- "app/views/conference_registrations/_volunteer.html.haml"
|
- "app/views/conference_registrations/_volunteer.html.haml"
|
||||||
- "app/views/devise/passwords/new.html.haml"
|
- "app/views/devise/passwords/new.html.haml"
|
||||||
- "app/views/payments/new.html.haml"
|
- "app/views/payments/new.html.haml"
|
||||||
- "app/views/tickets/index.html.haml"
|
- "app/views/tickets/index.html.haml"
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,6 @@
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dashbox .icon {
|
|
||||||
padding-left: 8px;
|
|
||||||
display: block;
|
|
||||||
font-size: 3.8em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dashbox label {
|
.dashbox label {
|
||||||
display: block;
|
display: block;
|
||||||
font-size: 1.1em;
|
font-size: 1.1em;
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,16 @@ module FormatHelper
|
||||||
end
|
end
|
||||||
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)
|
def target_progress_color(progress)
|
||||||
progress = progress.to_i
|
progress = progress.to_i
|
||||||
result =
|
result =
|
||||||
|
|
|
||||||
|
|
@ -1,53 +1,17 @@
|
||||||
= javascript_include_tag 'Chart'
|
= javascript_include_tag 'Chart'
|
||||||
.row
|
.row
|
||||||
.col-sm-3.col-xs-3
|
.col-sm-3.col-xs-3
|
||||||
.dashbox.text-center
|
= render "shared/big_statistic",
|
||||||
%span.fa.fa-user.fa-lg
|
icon: "user", subtitle: "User", value: @total_user, delta: @new_user
|
||||||
%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
|
|
||||||
.col-sm-3.col-xs-3
|
.col-sm-3.col-xs-3
|
||||||
.dashbox.text-center
|
= render "shared/big_statistic",
|
||||||
%span.fa.fa-check-square.fa-lg
|
icon: "check-square", subtitle: "Registration", value: @total_reg, delta: @new_reg
|
||||||
%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
|
|
||||||
.col-sm-3.col-xs-3
|
.col-sm-3.col-xs-3
|
||||||
.dashbox.text-center
|
= render "shared/big_statistic",
|
||||||
%span.fa.fa-file-text.fa-lg
|
icon: "file-text", subtitle: "Submission", value: @total_submissions, delta: @new_submissions
|
||||||
%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
|
|
||||||
.col-sm-3.col-xs-3
|
.col-sm-3.col-xs-3
|
||||||
.dashbox.text-center
|
= render "shared/big_statistic",
|
||||||
%span.fa.fa-archive.fa-lg
|
icon: "archive", subtitle: "Withdrawn", value: @total_withdrawn, delta: @new_withdrawn, reverse: true
|
||||||
%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
|
|
||||||
|
|
||||||
.row#registrations
|
.row#registrations
|
||||||
.col-md-8
|
.col-md-8
|
||||||
|
|
|
||||||
|
|
@ -6,56 +6,17 @@
|
||||||
%hr
|
%hr
|
||||||
.row
|
.row
|
||||||
.col-sm-3.col-xs-3
|
.col-sm-3.col-xs-3
|
||||||
.dashbox.text-center
|
= render "shared/big_statistic",
|
||||||
%span.fa.fa-user.fa-lg
|
icon: "user", subtitle: "Registration", value: @total_reg, delta: @new_reg
|
||||||
%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
|
|
||||||
|
|
||||||
.col-sm-3.col-xs-3
|
.col-sm-3.col-xs-3
|
||||||
.dashbox.text-center
|
= render "shared/big_statistic",
|
||||||
%span.fa.fa-check-square.fa-lg
|
icon: "check-square", subtitle: "Submission", value: @total_submissions, delta: @new_submissions
|
||||||
%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
|
|
||||||
|
|
||||||
.col-sm-3.col-xs-3
|
.col-sm-3.col-xs-3
|
||||||
.dashbox.text-center
|
= render "shared/big_statistic",
|
||||||
%span.fa.fa-file-text.fa-lg
|
icon: "file-text", subtitle: "Hour", value: @program_length, delta: @new_program_length
|
||||||
%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
|
|
||||||
|
|
||||||
.col-sm-3.col-xs-3
|
.col-sm-3.col-xs-3
|
||||||
.dashbox.text-center
|
= render "shared/big_statistic",
|
||||||
%span.fa.fa-archive.fa-lg
|
icon: "archive", subtitle: "Withdrawn", value: @total_withdrawn, delta: @new_withdrawn
|
||||||
%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
|
|
||||||
|
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.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