Implements targets and campaigns for conference
This commit is contained in:
parent
678fe38a25
commit
857ac43e74
40 changed files with 1086 additions and 44 deletions
40
app/views/admin/conference/_campaigns.html.haml
Normal file
40
app/views/admin/conference/_campaigns.html.haml
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
- if campaigns && !campaigns.empty?
|
||||
.row
|
||||
.col-md-12
|
||||
%p
|
||||
Your target "#{campaigns.values[0]['target_name']}" from campaign "#{campaigns.values[0]['campaign_name']}" has generated
|
||||
%strong
|
||||
#{pluralize(campaigns.values[0]['value'], campaigns.values[0]['unit'])}
|
||||
since #{campaigns.values[0]['created_at']}.
|
||||
%p
|
||||
That is
|
||||
%strong{'style'=>"color: #{target_progress_color(campaigns.values[0]['progress'])};"}
|
||||
#{campaigns.values[0]['progress']} %
|
||||
of your target, there are
|
||||
%strong{'style'=>"color: #{days_left_color(campaigns.values[0]['days_left'])};"}
|
||||
#{pluralize(campaigns.values[0]['days_left'], 'day')} left.
|
||||
.row
|
||||
.col-md-12
|
||||
%div{'style'=>'display: none;', 'id'=>"#{name}"}
|
||||
- campaigns.drop(1).each do |(key, value)|
|
||||
%div
|
||||
%p
|
||||
Your target "#{value['target_name']}" from campaign "#{value['campaign_name']}" has generated
|
||||
%strong
|
||||
#{pluralize(value['value'], value['unit'])}
|
||||
since #{value['created_at']}.
|
||||
%p
|
||||
That is
|
||||
%strong{'style'=>"color: #{target_progress_color(value['progress'])};"}
|
||||
#{value['progress']} %
|
||||
of your target, there are
|
||||
%strong{'style'=>"color: #{days_left_color(value['days_left'])};"}
|
||||
#{pluralize(value['days_left'], 'day')} left.
|
||||
.row
|
||||
.col-md-12
|
||||
- if campaigns.length > 1
|
||||
%a.show_targets{'href'=>'#', 'data-name'=>"#{name}"}
|
||||
more
|
||||
- else
|
||||
%h5.text-warning.text-center
|
||||
No Campaigns!
|
||||
32
app/views/admin/conference/_targets.html.haml
Normal file
32
app/views/admin/conference/_targets.html.haml
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
- if targets && !targets.empty?
|
||||
.row
|
||||
.col-md-8.col-md-offset-2
|
||||
.row
|
||||
.col-md-10
|
||||
%h6.text-muted.pull-left
|
||||
Target 1
|
||||
.row
|
||||
.col-md-10
|
||||
.progress{'title'=>"#{targets.keys[0]}"}
|
||||
.progress-bar{ 'role'=>'progressbar', 'aria-valuenow'=>"#{targets.values[0]}", 'aria-valuemin'=>'0',
|
||||
'aria-valuemax'=>'100', 'style'=>"width: #{targets.values[0]}%;"}
|
||||
= "#{targets.values[0]} %"
|
||||
.row
|
||||
.col-md-8.col-md-offset-2
|
||||
%div{'style'=>'display: none;', 'id'=>"#{name}"}
|
||||
- targets.drop(1).each_with_index do |(key, value), index|
|
||||
.row
|
||||
.col-md-10
|
||||
%h6.text-muted.pull-left
|
||||
= "Target #{index + 2}"
|
||||
.row
|
||||
.col-md-10
|
||||
.progress{'title'=>"#{key}"}
|
||||
.progress-bar{ 'role'=>'progressbar', 'aria-valuenow'=>"#{value}", 'aria-valuemin'=>'0',
|
||||
'aria-valuemax'=>'100', 'style'=>"width: #{value}%;" }
|
||||
= "#{value} %"
|
||||
.row
|
||||
.col-md-2.col-md-offset-2
|
||||
- if targets.length > 1
|
||||
%a.show_targets{'href'=>'#', 'data-name'=>"#{name}"}
|
||||
more
|
||||
|
|
@ -10,6 +10,8 @@
|
|||
.text
|
||||
%label.text-muted total registrations: #{@total_reg}
|
||||
%label.text-muted new registrations: #{@new_reg}
|
||||
.row
|
||||
= render partial: 'targets', locals: { targets: @registration_targets, name: 'registrations' }
|
||||
.col-sm-4
|
||||
.dashbox.text-center
|
||||
.icon
|
||||
|
|
@ -17,13 +19,17 @@
|
|||
.text
|
||||
%label.text-muted total submissions: #{@total_submissions}
|
||||
%label.text-muted new submissions: #{@new_submissions}
|
||||
.row
|
||||
= render partial: 'targets', locals: { targets: @submission_targets, name: 'submissions' }
|
||||
.col-sm-4
|
||||
.dashbox.text-center
|
||||
.icon
|
||||
%i.glyphicon.glyphicon-user
|
||||
.text
|
||||
%label.text-muted programm hours: #{@program_length} h
|
||||
%label.text-muted new programm hours: #{@new_program_length} h
|
||||
%label.text-muted programm: #{@program_length} min
|
||||
%label.text-muted new programm: #{@new_program_length} min
|
||||
.row
|
||||
= render partial: 'targets', locals: { targets: @program_minutes_targets, name: 'program_hours' }
|
||||
.row
|
||||
.col-md-12
|
||||
.row
|
||||
|
|
@ -97,6 +103,13 @@
|
|||
= render partial: 'recent_submissions', locals: {recent_events: @recent_events}
|
||||
.col-md-4
|
||||
= render partial: 'top_submitter', locals: {top_submitter: @top_submitter}
|
||||
.row
|
||||
.col-md-12
|
||||
%h3
|
||||
%span
|
||||
%i.glyphicon.glyphicon-flag
|
||||
Campaigns
|
||||
= render partial: 'campaigns', locals: {campaigns: @campaigns, name: 'campaigns'}
|
||||
|
||||
:javascript
|
||||
$('#recentTable a').click(function (e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue