minor tweaks to display logic
Tara L Andrews [Wed, 4 Jul 2012 10:28:32 +0000 (12:28 +0200)]
stemmaweb/lib/stemmaweb/Controller/Stexaminer.pm
stemmaweb/root/js/stexaminer.js

index d2aa261..e556e32 100644 (file)
@@ -48,6 +48,11 @@ sub index :Path :Args(1) {
                        foreach my $rhash ( @{$loc->{'readings'}} ) {
                                my $gst = wit_stringify( $rhash->{'group'} );
                                $rhash->{'group'} = $gst;
+                               my $roots = join( ', ', @{$rhash->{'independent_occurrence'}} );
+                               $rhash->{'independent_occurrence'} = $roots;
+                               unless( $rhash->{'text'} ) {
+                                       $rhash->{'text'} = $rhash->{'readingid'};
+                               }
                        }
                }
                # Values for TT rendering
index b38d842..2a9e10e 100644 (file)
@@ -63,17 +63,12 @@ function show_stats( rs ) {
        var rshtml = $('#stats_template').clone();
        rshtml.find('#statrank').append( rs.id );
        $.each( rs.readings, function( idx, rdghash ) {
-               var readinglabel = rdghash.readingid;
-               if( rdghash.text ) {
-                       readinglabel = rdghash.text;
-               }
-               var readingroots = rdghash.independent_occurrence.join( ', ' );
                var rdgstats = $('#reading_template').clone();
-               rdgstats.find('.readinglabel').append( readinglabel );
+               rdgstats.find('.readinglabel').append( rdghash.text );
                rdgstats.find('.reading_copied').append( rdghash.followed );
                rdgstats.find('.reading_changed').append( rdghash.not_followed );
                rdgstats.find('.reading_unclear').append( rdghash.follow_unknown );
-               rdgstats.find('.readingroots').append( readingroots );
+               rdgstats.find('.readingroots').append( rdghash.independent_occurrence );
                if( ! $.isEmptyObject( rdghash.reading_parents ) ) {
                        var parentstats = $('#reading_parent_template').clone();
                        $.each( rdghash.reading_parents, function( parentid, pdata ) {