better register contents view

This commit is contained in:
Torsten Ruger 2015-08-08 17:52:24 +03:00
parent b91fabdd90
commit abb22f524b
4 changed files with 20 additions and 14 deletions

View File

@ -32,10 +32,18 @@ $susy: (
}
.register-view {
@include gallery(3);
@include gallery(4);
margin-top: 10px;
}
.field {
@include span(5)
}
.value {
@include span(18)
}
.bright {
background-color: orange ;
}

View File

@ -19,8 +19,8 @@ module Main
end
def marker var
return "W" if var.is_a? String
var.class.name.split("::").last[0]
return "Wo" if var.is_a? String
var.class.name.split("::").last[0,2]
end
end

View File

@ -3,11 +3,6 @@ class RegisterModel < Volt::Model
field :value
field :fields
def register_changed reg , old , ins
self.last._class_name = "" if( self.length > 0)
self << { :name => ins.to_s , :class_name => "active" }
end
def register_changed reg , old , value
reg = reg.symbol unless reg.is_a? Symbol
return unless reg == name
@ -29,7 +24,7 @@ class RegisterModel < Volt::Model
if object and ! object.is_a?(String)
clazz = object.class.name.split("::").last
#puts "found #{clazz}"
self.fields << clazz
self.fields << "#{clazz}:#{object.internal_object_length}"
object.get_instance_variables.each do |variable|
f = object.get_instance_variable(variable)
self.fields << f

View File

@ -7,13 +7,16 @@
<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}}
{{ reg.fields.each_with_index do |attribute, index| }}
<div>
<div class="field">
{{index}}{{marker(attribute)}}
</div>
<div class="value">
{{attribute.object_id}}
</div>
</div>
{{end}}
</div>