Search Results:
diff --git a/src/app/components/search/search.component.ts b/src/app/components/search/search.component.ts
index 5f13b95..d201599 100644
--- a/src/app/components/search/search.component.ts
+++ b/src/app/components/search/search.component.ts
@@ -1,8 +1,9 @@
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, ViewChild } from '@angular/core';
import { OpenLPService } from '../../openlp.service';
import { PageTitleService } from '../../page-title.service';
import { PluginDescription } from '../../responses';
+import { SearchOptionsComponent } from './search-options/search-options.component';
@Component({
selector: 'openlp-search',
@@ -16,6 +17,8 @@ export class SearchComponent implements OnInit {
public searchResults = null;
public selectedPlugin = 'songs';
public currentPlugin: string;
+ public displaySearchOptions: Boolean = false;
+ @ViewChild(SearchOptionsComponent, {static: false}) searchOptions: SearchOptionsComponent;
constructor(private pageTitleService: PageTitleService, private openlpService: OpenLPService) {
pageTitleService.changePageTitle('Search');
@@ -26,6 +29,19 @@ export class SearchComponent implements OnInit {
this.openlpService.search(this.currentPlugin, this.searchText).subscribe(items => this.searchResults = items);
}
+ // Used to display search-options for certain plugins
+ onPluginChange() {
+ if (this.selectedPlugin === 'bibles') {
+ this.searchOptions.onPluginChange(this.selectedPlugin);
+ this.displaySearchOptions = true;
+ }
+ else {
+ if (this.displaySearchOptions) {
+ this.displaySearchOptions = false;
+ }
+ }
+ }
+
sendLive(id) {
this.openlpService.sendItemLive(this.currentPlugin, id).subscribe(res => {});
}
diff --git a/src/app/openlp.service.ts b/src/app/openlp.service.ts
index 7bbe660..5b4302f 100644
--- a/src/app/openlp.service.ts
+++ b/src/app/openlp.service.ts
@@ -82,6 +82,14 @@ export class OpenLPService {
return this.http.get(`${this.apiURL}/plugins/${plugin}/search?text=${text}`, httpOptions);
}
+ getSearchOptions(plugin): Observable
{
+ return this.http.get(`${this.apiURL}/plugins/${plugin}/search-options`, httpOptions);
+ }
+
+ setSearchOption(plugin, option): Observable {
+ return this.http.post(`${this.apiURL}/plugins/${plugin}/search-options`, {'option': option}, httpOptions);
+ }
+
getServiceItems(): Observable {
return this.http.get(`${this.apiURL}/service/items`, httpOptions);
}