Hide search box when showing item detail

This commit is contained in:
Edward Betts 2021-05-14 11:08:50 +02:00
parent 4cfeffd878
commit af076ae3aa
2 changed files with 20 additions and 17 deletions

View file

@ -24,6 +24,7 @@ var detail_card = document.getElementById("detail-card");
var detail = document.getElementById("detail"); var detail = document.getElementById("detail");
var detail_image = document.getElementById("detail-image"); var detail_image = document.getElementById("detail-image");
var detail_header = document.getElementById("detail-header"); var detail_header = document.getElementById("detail-header");
var search_and_isa = document.getElementById("search-and-isa");
var detail_qid; var detail_qid;
var candidates = document.getElementById("candidates"); var candidates = document.getElementById("candidates");
var checkbox_list = document.getElementsByClassName("isa-checkbox"); var checkbox_list = document.getElementsByClassName("isa-checkbox");
@ -366,7 +367,7 @@ function mouse_events(marker, qid) {
}); });
marker.on("click", function () { marker.on("click", function () {
var wd_item = items[qid].wikidata; var wd_item = items[qid].wikidata;
isa_card.classList.add("d-none"); search_and_isa.classList.add("d-none");
detail_card.classList.remove("d-none"); detail_card.classList.remove("d-none");
detail_card.classList.add("bg-highlight"); detail_card.classList.add("bg-highlight");
close_item_details(); close_item_details();
@ -583,7 +584,7 @@ document.getElementById("search-form").onsubmit = function (e) {
}; };
function close_detail() { function close_detail() {
isa_card.classList.remove("d-none"); search_and_isa.classList.remove("d-none");
detail_card.classList.add("d-none"); detail_card.classList.add("d-none");
close_item_details(); close_item_details();

View file

@ -23,24 +23,26 @@
</button> </button>
<div id="sidebar"> <div id="sidebar">
<div class="card m-2" id="search-card"> <div id="search-and-isa">
<div class="card-body"> <div class="card m-2" id="search-card">
<form id="search-form"> <div class="card-body">
<div> <form id="search-form">
<input id="search-text" placeholder="place"> <div>
<button type="submit" id="search-btn" class="btn btn-primary">search</button> <input id="search-text" placeholder="place">
</div> <button type="submit" id="search-btn" class="btn btn-primary">search</button>
</form> </div>
<div id="search-results"> </form>
<div id="search-results">
</div>
</div> </div>
</div> </div>
</div>
<div class="card d-none m-2" id="isa-card"> <div class="card d-none m-2" id="isa-card">
<div class="card-body"> <div class="card-body">
<div class="h5 card-title">item types</div> <div class="h5 card-title">item types</div>
<div><a href="#" id="show-all-isa">show all</a></div> <div><a href="#" id="show-all-isa">show all</a></div>
<div id="isa-list"> <div id="isa-list">
</div>
</div> </div>
</div> </div>
</div> </div>