From: Tara L Andrews Date: Sun, 8 Apr 2012 11:57:23 +0000 (+0200) Subject: segment the large texts in the relationship mapper X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ea8e8b3c151729c44479da68aefafdfa0f6f89b2;p=scpubgit%2Fstemmaweb.git segment the large texts in the relationship mapper --- diff --git a/lib/stemmaweb/Controller/Relation.pm b/lib/stemmaweb/Controller/Relation.pm index 2671473..8b72205 100644 --- a/lib/stemmaweb/Controller/Relation.pm +++ b/lib/stemmaweb/Controller/Relation.pm @@ -83,12 +83,13 @@ sub text :Chained('/') :PathPart('relation') :CaptureArgs(1) { $r += 500; } $c->stash->{'textsegments'} = []; - foreach my $start ( @divs ) { - my $seg = { 'start' => $start }; - $seg->{'end'} = $start + 550 > $length ? $length : $start + 550; + foreach my $i ( 0..$#divs ) { + my $seg = { 'start' => $divs[$i] }; + $seg->{'display'} = "Segment " . ($i+1); push( @{$c->stash->{'textsegments'}}, $seg ); } } + $DB::single = 1; $c->stash->{'textid'} = $textid; $c->stash->{'tradition'} = $tradition; } @@ -100,7 +101,7 @@ sub main :Chained('text') :PathPart('') :Args(0) { my $collation = $tradition->collation; my $svgopts; if( $startseg ) { - # Only render the subgraph from startseg to +500 or end, + # Only render the subgraph from startseg to +550 or end, # whichever is less. $svgopts = { 'from' => $startseg }; $svgopts->{'to'} = $startseg + 550 @@ -108,10 +109,12 @@ sub main :Chained('text') :PathPart('') :Args(0) { } elsif( exists $c->stash->{'textsegments'} ) { # This is the unqualified load of a long tradition. We implicitly start # at zero, but go only as far as 550. + $startseg = 0; $svgopts = { 'to' => 550 }; } my $svg_str = $collation->as_svg( $svgopts ); $svg_str =~ s/\n//gs; + $c->stash->{'startseg'} = $startseg if defined $startseg; $c->stash->{'svg_string'} = $svg_str; $c->stash->{'text_title'} = $tradition->name; $c->stash->{'template'} = 'relate.tt'; diff --git a/root/css/relationship.css b/root/css/relationship.css index ef19de0..9b778b6 100644 --- a/root/css/relationship.css +++ b/root/css/relationship.css @@ -33,9 +33,13 @@ body { padding-top: 40px; } .segment_guide { + color: #488dd2; padding-left: 30px; padding-right: 30px; } +.selected { + background-color: #dadada; +} h1.title a:link, h1.title a:visited, h1.title a:active { color: #666; font-weight: bold; diff --git a/root/src/relate.tt b/root/src/relate.tt index 87e311c..65bb19e 100644 --- a/root/src/relate.tt +++ b/root/src/relate.tt @@ -18,9 +18,13 @@ $(function() {

[% text_title %]

[% FOREACH segment IN textsegments -%] +[% IF segment.start != startseg -%] - [% segment.start %] – [% segment.end %] + [% segment.display %] +[% ELSE -%] + [% segment.display %] +[% END -%] [% END -%]