Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mkhairi committed Aug 12, 2024
1 parent 236662e commit 77c7abc
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 59 deletions.
6 changes: 3 additions & 3 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module ApplicationHelper
def container_class
if controller_name == 'pages' && action_name == 'welcome'
'container-full'
if controller_name == "pages" && action_name == "welcome"
"container-full"
else
'container'
"container"
end
end

Expand Down
22 changes: 11 additions & 11 deletions app/helpers/icons_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@ def icon(name, text = nil, options = {})
options = text
text = nil
end
options.reverse_merge!({ class: 'w-6 h-6' })
options['id'] = nil
options['class'] = options[:class]
options['width'] = '24px'
options['height'] = '24px'
options.reverse_merge!({ class: "w-6 h-6" })
options["id"] = nil
options["class"] = options[:class]
options["width"] = "24px"
options["height"] = "24px"

type = options.delete(:type) || 'outline'
type = options.delete(:type) || "outline"

tooltip = options.delete(:tooltip)
icon = InlineSvg::TransformPipeline.generate_html_from(read_svg_icon(name.to_s, type), options)
icon = icon.html_safe + content_tag(:span, text, class: 'ms-1') if text.blank?
icon = icon.html_safe + content_tag(:span, text, class: "ms-1") if text.blank?

return icon unless tooltip

content_tag(:span, icon, class: 'tooltip', data: { tip: tooltip })
content_tag(:span, icon, class: "tooltip", data: { tip: tooltip })
rescue StandardError
tag.span(name.to_s.dasherize) + content_tag(:span, text, class: 'ms-1')
tag.span(name.to_s.dasherize) + content_tag(:span, text, class: "ms-1")
end

private

def icons_path(type = 'outline')
def icons_path(type = "outline")
Rails.public_path.join("assets/icons/heroicons/#{type}")
end

def read_svg_icon(filename, type = 'outline')
def read_svg_icon(filename, type = "outline")
File.read("#{icons_path(type)}/#{filename.dasherize}.svg")
end
end
64 changes: 32 additions & 32 deletions app/helpers/themes_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,38 @@
module ThemesHelper
def themes
[
'light',
'dark',
'cupcake',
'bumblebee',
'emerald',
'corporate',
'synthwave',
'retro',
'cyberpunk',
'valentine',
'halloween',
'garden',
'forest',
'aqua',
'lofi',
'pastel',
'fantasy',
'wireframe',
'black',
'luxury',
'dracula',
'cmyk',
'autumn',
'business',
'acid',
'lemonade',
'night',
'coffee',
'winter',
'dim',
'nord',
'sunset'
"light",
"dark",
"cupcake",
"bumblebee",
"emerald",
"corporate",
"synthwave",
"retro",
"cyberpunk",
"valentine",
"halloween",
"garden",
"forest",
"aqua",
"lofi",
"pastel",
"fantasy",
"wireframe",
"black",
"luxury",
"dracula",
"cmyk",
"autumn",
"business",
"acid",
"lemonade",
"night",
"coffee",
"winter",
"dim",
"nord",
"sunset"
]
end
end
4 changes: 2 additions & 2 deletions app/inputs/tinymce_input.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ class TinymceInput < SimpleForm::Inputs::Base
def input(wrapper_options = nil)
options[:wrapper_html] ||= {}
options[:wrapper_html][:data] = { controller: :tinymce }
input_html_options[:data] = { tinymce_target: 'input' }
input_html_options[:class] = 'tinymce'
input_html_options[:data] = { tinymce_target: "input" }
input_html_options[:class] = "tinymce"
input_html_options[:rows] ||= 20
merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
@builder.text_area(attribute_name, merged_input_options)
Expand Down
4 changes: 2 additions & 2 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ class User < ApplicationRecord
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable,
authentication_keys: [:login]
authentication_keys: [ :login ]

validates :username, presence: true, length: { maximum: 20 }, username: true, uniqueness: true

def self.find_for_database_authentication(warden_conditions)
conditions = warden_conditions.dup
if login = conditions.delete(:login)
# when allowing distinct User records with, e.g., "username" and "UserName"...
where(conditions).where(['username = :value OR lower(email) = :value', { value: login }]).first
where(conditions).where([ "username = :value OR lower(email) = :value", { value: login } ]).first
else
where(conditions).first
end
Expand Down
10 changes: 5 additions & 5 deletions config/initializers/devise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class
# with default "from" parameter.
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"

# Configure the class responsible to send e-mails.
# config.mailer = 'Devise::Mailer'
Expand All @@ -36,7 +36,7 @@
# Load and configure the ORM. Supports :active_record (default) and
# :mongoid (bson_ext recommended) by default. Other ORMs may be
# available as additional gems.
require 'devise/orm/active_record'
require "devise/orm/active_record"

# ==> Configuration for any authentication mechanism
# Configure which keys are used when authenticating a user. The default is
Expand All @@ -58,12 +58,12 @@
# Configure which authentication keys should be case-insensitive.
# These keys will be downcased upon creating or modifying a user and when used
# to authenticate or find a user. Default is :email.
config.case_insensitive_keys = [:email]
config.case_insensitive_keys = [ :email ]

# Configure which authentication keys should have whitespace stripped.
# These keys will have whitespace before and after removed upon creating or
# modifying a user and when used to authenticate or find a user. Default is :email.
config.strip_whitespace_keys = [:email]
config.strip_whitespace_keys = [ :email ]

# Tell if authentication through request.params is enabled. True by default.
# It can be set to an array that will enable params authentication only for the
Expand Down Expand Up @@ -97,7 +97,7 @@
# Notice that if you are skipping storage for all authentication paths, you
# may want to disable generating routes to Devise's sessions controller by
# passing skip: :sessions to `devise_for` in your config/routes.rb
config.skip_session_storage = [:http_auth]
config.skip_session_storage = [ :http_auth ]

# By default, Devise cleans up the CSRF token on authentication to
# avoid CSRF token fixation attacks. This means that, when using AJAX
Expand Down
3 changes: 1 addition & 2 deletions db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/validators/username_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ def validate_each(record, attribute, value)
return if value =~ VALID_NAME_REGEX

record.errors.add attribute,
(options[:message] || 'should only contain letters, numbers, underscore, hyphen')
(options[:message] || "should only contain letters, numbers, underscore, hyphen")
end
end
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2069,7 +2069,7 @@ esbuild-rails@^1.0.7:
dependencies:
fast-glob "^3.2.12"

esbuild@^0.23.1:
esbuild@^0.23.0:
version "0.23.0"
resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.23.0.tgz#de06002d48424d9fdb7eb52dbe8e95927f852599"
integrity sha512-1lvV17H2bMYda/WaFb2jLPeHU3zml2k4/yagNMG8Q/YtfMjCwEUZa2eXXMgZTVSL5q1n4H7sQ0X6CdJDqqeCFA==
Expand Down

0 comments on commit 77c7abc

Please sign in to comment.