Implements instance dashboard

This commit is contained in:
Chrisbr 2014-06-16 13:51:43 +02:00
parent 61c066df87
commit 4abd5d2185
18 changed files with 970 additions and 217 deletions

View file

@ -0,0 +1,6 @@
.text-center
%h4 #{title}
%canvas.doughnut_chart{"data-chart"=>data.to_json}
- if data
- data.each do |key, value|
%span{"style"=>"border-bottom: 3px solid #{value['color']}"} #{key}: #{value['value']}

View file

@ -1,8 +0,0 @@
.well
.text-center
%h4 Event distribution
%canvas.doughnut_chart{"data-chart"=>@event_distribution.to_json}
.row
- if @event_distribution
- @event_distribution.each do |key, value|
%span{"style"=>"border-bottom: 3px solid #{value['color']}"} #{key}: #{value['value']}

View file

@ -0,0 +1,29 @@
.row
.col-md-12
.text-center
%h4
= title
.row
.col-md-12
.chart_data{ "data-chart"=>"#{y.to_json}", "data-conferences"=>"#{conferences.to_json}",
"data-deactive"=>"#{deactive_conferences.to_json}", "data-weeks"=>"#{x.to_json}",
"data-active"=>"#{active_conferences.to_json}"}
%canvas.line_chart{ :id => "line_chart_#{name}", "data-name"=>"#{name}" }
.row
.col-md-12
.text-center
= unit
.row
.col-md-12
.conferenceCheckboxes{ :id => "#{name}Checkboxes", "data-name"=>"#{name}" }
- if active_conferences && deactive_conferences && conferences && conferences.length > 1
- active_conferences.each do |conference|
%div
%span{ "style"=>"border-bottom: 3px solid #{conference[:color]};", "data-chart"=> "#{name}" }
%input{ "type"=>"checkbox", "name"=>"#{conference[:short_title]}", "checked"=>"checked"}
#{conference[:short_title]}
- deactive_conferences.each do |conference|
%div
%span{"style"=>"border-bottom: 3px solid #{conference[:color]};", "data-chart"=> "#{name}" }
%input{"type"=>"checkbox", "name"=>"#{conference[:short_title]}" }
#{conference[:short_title]}

View file

@ -1,18 +1,19 @@
- if recent_registrations && !recent_registrations.empty?
%table.table
%thead
%tr
%th #
%th Public Name
%th Conference
%th Date
- recent_registrations.each_with_index do |registration, index|
%tbody
%tr
%td #{index + 1}
%td #{registration.public_name}
%td #{registration.conference.title}
%td #{registration.created_at.strftime('%m/%d/%Y')}
.table-responsive
%table.table
%thead
%tr
%th #
%th Public Name
%th Conference
%th Date
- recent_registrations.each_with_index do |registration, index|
%tbody
%tr
%td #{index + 1}
%td #{registration.public_name}
%td #{registration.conference.title}
%td #{registration.created_at.strftime('%m/%d/%Y')}
- else
%h5.text-warning.text-center
No registrations!

View file

@ -1,21 +1,22 @@
- if recent_events && !recent_events.empty?
%table.table
%thead
%tr
%th #
%th Submitter
%th Title
%th Conference
%th Status
- recent_events.each_with_index do |event, index|
%tbody
%tr
%td #{index + 1}
%td #{event.submitter}
%td #{event.title}
%td #{event.conference.title}
%td
.span{'class'=>label_for(event.state)} #{event.state.humanize}
.table-responsive
%table.table
%thead
%tr
%th #
%th Submitter
%th Title
%th Conference
%th Status
- recent_events.each_with_index do |event, index|
%tbody
%tr
%td #{index + 1}
%td #{event.submitter}
%td #{event.title}
%td #{event.conference.title}
%td
.span{'class'=>label_for(event.state)} #{event.state.humanize}
- else
%h5.text-warning.text-center
No submissions!

View file

