Class: Lapillus::BookmarkablePageLink

Inherits:
Container show all
Defined in:
lib/lapillus/containers.rb

Instance Attribute Summary collapse

Attributes inherited from Container

#components

Attributes inherited from Component

#behaviours, #identifier, #model, #property, #visible

Instance Method Summary collapse

Methods inherited from Container

#[], #add, add_component, #component, fileuploadfield, image, label, listview, panel, password_textfield, #post, #render_children, textarea, textfield

Methods inherited from Component

#add_behaviour, #behaviour, #has_behaviour?, #has_model?, #has_parent?, #parent, #path, #response_page=, #session, #value, #webpage

Methods inherited from RenderableComponent

#on_render, #render_behaviours, #render_children, #render_component, #render_container, #visible?

Constructor Details

#initialize(id, page_url, page_parameters) ⇒ BookmarkablePageLink

Returns a new instance of BookmarkablePageLink.



140
141
142
143
144
# File 'lib/lapillus/containers.rb', line 140

def initialize(id, page_url, page_parameters)
  super(id)
  @page_url = page_url
  @page_parameters = page_parameters
end

Instance Attribute Details

#page_parametersObject (readonly)

Returns the value of attribute page_parameters.



139
140
141
# File 'lib/lapillus/containers.rb', line 139

def page_parameters
  @page_parameters
end

#page_urlObject (readonly)

Returns the value of attribute page_url.



139
140
141
# File 'lib/lapillus/containers.rb', line 139

def page_url
  @page_url
end

Instance Method Details

#render_to_element(element) ⇒ Object



146
147
148
# File 'lib/lapillus/containers.rb', line 146

def render_to_element(element)
  element.add_attribute("href", url)
end

#urlObject



150
151
152
# File 'lib/lapillus/containers.rb', line 150

def url
"#{@page_url}/"+page_parameters.sort.collect {|key, value| key.to_s+'/'+value.to_s}.join('/')    
end