Skip to content

Commit

Permalink
Merge pull request refinery#943 from awagener/master
Browse files Browse the repository at this point in the history
Small refactorings
  • Loading branch information
ugisozols committed Sep 5, 2011
2 parents 6cf0cc9 + 4afc3c1 commit 85c552d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions core/lib/refinery/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,22 @@ def activity=(activities)

# Returns true, if the user doesn't require plugin access
def always_allow_access?
@always_allow_access ||= false
@always_allow_access || false
end

# Special property to indicate that this plugin is the dashboard plugin.
def dashboard?
@dashboard ||= false
@dashboard || false
end

# Used to highlight the current tab in the admin interface
def highlighted?(params)
(params[:controller] =~ self.menu_match) or (self.dashboard? and params[:action] == 'error_404')
(params[:controller] =~ menu_match) or (dashboard? and params[:action] == 'error_404')
end

# Returns a RegExp that matches, if the current page is part of the plugin.
def menu_match
@menu_match ||= /refinery\/#{self.name}$/
@menu_match ||= /refinery\/#{name}$/
end

def pathname=(value)
Expand All @@ -70,12 +70,12 @@ def pathname=(value)

# Returns a hash that can be used to create a url that points to the administration part of the plugin.
def url
@url ||= if self.controller.present?
{:controller => "/admin/#{self.controller}"}
elsif self.directory.present?
{:controller => "/admin/#{self.directory.split('/').pop}"}
@url ||= if controller.present?
{:controller => "/admin/#{controller}"}
elsif directory.present?
{:controller => "/admin/#{directory.split('/').pop}"}
else
{:controller => "/admin/#{self.name}"}
{:controller => "/admin/#{name}"}
end
end

Expand Down

0 comments on commit 85c552d

Please sign in to comment.