Skip to content

Commit

Permalink
Merge pull request #187 from lcnetdev/bfp-310-more-subject-results
Browse files Browse the repository at this point in the history
[BFP-310] Expand Subject Results
  • Loading branch information
f-osorio authored Jan 22, 2025
2 parents d8cdbb3 + 4da878a commit 95e962d
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/components/panels/edit/fields/helpers/ActionButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@
let component = this.profileStore.returnStructureByComponentGuid(this.guid)
let empty = this.profileStore.isEmptyComponent(component)
return empty
return empty && this.preferenceStore.returnValue('--c-general-ad-hoc') && component.mandatory != 'true'
},
// Hide empty element in ad hoc mode
hideElement: function(){
Expand Down
91 changes: 68 additions & 23 deletions src/components/panels/edit/modals/SubjectEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
>

<div ref="complexLookupModalContainer" class="complex-lookup-modal-container">
<div style="position: relative;">
<div style="position: relative" class="subject-container-outer">
<div style="position:absolute; right:2em; top: 0.25em; z-index: 100;">
<div class="menu-buttons">
<button @click="closeEditor()">Close</button>
Expand Down Expand Up @@ -95,31 +95,31 @@
</div>


<div style="flex:1; align-self: flex-end;">
<div style="flex:1; align-self: flex-end; height: 95%" :class="{'scroll-all': preferenceStore.returnValue('--b-edit-complex-scroll-all') && !preferenceStore.returnValue('--b-edit-complex-scroll-independently')}">

<div v-if="activeSearch!==false">{{activeSearch}}</div>
<div v-if="searchResults !== null">
<div v-if="searchResults && searchResults.names.length>0 && !this.searching">

<div v-if="searchResults !== null" style="height: 95%">
<div v-if="searchResults && searchResults.names.length>0 && !this.searching" class="subject-section" :class="{'scrollable-subjects': preferenceStore.returnValue('--b-edit-complex-scroll-independently'), 'small-container': this.numPopulatedResults()==3 && preferenceStore.returnValue('--b-edit-complex-scroll-independently'), 'medium-container': this.numPopulatedResults()==2 && preferenceStore.returnValue('--b-edit-complex-scroll-independently'), 'large-container': this.numPopulatedResults()==1&&preferenceStore.returnValue('--b-edit-complex-scroll-independently')}">
<span class="subject-results-heading">LCNAF</span>
<div v-for="(name,idx) in searchResults.names" @click="selectContext((searchResults.names.length - idx)*-1)" @mouseover="loadContext((searchResults.names.length - idx)*-1)" :data-id="(searchResults.names.length - idx)*-1" :key="name.uri" :class="['fake-option', {'unselected':(pickPostion != (searchResults.names.length - idx)*-1 ), 'selected':(pickPostion == (searchResults.names.length - idx)*-1 ),'picked': (pickLookup[(searchResults.names.length - idx)*-1] && pickLookup[(searchResults.names.length - idx)*-1].picked)}]">
<span v-if="name.suggestLabel && name.suggestLabel.length>41">{{name.suggestLabel.substring(0,41)}}...</span>
<span v-if="name.suggestLabel && name.suggestLabel.length>41">{{name.suggestLabel.substring(0,41)}}...</span>
<span v-else>{{name.suggestLabel}}</span>
<span> [LCNAF]</span>
<span v-if="name.collections"> {{ this.buildAddtionalInfo(name.collections) }}</span>
</div>
<hr>
</div>

<!-- LCSH -->
<div v-if="searchResults && searchResults.subjectsComplex.length>0">
<div v-if="searchResults && searchResults.subjectsComplex.length>0" class="subject-section" :class="{'scrollable-subjects': preferenceStore.returnValue('--b-edit-complex-scroll-independently'), 'small-container': this.numPopulatedResults()>=3 && preferenceStore.returnValue('--b-edit-complex-scroll-independently'), 'medium-container': this.numPopulatedResults()==2 && preferenceStore.returnValue('--b-edit-complex-scroll-independently'), 'large-container': this.numPopulatedResults()==1&&preferenceStore.returnValue('--b-edit-complex-scroll-independently')}">
<span class="subject-results-heading">Complex</span>
<div v-for="(subjectC,idx) in searchResults.subjectsComplex" @click="selectContext(idx)" @mouseover="loadContext(idx)" :data-id="idx" :key="subjectC.uri" :class="['fake-option', {'unselected':(pickPostion != idx), 'selected':(pickPostion == idx), 'picked': (pickLookup[idx] && pickLookup[idx].picked)}]">
{{subjectC.suggestLabel}}<span></span>
<span v-if="subjectC.collections"> {{ this.buildAddtionalInfo(subjectC.collections) }}</span>
</div>
<hr>
</div>

<div v-if="searchResults && searchResults.subjectsSimple.length>0">
<div v-if="searchResults && searchResults.subjectsSimple.length>0" class="subject-section" :class="{'scrollable-subjects': preferenceStore.returnValue('--b-edit-complex-scroll-independently'), 'small-container': this.numPopulatedResults()==3 && preferenceStore.returnValue('--b-edit-complex-scroll-independently'), 'medium-container': this.numPopulatedResults()==2 && preferenceStore.returnValue('--b-edit-complex-scroll-independently'), 'large-container': this.numPopulatedResults()==1&&preferenceStore.returnValue('--b-edit-complex-scroll-independently')}">
<span class="subject-results-heading">Simple</span>
<div v-for="(subject,idx) in searchResults.subjectsSimple" @click="selectContext(searchResults.subjectsComplex.length + idx)" @mouseover="loadContext(searchResults.subjectsComplex.length + idx)" :data-id="searchResults.subjectsComplex.length + idx" :key="subject.uri" :class="['fake-option', {'unselected':(pickPostion != searchResults.subjectsComplex.length + idx ), 'selected':(pickPostion == searchResults.subjectsComplex.length + idx ), 'picked': (pickLookup[searchResults.subjectsComplex.length + idx] && pickLookup[searchResults.subjectsComplex.length + idx].picked), 'literal-option':(subject.literal)}]" >{{subject.suggestLabel}}<span v-if="subject.literal">
{{subject.label}}</span> <span v-if="subject.literal">[Literal]</span>
<span v-if="!subject.literal"> {{ this.buildAddtionalInfo(subject.collections) }}</span>
Expand All @@ -128,15 +128,16 @@


<!-- ChildrenSubjects -->
<div v-if="searchResults && searchResults.subjectsChildrenComplex.length>0">
<div v-if="searchResults && searchResults.subjectsChildrenComplex.length>0" class="subject-section" :class="{'scrollable-subjects': preferenceStore.returnValue('--b-edit-complex-scroll-independently'), 'small-container': this.numPopulatedResults()==3 && preferenceStore.returnValue('--b-edit-complex-scroll-independently'), 'medium-container': this.numPopulatedResults()==2 && preferenceStore.returnValue('--b-edit-complex-scroll-independently'), 'large-container': this.numPopulatedResults()==1&&preferenceStore.returnValue('--b-edit-complex-scroll-independently')}">
<span class="subject-results-heading">CYAK Complex</span>
<div v-for="(subjectC,idx) in searchResults.subjectsChildrenComplex" @click="selectContext(idx)" @mouseover="loadContext(idx)" :data-id="idx" :key="subjectC.uri" :class="['fake-option', {'unselected':(pickPostion != idx), 'selected':(pickPostion == idx), 'picked': (pickLookup[idx] && pickLookup[idx].picked)}]">
{{subjectC.suggestLabel}}<span></span>
<span v-if="subjectC.collections"> {{ this.buildAddtionalInfo(subjectC.collections) }}</span>
</div>
<hr>
</div>

<div v-if="searchResults && searchResults.subjectsChildren.length>0">
<div v-if="searchResults && searchResults.subjectsChildren.length>0" class="subject-section" :class="{'scrollable-subjects': preferenceStore.returnValue('--b-edit-complex-scroll-independently'), 'small-container': this.numPopulatedResults()==3 && preferenceStore.returnValue('--b-edit-complex-scroll-independently'), 'medium-container': this.numPopulatedResults()==2 && preferenceStore.returnValue('--b-edit-complex-scroll-independently'), 'large-container': this.numPopulatedResults()==1&&preferenceStore.returnValue('--b-edit-complex-scroll-independently')}">
<span class="subject-results-heading">CYAK Simple</span>
<div v-for="(subject,idx) in searchResults.subjectsChildren" @click="selectContext(searchResults.subjectsChildrenComplex.length + idx)" @mouseover="loadContext(searchResults.subjectsChildrenComplex.length + idx)" :data-id="searchResults.subjectsChildrenComplex.length + idx" :key="subject.uri" :class="['fake-option', {'unselected':(pickPostion != searchResults.subjectsChildrenComplex.length + idx ), 'selected':(pickPostion == searchResults.subjectsChildrenComplex.length + idx ), 'picked': (pickLookup[searchResults.subjectsChildrenComplex.length + idx] && pickLookup[searchResults.subjectsChildrenComplex.length + idx].picked), 'literal-option':(subject.literal)}]" >{{subject.suggestLabel}}<span v-if="subject.literal">
{{subject.label}}</span> <span v-if="subject.literal">[Literal]</span>
<span v-if="!subject.literal"> {{ this.buildAddtionalInfo(subject.collections) }}</span>
Expand Down Expand Up @@ -392,7 +393,8 @@
width: 99%;
margin-left: auto;
margin-right: auto;
height: 470px;
/* height: 470px; */
height: 90%;
}
.subject-editor-container-lowres{
Expand All @@ -406,7 +408,7 @@
.subject-editor-container-left{
display: flex;
height: 468px;
height: 95%;
position: relative;
overflow-y: hidden;
}
Expand All @@ -426,7 +428,8 @@
flex:1;
align-self: flex-start;
padding: 2em;
height: 503px;
/* height: 503px; */
height: 100%;
overflow-y: scroll;
background: whitesmoke;
}
Expand Down Expand Up @@ -528,8 +531,6 @@
font-weight: bold;
color: green;
font-size: larger;
}
Expand Down Expand Up @@ -675,6 +676,36 @@ margin-top: 10px;
float: right;
}
.subject-section{
border-top: solid black;
border-bottom: solid-black;
}
.scrollable-subjects {
overflow-y: scroll;
}
.small-container{
height: 33%;
}
.medium-container{
height: 50%;
}
.large-container{
height: 90%;
}
/* document.documentElement.clientHeight */
.scroll-all {
overflow-y: scroll;
}
.subject-container-outer{
/* height: v-bind('returnBrowserHeight()'); */
height: 100%;
}
/*
.left-menu-list-item-has-data::before {
content: "✓ " !important;
Expand Down Expand Up @@ -785,7 +816,6 @@ data: function() {
nextInputIsVoyagerModeDiacritics: false,
activeTypes: {
'madsrdf:Topic': {label:'Topic / Heading ($a $x)', value:'madsrdf:Topic',selected:false},
'madsrdf:GenreForm': {label:'Genre ($v)', value:'madsrdf:GenreForm',selected:false},
Expand All @@ -806,6 +836,21 @@ computed: {
},
methods: {
hasOverFlow: function(element){
let overflow = element.scrollHeight > element.clientHeight
return overflow
},
// Return the number of search results that are populated.
// Used to determine how tall to make each set of search results
numPopulatedResults: function(){
let count = 0
for (let key of Object.keys(this.searchResults)){
if (this.searchResults[key].length>=1){
count++
}
}
return count
},
//parse complex headings so we can have complete and broken up headings
parseComplexSubject: async function(uri){
Expand Down Expand Up @@ -1606,10 +1651,10 @@ methods: {
out.push("(GnFrm)")
} else if (collections.includes("GeographicSubdivisions")){
out.push("(GeoSubDiv)")
} else if (collections.includes("Subdivisions")){
out.push("(SubDiv)")
} else if (collections.includes("LCSH_Childrens")){
out.push("(ChldSubj)")
} else if (collections.includes("Subdivisions")){
out.push("(SubDiv)")
}
// if (collections.includes("LCNAF")){
Expand Down Expand Up @@ -2628,8 +2673,8 @@ methods: {
},
cleanState: function(){
this.searchMode = "LCSHNAF"
this.components= []
this.searchMode = "LCSHNAF"
this.components= []
this.lookup= {}
this.searchResults= null
this.activeSearch= false
Expand Down
7 changes: 6 additions & 1 deletion src/components/panels/sidebar_property/Properties.vue
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,12 @@
jumpToElement: function(profileName, elementName){
//if it's hidden show it
let removed = this.profileStore.removeFromAdHocMode(profileName, elementName)
let removed
if (this.preferenceStore.returnValue('--c-general-ad-hoc')){
removed = this.profileStore.removeFromAdHocMode(profileName, elementName)
} else {
removed = true
}
//jump to it
if (removed){
this.activeComponent = this.activeProfile.rt[profileName].pt[elementName]
Expand Down
17 changes: 11 additions & 6 deletions src/lib/utils_network.js
Original file line number Diff line number Diff line change
Expand Up @@ -2196,13 +2196,18 @@ const utilsNetwork = {
}
}

const numResultsNames = usePreferenceStore().returnValue('--b-edit-complex-number-names')
const numResultsComplex = usePreferenceStore().returnValue('--b-edit-complex-number-complex')
const numResultsSimple = usePreferenceStore().returnValue('--b-edit-complex-number-simple')
const numResultsCyac = usePreferenceStore().returnValue('--b-edit-complex-number-cyac')


this.subjectSearchActive = true
let namesUrl = useConfigStore().lookupConfig['http://preprod.id.loc.gov/authorities/names'].modes[0]['NAF All'].url.replace('<QUERY>',searchVal).replace('&count=25','&count=4').replace("<OFFSET>", "1")+'&memberOf=http://id.loc.gov/authorities/names/collection_NamesAuthorizedHeadings'
let namesUrl = useConfigStore().lookupConfig['http://preprod.id.loc.gov/authorities/names'].modes[0]['NAF All'].url.replace('<QUERY>',searchVal).replace('&count=25','&count='+numResultsNames).replace("<OFFSET>", "1")+'&memberOf=http://id.loc.gov/authorities/names/collection_NamesAuthorizedHeadings'
let namesUrlSubdivision = useConfigStore().lookupConfig['http://preprod.id.loc.gov/authorities/names'].modes[0]['NAF All'].url.replace('<QUERY>',searchVal).replace('&count=25','&count=5').replace("<OFFSET>", "1")+'&memberOf=http://id.loc.gov/authorities/subjects/collection_Subdivisions'

let subjectUrlComplex = useConfigStore().lookupConfig['http://id.loc.gov/authorities/subjects'].modes[0]['LCSH All'].url.replace('<QUERY>',complexVal).replace('&count=25','&count=5').replace("<OFFSET>", "1")+'&rdftype=ComplexType'+'&memberOf=http://id.loc.gov/authorities/subjects/collection_LCSHAuthorizedHeadings'
let subjectUrlSimple = useConfigStore().lookupConfig['http://id.loc.gov/authorities/subjects'].modes[0]['LCSH All'].url.replace('<QUERY>',searchVal).replace('&count=25','&count=4').replace("<OFFSET>", "1")+'&rdftype=SimpleType'+'&memberOf=http://id.loc.gov/authorities/subjects/collection_LCSHAuthorizedHeadings'
let subjectUrlComplex = useConfigStore().lookupConfig['http://id.loc.gov/authorities/subjects'].modes[0]['LCSH All'].url.replace('<QUERY>',complexVal).replace('&count=25','&count='+numResultsComplex).replace("<OFFSET>", "1")+'&rdftype=ComplexType'+'&memberOf=http://id.loc.gov/authorities/subjects/collection_LCSHAuthorizedHeadings'
let subjectUrlSimple = useConfigStore().lookupConfig['http://id.loc.gov/authorities/subjects'].modes[0]['LCSH All'].url.replace('<QUERY>',searchVal).replace('&count=25','&count='+numResultsSimple).replace("<OFFSET>", "1")+'&rdftype=SimpleType'+'&memberOf=http://id.loc.gov/authorities/subjects/collection_LCSHAuthorizedHeadings'
let subjectUrlSimpleSubdivison = useConfigStore().lookupConfig['http://id.loc.gov/authorities/subjects'].modes[0]['LCSH All'].url.replace('<QUERY>',searchVal).replace('&count=25','&count=5').replace("<OFFSET>", "1")+'&rdftype=SimpleType&memberOf=http://id.loc.gov/authorities/subjects/collection_Subdivisions'
let subjectUrlTemporal = useConfigStore().lookupConfig['http://id.loc.gov/authorities/subjects'].modes[0]['LCSH All'].url.replace('<QUERY>',searchVal).replace('&count=25','&count=5').replace("<OFFSET>", "1")+'&memberOf=http://id.loc.gov/authorities/subjects/collection_TemporalSubdivisions'
let subjectUrlGenre = useConfigStore().lookupConfig['http://id.loc.gov/authorities/subjects'].modes[0]['LCSH All'].url.replace('<QUERY>',searchVal).replace('&count=25','&count=5').replace("<OFFSET>", "1")+'&rdftype=GenreForm'
Expand All @@ -2214,13 +2219,13 @@ const utilsNetwork = {
let hubsUrlKeyword = useConfigStore().lookupConfig['https://preprod-8080.id.loc.gov/resources/works'].modes[0]['Hubs - Keyword'].url.replace('<QUERY>',searchVal).replace('&count=25','&count=5').replace("<OFFSET>", "1")
let hubsUrlAnchored = useConfigStore().lookupConfig['https://preprod-8080.id.loc.gov/resources/works'].modes[0]['Hubs - Left Anchored'].url.replace('<QUERY>',searchVal).replace('&count=25','&count=5').replace("<OFFSET>", "1")

let childrenSubject = useConfigStore().lookupConfig['http://id.loc.gov/authorities/childrensSubjects'].modes[0]['LCSHAC All'].url.replace('<QUERY>',searchVal).replace('&count=25','&count=4').replace("<OFFSET>", "1")+'&-memberOf=http://id.loc.gov/authorities/subjects/collection_Subdivisions'
let childrenSubjectComplex = useConfigStore().lookupConfig['http://id.loc.gov/authorities/childrensSubjects'].modes[0]['LCSHAC All'].url.replace('<QUERY>',searchVal).replace('&count=25','&count=4').replace("<OFFSET>", "1")+'&rdftype=ComplexType'
let childrenSubject = useConfigStore().lookupConfig['http://id.loc.gov/authorities/childrensSubjects'].modes[0]['LCSHAC All'].url.replace('<QUERY>',searchVal).replace('&count=25','&count='+numResultsCyac).replace("<OFFSET>", "1")+'&-memberOf=http://id.loc.gov/authorities/subjects/collection_Subdivisions'
let childrenSubjectComplex = useConfigStore().lookupConfig['http://id.loc.gov/authorities/childrensSubjects'].modes[0]['LCSHAC All'].url.replace('<QUERY>',searchVal).replace('&count=25','&count='+numResultsCyac).replace("<OFFSET>", "1")+'&rdftype=ComplexType'
let childrenSubjectSubdivision = useConfigStore().lookupConfig['http://id.loc.gov/authorities/childrensSubjects'].modes[0]['LCSHAC All'].url.replace('<QUERY>',searchVal).replace('&count=25','&count=4').replace("<OFFSET>", "1")+'&memberOf=http://id.loc.gov/authorities/subjects/collection_Subdivisions'

let searchValHierarchicalGeographic = searchVal.replaceAll('‑','-') //.split(' ').join('--')

let subjectUrlHierarchicalGeographic = useConfigStore().lookupConfig['HierarchicalGeographic'].modes[0]['All'].url.replace('<QUERY>',searchValHierarchicalGeographic).replace('&count=25','&count=4').replace("<OFFSET>", "1")
let subjectUrlHierarchicalGeographic = useConfigStore().lookupConfig['HierarchicalGeographic'].modes[0]['All'].url.replace('<QUERY>',searchValHierarchicalGeographic).replace('&count=25','&count='+numResultsComplex).replace("<OFFSET>", "1")

if (mode == 'GEO'){
subjectUrlHierarchicalGeographic = subjectUrlHierarchicalGeographic.replace('&count=4','&count=12').replace("<OFFSET>", "1")
Expand Down
2 changes: 1 addition & 1 deletion src/stores/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const useConfigStore = defineStore('config', {

versionMajor: 0,
versionMinor: 17,
versionPatch: 21,
versionPatch: 22,

regionUrls: {

Expand Down
Loading

0 comments on commit 95e962d

Please sign in to comment.