Added searchbar for all pages

This commit is contained in:
Keanu D?lle 2020-11-01 22:03:16 +01:00
parent 91349e2c2c
commit e2b9d2a798
5 changed files with 27 additions and 6 deletions

View File

@ -67,7 +67,6 @@ Searchbar = ( function() {
contentType: 'application/json',
success: function(data) {
if(is_ok(data)) {
console.log(data.members);
$.each(data.members, function(index, value){
$(".search-result-overlay-list").append("<a href=\"/portal/mm/profile?action=view&id="+value.entity_id+"\"><li class='list-group-item'><span class=\"badge badge-secondary\">Mitglied</span> "+value.firstname+" "+value.lastname+"</li></a>")
});
@ -80,8 +79,26 @@ Searchbar = ( function() {
}
});
}else{
console.log("Unknown search entity type: "+type);
return;
$.ajax({
url: '/api/members/',
type: 'GET',
data: {
"name": $("#searchbar").val()
},
contentType: 'application/json',
success: function(data) {
if(is_ok(data)) {
$.each(data.members, function(index, value){
$(".search-result-overlay-list").append("<a href=\"/portal/mm/profile?action=view&id="+value.entity_id+"\"><li class='list-group-item'><span class=\"badge badge-secondary\">Mitglied</span> "+value.firstname+" "+value.lastname+"</li></a>")
});
}
},
timeout: 3000,
error: function() {
alert("Verbindung zum Server unterbrochen!");
}
});
}
};
return {

View File

@ -4,6 +4,8 @@
<div class="wrapper">
{{> sidebar }}
<div id="content">
{{> searchbar}}
<hr>
<h1>Willkommen beim ERMS!</h1>
</div>
</div>

View File

@ -4,6 +4,8 @@
<div class="wrapper">
{{> sidebar }}
<div id="content">
{{> searchbar}}
<hr>
<h1>Member List</h1>
<div class="col-md-6">
<div class="filter">

View File

@ -4,11 +4,11 @@
</div>
<input type="text" class="form-control" id="searchbar" data-active-entity="{{active_entity}}" data-entity-type="{{entity_type}}">
<span class="input-group-append">
<button class="btn btn-outline-secondary" type="button">
<span class="btn btn-outline-secondary" type="button">
<svg width="16" height="16" fill="currentColor">
<use xlink:href="/img/bootstrap-icons.svg#search"/>
</svg>
</button>
</span>
</span>
</div>
<div class="search-result-overlay" style="display: none">

View File

@ -22,7 +22,7 @@
<li><a href="/portal/mm">Mitgliederliste</a></li>
</ul>
<ul>
<li><a href="/portal/mm/core-data">Profil</a></li>
<li><a href="/portal/mm/profile">Profil</a></li>
</ul>
<ul>
<li><a href="/portal/mm/groups">Gruppen</a></li>