Fix Rubocop issues

This commit is contained in:
CactusPuppy 2021-02-18 21:03:28 -08:00
parent a45008640f
commit 7f5d06b23c
No known key found for this signature in database
GPG key ID: 4B33B0A3E15E2C82
27 changed files with 94 additions and 83 deletions

View file

@ -112,7 +112,7 @@ module ApplicationHelper
concurrent_events << other_event_schedule.event
end
end
concurrent_events.sort_by { |event_schedule| event_schedule.room&.order }
concurrent_events.sort_by { |schedule| schedule.room&.order }
end
def speaker_links(event)
@ -188,7 +188,7 @@ module ApplicationHelper
'hidden' if Date.today > conference.end_date
end
# TODO:Snap!Con: Replace this with a search for a conference logo.
# TODO: Snap!Con: Replace this with a search for a conference logo.
def nav_root_link_for(conference = nil)
path = conference&.id.present? ? conference_path(conference) : root_path
link_to(
@ -201,8 +201,8 @@ module ApplicationHelper
def nav_link_text(conference)
conference.try(:organization).try(:name) ||
ENV['OSEM_NAME'] ||
'OSEM'
ENV['OSEM_NAME'] ||
'OSEM'
end
# returns the url to be used for logo on basis of sponsorship level position

View file

@ -24,6 +24,7 @@ module ConferenceHelper
def short_ticket_description(ticket)
return unless ticket.description
markdown(ticket.description.split("\n").first&.strip)
end
end

View file

@ -1,5 +1,7 @@
# frozen_string_literal: true
# TODO: Split this module into smaller modules
# rubocop:disable Metrics/ModuleLength
module EventsHelper
##
# Includes functions related to events
@ -164,7 +166,7 @@ module EventsHelper
conference_id,
event.id,
event.send(attribute),
url: admin_conference_program_event_path(
url: admin_conference_program_event_path(
conference_id,
event,
event: { attribute => nil }
@ -183,7 +185,7 @@ module EventsHelper
if current_user.roles.where(id: conference.roles).any?
# Show Pre-Event links for any memeber of the conference team.
link_to("Join Live Event #{'(Admin link)' unless is_now}",
event.url, target: '_blank')
event.url, target: '_blank')
elsif current_user.registered_to_event?(conference)
if is_now
link_to('Join Live Event', event.url, target: '_blank')
@ -193,7 +195,7 @@ module EventsHelper
end
end
def calendar_timestamp(timestamp, timezone)
def calendar_timestamp(timestamp, _timezone)
timestamp = timestamp.in_time_zone('GMT')
timestamp -= timestamp.utc_offset
timestamp.strftime('%Y%m%dT%H%M%S')
@ -206,12 +208,12 @@ module EventsHelper
start_timestamp = calendar_timestamp(event_schedule.start_time, conference.timezone)
end_timestamp = calendar_timestamp(event_schedule.end_time, conference.timezone)
event_details = {
action: 'TEMPLATE',
text: "#{event.title} at #{conference.title}",
details: calendar_event_text(event, event_schedule, conference),
action: 'TEMPLATE',
text: "#{event.title} at #{conference.title}",
details: calendar_event_text(event, event_schedule, conference),
location: "#{event.room.name} #{event.url}",
dates: "#{start_timestamp}/#{end_timestamp}",
ctz: event_schedule.timezone
dates: "#{start_timestamp}/#{end_timestamp}",
ctz: event_schedule.timezone
}
"#{calendar_base}?#{event_details.to_param}"
end
@ -220,13 +222,13 @@ module EventsHelper
def calendar_event_text(event, event_schedule, conference)
<<~TEXT
#{conference.title} - #{event.title}
#{event_schedule.start_time.strftime("%Y %B %e - %H:%M")} #{event_schedule.timezone}
#{conference.title} - #{event.title}
#{event_schedule.start_time.strftime('%Y %B %e - %H:%M')} #{event_schedule.timezone}
More Info: #{conference_program_proposal_url(conference, event)}
Join: #{event.url}
More Info: #{conference_program_proposal_url(conference, event)}
Join: #{event.url}
#{truncate(event.abstract, length: 200)}
#{truncate(event.abstract, length: 200)}
TEXT
end
@ -256,3 +258,4 @@ module EventsHelper
end
end
end
# rubocop:enable Metrics/ModuleLength

View file

@ -184,12 +184,12 @@ module FormatHelper
return '' if text.nil?
options = {
autolink: true,
autolink: true,
space_after_headers: true,
tables: true,
strikethrough: true,
footnotes: true,
superscript: true
tables: true,
strikethrough: true,
footnotes: true,
superscript: true
}
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML.new(escape_html: escape_html), options)
markdown.render(text).html_safe