Merge d040d9c6ab into 281022a80c
This commit is contained in:
commit
2c3e05746e
30 changed files with 559 additions and 497 deletions
|
|
@ -714,3 +714,6 @@ Style/TrailingCommaInLiteral:
|
||||||
- 'Guardfile'
|
- 'Guardfile'
|
||||||
- 'db/migrate/20140701123203_add_events_per_week_to_conference.rb'
|
- 'db/migrate/20140701123203_add_events_per_week_to_conference.rb'
|
||||||
- 'spec/models/conference_spec.rb'
|
- 'spec/models/conference_spec.rb'
|
||||||
|
|
||||||
|
Style/FrozenStringLiteralComment:
|
||||||
|
Enabled: false
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,16 @@
|
||||||
/* Styling for voting on proposals*/
|
/* Styling for voting on proposals*/
|
||||||
.myrating.bright { background-image: image-url("star-bright.png"); }
|
.rating {
|
||||||
.myrating.glow { background-image: image-url("star-glow.png"); }
|
|
||||||
.othersrating.bright { background-image: image-url("star-bright.png"); }
|
|
||||||
.avgrating.bright { background-image: image-url("star-bright.png"); }
|
|
||||||
.avgrating {
|
|
||||||
background: image-url("star.png") 0 0;
|
background: image-url("star.png") 0 0;
|
||||||
margin-right: -2px;
|
|
||||||
width: 24px;
|
width: 24px;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
|
||||||
.myrating, .othersrating {
|
|
||||||
background: image-url("star.png") 0 0;
|
|
||||||
width: 24px;
|
|
||||||
height: 24px;
|
|
||||||
float: left;
|
float: left;
|
||||||
}
|
|
||||||
|
|
||||||
|
&.bright {
|
||||||
|
background-image: image-url("star-bright.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
&.glow {
|
||||||
|
background-image: image-url("star-glow.png");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ module Admin
|
||||||
@scheduled_event_distribution = @conference.scheduled_event_distribution
|
@scheduled_event_distribution = @conference.scheduled_event_distribution
|
||||||
@file_name = "events_for_#{@conference.short_title}"
|
@file_name = "events_for_#{@conference.short_title}"
|
||||||
@event_export_option = params[:event_export_option]
|
@event_export_option = params[:event_export_option]
|
||||||
|
@export_formats = [:pdf, :csv, :xlsx]
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
|
|
@ -46,7 +47,7 @@ module Admin
|
||||||
@event_types = @program.event_types
|
@event_types = @program.event_types
|
||||||
@comments = @event.root_comments
|
@comments = @event.root_comments
|
||||||
@comment_count = @event.comment_threads.count
|
@comment_count = @event.comment_threads.count
|
||||||
@ratings = @event.votes.includes(:user)
|
@votes = @event.votes.includes(:user)
|
||||||
@difficulty_levels = @program.difficulty_levels
|
@difficulty_levels = @program.difficulty_levels
|
||||||
@versions = @event.versions |
|
@versions = @event.versions |
|
||||||
PaperTrail::Version.where(item_type: 'Commercial').where('object LIKE ?', "%commercialable_id: #{@event.id}\ncommercialable_type: Event%") |
|
PaperTrail::Version.where(item_type: 'Commercial').where('object LIKE ?', "%commercialable_id: #{@event.id}\ncommercialable_type: Event%") |
|
||||||
|
|
@ -146,7 +147,7 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def vote
|
def vote
|
||||||
@ratings = @event.votes.includes(:user)
|
@votes = @event.votes.includes(:user)
|
||||||
|
|
||||||
if (votes = current_user.votes.find_by_event_id(params[:id]))
|
if (votes = current_user.votes.find_by_event_id(params[:id]))
|
||||||
votes.update_attributes(rating: params[:rating])
|
votes.update_attributes(rating: params[:rating])
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def rescheduling_hint(affected_event_count)
|
def rescheduling_hint(affected_event_count)
|
||||||
if affected_event_count > 0
|
if affected_event_count.positive?
|
||||||
"You have #{affected_event_count} scheduled #{'event'.pluralize(affected_event_count)}. Changing the conference hours will unschedule those scheduled outside the conference hours."
|
"You have #{affected_event_count} scheduled #{'event'.pluralize(affected_event_count)}. Changing the conference hours will unschedule those scheduled outside the conference hours."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -196,4 +196,23 @@ module ApplicationHelper
|
||||||
object.picture.large.url
|
object.picture.large.url
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def rating_stars(rating, max, options = {})
|
||||||
|
Array.new(max) do |counter|
|
||||||
|
content_tag(
|
||||||
|
'label',
|
||||||
|
'',
|
||||||
|
class: "rating#{' bright' if rating.to_f > counter}",
|
||||||
|
**options
|
||||||
|
)
|
||||||
|
end.join.html_safe
|
||||||
|
end
|
||||||
|
|
||||||
|
def rating_fraction(rating, max, options = {})
|
||||||
|
content_tag(
|
||||||
|
'span',
|
||||||
|
"#{rating}/#{max}",
|
||||||
|
**options
|
||||||
|
)
|
||||||
|
end`
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -10,18 +10,6 @@ module EventsHelper
|
||||||
"Registered: #{event.registrations.count}"
|
"Registered: #{event.registrations.count}"
|
||||||
end
|
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
|
|
||||||
|
|
||||||
def replacement_event_notice(event_schedule)
|
def replacement_event_notice(event_schedule)
|
||||||
if event_schedule.present? && event_schedule.replacement?
|
if event_schedule.present? && event_schedule.replacement?
|
||||||
replaced_event = (event_schedule.intersecting_event_schedules.withdrawn.first || event_schedule.intersecting_event_schedules.canceled.first).event
|
replaced_event = (event_schedule.intersecting_event_schedules.withdrawn.first || event_schedule.intersecting_event_schedules.canceled.first).event
|
||||||
|
|
@ -47,4 +35,160 @@ module EventsHelper
|
||||||
include_blank: '(Please select)'
|
include_blank: '(Please select)'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def rating_tooltip(event, max_rating)
|
||||||
|
"#{event.average_rating}/#{max_rating}, #{pluralize(event.voters.length, 'vote')}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def event_type_dropdown(event, event_types, conference_id)
|
||||||
|
selection = event.event_type.try(:title) || 'Event Type'
|
||||||
|
options = event_types.collect do |event_type|
|
||||||
|
[
|
||||||
|
event_type.title,
|
||||||
|
admin_conference_program_event_path(
|
||||||
|
conference_id,
|
||||||
|
event,
|
||||||
|
event: { event_type_id: event_type.id }
|
||||||
|
)
|
||||||
|
]
|
||||||
|
end
|
||||||
|
active_dropdown(selection, options)
|
||||||
|
end
|
||||||
|
|
||||||
|
def track_dropdown(event, tracks, conference_id)
|
||||||
|
selection = event.track.try(:name) || 'Track'
|
||||||
|
options = tracks.collect do |track|
|
||||||
|
[
|
||||||
|
track.name,
|
||||||
|
admin_conference_program_event_path(
|
||||||
|
conference_id,
|
||||||
|
event,
|
||||||
|
event: { track_id: track.id }
|
||||||
|
)
|
||||||
|
]
|
||||||
|
end
|
||||||
|
active_dropdown(selection, options)
|
||||||
|
end
|
||||||
|
|
||||||
|
def difficulty_dropdown(event, difficulties, conference_id)
|
||||||
|
selection = event.difficulty_level.try(:title) || 'Difficulty'
|
||||||
|
options = difficulties.collect do |difficulty|
|
||||||
|
[
|
||||||
|
difficulty.title,
|
||||||
|
admin_conference_program_event_path(
|
||||||
|
conference_id,
|
||||||
|
event,
|
||||||
|
event: { difficulty_level_id: difficulty.id }
|
||||||
|
)
|
||||||
|
]
|
||||||
|
end
|
||||||
|
active_dropdown(selection, options)
|
||||||
|
end
|
||||||
|
|
||||||
|
def state_dropdown(event, conference_id, email_settings)
|
||||||
|
selection = event.state.humanize
|
||||||
|
options = []
|
||||||
|
if event.transition_possible? :accept
|
||||||
|
options << [
|
||||||
|
'Accept',
|
||||||
|
accept_admin_conference_program_event_path(conference_id, event)
|
||||||
|
]
|
||||||
|
if email_settings.send_on_accepted?
|
||||||
|
options << [
|
||||||
|
'Accept (without email)',
|
||||||
|
accept_admin_conference_program_event_path(
|
||||||
|
conference_id,
|
||||||
|
event,
|
||||||
|
send_mail: false
|
||||||
|
)
|
||||||
|
]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if event.transition_possible? :reject
|
||||||
|
options << [
|
||||||
|
'Reject',
|
||||||
|
reject_admin_conference_program_event_path(conference_id, event)
|
||||||
|
]
|
||||||
|
if email_settings.send_on_rejected?
|
||||||
|
options << [
|
||||||
|
'Reject (without email)',
|
||||||
|
reject_admin_conference_program_event_path(
|
||||||
|
conference_id,
|
||||||
|
event,
|
||||||
|
send_mail: false
|
||||||
|
)
|
||||||
|
]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if event.transition_possible? :restart
|
||||||
|
options << [
|
||||||
|
'Start review',
|
||||||
|
restart_admin_conference_program_event_path(conference_id, event)
|
||||||
|
]
|
||||||
|
end
|
||||||
|
if event.transition_possible? :confirm
|
||||||
|
options << [
|
||||||
|
'Confirm',
|
||||||
|
confirm_admin_conference_program_event_path(conference_id, event)
|
||||||
|
]
|
||||||
|
end
|
||||||
|
if event.transition_possible? :cancel
|
||||||
|
options << [
|
||||||
|
'Cancel',
|
||||||
|
cancel_admin_conference_program_event_path(conference_id, event)
|
||||||
|
]
|
||||||
|
end
|
||||||
|
active_dropdown(selection, options)
|
||||||
|
end
|
||||||
|
|
||||||
|
def event_switch_checkbox(event, attribute, conference_id)
|
||||||
|
check_box_tag(
|
||||||
|
conference_id,
|
||||||
|
event.id,
|
||||||
|
event.send(attribute),
|
||||||
|
url: admin_conference_program_event_path(
|
||||||
|
conference_id,
|
||||||
|
event,
|
||||||
|
event: { attribute => nil }
|
||||||
|
),
|
||||||
|
method: :patch,
|
||||||
|
class: 'switch-checkbox',
|
||||||
|
data: {
|
||||||
|
size: 'small',
|
||||||
|
off_color: 'warning',
|
||||||
|
on_text: 'Yes',
|
||||||
|
off_text: 'No'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def active_dropdown(selection, options)
|
||||||
|
# Consistent rendering of dropdown lists that submit patched changes
|
||||||
|
#
|
||||||
|
# Selection is the string to show by default, which is clicked to expose the
|
||||||
|
# dropdown options.
|
||||||
|
# Options is a list of 2-item lists; for each entry:
|
||||||
|
# * [0] is the text of the option,
|
||||||
|
# * [1] is the link url for the options
|
||||||
|
content_tag('div', class: 'dropdown') do
|
||||||
|
content_tag(
|
||||||
|
'a',
|
||||||
|
class: 'dropdown-toggle',
|
||||||
|
href: '#',
|
||||||
|
data: {
|
||||||
|
toggle: 'dropdown'
|
||||||
|
}
|
||||||
|
) do
|
||||||
|
content_tag('span', selection) +
|
||||||
|
content_tag('span', '', class: 'caret')
|
||||||
|
end +
|
||||||
|
content_tag('ul', class: 'dropdown-menu') do
|
||||||
|
options.collect do |option|
|
||||||
|
content_tag('li', link_to(option[0], option[1], method: :patch))
|
||||||
|
end.join.html_safe
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ class Ability
|
||||||
can [:index, :conferences], Organization
|
can [:index, :conferences], Organization
|
||||||
can [:index], Conference
|
can [:index], Conference
|
||||||
can [:show], Conference do |conference|
|
can [:show], Conference do |conference|
|
||||||
conference.splashpage && conference.splashpage.public == true
|
conference&.splashpage&.public
|
||||||
end
|
end
|
||||||
# Can view the schedule
|
# Can view the schedule
|
||||||
can [:schedule, :events], Conference do |conference|
|
can [:schedule, :events], Conference do |conference|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ class Cfp < ApplicationRecord
|
||||||
def weeks
|
def weeks
|
||||||
result = end_week - start_week + 1
|
result = end_week - start_week + 1
|
||||||
weeks = Date.new(start_date.year, 12, 31).strftime('%W').to_i
|
weeks = Date.new(start_date.year, 12, 31).strftime('%W').to_i
|
||||||
result < 0 ? result + weeks : result
|
result.negative? ? result + weeks : result
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
@ -63,7 +63,7 @@ class Cfp < ApplicationRecord
|
||||||
|
|
||||||
def remaining_days(date = Date.today)
|
def remaining_days(date = Date.today)
|
||||||
result = (end_date - date).to_i
|
result = (end_date - date).to_i
|
||||||
result > 0 ? result : 0
|
result.positive? ? result : 0
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
@ -106,12 +106,12 @@ class Cfp < ApplicationRecord
|
||||||
private
|
private
|
||||||
|
|
||||||
def before_end_of_conference
|
def before_end_of_conference
|
||||||
if program && program.conference && program.conference.end_date && end_date && (end_date > program.conference.end_date)
|
if program&.conference && program.conference.end_date && end_date && (end_date > program.conference.end_date)
|
||||||
errors
|
errors
|
||||||
.add(:end_date, "can't be after the conference end date (#{program.conference.end_date})")
|
.add(:end_date, "can't be after the conference end date (#{program.conference.end_date})")
|
||||||
end
|
end
|
||||||
|
|
||||||
if program && program.conference && program.conference.end_date && start_date && (start_date > program.conference.end_date)
|
if program&.conference && program.conference.end_date && start_date && (start_date > program.conference.end_date)
|
||||||
errors
|
errors
|
||||||
.add(:start_date, "can't be after the conference end date (#{program.conference.end_date})")
|
.add(:start_date, "can't be after the conference end date (#{program.conference.end_date})")
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ class Conference < ApplicationRecord
|
||||||
# * +false+ -> If the user is registered
|
# * +false+ -> If the user is registered
|
||||||
# * +true+ - If the user isn't registered
|
# * +true+ - If the user isn't registered
|
||||||
def user_registered? user
|
def user_registered? user
|
||||||
user.present? && registrations.where(user_id: user.id).count > 0
|
user.present? && registrations.where(user_id: user.id).count.positive?
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
@ -113,7 +113,7 @@ class Conference < ApplicationRecord
|
||||||
event_schedules = program.event_schedules.select do |event_schedule|
|
event_schedules = program.event_schedules.select do |event_schedule|
|
||||||
event_schedule.start_time.hour < start_hour ||
|
event_schedule.start_time.hour < start_hour ||
|
||||||
event_schedule.end_time.hour > end_hour ||
|
event_schedule.end_time.hour > end_hour ||
|
||||||
(event_schedule.end_time.hour == end_hour && event_schedule.end_time.minute > 0)
|
(event_schedule.end_time.hour == end_hour && event_schedule.end_time.minute.positive?)
|
||||||
end
|
end
|
||||||
event_schedules.each(&:destroy)
|
event_schedules.each(&:destroy)
|
||||||
end
|
end
|
||||||
|
|
@ -151,7 +151,7 @@ class Conference < ApplicationRecord
|
||||||
def get_submissions_per_week
|
def get_submissions_per_week
|
||||||
result = []
|
result = []
|
||||||
|
|
||||||
if program && program.cfp && program.events
|
if program&.cfp && program.events
|
||||||
submissions = program.events.select(:week).group(:week).order(:week).count
|
submissions = program.events.select(:week).group(:week).order(:week).count
|
||||||
start_week = program.cfp.start_week
|
start_week = program.cfp.start_week
|
||||||
weeks = program.cfp.weeks
|
weeks = program.cfp.weeks
|
||||||
|
|
@ -168,7 +168,7 @@ class Conference < ApplicationRecord
|
||||||
# * +Array+ -> e.g. 'Submitted' => [0, 3, 3, 5] -> first week 0 events, second week 3 events.
|
# * +Array+ -> e.g. 'Submitted' => [0, 3, 3, 5] -> first week 0 events, second week 3 events.
|
||||||
def get_submissions_data
|
def get_submissions_data
|
||||||
result = {}
|
result = {}
|
||||||
if program && program.cfp && program.events
|
if program&.cfp && program.events
|
||||||
result = get_events_per_week_by_state
|
result = get_events_per_week_by_state
|
||||||
|
|
||||||
start_week = program.cfp.start_week
|
start_week = program.cfp.start_week
|
||||||
|
|
@ -182,7 +182,7 @@ class Conference < ApplicationRecord
|
||||||
result[state] = pad_array_left_not_kumulative(start_week, values)
|
result[state] = pad_array_left_not_kumulative(start_week, values)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
result['Weeks'] = weeks > 0 ? (1..weeks).to_a : 0
|
result['Weeks'] = weeks.positive? ? (1..weeks).to_a : 0
|
||||||
end
|
end
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
@ -256,7 +256,7 @@ class Conference < ApplicationRecord
|
||||||
result[Ticket.find(ticket).title] = pad_array_left_not_kumulative(start_week, values)
|
result[Ticket.find(ticket).title] = pad_array_left_not_kumulative(start_week, values)
|
||||||
end
|
end
|
||||||
|
|
||||||
result['Weeks'] = weeks > 0 ? (1..weeks).to_a : 0
|
result['Weeks'] = weeks.positive? ? (1..weeks).to_a : 0
|
||||||
end
|
end
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
@ -269,15 +269,14 @@ class Conference < ApplicationRecord
|
||||||
def registration_weeks
|
def registration_weeks
|
||||||
result = 0
|
result = 0
|
||||||
weeks = 0
|
weeks = 0
|
||||||
if registration_period &&
|
if registration_period&.start_date &&
|
||||||
registration_period.start_date &&
|
|
||||||
registration_period.end_date
|
registration_period.end_date
|
||||||
weeks = Date.new(registration_period.start_date.year, 12, 31)
|
weeks = Date.new(registration_period.start_date.year, 12, 31)
|
||||||
.strftime('%W').to_i
|
.strftime('%W').to_i
|
||||||
|
|
||||||
result = get_registration_end_week - get_registration_start_week + 1
|
result = get_registration_end_week - get_registration_start_week + 1
|
||||||
end
|
end
|
||||||
result < 0 ? result + weeks : result
|
result.negative? ? result + weeks : result
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
@ -343,7 +342,7 @@ class Conference < ApplicationRecord
|
||||||
tracks: tracks_set?,
|
tracks: tracks_set?,
|
||||||
event_types: event_types_set?,
|
event_types: event_types_set?,
|
||||||
difficulty_levels: difficulty_levels_set?,
|
difficulty_levels: difficulty_levels_set?,
|
||||||
splashpage: splashpage && splashpage.public?
|
splashpage: splashpage&.public?
|
||||||
}
|
}
|
||||||
|
|
||||||
result.update(
|
result.update(
|
||||||
|
|
@ -449,11 +448,11 @@ class Conference < ApplicationRecord
|
||||||
i += 1
|
i += 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if others > 0
|
if others.positive?
|
||||||
result['Others'] = { 'value' => others, 'color' => next_color(i) }
|
result['Others'] = { 'value' => others, 'color' => next_color(i) }
|
||||||
i += 1
|
i += 1
|
||||||
end
|
end
|
||||||
result['None'] = { 'value' => none, 'color' => next_color(i) } if none > 0
|
result['None'] = { 'value' => none, 'color' => next_color(i) } if none.positive?
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -719,7 +718,7 @@ class Conference < ApplicationRecord
|
||||||
# * +True+ -> If the registration limit has been reached or exceeded
|
# * +True+ -> If the registration limit has been reached or exceeded
|
||||||
# * +False+ -> If the registration limit hasn't been exceeded
|
# * +False+ -> If the registration limit hasn't been exceeded
|
||||||
def registration_limit_exceeded?
|
def registration_limit_exceeded?
|
||||||
registration_limit > 0 && registrations.count + program.speakers.confirmed.unregistered(program.conference).count >= registration_limit
|
registration_limit.positive? && registrations.count + program.speakers.confirmed.unregistered(program.conference).count >= registration_limit
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns an hexadecimal color given a collection. The returned color changed
|
# Returns an hexadecimal color given a collection. The returned color changed
|
||||||
|
|
@ -757,7 +756,7 @@ class Conference < ApplicationRecord
|
||||||
# * +True+ -> if accepted booths are equal to the booth limit
|
# * +True+ -> if accepted booths are equal to the booth limit
|
||||||
# * +False+ -> Accepted booths have not reached the booth limit
|
# * +False+ -> Accepted booths have not reached the booth limit
|
||||||
def maximum_accepted_booths?
|
def maximum_accepted_booths?
|
||||||
booth_limit > 0 && booths.accepted.count + booths.confirmed.count >= booth_limit
|
booth_limit.positive? && booths.accepted.count + booths.confirmed.count >= booth_limit
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
@ -829,7 +828,7 @@ class Conference < ApplicationRecord
|
||||||
# Reports an error when such a condition is found
|
# Reports an error when such a condition is found
|
||||||
def valid_times_range?
|
def valid_times_range?
|
||||||
if start_hour && end_hour
|
if start_hour && end_hour
|
||||||
errors.add(:start_hour, 'is lower than 0') if start_hour < 0
|
errors.add(:start_hour, 'is lower than 0') if start_hour.negative?
|
||||||
errors.add(:end_hour, 'is lower or equal than start hour') if end_hour <= start_hour
|
errors.add(:end_hour, 'is lower or equal than start hour') if end_hour <= start_hour
|
||||||
errors.add(:end_hour, 'is greater than 24') if end_hour > 24
|
errors.add(:end_hour, 'is greater than 24') if end_hour > 24
|
||||||
end
|
end
|
||||||
|
|
@ -843,7 +842,7 @@ class Conference < ApplicationRecord
|
||||||
def weeks(start_week, end_week)
|
def weeks(start_week, end_week)
|
||||||
weeks = end_week - start_week + 1
|
weeks = end_week - start_week + 1
|
||||||
weeks_of_year = Date.new(start_date.year, 12, 31).strftime('%W').to_i
|
weeks_of_year = Date.new(start_date.year, 12, 31).strftime('%W').to_i
|
||||||
weeks < 0 ? weeks + weeks_of_year : weeks
|
weeks.negative? ? weeks + weeks_of_year : weeks
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
@ -961,7 +960,7 @@ class Conference < ApplicationRecord
|
||||||
# * +True+ -> One difficulty level or more
|
# * +True+ -> One difficulty level or more
|
||||||
# * +False+ -> No diffculty level
|
# * +False+ -> No diffculty level
|
||||||
def difficulty_levels_set?
|
def difficulty_levels_set?
|
||||||
program.difficulty_levels.count > 0
|
program.difficulty_levels.count.positive?
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
@ -971,7 +970,7 @@ class Conference < ApplicationRecord
|
||||||
# * +True+ -> One difficulty level or more
|
# * +True+ -> One difficulty level or more
|
||||||
# * +False+ -> No diffculty level
|
# * +False+ -> No diffculty level
|
||||||
def event_types_set?
|
def event_types_set?
|
||||||
program.event_types.count > 0
|
program.event_types.count.positive?
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
@ -981,7 +980,7 @@ class Conference < ApplicationRecord
|
||||||
# * +True+ -> One track or more
|
# * +True+ -> One track or more
|
||||||
# * +False+ -> No track
|
# * +False+ -> No track
|
||||||
def tracks_set?
|
def tracks_set?
|
||||||
program.tracks.count > 0
|
program.tracks.count.positive?
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
@ -991,7 +990,7 @@ class Conference < ApplicationRecord
|
||||||
# * +True+ -> One room or more
|
# * +True+ -> One room or more
|
||||||
# * +False+ -> No room
|
# * +False+ -> No room
|
||||||
def rooms_set?
|
def rooms_set?
|
||||||
venue.present? && venue.rooms.count > 0
|
venue.present? && venue.rooms.count.positive?
|
||||||
end
|
end
|
||||||
|
|
||||||
# Checks if the conference has a venue object.
|
# Checks if the conference has a venue object.
|
||||||
|
|
@ -1097,19 +1096,19 @@ class Conference < ApplicationRecord
|
||||||
# * +hash+ -> hash
|
# * +hash+ -> hash
|
||||||
def self.calculate_user_distribution_hash(active_user, unconfirmed_user, dead_user)
|
def self.calculate_user_distribution_hash(active_user, unconfirmed_user, dead_user)
|
||||||
result = {}
|
result = {}
|
||||||
if active_user > 0
|
if active_user.positive?
|
||||||
result['Active'] = {
|
result['Active'] = {
|
||||||
'color' => 'green',
|
'color' => 'green',
|
||||||
'value' => active_user
|
'value' => active_user
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
if unconfirmed_user > 0
|
if unconfirmed_user.positive?
|
||||||
result['Unconfirmed'] = {
|
result['Unconfirmed'] = {
|
||||||
'color' => 'red',
|
'color' => 'red',
|
||||||
'value' => unconfirmed_user
|
'value' => unconfirmed_user
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
if dead_user > 0
|
if dead_user.positive?
|
||||||
result['Dead'] = {
|
result['Dead'] = {
|
||||||
'color' => 'black',
|
'color' => 'black',
|
||||||
'value' => dead_user
|
'value' => dead_user
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,15 @@ class Event < ApplicationRecord
|
||||||
@total_rating += vote.rating
|
@total_rating += vote.rating
|
||||||
end
|
end
|
||||||
@total = votes.size
|
@total = votes.size
|
||||||
@total_rating > 0 ? number_with_precision(@total_rating / @total.to_f, precision: 2, strip_insignificant_zeros: true) : 0
|
if @total_rating.positive?
|
||||||
|
number_with_precision(
|
||||||
|
@total_rating / @total.to_f,
|
||||||
|
precision: 2,
|
||||||
|
strip_insignificant_zeros: true
|
||||||
|
)
|
||||||
|
else
|
||||||
|
0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# get event speakers with the event sumbmitter at the first position
|
# get event speakers with the event sumbmitter at the first position
|
||||||
|
|
@ -310,7 +318,7 @@ class Event < ApplicationRecord
|
||||||
|
|
||||||
def before_end_of_conference
|
def before_end_of_conference
|
||||||
errors
|
errors
|
||||||
.add(:created_at, "can't be after the conference end date!") if program.conference && program.conference.end_date &&
|
.add(:created_at, "can't be after the conference end date!") if program.conference&.end_date &&
|
||||||
(Date.today > program.conference.end_date)
|
(Date.today > program.conference.end_date)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -322,7 +330,7 @@ class Event < ApplicationRecord
|
||||||
# Allow only confirmed tracks that belong to the same program as the event
|
# Allow only confirmed tracks that belong to the same program as the event
|
||||||
#
|
#
|
||||||
def valid_track
|
def valid_track
|
||||||
return unless track && track.program && program
|
return unless track&.program && program
|
||||||
errors.add(:track, 'is invalid') unless track.confirmed? && track.program == program
|
errors.add(:track, 'is invalid') unless track.confirmed? && track.program == program
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ class Program < ApplicationRecord
|
||||||
tracks.self_organized.confirmed.order(start_date: :asc).each do |track|
|
tracks.self_organized.confirmed.order(start_date: :asc).each do |track|
|
||||||
event_schedules += track.selected_schedule.event_schedules.order(start_time: :asc) if track.selected_schedule
|
event_schedules += track.selected_schedule.event_schedules.order(start_time: :asc) if track.selected_schedule
|
||||||
end
|
end
|
||||||
event_schedules.sort_by(&:start_time) if event_schedules
|
event_schedules&.sort_by(&:start_time)
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
@ -134,7 +134,7 @@ class Program < ApplicationRecord
|
||||||
# * +false+ -> If rating is not enabled
|
# * +false+ -> If rating is not enabled
|
||||||
# * +true+ -> If rating is enabled
|
# * +true+ -> If rating is enabled
|
||||||
def rating_enabled?
|
def rating_enabled?
|
||||||
rating && rating > 0
|
rating&.positive?
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
@ -240,7 +240,9 @@ class Program < ApplicationRecord
|
||||||
# Check if schedule_interval is a divisor of 60 minutes
|
# Check if schedule_interval is a divisor of 60 minutes
|
||||||
#
|
#
|
||||||
def schedule_interval_divisor_60
|
def schedule_interval_divisor_60
|
||||||
errors.add(:schedule_interval, 'must be a divisor of 60') if schedule_interval > 0 && 60 % schedule_interval > 0
|
if schedule_interval.positive? && 60 % schedule_interval.positive?
|
||||||
|
errors.add(:schedule_interval, 'must be a divisor of 60')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
@ -248,7 +250,7 @@ class Program < ApplicationRecord
|
||||||
#
|
#
|
||||||
def unschedule_unfit_events
|
def unschedule_unfit_events
|
||||||
unfit_schedules = event_schedules.select do |event_schedule|
|
unfit_schedules = event_schedules.select do |event_schedule|
|
||||||
event_schedule.start_time.min % schedule_interval > 0
|
event_schedule.start_time.min % schedule_interval.positive?
|
||||||
end
|
end
|
||||||
EventSchedule.where(id: unfit_schedules.map(&:id)).destroy_all
|
EventSchedule.where(id: unfit_schedules.map(&:id)).destroy_all
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,8 @@ class Registration < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def registration_limit_not_exceed
|
def registration_limit_not_exceed
|
||||||
if conference.registration_limit > 0 && conference.registrations(:reload).count >= conference.registration_limit
|
if conference.registration_limit.positive? &&
|
||||||
|
conference.registrations(:reload).count >= conference.registration_limit
|
||||||
errors.add(:base, 'Registration limit exceeded')
|
errors.add(:base, 'Registration limit exceeded')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,10 @@ class RegistrationPeriod < ApplicationRecord
|
||||||
|
|
||||||
def before_end_of_conference
|
def before_end_of_conference
|
||||||
errors
|
errors
|
||||||
.add(:start_date, "can't be after the conference end date (#{conference.end_date})") if conference && conference.end_date && start_date && (start_date > conference.end_date)
|
.add(:start_date, "can't be after the conference end date (#{conference.end_date})") if conference&.end_date && start_date && (start_date > conference.end_date)
|
||||||
|
|
||||||
errors
|
errors
|
||||||
.add(:end_date, "can't be after the conference end date (#{conference.end_date})") if conference && conference.end_date && end_date && (end_date > conference.end_date)
|
.add(:end_date, "can't be after the conference end date (#{conference.end_date})") if conference&.end_date && end_date && (end_date > conference.end_date)
|
||||||
end
|
end
|
||||||
|
|
||||||
def start_date_before_end_date
|
def start_date_before_end_date
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ class TicketPurchase < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.purchase_ticket(conference, quantity, ticket, user)
|
def self.purchase_ticket(conference, quantity, ticket, user)
|
||||||
if quantity > 0
|
if quantity.positive?
|
||||||
purchase = new(ticket_id: ticket.id,
|
purchase = new(ticket_id: ticket.id,
|
||||||
conference_id: conference.id,
|
conference_id: conference.id,
|
||||||
user_id: user.id,
|
user_id: user.id,
|
||||||
|
|
@ -65,7 +65,7 @@ class TicketPurchase < ApplicationRecord
|
||||||
user_id: user.id,
|
user_id: user.id,
|
||||||
paid: false).first
|
paid: false).first
|
||||||
|
|
||||||
purchase.quantity = quantity if quantity > 0
|
purchase.quantity = quantity if quantity.positive?
|
||||||
purchase
|
purchase
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -113,10 +113,8 @@ class Track < ApplicationRecord
|
||||||
def revoke_role_and_cleanup
|
def revoke_role_and_cleanup
|
||||||
role = Role.find_by(name: 'track_organizer', resource: self)
|
role = Role.find_by(name: 'track_organizer', resource: self)
|
||||||
|
|
||||||
if role
|
role&.users&.each do |user|
|
||||||
role.users.each do |user|
|
user.remove_role 'track_organizer', self
|
||||||
user.remove_role 'track_organizer', self
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
self.selected_schedule_id = nil
|
self.selected_schedule_id = nil
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ class User < ApplicationRecord
|
||||||
def self.for_ichain_username(username, attributes)
|
def self.for_ichain_username(username, attributes)
|
||||||
user = find_by(username: username)
|
user = find_by(username: username)
|
||||||
|
|
||||||
raise UserDisabled if user && user.is_disabled
|
raise UserDisabled if user&.is_disabled
|
||||||
|
|
||||||
if user
|
if user
|
||||||
user.update_attributes(email: attributes[:email],
|
user.update_attributes(email: attributes[:email],
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ class Venue < ApplicationRecord
|
||||||
|
|
||||||
def country_name
|
def country_name
|
||||||
name = ISO3166::Country[country]
|
name = ISO3166::Country[country]
|
||||||
name.name if name
|
name&.name
|
||||||
end
|
end
|
||||||
|
|
||||||
def location?
|
def location?
|
||||||
|
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
- if event.transition_possible? :accept
|
|
||||||
%li= link_to 'Accept event',
|
|
||||||
accept_admin_conference_program_event_path(@conference.short_title, event),
|
|
||||||
method: :patch, id: "accept_event_#{event.id}"
|
|
||||||
|
|
||||||
- if @conference.email_settings.send_on_accepted?
|
|
||||||
%li= link_to 'Accept event (without email)',
|
|
||||||
accept_admin_conference_program_event_path(@conference.short_title, event, send_mail: false),
|
|
||||||
method: :patch, hint: 'Accept this event without sending an automated email.',
|
|
||||||
id: "accept_event_without_mail_#{event.id}"
|
|
||||||
|
|
||||||
- if event.transition_possible? :reject
|
|
||||||
%li= link_to 'Reject event',
|
|
||||||
reject_admin_conference_program_event_path(@conference.short_title, event),
|
|
||||||
method: :patch, confirm: 'Are you sure?', id: "reject_event_#{event.id}"
|
|
||||||
|
|
||||||
- if @conference.email_settings.send_on_rejected?
|
|
||||||
%li= link_to 'Reject event (without email)',
|
|
||||||
reject_admin_conference_program_event_path(@conference.short_title, event, send_mail: false),
|
|
||||||
method: :patch, confirm: 'Are you sure?', id: "reject_event_without_mail_#{event.id}"
|
|
||||||
|
|
||||||
- if event.transition_possible? :restart
|
|
||||||
%li= link_to 'Start review',
|
|
||||||
restart_admin_conference_program_event_path(@conference.short_title, event),
|
|
||||||
method: :patch, id: "restart_event_#{event.id}"
|
|
||||||
|
|
||||||
- if event.transition_possible? :confirm
|
|
||||||
%li= link_to 'Confirm event',
|
|
||||||
confirm_admin_conference_program_event_path(@conference.short_title, event),
|
|
||||||
method: :patch, id: "confirm_event_#{event.id}",
|
|
||||||
hint: 'Confirm that the speaker(s) will be present and that the event will actually take place.'
|
|
||||||
|
|
||||||
- if event.transition_possible? :cancel
|
|
||||||
%li= link_to 'Cancel event',
|
|
||||||
cancel_admin_conference_program_event_path(@conference.short_title, event),
|
|
||||||
method: :patch, id: "cancel_event_#{event.id}",
|
|
||||||
hint: 'Mark this event as cancelled. Usually this means that the speakers had to cancel their appearance.'
|
|
||||||
64
app/views/admin/events/_datatable_row.haml
Normal file
64
app/views/admin/events/_datatable_row.haml
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
- cache ['admin/events/index', conference_id, event, event.submitter,
|
||||||
|
event.speakers, event_types, tracks, difficulty_levels] do
|
||||||
|
%tr{ id: "event-#{event.id}" }
|
||||||
|
%td
|
||||||
|
= event.id
|
||||||
|
|
||||||
|
%td
|
||||||
|
= link_to event.title,
|
||||||
|
admin_conference_program_event_path(conference_id, event)
|
||||||
|
|
||||||
|
- if rating_enabled
|
||||||
|
%td.col-md-1{ data: { order: event.average_rating } }
|
||||||
|
= render 'datatable_row_rating',
|
||||||
|
event: event,
|
||||||
|
show_votes: show_votes,
|
||||||
|
max_rating: max_rating
|
||||||
|
|
||||||
|
- if event.submitter
|
||||||
|
%td
|
||||||
|
= link_to event.submitter.name, admin_user_path(event.submitter)
|
||||||
|
- unless event.submitter.registrations.for_conference(event.conference)
|
||||||
|
%span.label.label-warning Unregistered
|
||||||
|
- else
|
||||||
|
%td.bg-danger
|
||||||
|
Unknown submitter
|
||||||
|
|
||||||
|
%td
|
||||||
|
- event.speakers_ordered.each do |speaker|
|
||||||
|
.speaker
|
||||||
|
= link_to speaker.name, admin_user_path(speaker)
|
||||||
|
- unless speaker.registrations.for_conference(event.conference)
|
||||||
|
%span.label.label-danger Unregistered
|
||||||
|
|
||||||
|
- if @program.languages.present?
|
||||||
|
%td
|
||||||
|
= event.language
|
||||||
|
|
||||||
|
%td.text-center{ data: { order: event.require_registration.to_s } }
|
||||||
|
= event_switch_checkbox(event, :require_registration, conference_id)
|
||||||
|
- if event.require_registration
|
||||||
|
= link_to registered_text(event),
|
||||||
|
registrations_admin_conference_program_event_path(conference_id,
|
||||||
|
event),
|
||||||
|
class: 'btn btn-xs btn-default'
|
||||||
|
|
||||||
|
%td.text-center{ data: { order: event.is_highlight.to_s } }
|
||||||
|
= event_switch_checkbox(event, :is_highlight, conference_id)
|
||||||
|
|
||||||
|
%td
|
||||||
|
= event_type_dropdown(event, event_types, conference_id)
|
||||||
|
|
||||||
|
%td
|
||||||
|
= track_dropdown(event, tracks, conference_id)
|
||||||
|
|
||||||
|
%td
|
||||||
|
= difficulty_dropdown(event, difficulty_levels, conference_id)
|
||||||
|
|
||||||
|
%td
|
||||||
|
= state_dropdown(event, conference_id, email_settings)
|
||||||
|
|
||||||
|
%td.text-center
|
||||||
|
= link_to "#{event.comments_count}",
|
||||||
|
admin_conference_program_event_path(conference_id, event),
|
||||||
|
anchor: 'comments-div'
|
||||||
12
app/views/admin/events/_datatable_row_rating.haml
Normal file
12
app/views/admin/events/_datatable_row_rating.haml
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
- if show_votes
|
||||||
|
%div{ data: { toggle: 'tooltip' }, title: rating_tooltip(event, max_rating) }<
|
||||||
|
= rating_stars(event.average_rating, max_rating, avgrate: true)
|
||||||
|
|
||||||
|
.clearfix
|
||||||
|
- if event.voted?(current_user)
|
||||||
|
%span.label.label-success
|
||||||
|
You voted:
|
||||||
|
= rating_fraction(event.user_rating(current_user), max_rating)
|
||||||
|
- else
|
||||||
|
%span.label.label-danger
|
||||||
|
Not rated
|
||||||
21
app/views/admin/events/_export_menu.haml
Normal file
21
app/views/admin/events/_export_menu.haml
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
.btn-group
|
||||||
|
%button.btn.btn-success.dropdown-toggle{ data: { toggle: 'dropdown' } }
|
||||||
|
Export
|
||||||
|
= export_format.upcase
|
||||||
|
%span.caret
|
||||||
|
%ul.dropdown-menu{ role: 'menu' }
|
||||||
|
%li
|
||||||
|
= link_to 'All Events',
|
||||||
|
admin_conference_program_events_path(conference_id,
|
||||||
|
format: export_format,
|
||||||
|
event_export_option: 'all')
|
||||||
|
%li
|
||||||
|
= link_to 'Confirmed Events',
|
||||||
|
admin_conference_program_events_path(conference_id,
|
||||||
|
format: export_format,
|
||||||
|
event_export_option: 'confirmed')
|
||||||
|
%li
|
||||||
|
= link_to 'All Events with Comments',
|
||||||
|
admin_conference_program_events_path(conference_id,
|
||||||
|
format: export_format,
|
||||||
|
event_export_option: 'all_with_comments')
|
||||||
|
|
@ -1,188 +1,136 @@
|
||||||
.row
|
- cache ['admin/event', @conference, @event, @event_types, @tracks, @difficulty_levels] do
|
||||||
.col-md-12
|
.row
|
||||||
%h3
|
.col-md-12
|
||||||
= @event.title
|
%h3
|
||||||
%br
|
= @event.title
|
||||||
%small
|
%br
|
||||||
= @event.subtitle
|
%small
|
||||||
.btn-group.pull-right
|
= @event.subtitle
|
||||||
= link_to 'Registrations', registrations_admin_conference_program_event_path(@conference.short_title, @event), class: 'btn btn-success'
|
.btn-group.pull-right
|
||||||
= link_to 'Edit', edit_admin_conference_program_event_path(@conference.short_title, @event), class: 'btn btn-mini btn-primary'
|
= link_to 'Registrations', registrations_admin_conference_program_event_path(@conference.short_title, @event), class: 'btn btn-success'
|
||||||
|
= link_to 'Edit', edit_admin_conference_program_event_path(@conference.short_title, @event), class: 'btn btn-mini btn-primary'
|
||||||
|
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
%table.table
|
%table.table
|
||||||
%tr
|
%tr
|
||||||
%td.col-md-2
|
%td.col-md-2
|
||||||
%b Type
|
%b Type
|
||||||
%td
|
%td
|
||||||
.dropdown
|
= event_type_dropdown(@event, @event_types, @conference.short_title)
|
||||||
= link_to '#', class: 'dropdown-toggle', id: 'type-dropdown', 'data-toggle' => 'dropdown' do
|
|
||||||
- if @event.event_type.nil?
|
|
||||||
Event Type
|
|
||||||
- else
|
|
||||||
= @event.event_type.title
|
|
||||||
<b class='caret'></b>
|
|
||||||
%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
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%b Highlight
|
|
||||||
%td
|
|
||||||
= check_box_tag @conference.short_title, @event.id, @event.is_highlight,
|
|
||||||
method: :patch, url: "/admin/conferences/#{@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' }
|
|
||||||
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%b State
|
|
||||||
%td
|
|
||||||
.dropdown
|
|
||||||
= link_to '#', class: 'dropdown-toggle', 'data-toggle' => 'dropdown' do
|
|
||||||
= @event.state.humanize
|
|
||||||
<b class='caret'></b>
|
|
||||||
%ul.dropdown-menu
|
|
||||||
= render 'change_state_dropdown', event: @event
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%b Track
|
|
||||||
%td
|
|
||||||
.dropdown
|
|
||||||
= link_to '#', class: 'dropdown-toggle', id: 'track-dropdown', 'data-toggle' => 'dropdown' do
|
|
||||||
- if @event.track.nil?
|
|
||||||
Track
|
|
||||||
- else
|
|
||||||
= @event.track.name
|
|
||||||
<b class="caret"></b>
|
|
||||||
%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
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%b Difficulty
|
|
||||||
%td
|
|
||||||
.dropdown
|
|
||||||
= link_to '#', class: 'dropdown-toggle', id: 'difficulty-dropdown', 'data-toggle' => 'dropdown' do
|
|
||||||
- if @event.difficulty_level.nil?
|
|
||||||
Difficulty Level
|
|
||||||
- else
|
|
||||||
= @event.difficulty_level.title
|
|
||||||
<b class="caret"></b>
|
|
||||||
%ul.dropdown-menu
|
|
||||||
- @difficulty_levels.each do |difficulty|
|
|
||||||
%li= link_to difficulty.title, admin_conference_program_event_path(@conference.short_title,
|
|
||||||
@event,
|
|
||||||
event: { difficulty_level_id: difficulty.id }),
|
|
||||||
method: :patch
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%b Requires Registration
|
|
||||||
%td
|
|
||||||
= check_box_tag @conference.short_title, @event.id, @event.require_registration,
|
|
||||||
method: :patch, url: "/admin/conferences/#{@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
|
|
||||||
= registered_text(@event)
|
|
||||||
|
|
||||||
- if @program.languages.present?
|
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
%b Language
|
%b Highlight
|
||||||
%td
|
%td
|
||||||
= @event.language
|
= event_switch_checkbox(@event, :is_highlight, @conference.short_title)
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
%b State
|
||||||
|
%td
|
||||||
|
= state_dropdown(@event, @conference.short_title, @conference.email_settings)
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
%b Track
|
||||||
|
%td
|
||||||
|
= track_dropdown(@event, @tracks, @conference.short_title)
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
%b Difficulty
|
||||||
|
%td
|
||||||
|
= difficulty_dropdown(@event, @difficulty_levels, @conference.short_title)
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
%b Requires Registration
|
||||||
|
%td
|
||||||
|
= event_switch_checkbox(@event, :require_registration, @conference.short_title)
|
||||||
|
- if @event.require_registration
|
||||||
|
= registered_text(@event)
|
||||||
|
|
||||||
- unless @event.room.nil?
|
- if @program.languages.present?
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
%b Language
|
||||||
|
%td
|
||||||
|
= @event.language
|
||||||
|
|
||||||
|
- unless @event.room.nil?
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
%b Room
|
||||||
|
%td
|
||||||
|
= @event.room.name
|
||||||
|
- unless @event.time.nil?
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
%b Scheduled time
|
||||||
|
%td
|
||||||
|
= time_with_timezone(@event.time)
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
%b Room
|
%b Submitter
|
||||||
%td
|
%td
|
||||||
= @event.room.name
|
|
||||||
- unless @event.time.nil?
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%b Scheduled time
|
|
||||||
%td
|
|
||||||
= time_with_timezone(@event.time)
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%b Submitter
|
|
||||||
%td
|
|
||||||
- if @program.show_voting?
|
|
||||||
= link_to @event.submitter.name, admin_user_path(@event.submitter)
|
= link_to @event.submitter.name, admin_user_path(@event.submitter)
|
||||||
(
|
(
|
||||||
= link_to @event.submitter.email, "mailto: #{@event.submitter.email}"
|
= link_to @event.submitter.email, "mailto: #{@event.submitter.email}"
|
||||||
)
|
)
|
||||||
- else
|
%tr
|
||||||
%i Hidden
|
%td
|
||||||
%tr
|
%b Speakers
|
||||||
%td
|
%td
|
||||||
%b Speakers
|
|
||||||
%td
|
|
||||||
- if @program.show_voting?
|
|
||||||
- @event.speakers.each do |speaker|
|
- @event.speakers.each do |speaker|
|
||||||
%div
|
%div
|
||||||
= link_to speaker.name, admin_user_path(speaker)
|
= link_to speaker.name, admin_user_path(speaker)
|
||||||
(
|
(
|
||||||
= link_to speaker.email, "mailto: #{speaker.email}"
|
= link_to speaker.email, "mailto: #{speaker.email}"
|
||||||
)
|
)
|
||||||
- else
|
%tr
|
||||||
%i Hidden
|
%td
|
||||||
%tr
|
%b Biographies
|
||||||
%td
|
%td
|
||||||
%b Biographies
|
- @event.speakers.each do |speaker|
|
||||||
%td
|
- unless speaker.biography.blank?
|
||||||
- @event.speakers.each do |speaker|
|
%b
|
||||||
- unless speaker.biography.blank?
|
= speaker.name
|
||||||
%b
|
= markdown(speaker.biography)
|
||||||
= speaker.name
|
%tr
|
||||||
= markdown(speaker.biography)
|
%td
|
||||||
%tr
|
%b Submitted on
|
||||||
%td
|
%td= @event.created_at
|
||||||
%b Submitted on
|
%tr
|
||||||
%td= @event.created_at
|
%td
|
||||||
%tr
|
%b Last updated on
|
||||||
%td
|
%td= @event.updated_at
|
||||||
%b Last updated on
|
%tr
|
||||||
%td= @event.updated_at
|
%td
|
||||||
%tr
|
%b Abstract
|
||||||
%td
|
%td= markdown(@event.abstract)
|
||||||
%b Abstract
|
%tr
|
||||||
%td= markdown(@event.abstract)
|
%td
|
||||||
%tr
|
%b Requirements
|
||||||
%td
|
%td= simple_format(@event.description)
|
||||||
%b Requirements
|
|
||||||
%td= simple_format(@event.description)
|
|
||||||
|
|
||||||
- if @conference.program && @conference.program.rating && @conference.program.rating > 0
|
- if @conference.program.rating_enabled?
|
||||||
= render partial: 'voting'
|
= render 'voting',
|
||||||
|
event: @event,
|
||||||
|
show_votes: @program.show_voting?,
|
||||||
|
max_rating: @program.rating,
|
||||||
|
voting_period: @program.voting_period?,
|
||||||
|
votes: @votes,
|
||||||
|
conference_id: @conference.short_title
|
||||||
|
|
||||||
.row
|
- cache [@conference, @event, @comments] do
|
||||||
= link_to "Comments (#{@comment_count})", '#', id: 'event-comment-link'
|
.row
|
||||||
#comments-div
|
= link_to "Comments (#{@comment_count})", '#', id: 'event-comment-link'
|
||||||
%hr
|
#comments-div
|
||||||
%ul.media
|
%hr
|
||||||
%div
|
%ul.media
|
||||||
.row-fluid
|
%div
|
||||||
= semantic_form_for :comment, url: comment_admin_conference_program_event_path(@conference.short_title, @event.id), method: :post do |f|
|
.row-fluid
|
||||||
= f.input :body
|
= semantic_form_for :comment, url: comment_admin_conference_program_event_path(@conference.short_title, @event.id), method: :post do |f|
|
||||||
= f.submit 'Add Comment', class: 'btn btn-primary pull-right'
|
= f.input :body
|
||||||
%br
|
= f.submit 'Add Comment', class: 'btn btn-primary pull-right'
|
||||||
%br
|
%br
|
||||||
- @comments.each do |comment|
|
%br
|
||||||
%div
|
- @comments.each do |comment|
|
||||||
= render partial: 'nested_comments', locals: { comment: comment, padding: 0}
|
%div
|
||||||
|
= render partial: 'nested_comments', locals: { comment: comment, padding: 0}
|
||||||
|
|
|
||||||
|
|
@ -1,70 +1,56 @@
|
||||||
%table.table#myrating
|
%table.table#myrating
|
||||||
- if @program.show_voting?
|
- if show_votes
|
||||||
%tr
|
%tr
|
||||||
%td.col-md-2
|
%td.col-md-2
|
||||||
%b Rating
|
%b Rating
|
||||||
%td
|
%td
|
||||||
- if @event.average_rating.to_f > 0
|
#{event.average_rating}/#{max_rating}
|
||||||
#{@event.average_rating}/#{@program.rating}
|
= rating_stars(event.average_rating, max_rating, avgrate: true )
|
||||||
- else
|
|
||||||
Rating: 0/#{@program.rating}
|
|
||||||
|
|
||||||
- @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'
|
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
%b Voters
|
%b Voters
|
||||||
%td
|
%td
|
||||||
= @event.voters.length
|
= votes.length
|
||||||
- if @event.voters.length > 0
|
- unless votes.blank?
|
||||||
(
|
(
|
||||||
= @ratings.map {|x| "#{x.name}"}.join ', '
|
= votes.collect(&:name).to_sentence
|
||||||
)
|
)
|
||||||
%tr
|
%tr
|
||||||
%td.col-md-2
|
%td.col-md-2
|
||||||
%b Your vote
|
%b Your vote
|
||||||
%td
|
%td
|
||||||
- if @program.voting_period?
|
- if voting_period
|
||||||
- @program.rating.times do |counter|
|
- max_rating.times do |counter|
|
||||||
- if @event.voted?(current_user) && @event.user_rating(current_user) == counter + 1
|
- if event.user_rating(current_user) > counter
|
||||||
= link_to '', vote_admin_conference_program_event_path(@conference.short_title, @event, rating: counter + 1), remote: true, id: "label#{counter + 1}", class: 'myrating', voted: true
|
= link_to '',
|
||||||
|
vote_admin_conference_program_event_path(conference_id,
|
||||||
|
event, rating: counter + 1),
|
||||||
|
remote: true,
|
||||||
|
id: "label#{counter + 1}",
|
||||||
|
class: 'rating myrating bright',
|
||||||
|
voted: true
|
||||||
- else
|
- else
|
||||||
= link_to '', vote_admin_conference_program_event_path(@conference.short_title, @event, rating: counter + 1), remote: true, id: "label#{counter + 1}", class: 'myrating'
|
= link_to '',
|
||||||
%br
|
vote_admin_conference_program_event_path(conference_id,
|
||||||
|
event, rating: counter + 1),
|
||||||
|
remote: true,
|
||||||
|
id: "label#{counter + 1}",
|
||||||
|
class: 'rating myrating'
|
||||||
- else
|
- else
|
||||||
- @conference.program.rating.times do |counter|
|
= rating_stars(event.user_rating(current_user), max_rating, voted: true)
|
||||||
- if @event.voted?(current_user) && @event.user_rating(current_user) == counter + 1
|
= (Voting period is closed)
|
||||||
= label_tag "label#{counter + 1}", '', class: 'othersrating', voted: true
|
|
||||||
= javascript_tag "$('label[voted=true]').prevAll().andSelf().addClass('bright');"
|
|
||||||
- else
|
|
||||||
= label_tag "label#{counter + 1}", '', class: 'othersrating'
|
|
||||||
(#{voting_open_or_close(@program)})
|
|
||||||
|
|
||||||
- if @program.show_voting?
|
- if show_votes
|
||||||
- if @ratings.length > 0
|
- unless votes.blank?
|
||||||
- @ratings.each do |rate|
|
- votes.each do |vote|
|
||||||
- unless rate.user_id == current_user.id
|
- unless vote.user_id == current_user.id
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
= rate.name
|
= vote.name
|
||||||
%td
|
%td
|
||||||
- @conference.program.rating.times do |counter|
|
= rating_stars(vote, max_rating )
|
||||||
|
|
||||||
- if @event.voted?(rate.user) && @event.user_rating(rate.user) == counter + 1
|
|
||||||
= label_tag "label#{counter + 1}", "", class: 'othersrating', voted: true
|
|
||||||
= javascript_tag "$('label[voted=true]').prevAll().andSelf().addClass('bright');"
|
|
||||||
- else
|
|
||||||
= label_tag "label#{counter + 1}", "", class: 'othersrating'
|
|
||||||
:javascript
|
:javascript
|
||||||
$(function () {
|
|
||||||
var checkedId = $("a[voted='true']").attr('id');
|
|
||||||
$('a[id=' + checkedId + ']').prevAll().andSelf().addClass('bright');
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".myrating").hover(
|
$(".myrating").hover(
|
||||||
function() { // mouseover
|
function() { // mouseover
|
||||||
$(this).prevAll().andSelf().addClass('glow');
|
$(this).prevAll().andSelf().addClass('glow');
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
- if @program.show_voting?
|
|
||||||
#{event.average_rating}/#{@program.rating}
|
|
||||||
%br
|
|
||||||
#{pluralize(event.voters.length, 'voter')}
|
|
||||||
%br
|
|
||||||
- @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
|
|
||||||
|
|
||||||
- if event.voted?(current_user)
|
|
||||||
%span.label.label-success
|
|
||||||
Your rating: #{ event.user_rating(current_user) }
|
|
||||||
- else
|
|
||||||
%span.label.label-danger
|
|
||||||
Not rated
|
|
||||||
|
|
@ -6,37 +6,20 @@
|
||||||
= "(#{@events.length})" if @events.any?
|
= "(#{@events.length})" if @events.any?
|
||||||
|
|
||||||
.btn-group.pull-right
|
.btn-group.pull-right
|
||||||
%button.btn.btn-primary{ 'data-toggle' => 'modal', 'data-target' => '#mass-commercials-modal', title: 'Mass import of commercials for events' }
|
%button.btn.btn-primary{ title: 'Mass import of commercials for events',
|
||||||
|
data: { toggle: 'modal', target: '#mass-commercials-modal' } }
|
||||||
Add Commercials
|
Add Commercials
|
||||||
|
|
||||||
- if can? :create, Event
|
- if can? :create, Event
|
||||||
= link_to 'Add Event', new_admin_conference_program_event_path(@conference.short_title), class: 'button btn btn-default btn-info'
|
= link_to 'Add Event',
|
||||||
|
new_admin_conference_program_event_path(@conference.short_title),
|
||||||
|
class: 'button btn btn-default btn-info'
|
||||||
|
|
||||||
- if can? :read, Event
|
- if can? :read, Event
|
||||||
.btn-group
|
- @export_formats.each do |export_format|
|
||||||
%button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' }
|
= render 'export_menu',
|
||||||
Export PDF
|
export_format: export_format,
|
||||||
%span.caret
|
conference_id: @conference.short_title
|
||||||
%ul.dropdown-menu{ role: 'menu' }
|
|
||||||
%li= link_to 'All Events', admin_conference_program_events_path(@conference.short_title, format: :pdf, event_export_option: 'all')
|
|
||||||
%li= link_to 'Confirmed Events', admin_conference_program_events_path(@conference.short_title, format: :pdf, event_export_option: 'confirmed')
|
|
||||||
%li= link_to 'All Events with Comments', admin_conference_program_events_path(@conference.short_title, format: :pdf, event_export_option: 'all_with_comments')
|
|
||||||
.btn-group
|
|
||||||
%button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' }
|
|
||||||
Export CSV
|
|
||||||
%span.caret
|
|
||||||
%ul.dropdown-menu{ role: 'menu' }
|
|
||||||
%li= link_to 'All', admin_conference_program_events_path(@conference.short_title, format: :csv, event_export_option: 'all')
|
|
||||||
%li= link_to 'Confirmed', admin_conference_program_events_path(@conference.short_title, format: :csv, event_export_option: 'confirmed')
|
|
||||||
%li= link_to 'All with Comments', admin_conference_program_events_path(@conference.short_title, format: :csv, event_export_option: 'all_with_comments')
|
|
||||||
.btn-group
|
|
||||||
%button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' }
|
|
||||||
Export XLS
|
|
||||||
%span.caret
|
|
||||||
%ul.dropdown-menu{ role: 'menu' }
|
|
||||||
%li= link_to 'All', admin_conference_program_events_path(@conference.short_title, format: :xlsx, event_export_option: 'all')
|
|
||||||
%li= link_to 'Confirmed', admin_conference_program_events_path(@conference.short_title, format: :xlsx, event_export_option: 'confirmed')
|
|
||||||
%li= link_to 'All with Comments', admin_conference_program_events_path(@conference.short_title, format: :xlsx, event_export_option: 'all_with_comments')
|
|
||||||
|
|
||||||
%p.text-muted
|
%p.text-muted
|
||||||
All the submissions of your speakers
|
All the submissions of your speakers
|
||||||
|
|
@ -54,17 +37,25 @@
|
||||||
%b 11:https://youtube.com/myvideo
|
%b 11:https://youtube.com/myvideo
|
||||||
|
|
||||||
.modal-body
|
.modal-body
|
||||||
= semantic_form_for '', url: mass_upload_commercials_admin_conference_program_path(@conference.short_title), method: :post do |f|
|
= semantic_form_for '',
|
||||||
|
url: mass_upload_commercials_admin_conference_program_path(@conference.short_title),
|
||||||
|
method: :post do |f|
|
||||||
= f.input 'file', as: :file
|
= f.input 'file', as: :file
|
||||||
.modal-footer
|
.modal-footer
|
||||||
= f.submit 'Add', class: 'btn btn-primary'
|
= f.submit 'Add', class: 'btn btn-primary'
|
||||||
.row
|
.row
|
||||||
.col-md-4
|
.col-md-4
|
||||||
= render partial: 'admin/conferences/doughnut_chart', locals: { title: 'Events state', data: @event_distribution }
|
= render 'admin/conferences/doughnut_chart',
|
||||||
|
title: 'Events state',
|
||||||
|
data: @event_distribution
|
||||||
.col-md-4
|
.col-md-4
|
||||||
= render partial: 'admin/conferences/doughnut_chart', locals: { title: 'Confirmed events scheduled', data: @scheduled_event_distribution }
|
= render 'admin/conferences/doughnut_chart',
|
||||||
|
title: 'Confirmed events scheduled',
|
||||||
|
data: @scheduled_event_distribution
|
||||||
.col-md-4
|
.col-md-4
|
||||||
= render partial: 'admin/conferences/doughnut_chart', locals: { title: 'Tracks of confirmed events', data: @tracks_distribution_confirmed }
|
= render 'admin/conferences/doughnut_chart',
|
||||||
|
title: 'Tracks of confirmed events',
|
||||||
|
data: @tracks_distribution_confirmed
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
.margin-event-table
|
.margin-event-table
|
||||||
|
|
@ -81,7 +72,7 @@
|
||||||
%b Submitter
|
%b Submitter
|
||||||
%th
|
%th
|
||||||
%b Speakers
|
%b Speakers
|
||||||
-if @program.languages.present?
|
- if @program.languages.present?
|
||||||
%th
|
%th
|
||||||
%b Language
|
%b Language
|
||||||
%th
|
%th
|
||||||
|
|
@ -99,113 +90,14 @@
|
||||||
%th
|
%th
|
||||||
.fa.fa-comment
|
.fa.fa-comment
|
||||||
- @events.each do |event|
|
- @events.each do |event|
|
||||||
%tr
|
= render 'datatable_row',
|
||||||
%td
|
event: event,
|
||||||
= event.id
|
conference_id: @conference.short_title,
|
||||||
%td
|
program: @program,
|
||||||
= link_to event.title, admin_conference_program_event_path(@conference.short_title, event)
|
rating_enabled: @program.rating_enabled?,
|
||||||
|
show_votes: @program.show_voting?,
|
||||||
- if @program.rating_enabled?
|
max_rating: @program.rating,
|
||||||
%td.col-md-1{ 'data-order' => "#{event.average_rating}" }
|
event_types: @event_types,
|
||||||
= render partial: 'voting_index', locals: { event: event }
|
tracks: @tracks,
|
||||||
|
difficulty_levels: @difficulty_levels,
|
||||||
- if event.submitter && event.submitter.registrations && event.submitter.registrations.count < 1
|
email_settings: @conference.email_settings
|
||||||
- bgcolor = '#F7819F'
|
|
||||||
- else
|
|
||||||
- bgcolor = ''
|
|
||||||
%td{ style: "background-color: #{bgcolor}" }
|
|
||||||
- if @program.show_voting?
|
|
||||||
- unless event.submitter.nil?
|
|
||||||
= link_to event.submitter.name, admin_user_path(event.submitter)
|
|
||||||
- if event.submitter.registrations.count < 1
|
|
||||||
(Unregistered!)
|
|
||||||
- else
|
|
||||||
Unknown submitter
|
|
||||||
- else
|
|
||||||
%i Hidden
|
|
||||||
%td
|
|
||||||
- if @program.show_voting?
|
|
||||||
- event.speakers_ordered.each do |speaker|
|
|
||||||
.speaker
|
|
||||||
= link_to speaker.name, admin_user_path(speaker)
|
|
||||||
- else
|
|
||||||
%i Hidden
|
|
||||||
|
|
||||||
- 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/conferences/#{@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/conferences/#{@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
|
|
||||||
%button{ type: 'button', class: 'btn btn-link dropdown-toggle', 'data-toggle' => 'dropdown' }
|
|
||||||
- if event.event_type.nil?
|
|
||||||
Event Type
|
|
||||||
- else
|
|
||||||
= event.event_type.title
|
|
||||||
%span.caret
|
|
||||||
%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
|
|
||||||
.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
|
|
||||||
%td.text-center
|
|
||||||
= link_to "#{event.comments_count}", admin_conference_program_event_path(@conference.short_title, event), anchor: 'comments-div'
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1,10 @@
|
||||||
$('table#myrating').replaceWith("<%= escape_javascript(render :partial => 'voting') %>");
|
$('table#myrating').replaceWith(
|
||||||
|
"<%= escape_javascript(render 'voting', \
|
||||||
|
event: @event, \
|
||||||
|
show_votes: @program.show_voting?, \
|
||||||
|
max_rating: @program.rating, \
|
||||||
|
voting_period: @program.voting_period?, \
|
||||||
|
votes: @votes, \
|
||||||
|
conference_id: @conference.short_title \
|
||||||
|
) %>"
|
||||||
|
);
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class MigrateDataRemoveColumnIncludeCfpInSplashAddColumnIncludeCfp < ActiveRecor
|
||||||
TempConference.all.each do |conference|
|
TempConference.all.each do |conference|
|
||||||
cfp = TempCallForPaper.find_by(conference_id: conference.id)
|
cfp = TempCallForPaper.find_by(conference_id: conference.id)
|
||||||
|
|
||||||
if cfp && cfp.include_cfp_in_splash
|
if cfp&.include_cfp_in_splash
|
||||||
splashpage = TempSplashpage.find_or_initialize_by(conference_id: conference.id)
|
splashpage = TempSplashpage.find_or_initialize_by(conference_id: conference.id)
|
||||||
splashpage.include_cfp = cfp.include_cfp_in_splash # true
|
splashpage.include_cfp = cfp.include_cfp_in_splash # true
|
||||||
splashpage.save!
|
splashpage.save!
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ namespace :events_registrations do
|
||||||
duplicates = EventsRegistration.all.map { |er| er.id if er.valid? == false}.compact
|
duplicates = EventsRegistration.all.map { |er| er.id if er.valid? == false}.compact
|
||||||
|
|
||||||
puts "Duplicates found: #{duplicates.count}"
|
puts "Duplicates found: #{duplicates.count}"
|
||||||
if duplicates.count > 0
|
if duplicates.count.positive?
|
||||||
puts "With IDs: #{duplicates}"
|
puts "With IDs: #{duplicates}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@ feature Event do
|
||||||
visit admin_conference_program_events_path(conference.short_title)
|
visit admin_conference_program_events_path(conference.short_title)
|
||||||
expect(page).to have_content 'Example Proposal'
|
expect(page).to have_content 'Example Proposal'
|
||||||
|
|
||||||
click_button 'New'
|
click_on 'New'
|
||||||
click_link "reject_event_#{@event.id}"
|
click_link 'Reject'
|
||||||
expect(page).to have_content 'Event rejected!'
|
expect(page).to have_content 'Event rejected!'
|
||||||
@event.reload
|
@event.reload
|
||||||
expect(@event.state).to eq('rejected')
|
expect(@event.state).to eq('rejected')
|
||||||
|
|
@ -41,8 +41,8 @@ feature Event do
|
||||||
visit admin_conference_program_events_path(conference.short_title)
|
visit admin_conference_program_events_path(conference.short_title)
|
||||||
expect(page).to have_content 'Example Proposal'
|
expect(page).to have_content 'Example Proposal'
|
||||||
|
|
||||||
click_button 'New'
|
click_on 'New'
|
||||||
click_link "accept_event_#{@event.id}"
|
click_link 'Accept'
|
||||||
expect(page).to have_content 'Event accepted!'
|
expect(page).to have_content 'Event accepted!'
|
||||||
expect(page).to have_content 'Unconfirmed'
|
expect(page).to have_content 'Unconfirmed'
|
||||||
@event.reload
|
@event.reload
|
||||||
|
|
@ -54,8 +54,8 @@ feature Event do
|
||||||
visit admin_conference_program_events_path(conference.short_title)
|
visit admin_conference_program_events_path(conference.short_title)
|
||||||
expect(page).to have_content 'Example Proposal'
|
expect(page).to have_content 'Example Proposal'
|
||||||
|
|
||||||
click_button 'Rejected'
|
click_on 'Rejected'
|
||||||
click_link "restart_event_#{@event.id}"
|
click_link 'Start review'
|
||||||
expect(page).to have_content 'Review started!'
|
expect(page).to have_content 'Review started!'
|
||||||
@event.reload
|
@event.reload
|
||||||
expect(@event.state).to eq('new')
|
expect(@event.state).to eq('new')
|
||||||
|
|
|
||||||
|
|
@ -189,8 +189,8 @@ feature 'Version' do
|
||||||
click_button 'Update Proposal'
|
click_button 'Update Proposal'
|
||||||
|
|
||||||
visit admin_conference_program_events_path(conference.short_title)
|
visit admin_conference_program_events_path(conference.short_title)
|
||||||
click_button 'New'
|
click_on 'New'
|
||||||
click_link 'Reject event'
|
click_link 'Reject'
|
||||||
|
|
||||||
visit conference_program_proposals_path(conference_id: conference.short_title)
|
visit conference_program_proposals_path(conference_id: conference.short_title)
|
||||||
within('#events') do
|
within('#events') do
|
||||||
|
|
@ -198,15 +198,15 @@ feature 'Version' do
|
||||||
end
|
end
|
||||||
|
|
||||||
visit admin_conference_program_events_path(conference.short_title)
|
visit admin_conference_program_events_path(conference.short_title)
|
||||||
click_button 'New'
|
click_on 'New'
|
||||||
click_link 'Accept event'
|
click_link 'Accept'
|
||||||
|
|
||||||
visit conference_program_proposals_path(conference_id: conference.short_title)
|
visit conference_program_proposals_path(conference_id: conference.short_title)
|
||||||
click_link 'Confirm'
|
click_link 'Confirm'
|
||||||
|
|
||||||
visit admin_conference_program_events_path(conference.short_title)
|
visit admin_conference_program_events_path(conference.short_title)
|
||||||
click_button 'Confirmed'
|
click_on 'Confirmed'
|
||||||
click_link 'Cancel event'
|
click_link 'Cancel'
|
||||||
|
|
||||||
visit admin_revision_history_path
|
visit admin_revision_history_path
|
||||||
expect(page).to have_text("#{organizer.name} submitted new event ABC in conference #{conference.short_title}")
|
expect(page).to have_text("#{organizer.name} submitted new event ABC in conference #{conference.short_title}")
|
||||||
|
|
|
||||||
|
|
@ -18,4 +18,18 @@ describe EventsHelper, type: :helper do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#rating_tooltip' do
|
||||||
|
let(:max_rating) { 5 }
|
||||||
|
let(:event) { create(:event) }
|
||||||
|
let(:average_rating) { "#{event.average_rating}/#{max_rating}" }
|
||||||
|
let(:vote_count) { pluralize(event.voters.length, 'vote') }
|
||||||
|
|
||||||
|
it 'includes the average rating' do
|
||||||
|
expect(rating_tooltip(event, max_rating)).to match(average_rating)
|
||||||
|
end
|
||||||
|
it 'includes the vote count' do
|
||||||
|
expect(rating_tooltip(event, max_rating)).to match(vote_count)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue