Module: Locomotive::Plugin::ClassMethods
- Defined in:
- lib/locomotive/plugin.rb
Instance Method Summary collapse
-
#default_plugin_id ⇒ Object
Override this method to specify the default plugin_id to use when Locomotive registers the plugin.
-
#javascript_context ⇒ Object
Override this method to specify ruby objects accessable via the global javascript context.
-
#liquid_filters ⇒ Object
Override this method to provide a module or array of modules to include as liquid filters in the site.
-
#liquid_tags ⇒ Object
Override this method to specify the liquid tags supplied by this plugin.
-
#plugin_loaded ⇒ Object
Override this method to provide functionality which will be executed when the CMS starts up and loads all plugins.
-
#rack_app ⇒ Object
Override this method to supply a rack app to be used for handling requests.
Instance Method Details
#default_plugin_id ⇒ Object
Override this method to specify the default plugin_id to use when Locomotive registers the plugin. This plugin_id may be overridden by Locomotive CMS.
53 54 55 |
# File 'lib/locomotive/plugin.rb', line 53 def default_plugin_id to_s.split('::').last.underscore end |
#javascript_context ⇒ Object
Override this method to specify ruby objects accessable via the global javascript context. The return value must be a hash whoes keys are the variable names and the values are the objects. The objects will be included in the global context after being prefixed with the plugin_id.
Note:
therubyracer is not able to execute class methods so please ensure
that the objects you pass in are not classes.
118 119 120 |
# File 'lib/locomotive/plugin.rb', line 118 def javascript_context {} end |
#liquid_filters ⇒ Object
Override this method to provide a module or array of modules to include as liquid filters in the site. All public methods in the module will be included as filters after being prefixed with the plugin id (#{plugin_id}_#{method_name}).
68 69 70 |
# File 'lib/locomotive/plugin.rb', line 68 def liquid_filters nil end |
#liquid_tags ⇒ Object
Override this method to specify the liquid tags supplied by this plugin. The return value must be a hash whose keys are the tag names and values are the tag classes. The tag names will be included in Locomotive’s liquid renderer after being prefixed with the plugin id (#{plugin_id}_#{tag_name}).
84 85 86 |
# File 'lib/locomotive/plugin.rb', line 84 def {} end |
#plugin_loaded ⇒ Object
Override this method to provide functionality which will be executed when the CMS starts up and loads all plugins.
90 91 |
# File 'lib/locomotive/plugin.rb', line 90 def plugin_loaded end |
#rack_app ⇒ Object
Override this method to supply a rack app to be used for handling requests. Locomotive CMS will mount this app on a path dependent on the plugin_id. See RackAppHelpers for some helper methods.
96 97 98 |
# File 'lib/locomotive/plugin.rb', line 96 def rack_app nil end |