Class: Refinery::Plugin
- Inherits:
-
Object
- Object
- Refinery::Plugin
- Defined in:
- core/lib/refinery/plugin.rb
Instance Attribute Summary (collapse)
-
- (Object) always_allow_access
Returns the value of attribute always_allow_access.
-
- (Object) class_name
Returns the value of attribute class_name.
-
- (Object) controller
Returns the value of attribute controller.
-
- (Object) dashboard
Returns the value of attribute dashboard.
-
- (Object) directory
Returns the value of attribute directory.
-
- (Object) hide_from_menu
Returns the value of attribute hide_from_menu.
-
- (Object) menu_match
Returns the value of attribute menu_match.
-
- (Object) name
Returns the value of attribute name.
-
- (Object) pathname
Returns the value of attribute pathname.
-
- (Object) plugin_activity
Returns the value of attribute plugin_activity.
-
- (Object) url
Returns a hash that can be used to create a url that points to the administration part of the plugin.
-
- (Object) version
Returns the value of attribute version.
Class Method Summary (collapse)
Instance Method Summary (collapse)
-
- (Object) activity
Retrieve information about how to access the latest activities of this plugin.
-
- (Object) activity=(activities)
Stores information that can be used to retrieve the latest activities of this plugin.
-
- (Object) activity_by_class_name(class_name)
Given a record's class name, find the related activity object.
-
- (Object) description
Returns the internationalized version of the description.
-
- (Boolean) highlighted?(params)
Used to highlight the current tab in the admin interface.
-
- (Object) title
Returns the internationalized version of the title.
Instance Attribute Details
- (Object) always_allow_access
Returns the value of attribute always_allow_access
6 7 8 |
# File 'core/lib/refinery/plugin.rb', line 6 def always_allow_access @always_allow_access end |
- (Object) class_name
Returns the value of attribute class_name
6 7 8 |
# File 'core/lib/refinery/plugin.rb', line 6 def class_name @class_name end |
- (Object) controller
Returns the value of attribute controller
6 7 8 |
# File 'core/lib/refinery/plugin.rb', line 6 def controller @controller end |
- (Object) dashboard
Returns the value of attribute dashboard
6 7 8 |
# File 'core/lib/refinery/plugin.rb', line 6 def dashboard @dashboard end |
- (Object) directory
Returns the value of attribute directory
6 7 8 |
# File 'core/lib/refinery/plugin.rb', line 6 def directory @directory end |
- (Object) hide_from_menu
Returns the value of attribute hide_from_menu
6 7 8 |
# File 'core/lib/refinery/plugin.rb', line 6 def @hide_from_menu end |
- (Object) menu_match
Returns the value of attribute menu_match
6 7 8 |
# File 'core/lib/refinery/plugin.rb', line 6 def @menu_match end |
- (Object) name
Returns the value of attribute name
6 7 8 |
# File 'core/lib/refinery/plugin.rb', line 6 def name @name end |
- (Object) pathname
Returns the value of attribute pathname
6 7 8 |
# File 'core/lib/refinery/plugin.rb', line 6 def pathname @pathname end |
- (Object) plugin_activity
Returns the value of attribute plugin_activity
6 7 8 |
# File 'core/lib/refinery/plugin.rb', line 6 def plugin_activity @plugin_activity end |
- (Object) url
Returns a hash that can be used to create a url that points to the administration part of the plugin.
61 62 63 |
# File 'core/lib/refinery/plugin.rb', line 61 def url @url end |
- (Object) version
Returns the value of attribute version
6 7 8 |
# File 'core/lib/refinery/plugin.rb', line 6 def version @version end |
Class Method Details
+ (Object) register {|plugin = self.new| ... }
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'core/lib/refinery/plugin.rb', line 10 def self.register(&block) yield(plugin = self.new) raise "A plugin MUST have a name!: #{plugin.inspect}" if plugin.name.blank? # Set defaults. plugin. ||= %r{refinery/#{plugin.name}(/.+?)?$} plugin.always_allow_access ||= false plugin.dashboard ||= false plugin.class_name ||= plugin.name.camelize # add the new plugin to the collection of registered plugins ::Refinery::Plugins.registered << plugin end |
Instance Method Details
- (Object) activity
Retrieve information about how to access the latest activities of this plugin.
36 37 38 |
# File 'core/lib/refinery/plugin.rb', line 36 def activity self.plugin_activity ||= [] end |
- (Object) activity=(activities)
Stores information that can be used to retrieve the latest activities of this plugin
41 42 43 |
# File 'core/lib/refinery/plugin.rb', line 41 def activity=(activities) [activities].flatten.each { |activity| add_activity(activity) } end |
- (Object) activity_by_class_name(class_name)
Given a record's class name, find the related activity object.
46 47 48 |
# File 'core/lib/refinery/plugin.rb', line 46 def activity_by_class_name(class_name) self.activity.select{ |a| a.class_name == class_name.to_s.camelize } end |
- (Object) description
Returns the internationalized version of the description
31 32 33 |
# File 'core/lib/refinery/plugin.rb', line 31 def description ::I18n.translate(['refinery', 'plugins', name, 'description'].join('.')) end |
- (Boolean) highlighted?(params)
Used to highlight the current tab in the admin interface
51 52 53 |
# File 'core/lib/refinery/plugin.rb', line 51 def highlighted?(params) !!(params[:controller].try(:gsub, "admin/", "") =~ ) || (dashboard && params[:action] == 'error_404') end |
- (Object) title
Returns the internationalized version of the title
26 27 28 |
# File 'core/lib/refinery/plugin.rb', line 26 def title ::I18n.translate(['refinery', 'plugins', name, 'title'].join('.')) end |