This commit is contained in:
Vidit 2018-03-14 21:34:28 +00:00 committed by GitHub
commit b2f9b6790a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 112 additions and 0 deletions

View file

@ -59,6 +59,11 @@ class ConferencesController < ApplicationController
end
end
def user_proposals
event_types = EventType.where(title: 'Talk').collect(&:id)
@events = Event.includes(program: :conference).where(event_type_id: event_types).order(created_at: :desc)
end
private
def conference_finder_conditions

View file

@ -113,6 +113,8 @@ class Ability
can [:edit, :update], Track do |track|
user == track.submitter && !(track.accepted? || track.confirmed?)
end
can :user_proposals, Conference
end
# Abilities for users with roles wandering around in non-admin views.

View file

@ -0,0 +1,30 @@
- progress_status = event.progress_status
%ul.list-unstyled
- if can? :create, conference.registrations.new
%li{'class'=>class_for_todo(progress_status['registered'])}
%span{'class'=>icon_for_todo(progress_status['registered'])}
- if progress_status['registered']
Speaker(s) registered to the conference
- else
= 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)
%li{'class'=>class_for_todo(progress_status['commercials'])}
%span{'class'=>icon_for_todo(progress_status['commercials'])}
= link_to 'Add a commercial', edit_conference_program_proposal_path(event.program.conference.short_title, event, anchor: 'commercials-content')
- unless progress_status['track'].nil?
%li{'class'=>class_for_todo(progress_status['track'])}
%span{'class'=>icon_for_todo(progress_status['track'])}
= link_to 'Add a track', edit_conference_program_proposal_path(event.program.conference.short_title, event)
%li{'class'=>class_for_todo(progress_status['difficulty_level'])}
%span{'class'=>icon_for_todo(progress_status['difficulty_level'])}
= link_to 'Add a difficulty level', edit_conference_program_proposal_path(event.program.conference.short_title, event)

View file

@ -0,0 +1,66 @@
.container
.row
.col-md-12.page-header
%h1
User Proposals
%table.table.table-striped#events{ style: "margin-top: 30px;" }
- @events.each do |event|
%tr
%td{ style: "padding:20px 8px 20px 8px;" }
%span{ title: event.state.humanize,
class: "fa #{event_status_icon(event)}" }
%td.col-md-7{ style: "padding:20px 8px 20px 8px;" }
= link_to event.title, conference_program_proposal_path(event.conference.short_title, event.id)
%br
%small.text-muted
= event.event_type.title
= "(#{event.event_type.length} min)"
= "in #{event.track.name}" if event.track
- if event.require_registration
%br
= link_to registered_text(event), registrations_conference_program_proposal_path(event.conference.short_title, event), class: 'btn btn-xs btn-danger'
%td.col-md-2{ style: "padding:20px 8px 20px 8px;" }
= link_to 'Complete your proposal', 'javascript: void(0)', "type"=>"button", "data-trigger"=>"focus", "data-toggle"=>"popover", "title"=>"Your todo list", "data-content"=>"#{render partial: 'tooltip', locals: { event: event,conference: event.conference } }"
- if can? :create, event.conference.registrations.new
- progress_percentage = event.calculate_progress
.progress
%div{ class: "progress-bar #{event_progress_color(progress_percentage)}",
style: "width:#{progress_percentage}%;" }
= event.progress_status.reject{ |_key, value| value || value.nil? }.length
left
- else
:ruby
progress_list = event.progress_status
progress_percentage = (100 * progress_list.values.count(true) / (progress_list.values.compact.count-1)).to_s
.progress
%div{ class: "progress-bar #{event_progress_color(progress_percentage)}", style: "width:#{progress_percentage}%;" }
= event.progress_status.reject{ |_key, value| value || value.nil? }.length-1
left
%td.col-md-3{ style: "padding:20px 0px 20px 0px;" }
.pull-right
- if event.transition_possible? :confirm
= link_to 'Confirm',
confirm_conference_program_proposal_path(event.conference.short_title, event),
method: :patch, class: 'btn btn-mini btn-success', id: "confirm_proposal_#{event.id}"
- if event.transition_possible? :withdraw
- if can? :update, event
= link_to 'Withdraw', withdraw_conference_program_proposal_path(event.conference.short_title, event.id), method: :patch,
data: { confirm: 'Are you sure you want to withdraw this proposal?' }, class: 'btn btn-mini btn-warning',
id: "delete_proposal_#{event.id}"
- else
= link_to 'Withdraw', withdraw_conference_program_proposal_path(event.conference.short_title, event.id), method: :patch,
data: { confirm: 'Are you sure you want to withdraw this proposal?' }, class: 'btn disabled btn-mini btn-warning',
id: "delete_proposal_#{event.id}"
- if event.state == 'withdrawn' || event.state == 'rejected'
= link_to 'Re-Submit',
restart_conference_program_proposal_path(event.conference.short_title, event.id),
method: :patch, class: 'btn btn-mini btn-success', id: "review_event_#{event.id}"
- if can? :update, event
= link_to 'Edit', edit_conference_program_proposal_path(event.conference.short_title,event.id), class: 'btn btn-default', id: "edit_proposal_#{event.id}"
- else
= link_to 'Edit', edit_conference_program_proposal_path(event.conference.short_title,event.id), class: 'btn btn-default disabled', id: "edit_proposal_#{event.id}"

View file

@ -1,3 +1,7 @@
%li
= link_to(user_proposals_conferences_path) do
%span.fa.fa-comment
User Proposals
- unless ENV['OSEM_ICHAIN_ENABLED'] == 'true'
%li
= link_to(edit_user_registration_path) do