Rebuild rubocop TODOs after auto-correcting
This commit is contained in:
parent
31c50255e9
commit
84dbb52d11
580 changed files with 3689 additions and 3133 deletions
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
module VolunteersHelper
|
||||
def can_manage_volunteers?(conference)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module ApplicationHelper
|
||||
# Returns a string build from the start and end date of the given conference.
|
||||
#
|
||||
|
|
@ -60,7 +62,7 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def difficulty_levels(conference)
|
||||
all = conference.program.difficulty_levels.map {|t| t.title}
|
||||
all = conference.program.difficulty_levels.map(&:title)
|
||||
first = all[0...-1]
|
||||
last = all[-1]
|
||||
ts = ''
|
||||
|
|
@ -83,16 +85,14 @@ module ApplicationHelper
|
|||
# Output will be 'title, description and conference'
|
||||
def updated_attributes(version)
|
||||
version.changeset
|
||||
.reject{ |_, values| values[0].blank? && values[1].blank? }
|
||||
.keys.map{ |key| key.gsub('_id', '').tr('_', ' ')}.join(', ')
|
||||
.reverse.sub(',', ' dna ').reverse
|
||||
.reject { |_, values| values[0].blank? && values[1].blank? }
|
||||
.keys.map { |key| key.gsub('_id', '').tr('_', ' ') }.join(', ')
|
||||
.reverse.sub(',', ' dna ').reverse
|
||||
end
|
||||
|
||||
def normalize_array_length(hashmap, length)
|
||||
hashmap.each_value do |value|
|
||||
if value.length < length
|
||||
value.fill(value[-1], value.length...length)
|
||||
end
|
||||
value.fill(value[-1], value.length...length) if value.length < length
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -115,28 +115,26 @@ module ApplicationHelper
|
|||
other_event_schedules.each do |other_event_schedule|
|
||||
next unless other_event_schedule.event.confirmed?
|
||||
other_event_time_range = (other_event_schedule.start_time.strftime '%Y-%m-%d %H:%M')...(other_event_schedule.end_time.strftime '%Y-%m-%d %H:%M')
|
||||
if (event_time_range.to_a & other_event_time_range.to_a).present?
|
||||
concurrent_events << other_event_schedule.event
|
||||
end
|
||||
concurrent_events << other_event_schedule.event if (event_time_range.to_a & other_event_time_range.to_a).present?
|
||||
end
|
||||
concurrent_events
|
||||
end
|
||||
|
||||
def speaker_links(event)
|
||||
safe_join(event.speakers.map{ |speaker| link_to speaker.name, admin_user_path(speaker) }, ',')
|
||||
safe_join(event.speakers.map { |speaker| link_to speaker.name, admin_user_path(speaker) }, ',')
|
||||
end
|
||||
|
||||
def speaker_selector_input(form)
|
||||
users = User.active.pluck(:id, :name, :username, :email).map { |user| [user[0], user[1].blank? ? user[2] : user[1], user[2], user[3]] }.sort_by { |user| user[1].downcase }
|
||||
users = User.active.pluck(:id, :name, :username, :email).map { |user| [user[0], user[1].presence || user[2], user[2], user[3]] }.sort_by { |user| user[1].downcase }
|
||||
form.input :speakers, as: :select,
|
||||
collection: options_for_select(users.map {|user| ["#{user[1]} (#{user[2]}) #{user[3]}", user[0]]}, @event.speakers.map(&:id)),
|
||||
collection: options_for_select(users.map { |user| ["#{user[1]} (#{user[2]}) #{user[3]}", user[0]] }, @event.speakers.map(&:id)),
|
||||
include_blank: false, label: 'Speakers', input_html: { class: 'select-help-toggle', multiple: 'true' }
|
||||
end
|
||||
|
||||
def responsibles_selector_input(form)
|
||||
users = User.active.pluck(:id, :name, :username, :email).map { |user| [user[0], user[1].blank? ? user[2] : user[1], user[2], user[3]] }.sort_by { |user| user[1].downcase }
|
||||
users = User.active.pluck(:id, :name, :username, :email).map { |user| [user[0], user[1].presence || user[2], user[2], user[3]] }.sort_by { |user| user[1].downcase }
|
||||
form.input :responsibles, as: :select,
|
||||
collection: options_for_select(users.map {|user| ["#{user[1]} (#{user[2]}) #{user[3]}", user[0]]}, @booth.responsibles.map(&:id)),
|
||||
collection: options_for_select(users.map { |user| ["#{user[1]} (#{user[2]}) #{user[3]}", user[0]] }, @booth.responsibles.map(&:id)),
|
||||
include_blank: false, label: 'Responsibles', input_html: { class: 'select-help-toggle', multiple: 'true' },
|
||||
hint: 'The people responsible for the booth. You can only select existing users.'
|
||||
end
|
||||
|
|
@ -154,9 +152,7 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def rescheduling_hint(affected_event_count)
|
||||
if affected_event_count > 0
|
||||
"You have #{affected_event_count} scheduled #{'event'.pluralize(affected_event_count)}. Changing the conference hours will unschedule those scheduled outside the conference hours."
|
||||
end
|
||||
"You have #{affected_event_count} scheduled #{'event'.pluralize(affected_event_count)}. Changing the conference hours will unschedule those scheduled outside the conference hours." if affected_event_count > 0
|
||||
end
|
||||
|
||||
##
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module ConferenceHelper
|
||||
# Return true if only call_for_papers or call_for_tracks or call_for_booths is open
|
||||
def one_call_open(*calls)
|
||||
|
|
@ -6,7 +8,7 @@ module ConferenceHelper
|
|||
# Return true if exactly two of those calls are open: call_for_papers , call_for_tracks , call_for_booths
|
||||
|
||||
def two_calls_open(*calls)
|
||||
calls.count{ |call| call.try(:open?) } == 2
|
||||
calls.count { |call| call.try(:open?) } == 2
|
||||
end
|
||||
|
||||
# URL for sponsorship emails
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DateTimeHelper
|
||||
##
|
||||
# Includes functions related to date or time manipulations
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module EventsHelper
|
||||
##
|
||||
# Includes functions related to events
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module FormatHelper
|
||||
##
|
||||
# Includes functions related to formatting (like adding classes, colors)
|
||||
|
|
@ -44,24 +46,23 @@ module FormatHelper
|
|||
def target_progress_color(progress)
|
||||
progress = progress.to_i
|
||||
result =
|
||||
case
|
||||
when progress >= 90 then 'green'
|
||||
when progress < 90 && progress >= 80 then 'orange'
|
||||
else 'red'
|
||||
end
|
||||
if progress >= 90 then 'green'
|
||||
elsif progress < 90 && progress >= 80 then 'orange'
|
||||
else 'red'
|
||||
end
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
def days_left_color(days_left)
|
||||
days_left = days_left.to_i
|
||||
if days_left > 30
|
||||
result = 'green'
|
||||
elsif days_left < 30 && days_left > 10
|
||||
result = 'orange'
|
||||
else
|
||||
result = 'red'
|
||||
end
|
||||
result = if days_left > 30
|
||||
'green'
|
||||
elsif days_left < 30 && days_left > 10
|
||||
'orange'
|
||||
else
|
||||
'red'
|
||||
end
|
||||
result
|
||||
end
|
||||
|
||||
|
|
@ -116,7 +117,7 @@ module FormatHelper
|
|||
end
|
||||
|
||||
def word_pluralize(count, singular, plural = nil)
|
||||
word = if (count == 1 || count =~ /^1(\.0+)?$/)
|
||||
word = if count == 1 || count =~ /^1(\.0+)?$/
|
||||
singular
|
||||
else
|
||||
plural || singular.pluralize
|
||||
|
|
@ -134,7 +135,7 @@ module FormatHelper
|
|||
g = hexcolor[3..4].to_i(16)
|
||||
b = hexcolor[5..6].to_i(16)
|
||||
yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000
|
||||
(yiq >= 128) ? 'black' : 'white'
|
||||
yiq >= 128 ? 'black' : 'white'
|
||||
end
|
||||
|
||||
def td_height(rooms)
|
||||
|
|
@ -178,17 +179,15 @@ module FormatHelper
|
|||
item_class = 'item'
|
||||
item_class += ' first' if number == 0
|
||||
item_class += ' last' if number == (carousel_number - 1)
|
||||
if (col && ((col / num_cols) == number)) || (!col && number == 0)
|
||||
item_class += ' active'
|
||||
end
|
||||
item_class += ' active' if (col && ((col / num_cols) == number)) || (!col && number == 0)
|
||||
item_class
|
||||
end
|
||||
|
||||
def selected_scheduled?(schedule)
|
||||
(schedule == @selected_schedule) ? 'Yes' : 'No'
|
||||
schedule == @selected_schedule ? 'Yes' : 'No'
|
||||
end
|
||||
|
||||
def markdown(text, escape_html=true)
|
||||
def markdown(text, escape_html = true)
|
||||
return '' if text.nil?
|
||||
|
||||
options = {
|
||||
|
|
@ -200,7 +199,7 @@ module FormatHelper
|
|||
markdown.render(text).html_safe
|
||||
end
|
||||
|
||||
def markdown_hint(text='')
|
||||
def markdown_hint(text = '')
|
||||
markdown("#{text} Please look at #{link_to '**Markdown Syntax**', 'https://daringfireball.net/projects/markdown/syntax', target: '_blank'} to format your text", false)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module PathsHelper
|
||||
##
|
||||
# Includes functions related to links or redirects
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module UsersHelper
|
||||
##
|
||||
# Includes functions related to users
|
||||
|
|
@ -12,10 +14,8 @@ module UsersHelper
|
|||
Devise.omniauth_providers.each do |provider|
|
||||
provider_key = "#{provider}_key"
|
||||
provider_secret = "#{provider}_secret"
|
||||
unless Rails.application.secrets.send(provider_key).blank? || Rails.application.secrets.send(provider_secret).blank?
|
||||
providers << provider
|
||||
end
|
||||
providers << provider if !ENV["OSEM_#{provider.upcase}_KEY"].blank? && !ENV["OSEM_#{provider.upcase}_SECRET"].blank?
|
||||
providers << provider unless Rails.application.secrets.send(provider_key).blank? || Rails.application.secrets.send(provider_secret).blank?
|
||||
providers << provider if ENV["OSEM_#{provider.upcase}_KEY"].present? && ENV["OSEM_#{provider.upcase}_SECRET"].present?
|
||||
end
|
||||
|
||||
providers.uniq
|
||||
|
|
@ -25,6 +25,6 @@ module UsersHelper
|
|||
# Outputs the roles of a user, including the conferences for which the user has the roles
|
||||
# Eg. organizer(oSC13, oSC14), cfp(oSC12, oSC13)
|
||||
def show_roles(roles)
|
||||
roles.map{ |x| x[0].titleize + ' (' + x[1].join(', ') + ')' }.join ', '
|
||||
roles.map { |x| x[0].titleize + ' (' + x[1].join(', ') + ')' }.join ', '
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module VersionsHelper
|
||||
##
|
||||
# Groups functions related to change description
|
||||
|
|
@ -119,10 +121,9 @@ module VersionsHelper
|
|||
end
|
||||
|
||||
def event_change_description(version)
|
||||
case
|
||||
when version.event == 'create' then 'submitted new'
|
||||
if version.event == 'create' then 'submitted new'
|
||||
|
||||
when version.changeset['state']
|
||||
elsif version.changeset['state']
|
||||
case version.changeset['state'][1]
|
||||
when 'unconfirmed' then 'accepted'
|
||||
when 'withdrawn' then 'withdrew'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue