Skip to content

Commit

Permalink
cration search bar / menu developer inactive #33
Browse files Browse the repository at this point in the history
  • Loading branch information
theomarie committed Mar 31, 2020
1 parent 4dac67e commit 10895c5
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
37 changes: 36 additions & 1 deletion app/routes/developers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,27 @@ import { get, set } from '@ember/object';
import RSVP from 'rsvp';

export default Route.extend({
model() {
async model() {
var content = [];
let listDevelopers = await this.store.findAll('developer');

listDevelopers.forEach(developer => {
content.push(
{
category: "Developers",
title: developer.username,
description: developer.fullName,
url: "/developer/" + developer.id + "/home"
});
});


return RSVP.hash({
developers: this.get('store').findAll('developer'),
content: content,
alreadyOpen: ''
});

},
actions: {
openAdd() {
Expand Down Expand Up @@ -38,6 +54,25 @@ export default Route.extend({
}
set(model, 'alreadyOpen', dev.id)
this.transitionTo('developers.delete', dev.id);
},
initUI() {
jQuery('.ui.dropdown').dropdown({
on: 'hover'
});
jQuery('.ui.overlay').visibility({ type: 'fixed', offset: 15 });

jQuery('#searchBarDev')
.search({
source: this.modelFor('developers').content,
searchFields: [
'title', 'description'
],
type: "category",
fullTextSearch: true,
searchOnFocus: true,
minCharacters: 0,
maxResults: 10
});
}
}
});
8 changes: 7 additions & 1 deletion app/templates/developers.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
<button class="ui icon orange button" {{action 'openAdd'}}><i class="user plus icon" /> Add new developer</button>
<div class="ui fluid category search">
<div class="ui icon input">
<input class="promptDevelopers" type="text" id="searchBarDev" placeholder="Search developers...">
<i class="search icon"></i>
</div>
<div class="results"></div>
</div>
{{outlet}}
<table class="ui table content inverted">
<thead>
Expand Down

0 comments on commit 10895c5

Please sign in to comment.