mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Hide recent Registrations/Submissions when conference is over
This commit is contained in:
parent
415eadf477
commit
071ed50acb
3 changed files with 64 additions and 11 deletions
|
|
@ -33,6 +33,50 @@ module ApplicationHelper
|
|||
result
|
||||
end
|
||||
|
||||
# Returns time with conference timezone
|
||||
def time_with_timezone(time)
|
||||
time.strftime('%F %R') + ' ' + @conference.timezone.to_s
|
||||
end
|
||||
|
||||
##
|
||||
# Checks if the voting has already started, or if it has already ended
|
||||
#
|
||||
def voting_open_or_close(program)
|
||||
return if program.voting_period?
|
||||
if program.voting_start_date > Time.current
|
||||
return 'Voting period has not started yet!'
|
||||
else # voting_end_date > Date.today because voting_start_date < voting_end_date
|
||||
return 'Voting period is over!'
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
# Gets an EventType object, and returns its length in timestamp format (HH:MM)
|
||||
# ====Gets
|
||||
# * +Integer+ -> 30
|
||||
# ====Returns
|
||||
# * +String+ -> "00:30"
|
||||
def length_timestamp(length)
|
||||
[length / 60, length % 60].map { |t| t.to_s.rjust(2, '0') }.join(':')
|
||||
end
|
||||
|
||||
##
|
||||
# Gets a datetime object
|
||||
# ====Returns
|
||||
# * +String+ -> formated datetime object
|
||||
def format_datetime(obj)
|
||||
return unless obj
|
||||
obj.strftime('%Y-%m-%d %H:%M')
|
||||
end
|
||||
|
||||
##
|
||||
# ====Returns
|
||||
# * +String+ -> number of registrations / max allowed registrations
|
||||
def registered_text(event)
|
||||
return "Registered: #{event.registrations.count}/#{event.max_attendees}" if event.max_attendees
|
||||
"Registered: #{event.registrations.count}"
|
||||
end
|
||||
|
||||
# Set resource_name for devise so that we can call the devise help links (views/devise/shared/_links) from anywhere (eg sign_up form in proposals#new)
|
||||
def resource_name
|
||||
:user
|
||||
|
|
@ -168,4 +212,13 @@ module ApplicationHelper
|
|||
new_user_session_path
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
# ====Gets
|
||||
# a conference object
|
||||
# ==== Returns
|
||||
# class hidden if conference is over
|
||||
def hidden_if_conference_over(conference)
|
||||
'hidden' if Date.today > conference.end_date
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
.list-group
|
||||
%li.list-group-item
|
||||
%li{ 'class' => "list-group-item #{hidden_if_conference_over(conference)}" }
|
||||
%h4
|
||||
Conference progress
|
||||
.progress
|
||||
.progress-bar{ 'role' => 'progressbar', 'aria-valuenow' => "#{conference_progress['process']}", 'aria-valuemin' => '0',
|
||||
'aria-valuemax' => '100', 'style' => "width: #{conference_progress['process']}%;" }
|
||||
= conference_progress['process'] + '%'
|
||||
%li{ 'class' => "list-group-item #{class_for_todo(conference_progress['registration'])}" }
|
||||
%li{ 'class' => "list-group-item #{hidden_if_conference_over(conference)} #{class_for_todo(conference_progress['registration'])}" }
|
||||
%span{ 'class' => icon_for_todo(conference_progress['registration']) }
|
||||
- if can? :update, @conference
|
||||
- if conference.registration_period
|
||||
|
|
@ -15,13 +15,13 @@
|
|||
= link_to 'Set up registration period', new_admin_conference_registration_period_path(conference_progress['short_title'])
|
||||
- else
|
||||
Set up registration period
|
||||
%li{ 'class' => "list-group-item #{class_for_todo(conference_progress['cfp'])}" }
|
||||
%li{ 'class' => "list-group-item #{hidden_if_conference_over(conference)} #{class_for_todo(conference_progress['cfp'])}" }
|
||||
%span{ 'class' => icon_for_todo(conference_progress['cfp']) }
|
||||
- if can? :update, Cfp.new(program_id: @program.id)
|
||||
= link_to 'Set up call for papers', admin_conference_program_cfp_path(conference_progress['short_title'])
|
||||
- else
|
||||
Set up call for papers
|
||||
%li{'class'=>"list-group-item #{class_for_todo(conference_progress['venue'])}"}
|
||||
%li{'class'=>"list-group-item #{hidden_if_conference_over(conference)} #{class_for_todo(conference_progress['venue'])}"}
|
||||
%span{'class'=>icon_for_todo(conference_progress['venue'])}
|
||||
- if can? :update, Venue.new(conference: @conference)
|
||||
- @conference.reload
|
||||
|
|
@ -32,31 +32,31 @@
|
|||
- else
|
||||
- @conference.reload
|
||||
Add venue
|
||||
%li{ 'class' => "list-group-item #{class_for_todo(conference_progress['rooms'])}" }
|
||||
%li{ 'class' => "list-group-item #{hidden_if_conference_over(conference)} #{class_for_todo(conference_progress['rooms'])}" }
|
||||
%span{ 'class' => icon_for_todo(conference_progress['rooms']) }
|
||||
- if @conference.venue && (can? :update, @conference.venue.rooms.build)
|
||||
= link_to 'Add rooms', admin_conference_venue_rooms_path(conference_progress['short_title'])
|
||||
- else
|
||||
Add rooms
|
||||
%li{ 'class' => "list-group-item #{class_for_todo(conference_progress['tracks'])}" }
|
||||
%li{ 'class' => "list-group-item #{hidden_if_conference_over(conference)} #{class_for_todo(conference_progress['tracks'])}" }
|
||||
%span{ 'class' => icon_for_todo(conference_progress['tracks']) }
|
||||
- if can? :update, @conference.program.tracks.build
|
||||
= link_to 'Add tracks', admin_conference_program_tracks_path(conference_progress['short_title'])
|
||||
- else
|
||||
Add tracks
|
||||
%li{ 'class' => "list-group-item #{class_for_todo(conference_progress['event_types'])}" }
|
||||
%li{ 'class' => "list-group-item #{hidden_if_conference_over(conference)} #{class_for_todo(conference_progress['event_types'])}" }
|
||||
%span{ 'class' => icon_for_todo(conference_progress['event_types']) }
|
||||
- if can? :update, @conference.program.event_types.build
|
||||
= link_to 'Add event types', admin_conference_program_event_types_path(conference_progress['short_title'])
|
||||
- else
|
||||
Add event types
|
||||
%li{ 'class' => "list-group-item #{class_for_todo(conference_progress['difficulty_levels'])}" }
|
||||
%li{ 'class' => "list-group-item #{hidden_if_conference_over(conference)} #{class_for_todo(conference_progress['difficulty_levels'])}" }
|
||||
%span{ 'class' => icon_for_todo(conference_progress['difficulty_levels']) }
|
||||
- if can? :update, @conference.program.difficulty_levels.build
|
||||
= link_to 'Add difficulty levels', admin_conference_program_difficulty_levels_path(conference_progress['short_title'])
|
||||
- else
|
||||
Add difficulty levels
|
||||
%li{ class: "list-group-item #{class_for_todo(conference_progress['splashpage'])}" }
|
||||
%li{ class: "list-group-item #{hidden_if_conference_over(conference)} #{class_for_todo(conference_progress['splashpage'])}" }
|
||||
%span{ 'class' => icon_for_todo(conference_progress['splashpage']) }
|
||||
- if can? :update, @conference
|
||||
= link_to 'Set up a Splashpage', admin_conference_splashpage_path(conference_progress['short_title'])
|
||||
|
|
|
|||
|
|
@ -101,11 +101,11 @@
|
|||
.row
|
||||
.col-md-8
|
||||
%ul.nav.nav-tabs#recentTable
|
||||
%li.active
|
||||
%li{ 'class' => "active #{hidden_if_conference_over(@conference)}" }
|
||||
%a{ href: '#recent_reg', 'data-toggle' => 'tab' }
|
||||
%span.fa.fa-user
|
||||
Recent Registrations
|
||||
%li
|
||||
%li{ 'class' => "#{hidden_if_conference_over(@conference)}" }
|
||||
%a{ href: '#recent_submissions', 'data-toggle' => 'tab' }
|
||||
%span.fa.fa-file-text
|
||||
Recent Submissions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue