From 36b8088726c35943898161d3888d4d68582034f9 Mon Sep 17 00:00:00 2001 From: AEtherC0r3 Date: Tue, 9 May 2017 00:14:05 +0300 Subject: [PATCH] Replace submitter with speakers in reports#index Also, in events#show and proposals#index It is more relevant to check if the speakers have registered to the conference and filled their biographies than the submitter, because, there can be multiple speakers and the submitter isn't necessarily one of them And, remove admin/events/reports.html.haml, since, it isn't used anymore Fix #1477, fix #1479 --- app/models/event.rb | 4 +- app/views/admin/events/reports.html.haml | 127 ------------------ app/views/admin/events/show.html.haml | 13 +- app/views/admin/reports/_all_events.html.haml | 6 +- app/views/proposals/_tooltip.html.haml | 15 ++- 5 files changed, 24 insertions(+), 141 deletions(-) delete mode 100644 app/views/admin/events/reports.html.haml diff --git a/app/models/event.rb b/app/models/event.rb index 2bb526b9..0c786066 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -214,9 +214,9 @@ class Event < ActiveRecord::Base # Returns +Hash+ def progress_status { - registered: program.conference.user_registered?(submitter), + registered: speakers.all? { |speaker| program.conference.user_registered? speaker }, commercials: commercials.any?, - biography: !submitter.biography.blank?, + biographies: speakers.all? { |speaker| !speaker.biography.blank? }, subtitle: !subtitle.blank?, track: (!track.blank? unless program.tracks.empty?), difficulty_level: !difficulty_level.blank?, diff --git a/app/views/admin/events/reports.html.haml b/app/views/admin/events/reports.html.haml deleted file mode 100644 index 09659f06..00000000 --- a/app/views/admin/events/reports.html.haml +++ /dev/null @@ -1,127 +0,0 @@ -.tabbable - %ul.nav.nav-tabs - %li.active - = link_to 'All Events', '#all', 'data-toggle' => 'tab' - %li - %a{ href: '#missing-commercial', 'data-toggle' => 'tab' } - Events without Commercials - %span.label.label-danger{ style: 'border-radius: 1em;' } - = @events_missing_commercial.length - %li - %a{ href: '#requirements', 'data-toggle' => 'tab' } - Speaker Requirements - %span.label.label-success{ style: 'border-radius: 1em;' } - = @events_with_requirements.length - - %li - %a{ href: '#missing-speakers', 'data-toggle' => 'tab' } - Missing Speakers - %span.label.label-danger{ style: 'border-radius: 1em;' } - = @missing_event_speakers.length - - .tab-content - #all.tab-pane.active - .row - .col-md-12 - .page-header - %h1 - All Events - = "(#{@events.length})" - %p.text-muted - All submissions and the information that they are mssing - - .col-md-12 - %table.table.table-striped.table-bordered.table-hover.datatable - %thead - %th Title - %th Submitter Registered - %th Submitter Biography - %th Commercial - %th Subtitle - %th Difficulty Level - - if @program.tracks.any? - %th Track - %tbody - - @events.each do |event| - %tr - - progress_status = event.progress_status - %td - = link_to event.title, edit_admin_conference_program_event_path(@conference.short_title, event) - %br - .small (Presented by #{event.speaker_names}) - - - %w(registered biography commercials subtitle difficulty_level).each do |info| - %td{ 'data-order' => "#{progress_status[info]}" } - %span{ class: class_for_todo(progress_status[info]) } - %span{ class: [icon_for_todo(progress_status[info]), 'fa-lg'] } - - if @program.tracks.any? - %td{ 'data-order' => "#{progress_status['track']}" } - %span{ class: class_for_todo(progress_status['track']) } - %span{ class: [icon_for_todo(progress_status['track']), 'fa-lg'] } - - #missing-commercial.tab-pane - .row - .col-md-12 - .page-header - %h1 - Events without commercials - = "(#{@events_missing_commercial.length})" - %p.text-muted - All submissions that have no commercial - .col-md-12 - %table.table.table-striped.table-bordered.table-hover.datatable - %thead - %th Title - %th Speaker(s) - %tbody - - @events_missing_commercial.each do |event| - %tr - %td= link_to event.title, edit_admin_conference_program_event_path(@conference.short_title, event) - %td #{event.speaker_names} - - #requirements.tab-pane - .row - .col-md-12 - .page-header - %h1 - Requirements - = "(#{@events_with_requirements.length})" - %p.text-muted - All submissions where the speakers have special requirements - .col-md-12 - %table.table.table-striped.table-bordered.table-hover.datatable - %thead - %th Title - %th Speaker(s) - %th Requirements - %tbody - - @events_with_requirements.each do |event| - %tr - %td= link_to event.title, edit_admin_conference_program_event_path(@conference.short_title, event) - %td #{event.speaker_names} - %td= event.description - - #missing-speakers.tab-pane - .row - .col-md-12 - .page-header - %h1 - Missing Speakers - = "(#{@missing_event_speakers.length})" - %p.text-muted - All event speakers who haven't checked in - .col-md-12 - %table.table.table-striped.table-bordered.table-hover.datatable - %thead - %th Speaker Name - %th Registered? - %th Event - %th Start Time - %tbody - - @missing_event_speakers.each do |speaker| - %tr - %td= speaker.user.name - %td= @conference.user_registered?(speaker.user) ? 'Yes' : 'No' - %td= link_to speaker.event.title, edit_admin_conference_program_event_path(@conference.short_title, speaker.event) - - event_start_time = speaker.event.time - %td= event_start_time.present? ? event_start_time : '-' diff --git a/app/views/admin/events/show.html.haml b/app/views/admin/events/show.html.haml index 9969bbaf..0fe17c78 100644 --- a/app/views/admin/events/show.html.haml +++ b/app/views/admin/events/show.html.haml @@ -64,13 +64,18 @@ %br %table.table.table-hover %tr - %td= link_to 'Submitter must be registered to the conference', admin_conference_registrations_path(@event.program.conference.short_title) + %td= link_to "#{'Speaker'.pluralize(@event.speakers.count)} must be registered to the conference", admin_conference_registrations_path(@event.program.conference.short_title) %td{ 'class' => class_for_todo(progress_status['registered']) } %span{ 'class' => [icon_for_todo(progress_status['registered']), 'fa-lg'] } %tr - %td= link_to 'Fill out submitter biography', edit_admin_user_path(@event.submitter) - %td{ 'class' => class_for_todo(progress_status['biography']) } - %span{ 'class' => [icon_for_todo(progress_status['biography']), 'fa-lg'] } + %td + - if @event.speakers.count == 1 + = link_to 'Fill out speaker\'s biography', edit_admin_user_path(@event.speakers.first) + - else + Fill out speaker's biography: + = speaker_links(@event) + %td{ 'class' => class_for_todo(progress_status['biographies']) } + %span{ 'class' => [icon_for_todo(progress_status['biographies']), 'fa-lg'] } %tr %td= link_to 'Add a subtitle', edit_admin_conference_program_event_path(@event.program.conference.short_title, @event) %td{ 'class' => class_for_todo(progress_status['subtitle']) } diff --git a/app/views/admin/reports/_all_events.html.haml b/app/views/admin/reports/_all_events.html.haml index 7e76e927..98f405ea 100644 --- a/app/views/admin/reports/_all_events.html.haml +++ b/app/views/admin/reports/_all_events.html.haml @@ -12,8 +12,8 @@ %thead %th ID %th Title - %th Submitter Registered - %th Submitter Biography + %th Speakers Registered + %th Speakers Biographies %th Commercial %th Subtitle %th Difficulty Level @@ -32,7 +32,7 @@ = speaker_links(event) ) - - %w(registered biography commercials subtitle difficulty_level).each do |info| + - %w(registered biographies commercials subtitle difficulty_level).each do |info| %td{'data-order' => "#{progress_status[info]}"} %span{class: class_for_todo(progress_status[info])} %span{class: [icon_for_todo(progress_status[info]), 'fa-lg']} diff --git a/app/views/proposals/_tooltip.html.haml b/app/views/proposals/_tooltip.html.haml index 254b829b..168d2d26 100644 --- a/app/views/proposals/_tooltip.html.haml +++ b/app/views/proposals/_tooltip.html.haml @@ -3,12 +3,17 @@ %li{'class'=>class_for_todo(progress_status['registered'])} %span{'class'=>icon_for_todo(progress_status['registered'])} - if progress_status['registered'] - = link_to 'Register to the conference', edit_conference_conference_registration_path(event.program.conference.short_title) + Speaker(s) registered to the conference - else - = link_to 'Register to the conference', new_conference_conference_registration_path(event.program.conference.short_title) - %li{'class'=>class_for_todo(progress_status['biography'])} - %span{'class'=>icon_for_todo(progress_status['biography'])} - = link_to 'Fill out your biography', edit_user_path(event.submitter) + = link_to 'Speaker(s) not registered to the conference', new_conference_conference_registration_path(event.program.conference.short_title) + %li{'class'=>class_for_todo(progress_status['biographies'])} + %span{'class'=>icon_for_todo(progress_status['biographies'])} + - if progress_status['biographies'] + Speakers have filled out their biographies + - elsif current_user.biography.blank? && event.speakers.include?(current_user) + = link_to 'Fill out your biography', edit_user_path(current_user) + - else + Speakers' biographies missing %li{'class'=>class_for_todo(progress_status['subtitle'])} %span{'class'=>icon_for_todo(progress_status['subtitle'])} = link_to 'Add a subtitle', edit_conference_program_proposal_path(event.program.conference.short_title, event)