Add a plugin hook to specify a class on the body of the document

This commit is contained in:
Robin Ward
2017-09-28 13:16:51 -04:00
parent ca3d6921a0
commit 34f98f362f
2 changed files with 11 additions and 1 deletions

View File

@ -103,6 +103,12 @@ class Plugin::Instance
end
end
def add_body_class(class_name)
reloadable_patch do |plugin|
::ApplicationHelper.extra_body_classes << class_name if plugin.enabled?
end
end
# Extend a class but check that the plugin is enabled
# for class methods use `add_class_method`
def add_to_class(class_name, attr, &block)