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 { .register-view {
@include gallery(3); @include gallery(4);
margin-top: 10px; margin-top: 10px;
} }
.field {
@include span(5)
}
.value {
@include span(18)
}
.bright { .bright {
background-color: orange ; background-color: orange ;
} }

View File

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

View File

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

View File

@ -7,13 +7,16 @@
<div class="register-view"> <div class="register-view">
<div> <div>
{{ reg.name }} {{ reg.name }}
</div>
<div>
{{ reg.value }} {{ reg.value }}
</div> </div>
{{ reg.fields.each do |attribute| }} {{ reg.fields.each_with_index do |attribute, index| }}
<div class="col-md-12"> <div>
{{marker(attribute)}} {{attribute.object_id}} <div class="field">
{{index}}{{marker(attribute)}}
</div>
<div class="value">
{{attribute.object_id}}
</div>
</div> </div>
{{end}} {{end}}
</div> </div>