From 29685fc3fa6712d8f66c03eb820bf43201bba7b2 Mon Sep 17 00:00:00 2001 From: Jane Sandberg Date: Sat, 25 May 2019 18:46:03 -0700 Subject: [PATCH] LP1828840: Option to hide grid save settings button in angular grid To test: 1) Apply this commit. 2) Create an eg-grid in the Angular staff client without a persistKey attribute (or use the one in the sandbox). 3) Compile the client and open the grid in your browser. Open the column picker menu. Note that the Save button does not display. 4) Add an arbitrary value to the persistKey attribute. 5) Repeat step 3. Note that the Save button does display. 6) Change the value of the persistKey attribute to "disabled". 7) Repeat step 3. Note that the Save button does not display. Signed-off-by: Jane Sandberg --- Open-ILS/src/eg2/src/app/share/grid/grid-toolbar.component.html | 1 + Open-ILS/src/eg2/src/app/share/grid/grid-toolbar.component.ts | 1 + Open-ILS/src/eg2/src/app/share/grid/grid.component.html | 3 ++- Open-ILS/src/eg2/src/app/share/grid/grid.component.ts | 3 +++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid-toolbar.component.html b/Open-ILS/src/eg2/src/app/share/grid/grid-toolbar.component.html index af223fefdf..43e9c3410a 100644 --- a/Open-ILS/src/eg2/src/app/share/grid/grid-toolbar.component.html +++ b/Open-ILS/src/eg2/src/app/share/grid/grid-toolbar.component.html @@ -127,6 +127,7 @@ Manage Column Widths save Save Grid Settings diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid-toolbar.component.ts b/Open-ILS/src/eg2/src/app/share/grid/grid-toolbar.component.ts index 82c199c36b..9eea64734d 100644 --- a/Open-ILS/src/eg2/src/app/share/grid/grid-toolbar.component.ts +++ b/Open-ILS/src/eg2/src/app/share/grid/grid-toolbar.component.ts @@ -16,6 +16,7 @@ export class GridToolbarComponent implements OnInit { @Input() gridContext: GridContext; @Input() colWidthConfig: GridColumnWidthComponent; @Input() gridPrinter: GridPrintComponent; + @Input() disableSaveSettings = false; renderedGroups: {[group: string]: boolean}; diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid.component.html b/Open-ILS/src/eg2/src/app/share/grid/grid.component.html index 77ea0e6fb1..a69a0a64e4 100644 --- a/Open-ILS/src/eg2/src/app/share/grid/grid.component.html +++ b/Open-ILS/src/eg2/src/app/share/grid/grid.component.html @@ -4,7 +4,8 @@ + [colWidthConfig]="colWidthConfig" + [disableSaveSettings]="!persistKey || ('disabled' === persistKey)"> diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid.component.ts b/Open-ILS/src/eg2/src/app/share/grid/grid.component.ts index 66686ef2e8..8dce30c185 100644 --- a/Open-ILS/src/eg2/src/app/share/grid/grid.component.ts +++ b/Open-ILS/src/eg2/src/app/share/grid/grid.component.ts @@ -42,6 +42,9 @@ export class GridComponent implements OnInit, AfterViewInit, OnDestroy { // Storage persist key / per-grid-type unique identifier // The value is prefixed with 'eg.grid.' + // + // If persistKey is set to "disabled", or does not exist, + // the grid will not display a Save button to the user @Input() persistKey: string; @Input() disableSelect: boolean; -- 2.11.0