37 lines
858 B
Ruby
37 lines
858 B
Ruby
# frozen_string_literal: true
|
|
|
|
module ApplicationHelper
|
|
def page_title
|
|
return content_for(:page_title) if content_for?(:page_title)
|
|
return site_title if defined?(site_title)
|
|
"Unknown"
|
|
end
|
|
|
|
def domain
|
|
return content_for(:domain) if content_for?(:domain)
|
|
return site_domain if defined?(site_domain)
|
|
"unknown"
|
|
end
|
|
|
|
def color
|
|
return content_for(:color) if content_for?(:color)
|
|
return site_color if defined?(site_color)
|
|
"#2C2F33"
|
|
end
|
|
|
|
def with_params(**)
|
|
params.except(:controller, :action, :index).merge(**).permit!
|
|
end
|
|
|
|
def without_search(*args)
|
|
p = params.except(:controller, :action, :index, :search)
|
|
return p.permit! if args.empty?
|
|
p.merge(search: params.fetch(:search, {}).except(*args)).permit!
|
|
end
|
|
|
|
def if_active(css, path:)
|
|
return css if request.path == path
|
|
""
|
|
end
|
|
end
|