Class: SWS::Link

Inherits:
Component show all
Defined in:
lib/sws/Core/components/Link/Link.rb

Overview

Represents <LINK tag Bindings:

  • href (required) - href attribute of the tag

  • rel - rel attribute of the tag

  • type - type attribute of the tag

  • other_tag_string - generic string to add to the tag

Instance Attribute Summary

Attributes inherited from Component

#action_components, #definition_component, #encoding, #html_attrs, #method_to_call, #name, #parameters, #parent, #request, #request_number, #slots, #subcomponents, #tokens

Instance Method Summary collapse

Methods inherited from Component

#api_filename, #app, #awake, #content?, create, #create_component_tree, #definition_filename, #initialize, #page, #perform_action, #process_bindings, #process_parameters, #process_request, #remove_subcomponents, #session, #set_request_subcomponents, #sleep, #slot_bound?, #subcomponent_for_name, synchronize_slot, #synchronize_slot?, #synchronize_slots, #template_filename, #tokenize_binding, #update_binding, #url_string

Constructor Details

This class inherits a constructor from SWS::Component

Instance Method Details

#append_to_response(response) ⇒ Object



16
17
18
# File 'lib/sws/Core/components/Link/Link.rb', line 16

def append_to_response ( response )
	response << generate_html()
end

#container?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/sws/Core/components/Link/Link.rb', line 11

def container? ()
	return false
end

#generate_htmlObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/sws/Core/components/Link/Link.rb', line 21

def generate_html ()

	string = "<LINK"			
	if ( slot_bound?( "resource" ) )
      framework = slot_bound?("framework") ? @slots["framework"].value : "app"
      href = app().adaptor.base_path() + app().resource_request_handler_key + "/" + framework + "/" + @slots["resource"].value
	else
		href = @slots["href"].value
	end
	string << " href=\"#{href}\""
	string << bound_slot_string( "rel","type" )
	string << generic_attr_string() << ">"
	return string

end