Implements recent items tabs and top submitter for dashboard

This commit is contained in:
Chrisbr 2014-06-04 16:11:33 +02:00
parent 25a1c116fd
commit 28293cb4c4
11 changed files with 186 additions and 1 deletions

View file

@ -0,0 +1,18 @@
- 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')}
- else
%h5.text-warning.text-center
No registrations!

View file

@ -0,0 +1,21 @@
- 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.public_state)} #{event.public_state}
- else
%h5.text-warning.text-center
No submissions!

View file

@ -0,0 +1,22 @@
- 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
%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

@ -0,0 +1,17 @@
.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!

View file

@ -10,4 +10,35 @@
.col-md-8
= render partial: 'registrations', locals: { conferences: @conferences, registrations: @registrations,
registration_weeks: @registration_weeks }
.col-md-4
.col-md-4
.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}
.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

@ -5,3 +5,5 @@
.row
.col-md-4
= render partial: 'todo_list', locals: { conference_progress: @conference_progress }
.col-md-4
= render partial: 'top_submitter', locals: {top_submitter: @top_submitter}