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_container, textarea, textfield

Methods inherited from Component

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

Constructor Details

#initialize(id, page_url, page_parameters) ⇒ BookmarkablePageLink

Returns a new instance of BookmarkablePageLink.



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

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

Instance Attribute Details

#page_parametersObject (readonly)

Returns the value of attribute page_parameters.



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

def page_parameters
  @page_parameters
end

#page_urlObject (readonly)

Returns the value of attribute page_url.



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

def page_url
  @page_url
end

Instance Method Details

#render_to_element(element) ⇒ Object



154
155
156
# File 'lib/lapillus/containers.rb', line 154

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

#urlObject



158
159
160
# File 'lib/lapillus/containers.rb', line 158

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