Skip to content

Commit

Permalink
added vocselect to treeview
Browse files Browse the repository at this point in the history
  • Loading branch information
StiftungAusNachlass committed Mar 22, 2023
1 parent cff85d1 commit 3617c4f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
24 changes: 13 additions & 11 deletions src/webfrontend/CustomDataTypeGFBIO.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ class CustomDataTypeGFBIO extends CustomDataTypeWithCommons
# are there multible vocs in datamodel?
multibleVocs = false
vocTest = that.getVocabularyNameFromDatamodel()
vocTestArr = vocTest.split(' ')
vocTestArr = vocTest.split(',')

if vocTestArr.length > 1
multibleVocs = true
Expand Down Expand Up @@ -489,8 +489,6 @@ class CustomDataTypeGFBIO extends CustomDataTypeWithCommons
# merge ancestors to string
cdata.conceptAncestors = cdata.conceptAncestors.join(' ')

console.warn "cdata", cdata

if resultJSON.prefLabel.length > 0
# update the layout in form
that.__updateResult(cdata, layout, opts)
Expand Down Expand Up @@ -612,7 +610,7 @@ class CustomDataTypeGFBIO extends CustomDataTypeWithCommons
else
# else get first voc from given voclist (1-n)
vocParameter = that.getActiveVocabularyName(cdata)
vocParameter = vocParameter.split('|')
vocParameter = vocParameter.split(',')
vocParameter = vocParameter[0]

apikey = that.getApiKeyFromBaseconfig()
Expand All @@ -628,6 +626,8 @@ class CustomDataTypeGFBIO extends CustomDataTypeWithCommons
class: "cui-pane gfbio_treeviewPane"
center:
content: [
cdata_form
,
treeview.treeview
]

Expand Down Expand Up @@ -679,14 +679,15 @@ class CustomDataTypeGFBIO extends CustomDataTypeWithCommons
if elem.opts.name == 'gfbio_PopoverVocabularySelect' && that.renderPopupAsTreeview()
@buildAndSetTreeviewLayout(@popover, layout, cdata, cdata_form, that, false, opts)
that.__setEditorFieldStatus(cdata, layout)
if elem.opts.name == 'searchbarInput' || elem.opts.name == 'gfbio_PopoverVocabularySelect' || elem.opts.name == 'gfbio_countSuggestions'
if elem.opts.name == 'searchbarInput' || elem.opts.name == 'gfbio_countSuggestions'
that.__updateSuggestionsMenu(cdata, cdata_form, data.searchbarInput, elem, suggest_Menu, searchsuggest_xhr, layout, opts)
.start()

# init suggestmenu
suggest_Menu = new CUI.Menu
element : cdata_form.getFieldsByName("searchbarInput")[0]
use_element_width_as_min_width: true
if ! that.renderPopupAsTreeview()
suggest_Menu = new CUI.Menu
element : cdata_form.getFieldsByName("searchbarInput")[0]
use_element_width_as_min_width: true

# treeview?
if that.renderPopupAsTreeview()
Expand Down Expand Up @@ -789,8 +790,8 @@ class CustomDataTypeGFBIO extends CustomDataTypeWithCommons
)
]
}

fields.push maxhits
if ! that.renderPopupAsTreeview()
fields.push maxhits

# searchfield (autocomplete)
option = {
Expand All @@ -802,7 +803,8 @@ class CustomDataTypeGFBIO extends CustomDataTypeWithCommons
placeholder: $$("custom.data.type.gfbio.modal.form.text.searchbar.placeholder")
name: "searchbarInput"
}
fields.push option
if ! that.renderPopupAsTreeview()
fields.push option

fields

Expand Down
4 changes: 1 addition & 3 deletions src/webfrontend/CustomDataTypeGFBIOTreeview.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class GFBIO_ListViewTree
#############################################################################
# construct
#############################################################################
constructor: (@popover = null, @editor_layout = null, @cdata = null, @cdata_form = null, @context = null, @gfbio_opts = {}, @vocParameter = 'yso', @apikey = '') ->
constructor: (@popover = null, @editor_layout = null, @cdata = null, @cdata_form = null, @context = null, @gfbio_opts = {}, @vocParameter = 'ITIS', @apikey = '') ->

options =
class: "gfbioPlugin_Treeview"
Expand Down Expand Up @@ -283,8 +283,6 @@ class GFBIO_ListViewTreeNode extends CUI.ListViewTreeNode
# merge ancestors to string
that._cdata.conceptAncestors = that._cdata.conceptAncestors.join(' ')

console.log "that._cdata", that._cdata

# is this from exact search and user has to choose exact-search-mode?!
if that._gfbio_opts?.callFromExpertSearch == true
CustomDataTypeGFBIO.prototype.__chooseExpertHierarchicalSearchMode(that._cdata, that._editor_layout, resultJSON, that._editor_layout, that._gfbio_opts)
Expand Down

0 comments on commit 3617c4f

Please sign in to comment.