block and source views seperated
This commit is contained in:
parent
bdfafd17c8
commit
65d95de885
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
|
def index
|
||||||
init_machine
|
init_machine
|
||||||
init_blocks
|
|
||||||
init_source
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def marker var
|
|
||||||
return "W" if var.is_a? String
|
|
||||||
var.class.name.split("::").last[0]
|
|
||||||
end
|
|
||||||
|
|
||||||
def init_machine
|
def init_machine
|
||||||
machine = Virtual.machine.boot
|
machine = Virtual.machine.boot
|
||||||
@ -33,16 +27,6 @@ module Main
|
|||||||
@volt_app.interpreter.start machine.init
|
@volt_app.interpreter.start machine.init
|
||||||
end
|
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
|
# The main template contains a #template binding that shows another
|
||||||
# template. This is the path to that template. It may change based
|
# template. This is the path to that template. It may change based
|
||||||
# on the params._component, params._controller, and params._action values.
|
# 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
|
15
app/main/views/blocks/index.html
Normal file
15
app/main/views/blocks/index.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<:Title>
|
||||||
|
blocks index
|
||||||
|
|
||||||
|
<:Body>
|
||||||
|
<div class="block-view">
|
||||||
|
<div>
|
||||||
|
<h4> {{page._method_name}} </h4>
|
||||||
|
<h4> Block: {{page._block_name}} </h4>
|
||||||
|
</div>
|
||||||
|
{{ page._blocks.each do |b| }}
|
||||||
|
<div class="{{b._class_name}}">
|
||||||
|
{{b._name}}
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
@ -7,26 +7,9 @@
|
|||||||
<div class="file-view">
|
<div class="file-view">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="source-view">
|
<:sources />
|
||||||
<h4> Virtual Machine Instruction </h4>
|
|
||||||
{{page._sources.each do |source| }}
|
|
||||||
<div class="{{source._class_name}}">
|
|
||||||
{{source._name}}
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="block-view">
|
<:blocks />
|
||||||
<div>
|
|
||||||
<h4> {{page._method_name}} </h4>
|
|
||||||
<h4> Block: {{page._block_name}} </h4>
|
|
||||||
</div>
|
|
||||||
{{ page._blocks.each do |b| }}
|
|
||||||
<div class="{{b._class_name}}">
|
|
||||||
{{b._name}}
|
|
||||||
</div>
|
|
||||||
{{ end }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<:status/>
|
<:status/>
|
||||||
|
|
||||||
|
12
app/main/views/sources/index.html
Normal file
12
app/main/views/sources/index.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<:Title>
|
||||||
|
sources index
|
||||||
|
|
||||||
|
<:Body>
|
||||||
|
<div class="source-view">
|
||||||
|
<h4> Virtual Machine Instruction </h4>
|
||||||
|
{{page._sources.each do |source| }}
|
||||||
|
<div class="{{source._class_name}}">
|
||||||
|
{{source._name}}
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
5
spec/app/main/integration/blocks_spec.rb
Normal file
5
spec/app/main/integration/blocks_spec.rb
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe '', type: :feature do
|
||||||
|
# Specs here
|
||||||
|
end
|
5
spec/app/main/integration/sources_spec.rb
Normal file
5
spec/app/main/integration/sources_spec.rb
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe '', type: :feature do
|
||||||
|
# Specs here
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user