From: Bill Erickson Date: Thu, 28 Jan 2021 15:32:11 +0000 (-0500) Subject: LP1913338 Catalog search form visibility stickiness WIP X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=65555ec48575ab94da99ba5733a429cda29bedcc;p=working%2FEvergreen.git LP1913338 Catalog search form visibility stickiness WIP Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts b/Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts index e613fb3c9b..5ec91d5fd7 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts @@ -56,6 +56,7 @@ export class CatalogResolver implements Resolve> { 'opac.staff_saved_search.size', 'opac.search.enable_bookplate_search', 'eg.staffcat.exclude_electronic', + 'eg.catalog.search.form.open', 'circ.staff_placed_holds_fallback_to_ws_ou' ]).then(settings => { this.staffCat.defaultSearchOrg = diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.html index ab50809a23..6edd2e0e04 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.html +++ b/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.html @@ -10,7 +10,7 @@
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts index 4e37e5a269..89bfc5b20f 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts @@ -37,6 +37,7 @@ export class SearchFormComponent implements OnInit, AfterViewInit { // Display the full form if true, otherwise display the expandy. showThyself = true; + showThyselfSetting = false; constructor( private renderer: Renderer2, @@ -44,10 +45,27 @@ export class SearchFormComponent implements OnInit, AfterViewInit { private route: ActivatedRoute, private org: OrgService, private cat: CatalogService, + private store: ServerStoreService, private staffCat: StaffCatalogService ) { this.copyLocations = []; + } + + toggleFormDisplay() { + this.showThyself = !this.showThyself; + this.store.setItem('eg.catalog.search.form.open', this.showThyself); + } + + ngOnInit() { + this.ccvmMap = this.cat.ccvmMap; + this.cmfMap = this.cat.cmfMap; + this.context = this.staffCat.searchContext; + + // Start with advanced search options open + // if any filters are active. + this.showSearchFilters = this.filtersActive(); + // Some search scenarios, like rendering a search template, // will not be searchable and thus not resovle to a specific // search tab. Check to see if a specific tab is requested @@ -58,28 +76,23 @@ export class SearchFormComponent implements OnInit, AfterViewInit { } }); + this.store.getItem('eg.catalog.search.form.open') + .then(value => this.showThyselfSetting = value); + this.router.events.subscribe(routeEvent => { if (routeEvent instanceof NavigationEnd) { this.showThyself = true; - COLLAPSE_ON_PAGES.forEach(pageRegex => { - if (routeEvent.url.match(pageRegex)) { - this.showThyself = false; - } - }); + if (!this.showThyselfSetting) { + COLLAPSE_ON_PAGES.forEach(pageRegex => { + if (routeEvent.url.match(pageRegex)) { + this.showThyself = false; + } + }); + } } }); } - ngOnInit() { - this.ccvmMap = this.cat.ccvmMap; - this.cmfMap = this.cat.cmfMap; - this.context = this.staffCat.searchContext; - - // Start with advanced search options open - // if any filters are active. - this.showSearchFilters = this.filtersActive(); - } - ngAfterViewInit() { // Query inputs are generated from search context data, // so they are not available until after the first render. diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.staffcat-sticky-search-form.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.staffcat-sticky-search-form.sql new file mode 100644 index 0000000000..be47ba63fc --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.staffcat-sticky-search-form.sql @@ -0,0 +1,15 @@ +BEGIN; + +-- SELECT evergreen.upgrade_deps_block_check('TODO', :eg_version); + +INSERT INTO config.workstation_setting_type (name, grp, datatype, label) +VALUES ( + 'eg.catalog.search.form.open', 'gui', 'bool', + oils_i18n_gettext( + 'eg.catalog.search.form.open', + 'Catalog Search Form Visibility Sticky Setting', + 'cwst', 'label' + ) +); + +COMMIT;