made view component out of register view
This commit is contained in:
parent
69e51a1037
commit
5bd6b3517d
26
app/main/controllers/registers_controller.rb
Normal file
26
app/main/controllers/registers_controller.rb
Normal file
@ -0,0 +1,26 @@
|
||||
module Main
|
||||
class RegistersController < Volt::ModelController
|
||||
|
||||
def initialize app , context
|
||||
super(app , context)
|
||||
self.model = []
|
||||
init_registers attrs.interpreter
|
||||
end
|
||||
|
||||
def init_registers interpreter
|
||||
interpreter.registers.each do |reg , val|
|
||||
r = RegisterModel.new( :name => reg , :value => val)
|
||||
self.model << r
|
||||
interpreter.register_event(:register_changed, r)
|
||||
interpreter.register_event(:object_changed, r)
|
||||
r.register_changed( reg , nil , interpreter.registers[reg])
|
||||
end
|
||||
end
|
||||
|
||||
def marker var
|
||||
return "W" if var.is_a? String
|
||||
var.class.name.split("::").last[0]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
@ -12,7 +12,6 @@
|
||||
</div>
|
||||
|
||||
<div class="file-view">
|
||||
Future Source code view
|
||||
</div>
|
||||
|
||||
<div class="source-view">
|
||||
@ -50,20 +49,4 @@
|
||||
<span> {{page._interpreter._stdout}} </span>
|
||||
</div>
|
||||
|
||||
<div class="registers-view">
|
||||
{{ page._registers.each do |reg| }}
|
||||
<div class="register-view">
|
||||
<div>
|
||||
{{ reg.name }}
|
||||
</div>
|
||||
<div>
|
||||
{{ reg.value }}
|
||||
</div>
|
||||
{{ reg.fields.each do |attribute| }}
|
||||
<div class="col-md-12">
|
||||
{{marker(attribute)}} {{attribute.object_id}}
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
<:registers interpreter="{{ @interpreter }}"/>
|
||||
|
21
app/main/views/registers/index.html
Normal file
21
app/main/views/registers/index.html
Normal file
@ -0,0 +1,21 @@
|
||||
<:Title>
|
||||
registers index
|
||||
|
||||
<:Body>
|
||||
<div class="registers-view">
|
||||
{{ model.each do |reg| }}
|
||||
<div class="register-view">
|
||||
<div>
|
||||
{{ reg.name }}
|
||||
</div>
|
||||
<div>
|
||||
{{ reg.value }}
|
||||
</div>
|
||||
{{ reg.fields.each do |attribute| }}
|
||||
<div class="col-md-12">
|
||||
{{marker(attribute)}} {{attribute.object_id}}
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
5
spec/app/main/integration/registers_spec.rb
Normal file
5
spec/app/main/integration/registers_spec.rb
Normal file
@ -0,0 +1,5 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe '', type: :feature do
|
||||
# Specs here
|
||||
end
|
Loading…
Reference in New Issue
Block a user