Class: ViewActionAdapter

Inherits:
ActionAdapter show all
Defined in:
lib/ribit/action.rb

Direct Known Subclasses

EditActionAdapter, EditCategoryActionAdapter

Instance Method Summary collapse

Methods inherited from ActionAdapter

#build_url

Constructor Details

#initialize(targetID, text = nil) ⇒ ViewActionAdapter

Returns a new instance of ViewActionAdapter.



933
934
935
936
937
# File 'lib/ribit/action.rb', line 933

def initialize( targetID, text=nil )
    # id might be number
  @targetID = targetID.to_s
  @linkText = text
end

Instance Method Details

#get_urlObject



951
952
953
954
955
# File 'lib/ribit/action.rb', line 951

def get_url
    propertyList = PropertyList.new
    propertyList.put( Constants::PAGE_ID_REQUEST_PARAM_NAME, @targetID )
  return build_url( ViewAction::ID, propertyList )
end

#process(element) ⇒ Object



940
941
942
943
944
945
946
947
948
# File 'lib/ribit/action.rb', line 940

def process( element )
  # build url
  element.attributes['href'] = get_url()
  
  # change link text only if specified so
  if ( @linkText != nil )
    element.text = @linkText
  end
end

#to_eleObject



958
959
960
961
962
963
# File 'lib/ribit/action.rb', line 958

def to_ele
  element = REXML::Element.new( 'a' )
  element.attributes['href'] = get_url()
  element.text = @linkText
  return element
end