app/helpers/alchemy/admin/navigation_helper.rb in alchemy_cms-7.0.0.pre.a vs app/helpers/alchemy/admin/navigation_helper.rb in alchemy_cms-7.0.0.pre.b
- old
+ new
@@ -12,11 +12,11 @@
#
def alchemy_main_navigation_entry(alchemy_module)
render(
"alchemy/admin/partials/main_navigation_entry",
alchemy_module: alchemy_module,
- navigation: alchemy_module["navigation"],
+ navigation: alchemy_module["navigation"]
)
end
# Used for checking the main navi permissions
#
@@ -35,21 +35,21 @@
# can :index, :my_admin_posts
#
def navigate_module(navigation)
[
navigation["action"].to_sym,
- navigation["controller"].to_s.gsub(/\A\//, "").gsub(/\//, "_").to_sym,
+ navigation["controller"].to_s.gsub(/\A\//, "").tr("/", "_").to_sym
]
end
# CSS classes for main navigation entry.
#
def main_navigation_css_classes(navigation)
[
"main_navi_entry",
admin_mainnavi_active?(navigation) ? "active" : nil,
- navigation.key?("sub_navigation") ? "has_sub_navigation" : nil,
+ navigation.key?("sub_navigation") ? "has_sub_navigation" : nil
].compact
end
# Returns true if given navi entry is in params controller and action
#
@@ -73,11 +73,11 @@
# A Alchemy module definition
#
def url_for_module(alchemy_module)
route_from_engine_or_main_app(
alchemy_module["engine_name"],
- url_options_for_module(alchemy_module),
+ url_options_for_module(alchemy_module)
)
end
# Returns url for given Alchemy module sub navigation entry.
#
@@ -92,11 +92,11 @@
alchemy_module = module_definition_for(navigation)
return if alchemy_module.nil?
route_from_engine_or_main_app(
alchemy_module["engine_name"],
- url_options_for_navigation_entry(navigation),
+ url_options_for_navigation_entry(navigation)
)
end
# Alchemy modules for main navigation.
#
@@ -124,11 +124,11 @@
# @param [Hash]
# url options hash passed to +url_for+ helper
#
def route_from_engine_or_main_app(engine_name, url_options)
if engine_name.present?
- eval(engine_name).url_for(url_options)
+ eval(engine_name).url_for(url_options) # rubocop:disable Security/Eval
else
main_app.url_for(url_options)
end
end
@@ -149,10 +149,10 @@
def url_options_for_navigation_entry(entry)
{
controller: entry["controller"],
action: entry["action"],
only_path: true,
- params: entry["params"],
+ params: entry["params"]
}.delete_if { |_k, v| v.nil? }
end
# Retrieves the current Alchemy module from controller and index action.
#