Pass on the text direction, scroll to end if RL
[scpubgit/stemmaweb.git] / lib / stemmaweb / Controller / Relation.pm
index 1c3bf8e..0a0579c 100644 (file)
@@ -70,7 +70,10 @@ sub main :Chained('text') :PathPart('') :Args(0) {
        my( $self, $c ) = @_;
        my $tradition = delete $c->stash->{'tradition'};
        my $collation = $tradition->collation;
-       
+
+       # Stash text direction to use in JS.
+       $c->stash->{'direction'} = $collation->direction;
+
        # Stash the relationship definitions
        $c->stash->{'relationship_scopes'} = 
                to_json( find_type_constraint( 'RelationshipScope' )->values );
@@ -133,7 +136,7 @@ sub main :Chained('text') :PathPart('') :Args(0) {
        $c->stash->{'startseg'} = $startseg if defined $startseg;
        $c->stash->{'svg_string'} = $svg_str;
        $c->stash->{'text_title'} = $tradition->name;
-       if( $tradition->can('language') ) {
+       if( $tradition->can('language') && $tradition->language ) {
                $c->stash->{'text_lang'} = $tradition->language;
                $c->stash->{'can_morphologize'} = 1;
        } else {