From: Tara L Andrews Date: Wed, 5 Sep 2012 09:53:35 +0000 (+0200) Subject: add index page link to stexaminer and relmapper X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2Fstemmaweb.git;a=commitdiff_plain;h=c655153c4b67f2460832281ac412d374fb5ae6e5 add index page link to stexaminer and relmapper --- diff --git a/lib/stemmaweb/Controller/Root.pm b/lib/stemmaweb/Controller/Root.pm index d4184aa..c3812e7 100644 --- a/lib/stemmaweb/Controller/Root.pm +++ b/lib/stemmaweb/Controller/Root.pm @@ -33,6 +33,10 @@ components will be loaded. sub index :Path :Args(0) { my ( $self, $c ) = @_; + # Are we being asked to load a text immediately? If so + if( $c->req->param('withtradition') ) { + $c->stash->{'withtradition'} = $c->req->param('withtradition'); + } $c->stash->{template} = 'index.tt'; } diff --git a/lib/stemmaweb/Controller/Stexaminer.pm b/lib/stemmaweb/Controller/Stexaminer.pm index 80d8827..37c2dea 100644 --- a/lib/stemmaweb/Controller/Stexaminer.pm +++ b/lib/stemmaweb/Controller/Stexaminer.pm @@ -40,6 +40,7 @@ sub index :Path :Args(2) { my $stemma = $tradition->stemma( $stemid ); $c->stash->{svg} = $stemma->as_svg( { size => [ 600, 350 ] } ); $c->stash->{graphdot} = $stemma->editable({ linesep => ' ' }); + $c->stash->{text_id} = $textid; $c->stash->{text_title} = $tradition->name; $c->stash->{template} = 'stexaminer.tt'; diff --git a/root/src/directory.tt b/root/src/directory.tt index d7d6266..dbe1547 100644 --- a/root/src/directory.tt +++ b/root/src/directory.tt @@ -5,7 +5,7 @@ @@ -18,7 +18,7 @@ diff --git a/root/src/index.tt b/root/src/index.tt index e2e8192..53bf324 100644 --- a/root/src/index.tt +++ b/root/src/index.tt @@ -7,6 +7,7 @@ var basepath = window.location.pathname if( basepath.lastIndexOf('/') == basepath.length - 1 ) { basepath = basepath.slice( 0, basepath.length - 1) }; +var textOnLoad = "[% withtradition %]"; var selectedTextID; var selectedTextInfo; var selectedStemmaID = -1; @@ -20,6 +21,13 @@ function refreshDirectory () { if (status == "error") { var msg = "An error occurred: "; $("#directory").html(msg + xhr.status + " " + xhr.statusText); + } else { + if( textOnLoad != "" ) { + // Call the click callback for the relevant text, if it is + // in the page. + $('#'+textOnLoad).click(); + textOnLoad = ""; + } } } ); @@ -232,7 +240,7 @@ $(document).ready( function() {

Stemmaweb - a collection of tools for analysis of collated texts

- [% IF c.user_exists %]Hello! [% c.user.get_object.email %] Sign out | [% ELSE %]Login | Register | [% END %]About + [% IF c.user_exists %]Hello! [% c.user.get_object.email %] Sign out | [% ELSE %]Login | [% END %]About

Text directory

diff --git a/root/src/relate.tt b/root/src/relate.tt index f71282d..95af6d6 100644 --- a/root/src/relate.tt +++ b/root/src/relate.tt @@ -13,7 +13,7 @@ $(document).ready(function () {

Relationship mapper

[% text_title %]

diff --git a/root/src/stexaminer.tt b/root/src/stexaminer.tt index 379e9f9..2f1a117 100644 --- a/root/src/stexaminer.tt +++ b/root/src/stexaminer.tt @@ -10,7 +10,7 @@ var graphdot = '[% graphdot %]'; [% END -%]

Stexaminer

[% text_title %]