block and source views seperated
This commit is contained in:
12
app/main/controllers/blocks_controller.rb
Normal file
12
app/main/controllers/blocks_controller.rb
Normal file
@ -0,0 +1,12 @@
|
||||
module Main
|
||||
class BlocksController < Volt::ModelController
|
||||
|
||||
def initialize *args
|
||||
super(*args)
|
||||
blocks = BlocksModel.new
|
||||
page._blocks = blocks
|
||||
@volt_app.interpreter.register_event(:instruction_changed, blocks)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
@ -14,15 +14,9 @@ module Main
|
||||
|
||||
def index
|
||||
init_machine
|
||||
init_blocks
|
||||
init_source
|
||||
end
|
||||
|
||||
private
|
||||
def marker var
|
||||
return "W" if var.is_a? String
|
||||
var.class.name.split("::").last[0]
|
||||
end
|
||||
|
||||
def init_machine
|
||||
machine = Virtual.machine.boot
|
||||
@ -33,16 +27,6 @@ module Main
|
||||
@volt_app.interpreter.start machine.init
|
||||
end
|
||||
|
||||
def init_blocks
|
||||
blocks = BlocksModel.new
|
||||
page._blocks = blocks
|
||||
@volt_app.interpreter.register_event(:instruction_changed, blocks)
|
||||
end
|
||||
def init_source
|
||||
sources = SourceModel.new
|
||||
page._sources = sources
|
||||
@volt_app.interpreter.register_event(:instruction_changed, sources)
|
||||
end
|
||||
# The main template contains a #template binding that shows another
|
||||
# template. This is the path to that template. It may change based
|
||||
# on the params._component, params._controller, and params._action values.
|
||||
|
12
app/main/controllers/sources_controller.rb
Normal file
12
app/main/controllers/sources_controller.rb
Normal file
@ -0,0 +1,12 @@
|
||||
module Main
|
||||
class SourcesController < Volt::ModelController
|
||||
def initialize *args
|
||||
super(*args)
|
||||
|
||||
sources = SourceModel.new
|
||||
page._sources = sources
|
||||
@volt_app.interpreter.register_event(:instruction_changed, sources)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user