diff --git a/templates/shared/searchbuilder.tmpl b/templates/shared/searchbuilder.tmpl index 2df8b5f4eb..db9fb76b8b 100644 --- a/templates/shared/searchbuilder.tmpl +++ b/templates/shared/searchbuilder.tmpl @@ -7,17 +7,17 @@ } #search-builder-toggle { - cursor: pointer; - color: black; - font-weight: bold; - text-decoration: none; - padding-left: 20px; - font-style: italic; + cursor: pointer; + color: black; + font-weight: bold; + text-decoration: none; + padding-left: 20px; + font-style: italic; } #search-builder-arrow { - margin-left: 2px; - font-size:0.8em; + margin-left: 2px; + font-size: 0.8em; } #search-builder .input-group { @@ -54,7 +54,8 @@
Search Builder -
+ +
@@ -81,17 +82,121 @@ { name: 'query', tooltip: 'queries repo name, owner, description & topics. Allows partial match' }, { name: 'topic', tooltip: 'the topic of a repo, e.g. tc-ready' }, { name: 'lang', tooltip: 'language, e.g. en, fr' }, - { name: 'subject', tooltip: 'type of resource, e.g. Aligned Bible, Open Bibles Stories' }, + { name: 'subject', tooltip: 'type of resource, e.g. Aligned Bible, Open Bibles Stories', options: [ + "Aligned Bible", + "Aramaic Grammar", + "Bible", + "Greek Grammar", + "Greek Lexicon", + "Greek New Testament", + "Hebrew Grammar", + "Hebrew Old Testament", + "Hebrew-Aramaic Lexicon", + "OBS Study Notes", + "OBS Study Questions", + "OBS Translation Notes", + "OBS Translation Questions", + "Open Bible Stories", + "Study Notes", + "Study Questions", + "Training Library", + "Translation Academy", + "Translation Notes", + "Translation Questions", + "Translation Words", + "TSV Study Notes", + "TSV Study Questions", + "TSV Translation Notes", + "TSV Translation Questions", + "TSV Translation Words Links", + "TSV OBS Study Notes", + "TSV OBS Study Questions", + "TSV OBS Translation Notes", + "TSV OBS Translation Questions", + "TSV OBS Translation Words Links" + ] + }, { name: 'owner', tooltip: 'user or organization, e.g. unfoldingWord' }, { name: 'repo', tooltip: 'repository name, e.g. en_ult' }, - { name: 'abbreviation', tooltip: 'identifier or abbreviation of a resource, e.g. ult' }, - { name: 'book', tooltip: 'contains this Bible book, e.g. mat, mrk, luk, jhn' }, - { name: 'flavor', tooltip: 'scripture burrito flavor, e.g. textTranslation, gloss' }, - { name: 'flavor_type', tooltip: 'scripture burrito flavor type, e.g. scripture, parascriptural, textStories' }, - { name: 'metadata_type', tooltip: 'type of repo metadata schema, e.g. rc, sb, tc, ts' }, - { name: 'content_format', tooltip: 'content format, e.g. markdown, tsv7, tsv9, usfm' }, + { name: 'abbreviation', tooltip: 'identifier or abbreviation of a resource, e.g. ult', options: ['ult', 'ust', 'glt', 'gst', 'ta', 'tn', 'tq', 'tw', 'twl', 'obs', 'obs-tn', 'obs-tq', 'sn', 'sq'] }, + { name: 'book', tooltip: 'contains this Bible book, e.g. mat, mrk, luk, jhn', options: [ + "gen", + "exo", + "lev", + "num", + "deu", + "jos", + "jdg", + "rut", + "1sa", + "2sa", + "1ki", + "2ki", + "1ch", + "2ch", + "ezr", + "neh", + "est", + "job", + "psa", + "pro", + "ecc", + "sng", + "isa", + "jer", + "lam", + "ezk", + "dan", + "hos", + "jol", + "amo", + "oba", + "jon", + "mic", + "nam", + "hab", + "zep", + "hag", + "zec", + "mal", + "mat", + "mrk", + "luk", + "jhn", + "act", + "rom", + "1co", + "2co", + "gal", + "eph", + "php", + "col", + "1th", + "2th", + "1ti", + "2ti", + "tit", + "phm", + "heb", + "jas", + "1pe", + "2pe", + "1jn", + "2jn", + "3jn", + "jud", + "rev", + "obs", + "frt", + "bak", + ] + }, + { name: 'flavor_type', tooltip: 'scripture burrito flavor type, e.g. scripture, parascriptural, textStories', options: ['gloss', 'parascriptural', 'peripheral', 'scripture'] }, + { name: 'flavor', tooltip: 'scripture burrito flavor, e.g. textTranslation, textStories, gloss', options: ['audioTranslation', 'embossedBrailleScripture', 'signLanguageVideoTranslation', 'textTranslation', 'textStories', 'typesetScripture', 'wordAlignment'] }, + { name: 'metadata_type', tooltip: 'type of repo metadata schema, e.g. rc, sb, tc, ts', options: ['rc', 'sb', 'tc', 'ts'] }, + { name: 'content_format', tooltip: 'content format, e.g. markdown, tsv7, tsv9, usfm', options: ['markdown', 'tsv7', 'tsv9', 'usfm'] }, { name: 'tag', tooltip: 'released with the given tag, e.g. v3' }, - { name: 'stage', tooltip: 'stage of the release: prod, preprod, latest or other' }, + { name: 'stage', tooltip: 'stage of the release: prod, preprod, latest or other', options: ['prod', 'preprod', 'latest', 'other'] }, ]; qInput.addEventListener('input', updateAdvancedFields); @@ -114,10 +219,22 @@ input.setAttribute('placeholder', fieldObj.tooltip); input.addEventListener('input', updateQueryField) + if (fieldObj.options) { + const datalist = document.createElement('datalist'); + datalist.id = fieldObj.name + '-options'; + fieldObj.options.forEach(option => { + const optionElement = document.createElement('option'); + optionElement.value = option; + datalist.appendChild(optionElement); + }); + input.setAttribute('list', datalist.id); + inputGroup.appendChild(datalist); + } + inputGroup.appendChild(label); inputGroup.appendChild(input); if (!isCatalogSearch && catalogOnlyFields.includes(fieldObj.name)) { - inputGroup.style.display = 'none'; + inputGroup.style.display = 'none'; } advancedSearchContainer.appendChild(inputGroup); });