Tabify the statistics page
This commit is contained in:
parent
83b20dfc58
commit
d96f7d5332
2 changed files with 142 additions and 152 deletions
|
|
@ -1,157 +1,147 @@
|
||||||
.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
|
%h3
|
||||||
- if @supporter_levels.count > 0
|
Registered
|
||||||
|
- if @registered
|
||||||
|
= "(#{@registered})"
|
||||||
|
- if @attendees
|
||||||
|
= " - Attendees (#{@attendees})"
|
||||||
%table.table.table-bordered.table-striped
|
%table.table.table-bordered.table-striped
|
||||||
%thead
|
%thead
|
||||||
%th Support Level
|
%th General Stats
|
||||||
%th #
|
%th #
|
||||||
%th %
|
%tr
|
||||||
- @supporter_levels.each do |level|
|
%td Registered attended
|
||||||
- reg_support = reg_support(level)
|
%td= @registered_attended
|
||||||
- if reg_support.count > 0
|
%tr
|
||||||
%tr
|
%td Registered not attended
|
||||||
%td= level.title
|
%td= @registered_not_attended
|
||||||
|
%tr
|
||||||
|
%td Attended with partner
|
||||||
|
%td= @attended_with_partner
|
||||||
|
%tr
|
||||||
|
%td Registred to attend with partner
|
||||||
|
%td= @registered_with_partner
|
||||||
|
%tr
|
||||||
|
%td Handicapped Access for:
|
||||||
|
%td= @conference.registrations.where("handicapped_access_required = ?", true).count
|
||||||
|
%tr
|
||||||
|
%td Staying at suggested hotel:
|
||||||
|
%td= @conference.registrations.where("using_affiliated_lodging = ?", true).count
|
||||||
|
- if @conference.use_dietary_choices == true
|
||||||
|
- diet_choices = []
|
||||||
|
- @conference.dietary_choices.each do |d|
|
||||||
|
- count = @conference.registrations.where("dietary_choice_id = ?", d.id).count
|
||||||
|
- if count > 0
|
||||||
|
- diet_choices << [d.title, count]
|
||||||
|
- if diet_choices.any?
|
||||||
|
.span4
|
||||||
|
%table.table.table-bordered.table-striped
|
||||||
|
%thead
|
||||||
|
%th Dietary Choice
|
||||||
|
%th #
|
||||||
|
%th Percentage
|
||||||
|
- diet_choices.each do |d|
|
||||||
|
%tr
|
||||||
|
%td= d[0]
|
||||||
|
%td= d[1]
|
||||||
|
%td
|
||||||
|
= "#{d[1] * 100 / @registered}% of registered"
|
||||||
|
- if @attendees
|
||||||
|
%br
|
||||||
|
= "#{d[1] * 100 / @attendees}% of attendees"
|
||||||
|
- if @conference.social_events.count > 0
|
||||||
|
- social_events = []
|
||||||
|
- @conference.social_events.each do |social_event|
|
||||||
|
- count = @conference.registrations.joins(:social_events).where("registrations_social_events.social_event_id = ?", social_event.id).count
|
||||||
|
- if count > 0
|
||||||
|
- social_events << [social_event.title, count]
|
||||||
|
- if social_events.any?
|
||||||
|
.span4
|
||||||
|
%table.table.table-bordered.table-striped
|
||||||
|
%thead
|
||||||
|
%th Social Event
|
||||||
|
%th #
|
||||||
|
- social_events.each do |s|
|
||||||
|
%tr
|
||||||
|
%td= s[0]
|
||||||
|
%td= s[1]
|
||||||
|
.tab-pane#speakers
|
||||||
|
- count =0
|
||||||
|
%h3
|
||||||
|
Speakers (#{@speakers.length})
|
||||||
|
%br
|
||||||
|
|
||||||
|
%table.table.table-striped.table-bordered.table-hover#events
|
||||||
|
%thead
|
||||||
|
%th
|
||||||
|
ID
|
||||||
|
- (@speaker_fields_person + @speaker_fields_reg).each do |field|
|
||||||
|
%th
|
||||||
|
= field.capitalize
|
||||||
|
|
||||||
|
- @speakers.each do |speaker|
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
= count +=1
|
||||||
|
|
||||||
|
- @speaker_fields_person.each do |field|
|
||||||
%td
|
%td
|
||||||
= reg_support.count
|
- if field == 'name'
|
||||||
%td
|
= speaker.first_name
|
||||||
= "#{reg_support.count * 100 / @registered}% of registered"
|
= speaker.last_name
|
||||||
- if @attendees
|
|
||||||
%br
|
%br
|
||||||
= "#{reg_support.count * 100 / @attendees}% of attendees"
|
(#{speaker.public_name})
|
||||||
|
- else
|
||||||
|
= speaker.send(field.to_sym)
|
||||||
#registrations-stats
|
- @speaker_fields_reg.each do |field|
|
||||||
%h3
|
%td
|
||||||
Registered
|
- reg = speaker_reg(speaker)
|
||||||
- if @registered
|
- if !reg.nil?
|
||||||
= "(#{@registered})"
|
- if field == "diet"
|
||||||
- if @attendees
|
- if reg.dietary_choice_id
|
||||||
= " - Attendees (#{@attendees})"
|
= speaker_diet(reg).title
|
||||||
.row-fluid
|
%br
|
||||||
.span3
|
= reg.other_dietary_choice
|
||||||
%table.table.table-bordered.table-striped
|
- elsif field == 'arrival' || field == 'departure'
|
||||||
%thead
|
= getdatetime(reg, field)
|
||||||
%th General Stats
|
- else
|
||||||
%th #
|
= reg.send(field.to_sym)
|
||||||
%tr
|
.tab-pane#tickets
|
||||||
%td Registered attended
|
- if @supporter_levels.count > 0
|
||||||
%td= @registered_attended
|
|
||||||
%tr
|
|
||||||
%td Registered not attended
|
|
||||||
%td= @registered_not_attended
|
|
||||||
%tr
|
|
||||||
%td Attended with partner
|
|
||||||
%td= @attended_with_partner
|
|
||||||
%tr
|
|
||||||
%td Registred to attend with partner
|
|
||||||
%td= @registered_with_partner
|
|
||||||
%tr
|
|
||||||
%td Handicapped Access for:
|
|
||||||
%td= @conference.registrations.where("handicapped_access_required = ?", true).count
|
|
||||||
%tr
|
|
||||||
%td Staying at suggested hotel:
|
|
||||||
%td= @conference.registrations.where("using_affiliated_lodging = ?", true).count
|
|
||||||
|
|
||||||
- if @conference.use_dietary_choices == true
|
|
||||||
- diet_choices = []
|
|
||||||
- @conference.dietary_choices.each do |d|
|
|
||||||
- count = @conference.registrations.where("dietary_choice_id = ?", d.id).count
|
|
||||||
- if count > 0
|
|
||||||
- diet_choices << [d.title, count]
|
|
||||||
- if diet_choices.any?
|
|
||||||
.span4
|
|
||||||
%table.table.table-bordered.table-striped
|
%table.table.table-bordered.table-striped
|
||||||
%thead
|
%thead
|
||||||
%th Dietary Choice
|
%th Support Level
|
||||||
%th #
|
%th #
|
||||||
%th Percentage
|
%th %
|
||||||
- diet_choices.each do |d|
|
- @supporter_levels.each do |level|
|
||||||
%tr
|
- reg_support = reg_support(level)
|
||||||
%td= d[0]
|
- if reg_support.count > 0
|
||||||
%td= d[1]
|
%tr
|
||||||
%td
|
%td= level.title
|
||||||
= "#{d[1] * 100 / @registered}% of registered"
|
%td
|
||||||
- if @attendees
|
= reg_support.count
|
||||||
%br
|
%td
|
||||||
= "#{d[1] * 100 / @attendees}% of attendees"
|
= "#{reg_support.count * 100 / @registered}% of registered"
|
||||||
|
- if @attendees
|
||||||
- if @conference.social_events.count > 0
|
%br
|
||||||
- social_events = []
|
= "#{reg_support.count * 100 / @attendees}% of attendees"
|
||||||
- @conference.social_events.each do |social_event|
|
- else
|
||||||
- count = @conference.registrations.joins(:social_events).where("registrations_social_events.social_event_id = ?", social_event.id).count
|
%p
|
||||||
- if count > 0
|
No tickets sold yet
|
||||||
- social_events << [social_event.title, count]
|
|
||||||
- if social_events.any?
|
|
||||||
.span4
|
|
||||||
%table.table.table-bordered.table-striped
|
|
||||||
%thead
|
|
||||||
%th Social Event
|
|
||||||
%th #
|
|
||||||
- social_events.each do |s|
|
|
||||||
%tr
|
|
||||||
%td= s[0]
|
|
||||||
%td= s[1]
|
|
||||||
|
|
||||||
#speakers-stats
|
|
||||||
- count =0
|
|
||||||
.row-fluid
|
|
||||||
%h3
|
|
||||||
Speakers (#{@speakers.length})
|
|
||||||
%br
|
|
||||||
|
|
||||||
%table.table.table-striped.table-bordered.table-hover#events
|
|
||||||
%thead
|
|
||||||
%th
|
|
||||||
ID
|
|
||||||
- (@speaker_fields_person + @speaker_fields_reg).each do |field|
|
|
||||||
%th
|
|
||||||
= field.capitalize
|
|
||||||
|
|
||||||
- @speakers.each do |speaker|
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
= count +=1
|
|
||||||
|
|
||||||
- @speaker_fields_person.each do |field|
|
|
||||||
%td
|
|
||||||
- if field == 'name'
|
|
||||||
= speaker.first_name
|
|
||||||
= speaker.last_name
|
|
||||||
%br
|
|
||||||
(#{speaker.public_name})
|
|
||||||
- else
|
|
||||||
= speaker.send(field.to_sym)
|
|
||||||
- @speaker_fields_reg.each do |field|
|
|
||||||
%td
|
|
||||||
- reg = speaker_reg(speaker)
|
|
||||||
- if !reg.nil?
|
|
||||||
- if field == "diet"
|
|
||||||
- if reg.dietary_choice_id
|
|
||||||
= speaker_diet(reg).title
|
|
||||||
%br
|
|
||||||
= reg.other_dietary_choice
|
|
||||||
- elsif field == 'arrival' || field == 'departure'
|
|
||||||
= getdatetime(reg, field)
|
|
||||||
- else
|
|
||||||
= reg.send(field.to_sym)
|
|
||||||
|
|
||||||
: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();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
@ -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'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue