Class: AdminWidgets::ScopesWidget::Scope

Inherits:
BaseWidget
  • Object
show all
Defined in:
lib/admin_widgets/scopes_widget.rb

Overview

Helper classes

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseWidget

#capture, #content_block, #helper, #method_missing, #root

Methods included from Memoization

#memoize

Methods included from Delegation

#delegate

Constructor Details

#initialize(parent, name, options = {}) ⇒ Scope

Returns a new instance of Scope.



35
36
37
# File 'lib/admin_widgets/scopes_widget.rb', line 35

def initialize(parent, name, options = {})
  super options.merge(:parent => parent, :name => name)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class AdminWidgets::BaseWidget

Instance Attribute Details

#nameObject

Returns the value of attribute name.



33
34
35
# File 'lib/admin_widgets/scopes_widget.rb', line 33

def name
  @name
end

#optionsObject

Returns the value of attribute options.



33
34
35
# File 'lib/admin_widgets/scopes_widget.rb', line 33

def options
  @options
end

#parentObject

Returns the value of attribute parent.



33
34
35
# File 'lib/admin_widgets/scopes_widget.rb', line 33

def parent
  @parent
end

Instance Method Details

#contentObject



56
57
58
# File 'lib/admin_widgets/scopes_widget.rb', line 56

def content
  rawtext helper.link_to(full_label, params, :class => css_class)
end

#current?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/admin_widgets/scopes_widget.rb', line 48

def current?
  (current_scope.nil? && default) || (current_scope.to_s == name.to_s)
end

#paramsObject



52
53
54
# File 'lib/admin_widgets/scopes_widget.rb', line 52

def params
  parent.params.merge(:scope => scope)
end