@ -1,22 +1,23 @@
- if recent_users && !recent_users.empty?
%table.table
%thead
%tr
%th #
%th E-Mail
%th Date registered
%th Status
- recent_users.each_with_index do |user, index|
%tbody
.table-responsive
%table.table
%thead
%tr
%td #{index}
%td #{user.email}
%td #{user.created_at.strftime('%m/%d/%Y')}
%td
- if user.confirmed?
%span.label.label-success Confirmed
-else
%span.label.label-danger Unconfirmed
%th #
%th E-Mail
%th Date registered
%th Status
- recent_users.each_with_index do |user, index|
%tbody
%tr
%td #{index}
%td #{user.email}
%td #{user.created_at.strftime('%m/%d/%Y')}
%td
- if user.confirmed?
%span.label.label-success Confirmed
-else
%span.label.label-danger Unconfirmed
- else
%h5.text-warning.text-center
No sign ups!

View file

@ -1,20 +0,0 @@
.well#registrations
.row
.text-center
%h4 Conference registrations over time
.row
.registrationsChart{"data-chart"=>"#{registrations.to_json}", "data-conferences"=>"#{conferences.to_json}", "data-weeks"=>"#{registration_weeks.to_json}"}
%canvas.line_chart#registrationsChart{"data-name"=>"registrations"}
.row
.text-center
weeks
.row
.conferenceCheckboxes#registrationsCheckboxes
- conferences.each do |conference|
%div
%span{"style"=>"border-bottom: 3px solid #{conference.color};", "data-chart"=> "registrations"}
- if conference.pending?
%input{"type"=>"checkbox", "name"=>"#{conference.short_title}", "checked"=>"checked"}
- else
%input{"type"=>"checkbox", "name"=>"#{conference.short_title}"}
#{conference.short_title}

View file

@ -1,20 +0,0 @@
.well#submissions
.row
.text-center
%h4 Event submissions over time
.row
.submissionsChart{"data-chart"=>"#{submissions.to_json}", "data-conferences"=>"#{conferences.to_json}", "data-weeks"=>"#{cfp_weeks.to_json}"}
%canvas.line_chart#submissionsChart{"data-name"=>"submissions"}
.row
.text-center
weeks
.row
.conferenceCheckboxes#submissionsCheckboxes
- conferences.each do |conference|
%div
%span{"style"=>"border-bottom: 3px solid #{conference.color};", "data-chart"=> "submissions"}
- if conference.pending?
%input{"type"=>"checkbox", "name"=>"#{conference.short_title}", "checked"=>"checked"}
- else
%input{"type"=>"checkbox", "name"=>"#{conference.short_title}"}
#{conference.short_title}

View file

@ -1,21 +0,0 @@
.col-sm-4
.dashbox.well.well-sm.text-center
.icon
%i.glyphicon.glyphicon-user
.text
%label.text-muted total user: #{@total_user}
%label.text-muted new user: #{@new_user}
.col-sm-4
.dashbox.well.well-sm.text-center
.icon
%i.glyphicon.glyphicon-star
.text
%label.text-muted total registrations: #{@total_reg}
%label.text-muted new registrations: #{@new_reg}
.col-sm-4
.dashbox.well.well-sm.text-center
.icon
%i.glyphicon.glyphicon-comment
.text
%label.text-muted total submissions: #{@total_submissions}
%label.text-muted new submissions: #{@new_submissions}

View file

@ -1,17 +1,18 @@
.row
%h3
Top Submitter
- if @top_submitter && !@top_submitter.empty?
- @top_submitter.each do |key, value|
.row.top-submitter
.col-md-2
= image_tag(key.gravatar_url(size: '25'), title: "Yo #{key.public_name}!", :alt => '', 'class'=>'img-circle img-responsive text-center')
.col-md-10
%h4
#{key}
%div
%small
#{pluralize(value, 'submission')}
- else
%h4.text-warning
No submissions!
.col-md-12
%h3
Top Submitter
- if @top_submitter && !@top_submitter.empty?
- @top_submitter.each do |key, value|
.row.top-submitter
.col-md-2
= image_tag(key.gravatar_url(size: '25'), title: "Yo #{key.public_name}!", :alt => '', 'class'=>'img-circle img-responsive text-center')
.col-md-10
%h4
#{key}
%div
%small
#{pluralize(value, 'submission')}
- else
%h4.text-warning
No submissions!

