mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-25 21:39:21 +00:00
Add search bar to side bar
This commit is contained in:
parent
356d70651b
commit
c04ee45098
@ -90,7 +90,7 @@ ComunicWeb.components.menuBar.authenticated = {
|
|||||||
navbarCollapseElemList.className = "nav navbar-nav";
|
navbarCollapseElemList.className = "nav navbar-nav";
|
||||||
|
|
||||||
//Add search form
|
//Add search form
|
||||||
this.addSearchForm(navbarCollapseElemList);
|
//this.addSearchForm(navbarCollapseElemList);
|
||||||
|
|
||||||
//Navbar right elements
|
//Navbar right elements
|
||||||
var navbarRight = createElem("div", navBar);
|
var navbarRight = createElem("div", navBar);
|
||||||
|
@ -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);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user