Registrations dashbox eliminated from registrations

This commit is contained in:
Ana 2016-06-20 16:02:05 +02:00
parent 62c3ee1631
commit 1d7f3207a6
5 changed files with 205 additions and 209 deletions

View file

@ -57,3 +57,7 @@
display: inline-block; display: inline-block;
padding: 0px 10px 0px 0px; padding: 0px 10px 0px 0px;
} }
.margin-event-table{
margin-top: 40px !important;
}

View file

@ -10,7 +10,6 @@ module Admin
@registrations = @conference.registrations.includes(:user).order('registrations.created_at ASC') @registrations = @conference.registrations.includes(:user).order('registrations.created_at ASC')
@attended = @conference.registrations.where('attended = ?', true).count @attended = @conference.registrations.where('attended = ?', true).count
@new_reg = @conference.registrations.where('created_at > ?', current_user.last_sign_in_at).count
@registration_distribution = @conference.registration_distribution @registration_distribution = @conference.registration_distribution
@affiliation_distribution = @conference.affiliation_distribution @affiliation_distribution = @conference.affiliation_distribution
end end

View file

@ -14,161 +14,162 @@
= render partial: 'admin/conference/doughnut_chart', locals: {title: 'Confirmed events scheduled', data: @scheduled_event_distribution} = render partial: 'admin/conference/doughnut_chart', locals: {title: 'Confirmed events scheduled', data: @scheduled_event_distribution}
.col-md-4 .col-md-4
= render partial: 'admin/conference/doughnut_chart', locals: {title: 'Tracks of confirmed events', data: @tracks_distribution_confirmed} = render partial: 'admin/conference/doughnut_chart', locals: {title: 'Tracks of confirmed events', data: @tracks_distribution_confirmed}
.row{ style: "margin-top: 40px;"} .row
.col-md-12 .col-md-12
%table.table.table-striped.table-bordered.table-hover.datatable %div.margin-event-table
%thead %table.table.table-striped.table-bordered.table-hover.datatable
%th %thead
%b ID
%th
%b Title
- if @program.rating_enabled?
%th %th
%b Rating %b ID
%th
%b Submitter
%th
%b Speaker
-if @program.languages.present?
%th %th
%b Language %b Title
%th
%b Requires Registration
%th
%b Highlight
%th
%b Type
%th
%b Track
%th
%b Difficulty
%th
%b State
- @events.each do |event|
%tr
%td
= event.id
%td
=link_to event.title, admin_conference_program_event_path(@conference.short_title, event)
- if @program.rating_enabled? - if @program.rating_enabled?
%td.col-md-1{'data-order' => "#{event.average_rating}"} %th
- if event.average_rating.to_f > 0 %b Rating
#{event.average_rating}/#{@program.rating} %th
%br %b Submitter
#{pluralize(event.voters.length, 'voter')} %th
%br %b Speaker
- @program.rating.times do |counter|
- if event.average_rating.to_f.round == counter+1
= label_tag "label_rating", "", :class => "avgrating", :avgrate => true
= javascript_tag "$('label[avgrate=true]').prevAll().andSelf().addClass('bright');"
- else
= label_tag "label_rating", "", :class => "avgrating"
%br
- voted = event.voted?(event, current_user)
- if voted
%span.label.label-success
Your rating: #{voted.rating}
- else
%span.label.label-danger
Not rated
- else
0/#{@program.rating}
%br
- if event.submitter && event.submitter.registrations && event.submitter.registrations.count < 1
- bgcolor="#F7819F"
- else
- bgcolor=""
%td{:style=>"background-color: #{bgcolor}"}
- if !event.submitter.nil?
=link_to event.submitter.name, admin_user_path(event.submitter)
- if event.submitter.registrations.count < 1
(Unregistered!)
- else
Unknown submitter
%td
- if speaker = event.speakers.first
= link_to speaker.name, admin_user_path(speaker)
- else
Unknown speaker
-if @program.languages.present? -if @program.languages.present?
%th
%b Language
%th
%b Requires Registration
%th
%b Highlight
%th
%b Type
%th
%b Track
%th
%b Difficulty
%th
%b State
- @events.each do |event|
%tr
%td %td
= event.language = event.id
%td
=link_to event.title, admin_conference_program_event_path(@conference.short_title, event)
%td.text-center{'data-order' => "#{event.require_registration}"} - if @program.rating_enabled?
= check_box_tag @conference.short_title, event.id, event.require_registration, %td.col-md-1{'data-order' => "#{event.average_rating}"}
method: :patch, url: "/admin/conference/#{@conference.short_title}/program/events/#{event.id}?event[require_registration]=", - if event.average_rating.to_f > 0
class: 'switch-checkbox', data: { size: 'small', #{event.average_rating}/#{@program.rating}
off_color: 'warning', %br
on_text: 'Yes', #{pluralize(event.voters.length, 'voter')}
off_text: 'No' } %br
- if event.require_registration - @program.rating.times do |counter|
%br - if event.average_rating.to_f.round == counter+1
= link_to registered_text(event), registrations_admin_conference_program_event_path(@conference.short_title, event), class: 'btn btn-xs btn-default' = label_tag "label_rating", "", :class => "avgrating", :avgrate => true
= javascript_tag "$('label[avgrate=true]').prevAll().andSelf().addClass('bright');"
%td.text-center{'data-order' => "#{event.is_highlight}"} - else
= check_box_tag @conference.short_title, event.id, event.is_highlight, = label_tag "label_rating", "", :class => "avgrating"
method: :patch, url: "/admin/conference/#{@conference.short_title}/program/events/#{event.id}?event[is_highlight]=", %br
class: 'switch-checkbox', data: { size: 'small', - voted = event.voted?(event, current_user)
off_color: 'warning', - if voted
on_text: 'Yes', %span.label.label-success
off_text: 'No' } Your rating: #{voted.rating}
- else
%td %span.label.label-danger
.btn-group Not rated
%button{:type=>"button", :class=>"btn btn-link dropdown-toggle", "data-toggle"=>"dropdown"}
- if event.event_type.nil?
Event Type
- else - else
= event.event_type.title 0/#{@program.rating}
%span.caret %br
%ul.dropdown-menu
- @event_types.each do |type|
%li= link_to type.title,
admin_conference_program_event_path(@conference.short_title,
event,
event: { event_type_id: type.id }),
method: :patch
%td
.btn-group
%button{:type=>"button", :class=>"btn btn-link dropdown-toggle", "data-toggle"=>"dropdown"}
- if event.track.nil?
Track
- else
= event.track.name
%span.caret
%ul.dropdown-menu
- @tracks.each do |track|
%li= link_to track.name,
admin_conference_program_event_path(@conference.short_title,
event,
event: { track_id: track.id }),
method: :patch
%td
.btn-group
%button{:type=>"button", :class=>"btn btn-link dropdown-toggle", "data-toggle"=>"dropdown"}
- if event.difficulty_level.nil?
Difficulty
- else
= event.difficulty_level.title
%span.caret
%ul.dropdown-menu
- @difficulty_levels.each do |difficulty_level|
%li= link_to difficulty_level.title,
admin_conference_program_event_path(@conference.short_title,
event,
event: { difficulty_level_id: difficulty_level.id }),
method: :patch
%td - if event.submitter && event.submitter.registrations && event.submitter.registrations.count < 1
- if event.state == "withdrawn" - bgcolor="#F7819F"
Withdrawn
- else - else
- bgcolor=""
%td{:style=>"background-color: #{bgcolor}"}
- if !event.submitter.nil?
=link_to event.submitter.name, admin_user_path(event.submitter)
- if event.submitter.registrations.count < 1
(Unregistered!)
- else
Unknown submitter
%td
- if speaker = event.speakers.first
= link_to speaker.name, admin_user_path(speaker)
- else
Unknown speaker
-if @program.languages.present?
%td
= event.language
%td.text-center{'data-order' => "#{event.require_registration}"}
= check_box_tag @conference.short_title, event.id, event.require_registration,
method: :patch, url: "/admin/conference/#{@conference.short_title}/program/events/#{event.id}?event[require_registration]=",
class: 'switch-checkbox', data: { size: 'small',
off_color: 'warning',
on_text: 'Yes',
off_text: 'No' }
- if event.require_registration
%br
= link_to registered_text(event), registrations_admin_conference_program_event_path(@conference.short_title, event), class: 'btn btn-xs btn-default'
%td.text-center{'data-order' => "#{event.is_highlight}"}
= check_box_tag @conference.short_title, event.id, event.is_highlight,
method: :patch, url: "/admin/conference/#{@conference.short_title}/program/events/#{event.id}?event[is_highlight]=",
class: 'switch-checkbox', data: { size: 'small',
off_color: 'warning',
on_text: 'Yes',
off_text: 'No' }
%td
.btn-group .btn-group
%button{:type=>"button", :class=>"btn btn-link dropdown-toggle", "data-toggle"=>"dropdown"} %button{:type=>"button", :class=>"btn btn-link dropdown-toggle", "data-toggle"=>"dropdown"}
= event.state.humanize - if event.event_type.nil?
Event Type
- else
= event.event_type.title
%span.caret %span.caret
%ul.dropdown-menu{:role=>"menu"} %ul.dropdown-menu
= render 'change_state_dropdown', event: event - @event_types.each do |type|
%li= link_to type.title,
admin_conference_program_event_path(@conference.short_title,
event,
event: { event_type_id: type.id }),
method: :patch
%td
.btn-group
%button{:type=>"button", :class=>"btn btn-link dropdown-toggle", "data-toggle"=>"dropdown"}
- if event.track.nil?
Track
- else
= event.track.name
%span.caret
%ul.dropdown-menu
- @tracks.each do |track|
%li= link_to track.name,
admin_conference_program_event_path(@conference.short_title,
event,
event: { track_id: track.id }),
method: :patch
%td
.btn-group
%button{:type=>"button", :class=>"btn btn-link dropdown-toggle", "data-toggle"=>"dropdown"}
- if event.difficulty_level.nil?
Difficulty
- else
= event.difficulty_level.title
%span.caret
%ul.dropdown-menu
- @difficulty_levels.each do |difficulty_level|
%li= link_to difficulty_level.title,
admin_conference_program_event_path(@conference.short_title,
event,
event: { difficulty_level_id: difficulty_level.id }),
method: :patch
%td
- if event.state == "withdrawn"
Withdrawn
- else
.btn-group
%button{:type=>"button", :class=>"btn btn-link dropdown-toggle", "data-toggle"=>"dropdown"}
= event.state.humanize
%span.caret
%ul.dropdown-menu{:role=>"menu"}
= render 'change_state_dropdown', event: event

