Added labels to ruleid link's.

master
Pacman Ghost 3 years ago
parent 68ba40d388
commit 2800dd63c4
  1. 11
      asl_rulebook2/webapp/static/SearchResult.js
  2. 2
      asl_rulebook2/webapp/static/utils.js

@ -1,4 +1,4 @@
import { gMainApp, gEventBus, gAppConfig } from "./MainApp.js" ;
import { gMainApp, gContentDocs, gEventBus, gAppConfig } from "./MainApp.js" ;
import { findTargets, getPrimaryTarget, isRuleid, getChapterResource, fixupSearchHilites, hasHilite, hideFootnotes } from "./utils.js" ;
// --------------------------------------------------------------------
@ -177,10 +177,11 @@ gMainApp.component( "ruleid", {
props: [ "csetId", "ruleId" ],
data() { return {
cdocId: null, ruleid: null,
title: null,
} ; },
// NOTE: This bit of HTML is sensitive to spaces :-/
template: `<span class="ruleid" :class="{unknown:!ruleid}">[<a v-if=ruleid @click=onClick>{{ruleId}}</a><span v-else>{{ruleId}}</span>]</span>`,
template: `<span class="ruleid" :class="{unknown:!ruleid}">[<a v-if=ruleid @click=onClick :title=title>{{ruleId}}</a><span v-else>{{ruleId}}</span>]</span>`,
created() {
// check if the rule is one we know about
@ -189,8 +190,10 @@ gMainApp.component( "ruleid", {
// NOTE: We assume that targets are unique within a content set. This might not be true if MMP
// ever adds Chapter Z stuff to the main index, but we'll cross that bridge if and when we come to it.
// TBH, that stuff would probably be better off as a separate content set, anyway.
this.cdocId = targets[0].cdoc_id ;
this.ruleid = targets[0].ruleid ;
let target = targets[0]
this.cdocId = target.cdoc_id ;
this.ruleid = target.ruleid ;
this.title = gContentDocs[ target.cdoc_id ].targets[ target.ruleid ].caption ;
}
},

@ -99,8 +99,6 @@ export function linkifyAutoRuleids( $root )
let target = targets[0] ;
// add a label
// NOTE: We don't add labels to ruleref's in index search results because their destination
// is more-or-less indicated by the ruleref caption.
let caption = gContentDocs[ target.cdoc_id ].targets[ target.ruleid ].caption ;
$(this).attr( "title", caption ) ;

Loading…
Cancel
Save