classes view separated out

This commit is contained in:
Torsten Ruger 2015-07-31 19:35:06 +03:00
parent ab08fcc7c1
commit bdfafd17c8
5 changed files with 34 additions and 17 deletions

View File

@ -0,0 +1,16 @@
module Main
class ClassesController < Volt::ModelController
def initialize *args
super(*args)
page._classes!.clear
Virtual.machine.space.classes.each do |name , claz|
next if [:Kernel,:Module,:MetaClass,:BinaryCode].index name
c = Volt::Model.new :name => name
page._classes << c
end
end
end
end

View File

@ -14,7 +14,6 @@ module Main
def index
init_machine
init_classes
init_blocks
init_source
end
@ -34,14 +33,6 @@ module Main
@volt_app.interpreter.start machine.init
end
def init_classes
page._classes!.clear
Virtual.machine.space.classes.each do |name , claz|
next if [:Kernel,:Module,:MetaClass,:BinaryCode].index name
c = Volt::Model.new :name => name
page._classes << c
end
end
def init_blocks
blocks = BlocksModel.new
page._blocks = blocks

View File

@ -0,0 +1,12 @@
<:Title>
classes index
<:Body>
<div class="classes">
<h4> Classes </h4>
{{page._classes.each do |clas| }}
<div class="one-class">
{{ clas._name }}
</div>
{{end}}
</div>

View File

@ -2,14 +2,7 @@
Home
<:Body>
<div class="classes">
<h4> Classes </h4>
{{page._classes.each do |clas| }}
<div class="one-class">
{{ clas._name }}
</div>
{{end}}
</div>
<:classes />
<div class="file-view">
</div>

View File

@ -0,0 +1,5 @@
require 'spec_helper'
describe '', type: :feature do
# Specs here
end