Sha256: 21e37334caa3fecd9edd7e5d9f00bdd3d227efa28b1df26552d8e71453f5f8ba
Contents?: true
Size: 1.01 KB
Versions: 7
Compression:
Stored size: 1.01 KB
Contents
module Refinery class Plugin def self.register(&block) yield self.new end attr_accessor :title, :version, :description, :url, :menu_match, :plugin_activity, :directory, :hide_from_menu, :always_allow_access def initialize Refinery::Plugins.registered << self # add me to the collection of registered plugins end def highlighted?(params) params[:controller] =~ menu_match end def activity self.plugin_activity ||= [] end def activity=(activities) [activities].flatten.each { |activity| add_activity(activity) } end def add_activity(options) (self.plugin_activity ||= []) << Activity::new(options) end def url @url ||= "/admin/#{self.directory.blank? ? self.title.downcase : self.directory.split('/').pop}" end def menu_match @menu_match ||= /admin\/#{self.title.downcase}/ end def hide_from_menu @hide_from_menu end def always_allow_access @always_allow_access ||= false end end end
Version data entries
7 entries across 7 versions & 1 rubygems