Add search bar to side bar

This commit is contained in:
Pierre HUBERT 2019-05-11 17:03:09 +02:00
parent 356d70651b
commit c04ee45098
2 changed files with 36 additions and 1 deletions

View File

@ -90,7 +90,7 @@ ComunicWeb.components.menuBar.authenticated = {
navbarCollapseElemList.className = "nav navbar-nav";
//Add search form
this.addSearchForm(navbarCollapseElemList);
//this.addSearchForm(navbarCollapseElemList);
//Navbar right elements
var navbarRight = createElem("div", navBar);

View File

@ -67,5 +67,40 @@ ComunicWeb.components.sideBar.main = {
]
});
});
// Search form
var searchForm = createElem2({
appendTo: section,
type: "form",
class: "sidebar-form",
children: [
createElem2({
type: "div",
class: "input-group",
children: [
createElem2({
type: "input",
class: "form-control",
elemType: "text",
placeholder: "Search...",
}),
createElem2({
type: "span",
class: "input-group-btn",
innerHTML: '<button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i></button>',
}),
]
})
]
});
searchForm.addEventListener("submit", function(e){
e.preventDefault();
openPage("search?q=" + searchForm.getElementsByTagName("input")[0].value);
});
}
}