Sha256: 7962277f7b4417451d4e311d92fd7ce1abfd1b19ac89735cdf67a2c84a11ab6c

Contents?: true

Size: 1.03 KB

Versions: 21

Compression:

Stored size: 1.03 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] =~ self.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.gsub(" ", "_").downcase}$/
  	end
  	
  	def hide_from_menu
  	  @hide_from_menu
	  end
	
		def always_allow_access
			@always_allow_access ||= false
		end
  
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
refinerycms-0.9.5.13 vendor/plugins/refinery/lib/refinery/plugin.rb
refinerycms-0.9.5.12 vendor/plugins/refinery/lib/refinery/plugin.rb
refinerycms-0.9.5.11 vendor/plugins/refinery/lib/refinery/plugin.rb
refinerycms-0.9.5.10 vendor/plugins/refinery/lib/refinery/plugin.rb
refinerycms-0.9.5.9 vendor/plugins/refinery/lib/refinery/plugin.rb
refinerycms-0.9.5.8 vendor/plugins/refinery/lib/refinery/plugin.rb
refinerycms-0.9.5.7 vendor/plugins/refinery/lib/refinery/plugin.rb
refinerycms-0.9.5.6 vendor/plugins/refinery/lib/refinery/plugin.rb
refinerycms-0.9.5.5 vendor/plugins/refinery/lib/refinery/plugin.rb
refinerycms-0.9.5.4 vendor/plugins/refinery/lib/refinery/plugin.rb
refinerycms-0.9.5.3 vendor/plugins/refinery/lib/refinery/plugin.rb
refinerycms-0.9.5.2 vendor/plugins/refinery/lib/refinery/plugin.rb
refinerycms-0.9.5.1 vendor/plugins/refinery/lib/refinery/plugin.rb
refinerycms-0.9.5 vendor/plugins/refinery/lib/refinery/plugin.rb
refinerycms-0.9.4.5 vendor/plugins/refinery/lib/refinery/plugin.rb
refinerycms-0.9.4.4 vendor/plugins/refinery/lib/refinery/plugin.rb
refinerycms-0.9.4.3 vendor/plugins/refinery/lib/refinery/plugin.rb
refinerycms-0.9.4.2 vendor/plugins/refinery/lib/refinery/plugin.rb
refinerycms-0.9.4.1 vendor/plugins/refinery/lib/refinery/plugin.rb
refinerycms-0.9.4 vendor/plugins/refinery/lib/refinery/plugin.rb