Class: HtmlGrid::PopupLink

Inherits:
Link show all
Defined in:
lib/htmlgrid/popuplink.rb

Constant Summary collapse

@@name_ptrn =
/[^a-z]+/i

Constants inherited from Component

Component::CSS_CLASS, Component::CSS_ID, Component::HTML_ATTRIBUTES, Component::HTTP_HEADERS, Component::LABEL

Instance Attribute Summary collapse

Attributes inherited from NamedComponent

#name

Attributes inherited from Component

#attributes, #dojo_tooltip, #label, #model, #value

Instance Method Summary collapse

Methods inherited from Link

#href, #href=, #target=

Methods inherited from NamedComponent

#data_origin, #error?, #initialize

Methods inherited from Component

#_to_html, #autofill?, #css_class, #css_class=, #css_id, #css_id=, #dojo_dynamic_html, #dojo_parse_on_load, #dojo_tag, #dojo_title=, #dynamic_html, #escape, #escape_symbols, #formname, #http_headers, #initialize, #label?, #onclick=, #onload=, #onsubmit=, #set_attribute, #tabindex=

Constructor Details

This class inherits a constructor from HtmlGrid::NamedComponent

Instance Attribute Details

#height=(value) ⇒ Object (writeonly)

Sets the attribute height

Parameters:

  • value

    the value to set the attribute height to.



31
32
33
# File 'lib/htmlgrid/popuplink.rb', line 31

def height=(value)
  @height = value
end

#locationbar=(value) ⇒ Object (writeonly)

Sets the attribute locationbar

Parameters:

  • value

    the value to set the attribute locationbar to.



32
33
34
# File 'lib/htmlgrid/popuplink.rb', line 32

def locationbar=(value)
  @locationbar = value
end

Sets the attribute menubar

Parameters:

  • value

    the value to set the attribute menubar to.



32
33
34
# File 'lib/htmlgrid/popuplink.rb', line 32

def menubar=(value)
  @menubar = value
end

#resizable=(value) ⇒ Object (writeonly)

Sets the attribute resizable

Parameters:

  • value

    the value to set the attribute resizable to.



32
33
34
# File 'lib/htmlgrid/popuplink.rb', line 32

def resizable=(value)
  @resizable = value
end

#scrollbars=(value) ⇒ Object (writeonly)

Sets the attribute scrollbars

Parameters:

  • value

    the value to set the attribute scrollbars to.



32
33
34
# File 'lib/htmlgrid/popuplink.rb', line 32

def scrollbars=(value)
  @scrollbars = value
end

#toolbar=(value) ⇒ Object (writeonly)

Sets the attribute toolbar

Parameters:

  • value

    the value to set the attribute toolbar to.



32
33
34
# File 'lib/htmlgrid/popuplink.rb', line 32

def toolbar=(value)
  @toolbar = value
end

#width=(value) ⇒ Object (writeonly)

Sets the attribute width

Parameters:

  • value

    the value to set the attribute width to.



31
32
33
# File 'lib/htmlgrid/popuplink.rb', line 31

def width=(value)
  @width = value
end

Instance Method Details

#initObject



33
34
35
36
37
38
39
40
41
42
# File 'lib/htmlgrid/popuplink.rb', line 33

def init
  super
  @scrollbars = true
  @resizable = true
  @toolbar = true
  @menubar = false
  @locationbar = false
  @width = 750
  @height = 460
end

#to_html(context) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/htmlgrid/popuplink.rb', line 44

def to_html(context)
  props = {
    "scrollbars"	=>	yesorno(@scrollbars),
    "resizable"	=>	yesorno(@resizable),
    "toolbar"	=>	yesorno(@toolbar),
    "menubar"	=>	yesorno(@menubar),
    "locationbar"	=>	yesorno(@locationbar),
    "width"	=>	@width,
    "height"	=>	@height
  }.collect { |key, val|
    [key, val].join("=")
  }.join(",")
  name = @lookandfeel.lookup(@name).to_s.gsub(@@name_ptrn, "")
  script = "window.open('#{href}', '#{name}', '#{props}').focus(); return false"
  @attributes.store("onClick", script)
  super
end