From: tla Date: Tue, 21 Jan 2014 15:05:15 +0000 (+0100) Subject: add is_significant attribute to relationships. Closes #33 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e4bdf6606498d358c80e45b8cee69250b3bee6d3;p=scpubgit%2Fstemmaweb.git add is_significant attribute to relationships. Closes #33 --- diff --git a/lib/stemmaweb/Controller/Relation.pm b/lib/stemmaweb/Controller/Relation.pm index c5f3281..7b75c8e 100644 --- a/lib/stemmaweb/Controller/Relation.pm +++ b/lib/stemmaweb/Controller/Relation.pm @@ -1,8 +1,10 @@ package stemmaweb::Controller::Relation; use JSON qw/ to_json from_json /; use Moose; +use Moose::Util::TypeConstraints qw/ find_type_constraint /; use Module::Load; use namespace::autoclean; +use Text::Tradition::Datatypes; use TryCatch; BEGIN { extends 'Catalyst::Controller' } @@ -70,7 +72,10 @@ sub main :Chained('text') :PathPart('') :Args(0) { my $collation = $tradition->collation; # Stash the relationship definitions - $c->stash->{'relationship_scopes'} = to_json( [ qw/ local global / ] ); + $c->stash->{'relationship_scopes'} = + to_json( find_type_constraint( 'RelationshipScope' )->values ); + $c->stash->{'ternary_values'} = + to_json( find_type_constraint( 'Ternary' )->values ); my @reltypeinfo; foreach my $type ( sort { _typesort( $a, $b ) } $collation->relations->types ) { next if $type->is_weak; @@ -208,6 +213,7 @@ sub relationships :Chained('text') :PathPart :Args(0) { a_derivable_from_b => $relobj->a_derivable_from_b, b_derivable_from_a => $relobj->b_derivable_from_a, non_independent => $relobj->non_independent, + is_significant => $relobj->is_significant }; $relhash->{'note'} = $relobj->annotation if $relobj->has_annotation; push( @all_relations, $relhash ); diff --git a/root/css/dashboard.css b/root/css/dashboard.css index aded615..1386ee0 100644 --- a/root/css/dashboard.css +++ b/root/css/dashboard.css @@ -111,14 +111,6 @@ top: 10px; margin-bottom: 24px; } -.error { - font-weight: bold; - color: #ff3333; -} -.notification { - font-weight: bold; - color: #33ff33; -} #new_file { position: absolute; top: -50px; diff --git a/root/css/style.css b/root/css/style.css index 33344aa..5d55a48 100644 --- a/root/css/style.css +++ b/root/css/style.css @@ -136,4 +136,11 @@ div.pager_left_button.greyed_out, div.pager_left_button.greyed_out:hover { color: #ffffff; text-decoration: underline; } - +.error { + font-weight: bold; + color: #ff3333; +} +.notification { + font-weight: bold; + color: #33ff33; +} diff --git a/root/js/relationship.js b/root/js/relationship.js index cf40f3e..0e253d8 100644 --- a/root/js/relationship.js +++ b/root/js/relationship.js @@ -600,6 +600,14 @@ function relation_factory() { $('#delete_relation_type').text( relation.data('type') ); $('#delete_relation_scope').text( relation.data('scope') ); $('#delete_relation_attributes').empty(); + var significance = ' is not '; + if( relation.data( 'is_significant' ) === 'yes') { + significance = ' is '; + } else if ( relation.data( 'is_significant' ) === 'maybe' ) { + significance = ' might be '; + } + $('#delete_relation_attributes').append( + "This relationship" + significance + "stemmatically significant
"); if( relation.data( 'a_derivable_from_b' ) ) { $('#delete_relation_attributes').append( "'" + relation.data('source_text') + "' derivable from '" + relation.data('target_text') + "'
"); @@ -1050,7 +1058,7 @@ $(document).ready(function () { if( editable ) { $( '#dialog-form' ).dialog( { autoOpen: false, - height: 270, + height: 350, width: 330, modal: true, buttons: { @@ -1100,11 +1108,15 @@ $(document).ready(function () { $.each( relationship_scopes, function(index, value) { $('#scope').append( $('

+ + +