remove the root function (pass to super now)
This commit is contained in:
parent
b8a0e5f8a3
commit
caa1da342c
@ -7,17 +7,12 @@ class ListView < ElementView
|
|||||||
@elements = []
|
@elements = []
|
||||||
end
|
end
|
||||||
|
|
||||||
# can be overriden to return a string that will be passed to div to create the root
|
# create a root node acording to the tag given (default div)
|
||||||
# element for the list. See "div" in ElementView for possible strings
|
# The tag name will be passed to the div function, so class and id may be set as well (see there)
|
||||||
def root
|
|
||||||
"div"
|
|
||||||
end
|
|
||||||
|
|
||||||
# create a root node acording to the "root" function (default div)
|
|
||||||
# draw all children and keep the elements as @elements
|
# draw all children and keep the elements as @elements
|
||||||
# return (as per base class) the single root of the collection
|
# return (as per base class) the single root of the collection
|
||||||
def draw
|
def draw root = "div"
|
||||||
@element = div(self.root)
|
@element = div(root)
|
||||||
@elements = @children.collect do | c |
|
@elements = @children.collect do | c |
|
||||||
add_element c.draw
|
add_element c.draw
|
||||||
end
|
end
|
||||||
|
@ -16,7 +16,6 @@ class BlocksView < ListView
|
|||||||
|
|
||||||
def instruction_changed
|
def instruction_changed
|
||||||
return if @interpreter.block.name == active_block_name
|
return if @interpreter.block.name == active_block_name
|
||||||
puts "blocks changed to #{@interpreter.block.name}"
|
|
||||||
@elements.last.at_css(".bright").remove_class("bright")
|
@elements.last.at_css(".bright").remove_class("bright")
|
||||||
append( BlockView.new(@interpreter.block) )
|
append( BlockView.new(@interpreter.block) )
|
||||||
remove_first if( @elements.length > 5)
|
remove_first if( @elements.length > 5)
|
||||||
|
@ -13,12 +13,8 @@ class RegistersView < ListView
|
|||||||
super(kids)
|
super(kids)
|
||||||
end
|
end
|
||||||
|
|
||||||
def root
|
|
||||||
"div.registers_view"
|
|
||||||
end
|
|
||||||
|
|
||||||
def draw
|
def draw
|
||||||
super()
|
super( "div.registers_view" )
|
||||||
@element.children.each do |reg|
|
@element.children.each do |reg|
|
||||||
elem = div("div.register_view")
|
elem = div("div.register_view")
|
||||||
wrap_node_with reg , elem
|
wrap_node_with reg , elem
|
||||||
|
Loading…
x
Reference in New Issue
Block a user