Enable track requests

This commit is contained in:
AEtherC0r3 2017-07-12 16:35:09 +03:00 committed by Stella Rouzi
parent 0f154d07c9
commit 2f9eb04219
14 changed files with 155 additions and 20 deletions

View file

@ -56,7 +56,7 @@ module ApplicationHelper
end
def tracks(conference)
all = conference.program.tracks.map {|t| t.name}
all = conference.program.tracks.map { |t| t.name if !t.self_organized? || t.confirmed? && t.cfp_active }.compact
first = all[0...-1]
last = all[-1]
ts = ''

View file

@ -95,6 +95,14 @@ class Ability
can :manage, Commercial, commercialable_type: 'Event', commercialable_id: user.events.pluck(:id)
can [:destroy], Openid
can [:new, :create], Track do |track|
track.new_record? && track.program.cfps.for_tracks.try(:open?)
end
can [:index, :show, :edit, :update], Track do |track|
user == track.submitter
end
end
# Abilities for users with roles wandering around in non-admin views.

View file

@ -1,9 +1,10 @@
# cannot delete program if there are events submitted
class Cfp < ActiveRecord::Base
TYPES = %w(events booths).freeze
TYPES = %w(events booths tracks).freeze
scope :for_events, (-> { find_by(cfp_type: 'events') })
scope :for_tracks, (-> { find_by(cfp_type: 'tracks') })
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }
belongs_to :program

View file

@ -0,0 +1,12 @@
%dt
Start Date:
%dd#start_date
= @cfp.start_date.strftime('%A, %B %-d. %Y')
%dt
End Date:
%dd#end_date
= @cfp.end_date.strftime('%A, %B %-d. %Y')
%dt
Days Left:
%dd
= pluralize(@cfp.remaining_days, 'day')

View file

@ -0,0 +1,30 @@
= content_for :splash_nav do
%li
%a.smoothscroll{ href: '#callfortracks' } Call For Tracks
.container
.row
.col-md-12.text-center
%h2
Call for Tracks
%p.lead
We are ready to accept requests for tracks!
.row
.col-md-6.col-md-offset-3.col-sm-10.col-sm-offset-1
%p
The submission period for track requests has begun
%em.notranslate
= @conference.program.cfps.for_tracks.start_date.strftime('%A, %B %-d. %Y')
and closes
%em.notranslate
= @conference.program.cfps.for_tracks.end_date.strftime('%A, %B %-d. %Y.')
- if @conference.program.cfps.for_tracks.try(:open?)
That means you have only
%b.notranslate= pluralize(@conference.program.cfps.for_tracks.remaining_days, 'day')
left!
- else
The submission period for track requests is closed.
.row
.col-md-12.text-center
%p.cta-button
= link_to "Submit your request for track", conference_program_tracks_path(@conference.short_title), class: 'btn btn-success btn-lg text-center'

View file

@ -30,6 +30,10 @@
= link_to "Register", new_conference_conference_registration_path(conference.short_title), class: "btn btn-default", disabled: cannot?(:new, Registration.new(conference_id: conference.id))
- if cannot?(:new, Registration.new(conference_id: conference.id)) && conference.registration_limit_exceeded?
Sorry, no places left
- if !current_user.nil? && current_user.tracks.where(program: conference.program).length > 0
= link_to "My Track Requests", conference_program_tracks_path(conference.short_title), class: 'btn btn-default'
- elsif can? :new, conference.program.tracks.new
= link_to "Submit Track Request", new_conference_program_track_path(conference.short_title), class: 'btn btn-default'
- if !current_user.nil? && current_user.proposal_count(conference) > 0
= link_to "My Proposals", conference_program_proposals_path(conference.short_title), class: 'btn btn-default'
- elsif can? :new, conference.program.events.new

View file

@ -45,6 +45,10 @@
%section#program
= render 'schedule_splashpage'
- if @conference.program.cfps.for_tracks.try(:open?) && @conference.splashpage.include_cfp
%section#callfortracks
= render 'call_for_tracks'
- if @conference.program.cfp_open? and @conference.splashpage.include_cfp
%section#callforpapers
= render 'call_for_paper'

View file

@ -32,7 +32,7 @@
%span.label{style: "background-color: #{track.color}; color: #{ contrast_color(track.color) }"}
= track.color
%td
= track.state
= track.state.humanize
%td
= link_to 'Edit', edit_conference_program_track_path(@conference.short_title, track),
method: :get, class: 'btn btn-primary'

View file

@ -16,7 +16,7 @@
%dt
State:
%dd
= @track.state
= @track.state.humanize
%dt
Description
%dd