mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-17 06:52:27 +01:00
fixed ruby syntax with linter
This commit is contained in:
parent
21a5f5591a
commit
94796bca29
@ -1,3 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Various helpers methods
|
||||
module ApplicationHelper
|
||||
|
||||
include Twitter::Autolink
|
||||
@ -19,7 +22,7 @@ module ApplicationHelper
|
||||
{ flash: 'alert-success', alert: 'alert-danger', notice: 'alert-info' }[flash_type.to_sym] || flash_type.to_s
|
||||
end
|
||||
|
||||
def flash_messages(opts = {})
|
||||
def flash_messages(_opts = {})
|
||||
flash.each do |msg_type, message|
|
||||
concat(content_tag(:div, message, class: "flash-message alert #{bootstrap_class_for(msg_type)} fade in") do
|
||||
concat content_tag(:button, 'x', class: 'close', data: { dismiss: 'alert' })
|
||||
@ -35,9 +38,9 @@ module ApplicationHelper
|
||||
|
||||
def class_exists?(class_name)
|
||||
klass = Module.const_get(class_name)
|
||||
return klass.is_a?(Class)
|
||||
klass.is_a?(Class)
|
||||
rescue NameError
|
||||
return false
|
||||
false
|
||||
end
|
||||
|
||||
##
|
||||
@ -56,7 +59,7 @@ module ApplicationHelper
|
||||
end
|
||||
|
||||
def bool_to_sym(bool)
|
||||
if (bool) then return :true else return :false end
|
||||
bool ? :true : :false # rubocop:disable Lint/BooleanSymbol
|
||||
end
|
||||
|
||||
def amount_to_f(amount)
|
||||
@ -73,8 +76,8 @@ module ApplicationHelper
|
||||
array.each do |i|
|
||||
if key.nil?
|
||||
return i if i.id == id
|
||||
else
|
||||
return i if i[key] == id
|
||||
elsif i[key] == id
|
||||
return i
|
||||
end
|
||||
end
|
||||
nil
|
||||
@ -88,21 +91,20 @@ module ApplicationHelper
|
||||
##
|
||||
def dst_correction(reference, datetime)
|
||||
res = datetime.in_time_zone(reference.time_zone.tzinfo.name)
|
||||
res = res - 1.hour if res.dst? && !reference.dst?
|
||||
res = res + 1.hour if reference.dst? && !res.dst?
|
||||
res -= 1.hour if res.dst? && !reference.dst?
|
||||
res += 1.hour if reference.dst? && !res.dst?
|
||||
res
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
## inspired by gems/actionview-4.2.5/lib/action_view/helpers/translation_helper.rb
|
||||
def scope_key_by_partial(key)
|
||||
if key.to_s.first == "."
|
||||
if @virtual_path
|
||||
@virtual_path.gsub(%r{/_?}, ".") + key.to_s
|
||||
else
|
||||
raise "Cannot use t(#{key.inspect}) shortcut because path is not available"
|
||||
end
|
||||
if key.to_s.first == '.'
|
||||
raise "Cannot use t(#{key.inspect}) shortcut because path is not available" unless @virtual_path
|
||||
|
||||
@virtual_path.gsub(%r{/_?}, '.') + key.to_s
|
||||
else
|
||||
key
|
||||
end
|
||||
|
@ -1,3 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Helpers methods about calendar availabilities
|
||||
module AvailabilityHelper
|
||||
MACHINE_COLOR = '#e4cd78'
|
||||
TRAINING_COLOR = '#bd7ae9'
|
||||
|
@ -1,3 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Helpers methods about uploading files
|
||||
module UploadHelper
|
||||
|
||||
def delete_empty_dirs
|
||||
|
Loading…
x
Reference in New Issue
Block a user