Class: Georgia::FacetPresenter

Inherits:
Presenter show all
Defined in:
app/presenters/georgia/facet_presenter.rb

Instance Attribute Summary collapse

Attributes inherited from Presenter

#view_context

Instance Method Summary collapse

Constructor Details

#initialize(view_context, text, param, options = {}) ⇒ FacetPresenter

Returns a new instance of FacetPresenter.



7
8
9
10
11
12
13
# File 'app/presenters/georgia/facet_presenter.rb', line 7

def initialize view_context, text, param, options={}
  super
  @text = text
  @param = param
  @active = options.fetch(:active, get_active_state_from_params)
  @options = options
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Georgia::Presenter

Instance Attribute Details

#activeObject (readonly) Also known as: active?

Returns the value of attribute active.



4
5
6
# File 'app/presenters/georgia/facet_presenter.rb', line 4

def active
  @active
end

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'app/presenters/georgia/facet_presenter.rb', line 4

def options
  @options
end

#paramObject (readonly)

Returns the value of attribute param.



4
5
6
# File 'app/presenters/georgia/facet_presenter.rb', line 4

def param
  @param
end

#textObject (readonly)

Returns the value of attribute text.



4
5
6
# File 'app/presenters/georgia/facet_presenter.rb', line 4

def text
  @text
end

Instance Method Details

#to_sObject



15
16
17
# File 'app/presenters/georgia/facet_presenter.rb', line 15

def to_s
  active? ? (:em, text) : link_to(text, url_for(params.merge(param => text)), class: 'label label-default')
end