Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions app/components/application-header.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import Component from '@ember/component';
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';

export default Component.extend({
globalSearch: service(),
allStatus: false,
showAdvanced: false,
export default class SearchComponent extends Component {
@service globalSearch;

actions: {
search() {
this.globalSearch.doSearch(this.query);
},
clear() {
this.globalSearch.doSearch(null);
}
@tracked query = '';

@action
search(event) {
event.preventDefault();
const inputValue = event.target.querySelector('[name="query"]').value;
this.globalSearch.doSearch(inputValue);
}
});
}
31 changes: 9 additions & 22 deletions app/templates/components/application-header.hbs
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
<BsNavbar @backgroundColor="white" @class="navbar-expand-lg" @onCollapse={{action (mut this.collapsed) true}} @onExpand={{action (mut this.collapsed) false}} as |navbar|>
<div class="container-fluid">
<a class="navbar-brand d-block" href="/">
<img class="pl-0 pr-0" src="/assets/ror-logo.svg" alt="Research Organization Registry logo">
<img class="pl-0 pr-0" src="/assets/ror-logo.svg" alt="Research Organization Registry">
</a>
<div id="search">
<form {{on "submit" (fn this.actions.search this.query)}} class="form-inline mw-25" role="search">
<input name="query" value={{this.query}} id="query" class="form-control" placeholder="Search Registry..." escape-press={{action "clear"}} enter={{action "search"}} />
<form {{on "submit" this.search}} class="form-inline mw-25" role="search">
<input
name="query"
value={{this.query}}
id="query"
class="form-control"
placeholder="Search Registry..."
/>
</form>
</div>

Expand Down Expand Up @@ -55,22 +61,3 @@
</navbar.content>
</div>
</BsNavbar>
{{#if this.showAdvanced}}
<div class="row">
<div class="col-md-12">
<div class="callout small">
<h2>Show records with status:</h2>
<form {{action "applyFilter" query on="submit"}} class="form-inline mw-25" role="search">
<input type="checkbox" id="active-status" name="activeStatus" />
<label for="active-status">Active</label>
<input type="checkbox" id="inactive-status" name="inactiveStatus" />
<label for="inactive-status">Inactive</label>
<input type="checkbox" id="withdrawn-status" name="withdrawnStatus" />
<label for="withdrawn-status">Withdrawn</label>
<input type="checkbox" id="all-status" name="allStatus" change={{action "applyFilter"}} />
<label for="all-status">All statuses</label>
</form>
</div>
</div>
</div>
{{/if}}
Loading