View file

@ -1,8 +0,0 @@
.well
.text-center
%h4 User distribution
%canvas.doughnut_chart{"data-chart"=>user_distribution.to_json}
.row
- if user_distribution
- user_distribution.each do |key, value|
%span{"style"=>"border-bottom: 3px solid #{value['color']}"} #{key}: #{value['value']}

View file

@ -1,46 +1,70 @@
.row
= render partial: 'top_boxes', locals: { total_user: @total_user, new_user: @new_user, active_user: @active_user,
total_reg: @total_reg, new_reg: @new_reg, submissions_count: @submissions_count }
.row
.col-sm-4
.dashbox.text-center
.icon
%i.glyphicon.glyphicon-user
.text
%label.text-muted total user: #{@total_user}
%label.text-muted new user: #{@new_user}
.col-sm-4
.dashbox.text-center
.icon
%i.glyphicon.glyphicon-star
.text
%label.text-muted total registrations: #{@total_reg}
%label.text-muted new registrations: #{@new_reg}
.col-sm-4
.dashbox.text-center
.icon
%i.glyphicon.glyphicon-comment
.text
%label.text-muted total submissions: #{@total_submissions}
%label.text-muted new submissions: #{@new_submissions}
.row#registrations
.col-md-8
= render partial: 'submissions', locals: { conferences: @conferences, submissions: @submissions,
cfp_weeks: @cfp_weeks }
= render partial: 'line_chart', locals: { title: 'Registrations over time',
name: 'registrations',
conferences: @conferences,
active_conferences: @active_conferences,
deactive_conferences: @deactive_conferences,
y: @registrations,
x: @registration_weeks,
unit: 'weeks' }
.col-md-4
= render partial: 'event_distribution', locals: { event_distribution: @event_distribution }
= render partial: 'doughnut_chart', locals: { title: 'Events',data: @event_distribution }
.row#submissions
.col-md-8
= render partial: 'line_chart', locals: { title: 'Submissions over time',
name: 'submissions',
conferences: @conferences,
active_conferences: @active_conferences,
deactive_conferences: @deactive_conferences,
y: @submissions,
x: @cfp_weeks,
unit: 'weeks' }
.col-md-4
= render partial: 'doughnut_chart', locals: { title: 'User',data: @user_distribution }
.row
.col-md-8
= render partial: 'registrations', locals: { conferences: @conferences, registrations: @registrations,
registration_weeks: @registration_weeks }
.col-md-4
= render partial: 'user_distribution', locals: { user_distribution: @user_distribution }
.col-md-8
.row
%ul.nav.nav-tabs#recentTable
%li.active
%a{:href=>"#recent_user", "data-toggle"=>"tab"}
%span.glyphicon.glyphicon-user
Recent Users
%li
%a{:href=>"#recent_reg", "data-toggle"=>"tab"}
%span.glyphicon.glyphicon-star
Recent Registrations
%li
%a{:href=>"#recent_submissions", "data-toggle"=>"tab"}
%span.glyphicon.glyphicon-comment
Recent Submissions
.tab-content
.tab-pane.active#recent_user
= render partial: 'recent_users', locals: {recent_users: @recent_users}
.tab-pane#recent_reg
= render partial: 'recent_registrations', locals: {recent_registrations: @recent_registrations}
.tab-pane#recent_submissions
= render partial: 'recent_submissions', locals: {recent_events: @recent_events}
%ul.nav.nav-tabs#recentTable
%li.active
%a{:href=>"#recent_user", "data-toggle"=>"tab"}
%span.glyphicon.glyphicon-user
Recent Users
%li
%a{:href=>"#recent_reg", "data-toggle"=>"tab"}
%span.glyphicon.glyphicon-star
Recent Registrations
%li
%a{:href=>"#recent_submissions", "data-toggle"=>"tab"}
%span.glyphicon.glyphicon-comment
Recent Submissions
.tab-content
.tab-pane.active#recent_user
= render partial: 'recent_users', locals: {recent_users: @recent_users}
.tab-pane#recent_reg
= render partial: 'recent_registrations', locals: {recent_registrations: @recent_registrations}
.tab-pane#recent_submissions
= render partial: 'recent_submissions', locals: {recent_events: @recent_events}
.col-md-4
= render partial: 'top_submitter', locals: {top_submitter: @top_submitter}
:javascript
$('#recentTable a').click(function (e) {
e.preventDefault();
$(this).tab('show');
})

