Tabify the statistics page

This commit is contained in:
Henne Vogelsang 2013-07-12 14:28:48 +02:00
parent 83b20dfc58
commit d96f7d5332
2 changed files with 142 additions and 152 deletions

View file

@ -1,42 +1,21 @@
.row-fluid .row-fluid
.span12 .span12
.pull-left{:style=>"margin-top:20px; margin-bottom:20px;"} %ul.nav.nav-tabs#myTab
= link_to "Registration Stats", "#", :id => "registrations-stats-link", :class => "btn btn-success" %li.active
= link_to "Speakers Stats", "#", :id => "speakers-stats-link", :class => "btn btn-success" %a{:href=>"#registrations", "data-toggle"=>"tab"} Regitrations
= link_to "Tickets Stats", "#", :id => "tickets-stats-link", :class => "btn btn-success" %li
%a{:href=>"#speakers", "data-toggle"=>"tab"} Speakers
%li
%a{:href=>"#tickets", "data-toggle"=>"tab"} Tickets
#tickets-stats .tab-content
.row-fluid .tab-pane.active#registrations
.span4
- if @supporter_levels.count > 0
%table.table.table-bordered.table-striped
%thead
%th Support Level
%th #
%th %
- @supporter_levels.each do |level|
- reg_support = reg_support(level)
- if reg_support.count > 0
%tr
%td= level.title
%td
= reg_support.count
%td
= "#{reg_support.count * 100 / @registered}% of registered"
- if @attendees
%br
= "#{reg_support.count * 100 / @attendees}% of attendees"
#registrations-stats
%h3 %h3
Registered Registered
- if @registered - if @registered
= "(#{@registered})" = "(#{@registered})"
- if @attendees - if @attendees
= " - Attendees (#{@attendees})" = " - Attendees (#{@attendees})"
.row-fluid
.span3
%table.table.table-bordered.table-striped %table.table.table-bordered.table-striped
%thead %thead
%th General Stats %th General Stats
@ -59,7 +38,6 @@
%tr %tr
%td Staying at suggested hotel: %td Staying at suggested hotel:
%td= @conference.registrations.where("using_affiliated_lodging = ?", true).count %td= @conference.registrations.where("using_affiliated_lodging = ?", true).count
- if @conference.use_dietary_choices == true - if @conference.use_dietary_choices == true
- diet_choices = [] - diet_choices = []
- @conference.dietary_choices.each do |d| - @conference.dietary_choices.each do |d|
@ -82,7 +60,6 @@
- if @attendees - if @attendees
%br %br
= "#{d[1] * 100 / @attendees}% of attendees" = "#{d[1] * 100 / @attendees}% of attendees"
- if @conference.social_events.count > 0 - if @conference.social_events.count > 0
- social_events = [] - social_events = []
- @conference.social_events.each do |social_event| - @conference.social_events.each do |social_event|
@ -99,10 +76,8 @@
%tr %tr
%td= s[0] %td= s[0]
%td= s[1] %td= s[1]
.tab-pane#speakers
#speakers-stats
- count =0 - count =0
.row-fluid
%h3 %h3
Speakers (#{@speakers.length}) Speakers (#{@speakers.length})
%br %br
@ -142,16 +117,31 @@
= getdatetime(reg, field) = getdatetime(reg, field)
- else - else
= reg.send(field.to_sym) = reg.send(field.to_sym)
.tab-pane#tickets
- if @supporter_levels.count > 0
%table.table.table-bordered.table-striped
%thead
%th Support Level
%th #
%th %
- @supporter_levels.each do |level|
- reg_support = reg_support(level)
- if reg_support.count > 0
%tr
%td= level.title
%td
= reg_support.count
%td
= "#{reg_support.count * 100 / @registered}% of registered"
- if @attendees
%br
= "#{reg_support.count * 100 / @attendees}% of attendees"
- else
%p
No tickets sold yet
:javascript :javascript
$(document).ready( function() { $('#myTab a').click(function (e) {
$("#registrations-stats-link").click(function() { e.preventDefault();
$("#registrations-stats").toggle(); $(this).tab('show');
}); })
$("#speakers-stats-link").click(function() {
$("#speakers-stats").toggle();
});
$("#tickets-stats-link").click(function() {
$("#tickets-stats").toggle();
});
});

View file

@ -56,16 +56,16 @@
- if current_page?(admin_conference_stats_path(@conference.short_title)) - if current_page?(admin_conference_stats_path(@conference.short_title))
%li.active %li.active
= link_to('#') do = link_to('#') do
%i.icon-comment %i.icon-tasks
Stats Statistics
- else - else
%li %li
= link_to(admin_conference_stats_path(@conference.short_title)) do = link_to(admin_conference_stats_path(@conference.short_title)) do
%i.icon-comment %i.icon-tasks
Stats Statistics
%li %li
= link_to(admin_conference_schedule_path(@conference.short_title), :target => "_blank") do = link_to(admin_conference_schedule_path(@conference.short_title), :target => "_blank") do
%i.icon-tasks %i.icon-calendar
Schedule Schedule
%ul.nav.hidden-desktop %ul.nav.hidden-desktop
= render 'layouts/user_menu' = render 'layouts/user_menu'