redo object view as list, introduce ref view

This commit is contained in:
Torsten Ruger
2015-08-22 20:11:33 +02:00
parent caa1da342c
commit 7885ae93c4
5 changed files with 49 additions and 30 deletions

View File

@ -56,10 +56,17 @@ class ElementView
wrapper << node
end
# add the given element the @element
# add the given element to the @element, at the end
# return the div that was passed in (use << to return the @element)
def add_element div
div.append_to @element
def append_element div
@element << div
div
end
# add the given element to the @element , at the front
# return the div that was passed in (use >> to return the @element)
def prepend_element div
@element >> div
div
end
@ -67,7 +74,7 @@ class ElementView
# add that new element to the @element
# return the newly created element
def add class_or_id , tex = nil
add_element div( class_or_id , tex)
append_element div( class_or_id , tex)
end

View File

@ -14,7 +14,7 @@ class ListView < ElementView
def draw root = "div"
@element = div(root)
@elements = @children.collect do | c |
add_element c.draw
append_element c.draw
end
@element
end