View file

@ -3,9 +3,103 @@
Dashboard for #{@conference.title}
%hr
.row
.col-md-4
= render partial: 'todo_list', locals: { conference_progress: @conference_progress }
.col-sm-4
.dashbox.text-center
.icon
%i.glyphicon.glyphicon-star
.text
%label.text-muted total registrations: #{@total_reg}
%label.text-muted new registrations: #{@new_reg}
.col-sm-4
.dashbox.text-center
.icon
%i.glyphicon.glyphicon-comment
.text
%label.text-muted total submissions: #{@total_submissions}
%label.text-muted new submissions: #{@new_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
.row
.col-md-12
.row
.col-md-8
.row#registrations
.col-md-12
= render partial: 'line_chart', locals: { title: 'Registrations over time',
name: 'registrations',
conferences: [@conference],
active_conferences: [@conference],
deactive_conferences: [],
y: @registrations,
x: @registration_weeks,
unit: 'weeks' }
.row#submissions
.col-md-12
= render partial: 'line_chart', locals: { title: 'Submissions over time',
name: 'submissions',
conferences: @submissions,
active_conferences: @submissions,
deactive_conferences: [],
y: @submissions_data,
x: @cfp_weeks,
unit: 'weeks' }
.col-md-4
= render partial: 'todo_list', locals: { conference_progress: @conference_progress }
.row
.col-md-12#doughnut
%ul.nav.nav-tabs#doughnut_tabs
%li.active
%a{:href=>"#distribution_all", "data-toggle"=>"tab"}
%span.glyphicon.glyphicon-star
All
%li
%a{:href=>"#distribution_confirmed", "data-toggle"=>"tab"}
%span.glyphicon.glyphicon-comment
Confirmed
.tab-content
.tab-pane.active#distribution_all
.row
.col-md-4
= render partial: 'doughnut_chart', locals: {title: 'Event types', data: @event_type_distribution}
.col-md-4
= render partial: 'doughnut_chart', locals: {title: 'Difficulty levels', data: @difficulty_levels_distribution}
.col-md-4
= render partial: 'doughnut_chart', locals: {title: 'Tracks', data: @tracks_distribution}
.tab-pane#distribution_confirmed
.row
.col-md-4
= render partial: 'doughnut_chart', locals: {title: 'Event types', data: @event_type_distribution_confirmed}
.col-md-4
= render partial: 'doughnut_chart', locals: {title: 'Difficulty levels', data: @difficulty_levels_distribution_confirmed}
.col-md-4
= render partial: 'doughnut_chart', locals: {title: 'Tracks', data: @tracks_distribution_confirmed}
.row
.col-md-8
%ul.nav.nav-tabs#recentTable
%li.active
%a{:href=>"#recent_reg", "data-toggle"=>"tab"}
%span.glyphicon.glyphicon-star
Recent Registrations
%li
%a{:href=>"#recent_submissions", "data-toggle"=>"tab"}
%span.glyphicon.glyphicon-comment
Recent Submissions
.tab-content
.tab-pane.active#recent_reg
= render partial: 'recent_registrations', locals: {recent_registrations: @recent_registrations}
.tab-pane#recent_submissions
= render partial: 'recent_submissions', locals: {recent_events: @recent_events}
.col-md-4
= render partial: 'top_submitter', locals: {top_submitter: @top_submitter}
.col-md-4
= render partial: 'event_distribution', locals: { event_distribution: @event_distribution }
:javascript
$('#recentTable a').click(function (e) {
e.preventDefault();
$(this).tab('show');
})