View file

@ -11,19 +11,6 @@
= link_to 'Export XLS', {format: :xlsx}, class: 'btn btn-success' = link_to 'Export XLS', {format: :xlsx}, class: 'btn btn-success'
%p.text-muted %p.text-muted
All the people who registered to your event All the people who registered to your event
.row
.col-sm-4.col-xs-4
.dashbox.text-center
%span.fa.fa-user.fa-lg
%span.fa.fa-lg
= @registrations.length
%p
%small
#{'Registration'.pluralize(@registrations.length)}
- if @new_reg
%span.label.label-success{title: "+#{@new_reg} since you last logged in!"}
+
= @new_reg
.col-md-4 .col-md-4
= render partial: 'admin/conference/doughnut_chart', locals: {title: 'Affiliation', data: @affiliation_distribution} = render partial: 'admin/conference/doughnut_chart', locals: {title: 'Affiliation', data: @affiliation_distribution}
- unless @conference.pending? - unless @conference.pending?
@ -31,57 +18,58 @@
= render partial: 'admin/conference/doughnut_chart', locals: {title: 'Attended registrations', data: @registration_distribution} = render partial: 'admin/conference/doughnut_chart', locals: {title: 'Attended registrations', data: @registration_distribution}
.row .row
.col-md-12 .col-md-12
%table.table.table-hover.datatable#registrations %div.margin-event-table
%thead %table.table.table-hover.datatable#registrations
%tr %thead
%th ID#
%th Name
%th E-Mail
%th Arrival
%th Departure
- if @conference.questions.any?
%th Questions
%th Actions
%tbody
- @registrations.each_with_index do |registration, index|
%tr %tr
%td %th ID#
= registration.id %th Name
%td %th E-Mail
= registration.name.present? ? registration.name : registration.username %th Arrival
%br %th Departure
- registration.user.roles.where(resource: @conference).each do |role| - if @conference.questions.any?
%span.label.label-info %th Questions
= role.name.titleize %th Actions
%td %tbody
= registration.email - @registrations.each_with_index do |registration, index|
%td %tr
- if registration.arrival
= registration.arrival.strftime('%d %b %H:%M')
- else
n/a
%td
- if registration.departure
= registration.departure.strftime('%d %b %H:%M')
- else
n/a
-if @conference.questions.any?
%td %td
= link_to 'Questions','#', class: 'btn btn-success question-btn', 'data-id' => index, 'data-name' => registration.name = registration.id
%td %td
= check_box_tag "#{@conference.short_title}_#{registration.id}", registration.id, registration.attended, = registration.name.present? ? registration.name : registration.username
class: 'switch-checkbox', method: :patch, %br
url: toggle_attendance_admin_conference_registration_path(@conference.short_title, id: registration.id)+"?attended=", - registration.user.roles.where(resource: @conference).each do |role|
data: { size: 'small', %span.label.label-info
on_color: 'success', = role.name.titleize
off_color: 'warning', %td
on_text: 'Present', = registration.email
off_text: 'Absent' } %td
.btn-group - if registration.arrival
= link_to 'Edit', edit_admin_conference_registration_path(@conference.short_title, id: registration), = registration.arrival.strftime('%d %b %H:%M')
method: :get, class: 'btn btn-primary' - else
= link_to 'Delete', admin_conference_registration_path(@conference.short_title, registration), n/a
method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete the Registration for #{registration.name}?" } %td
- if registration.departure
= registration.departure.strftime('%d %b %H:%M')
- else
n/a
-if @conference.questions.any?
%td
= link_to 'Questions','#', class: 'btn btn-success question-btn', 'data-id' => index, 'data-name' => registration.name
%td
= check_box_tag "#{@conference.short_title}_#{registration.id}", registration.id, registration.attended,
class: 'switch-checkbox', method: :patch,
url: toggle_attendance_admin_conference_registration_path(@conference.short_title, id: registration.id)+"?attended=",
data: { size: 'small',
on_color: 'success',
off_color: 'warning',
on_text: 'Present',
off_text: 'Absent' }
.btn-group
= link_to 'Edit', edit_admin_conference_registration_path(@conference.short_title, id: registration),
method: :get, class: 'btn btn-primary'
= link_to 'Delete', admin_conference_registration_path(@conference.short_title, registration),
method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete the Registration for #{registration.name}?" }
- @registrations.each_with_index do |registration, index| - @registrations.each_with_index do |registration, index|
.questions{class: "question#{index}", style: 'display:none;'} .questions{class: "question#{index}", style: 'display:none;'}
= render partial: 'questions', locals: { registration: registration } = render partial: 'questions', locals: { registration: registration }

View file

@ -352,9 +352,13 @@ ActiveRecord::Schema.define(version: 20160427104236) do
t.boolean "include_registrations" t.boolean "include_registrations"
t.boolean "include_sponsors" t.boolean "include_sponsors"
t.boolean "include_lodgings" t.boolean "include_lodgings"
t.string "banner_photo_file_name"
t.string "banner_photo_content_type"
t.integer "banner_photo_file_size"
t.datetime "banner_photo_updated_at"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.boolean "include_cfp", default: false t.boolean "include_cfp", default: false
end end
create_table "sponsors", force: :cascade do |t| create_table "sponsors", force: :cascade do |t|