Class: Georgia::Portlet

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

Instance Attribute Summary collapse

Attributes inherited from Presenter

#view_context

Instance Method Summary collapse

Constructor Details

#initialize(view_context, portlet, args = {}) ⇒ Portlet

Returns a new instance of Portlet.



6
7
8
9
# File 'app/presenters/georgia/portlet.rb', line 6

def initialize view_context, portlet, args={}
  @portlet = portlet
  super
end

Dynamic Method Handling

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

Instance Attribute Details

#portletObject (readonly)

Returns the value of attribute portlet.



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

def portlet
  @portlet
end

Instance Method Details

#handle_tagObject



19
20
21
# File 'app/presenters/georgia/portlet.rb', line 19

def handle_tag
  (:span, icon_tag('ellipsis-v'), class: 'handle')
end

#idObject



11
12
13
# File 'app/presenters/georgia/portlet.rb', line 11

def id
  @id ||= @portlet.persisted? ? @portlet.id : rand(10 ** 8)
end

#portlet_tag(content, options = {}) ⇒ Object



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

def portlet_tag content, options={}
   :li, content, options.reverse_merge(class: 'portlet', id: dom_id(portlet), data: {portlet: id})
end