remove the root function (pass to super now)

This commit is contained in:
Torsten Ruger 2015-08-22 19:28:09 +02:00
parent b8a0e5f8a3
commit caa1da342c
3 changed files with 5 additions and 15 deletions

View File

@ -7,17 +7,12 @@ class ListView < ElementView
@elements = []
end
# can be overriden to return a string that will be passed to div to create the root
# element for the list. See "div" in ElementView for possible strings
def root
"div"
end
# create a root node acording to the "root" function (default div)
# create a root node acording to the tag given (default div)
# The tag name will be passed to the div function, so class and id may be set as well (see there)
# draw all children and keep the elements as @elements
# return (as per base class) the single root of the collection
def draw
@element = div(self.root)
def draw root = "div"
@element = div(root)
@elements = @children.collect do | c |
add_element c.draw
end

View File

@ -16,7 +16,6 @@ class BlocksView < ListView
def instruction_changed
return if @interpreter.block.name == active_block_name
puts "blocks changed to #{@interpreter.block.name}"
@elements.last.at_css(".bright").remove_class("bright")
append( BlockView.new(@interpreter.block) )
remove_first if( @elements.length > 5)

View File

@ -13,12 +13,8 @@ class RegistersView < ListView
super(kids)
end
def root
"div.registers_view"
end
def draw
super()
super( "div.registers_view" )
@element.children.each do |reg|
elem = div("div.register_view")
wrap_node_with reg , elem