[open-ils-commits] [GIT] Evergreen ILS branch master updated. 9776fd8bcb298aa6c97c0e7bf4ca64ca850269a0

Evergreen Git git at git.evergreen-ils.org
Wed Jan 23 12:00:34 EST 2019


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  9776fd8bcb298aa6c97c0e7bf4ca64ca850269a0 (commit)
       via  44d4238f5bb855320c8f35384a5d47c37cb16b81 (commit)
      from  e0b42ed52e7e9e5f784c5e2126dd1780cb56b6f6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9776fd8bcb298aa6c97c0e7bf4ca64ca850269a0
Author: Bill Erickson <berickxx at gmail.com>
Date:   Mon Dec 17 10:56:36 2018 -0500

    LP#1808268 eg2 grid rename action disable option
    
    Rename the "disabled" attribute on toolbar-action to "disabeOnRows" to
    better clarify the expected input value: function returning bool instead
    of bool variable.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Jane Sandberg <sandbej at linnbenton.edu>

diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid-toolbar-action.component.ts b/Open-ILS/src/eg2/src/app/share/grid/grid-toolbar-action.component.ts
index 6b6114f..85211e6 100644
--- a/Open-ILS/src/eg2/src/app/share/grid/grid-toolbar-action.component.ts
+++ b/Open-ILS/src/eg2/src/app/share/grid/grid-toolbar-action.component.ts
@@ -16,7 +16,7 @@ export class GridToolbarActionComponent implements OnInit {
     // Optional: add a function that returns true or false.
     // If true, this action will be disabled; if false
     // (default behavior), the action will be enabled.
-    @Input() disabled: (rows: any[]) => boolean;
+    @Input() disableOnRows: (rows: any[]) => boolean;
 
     // get a reference to our container grid.
     constructor(@Host() private grid: GridComponent) {}
@@ -32,8 +32,8 @@ export class GridToolbarActionComponent implements OnInit {
         action.label = this.label;
         action.action = this.action;
 
-        action.disabled = (this.disabled == null) ? (rows: any[]) => false : this.disabled;
-
+        action.disableOnRows = (this.disableOnRows === null) ?
+            (rows: any[]) => false : this.disableOnRows;
 
         this.grid.context.toolbarActions.push(action);
     }
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 a133623..93df402 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
@@ -42,7 +42,7 @@ export class GridToolbarComponent implements OnInit {
     }
 
     shouldDisableAction(action: GridToolbarAction) {
-        return action.disabled(this.gridContext.getSelectedRows());
+        return action.disableOnRows(this.gridContext.getSelectedRows());
     }
 
     printHtml() {
diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid.ts b/Open-ILS/src/eg2/src/app/share/grid/grid.ts
index 35ca542..8a777e4 100644
--- a/Open-ILS/src/eg2/src/app/share/grid/grid.ts
+++ b/Open-ILS/src/eg2/src/app/share/grid/grid.ts
@@ -890,7 +890,7 @@ export class GridContext {
 export class GridToolbarAction {
     label: string;
     action: (rows: any[]) => any;
-    disabled: (rows: any[]) => boolean;
+    disableOnRows: (rows: any[]) => boolean;
 }
 
 // Buttons are global actions
diff --git a/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html b/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html
index 66398fe..8249335 100644
--- a/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html
+++ b/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html
@@ -122,7 +122,8 @@ HERasdfE
   [rowFlairCallback]="btGridRowFlairCallback"
   [cellClassCallback]="btGridCellClassCallback"
   [sortable]="true">
-  <eg-grid-toolbar-action label="Action that needs a single row" i18n-label [action]="complimentEvergreen" [disabled]="notOneSelectedRow">
+  <eg-grid-toolbar-action label="Action that needs a single row" i18n-label
+    [action]="complimentEvergreen" [disableOnRows]="notOneSelectedRow">
   </eg-grid-toolbar-action>
   <eg-grid-column name="test" [cellTemplate]="cellTmpl" 
     [cellContext]="btGridTestContext" [sortable]="false">

commit 44d4238f5bb855320c8f35384a5d47c37cb16b81
Author: Jane Sandberg <sandbej at linnbenton.edu>
Date:   Thu Dec 13 20:50:15 2018 -0800

    LP1808268: Add [disable] option to <eg-grid-toolbar-action> in eg2
    
    To test:
    1) Apply this commit and recompile eg2.
    2) Open the eg2 sandbox (https://yourdomain/eg2/staff/sandbox)
    3) Ensure that the action called "Action that needs a single row"
    is only enabled when one row of the grid is selected.
    4) Create more <eg-grid-toolbar-actions> on grids in eg2.  Make sure
    that they all enable/disable those actions per the output of the
    functions you reference in the [disabled] attribute.
    
    Signed-off-by: Jane Sandberg <sandbej at linnbenton.edu>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>

diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid-toolbar-action.component.ts b/Open-ILS/src/eg2/src/app/share/grid/grid-toolbar-action.component.ts
index 593530a..6b6114f 100644
--- a/Open-ILS/src/eg2/src/app/share/grid/grid-toolbar-action.component.ts
+++ b/Open-ILS/src/eg2/src/app/share/grid/grid-toolbar-action.component.ts
@@ -13,6 +13,11 @@ export class GridToolbarActionComponent implements OnInit {
     @Input() label: string;
     @Input() action: (rows: any[]) => any;
 
+    // Optional: add a function that returns true or false.
+    // If true, this action will be disabled; if false
+    // (default behavior), the action will be enabled.
+    @Input() disabled: (rows: any[]) => boolean;
+
     // get a reference to our container grid.
     constructor(@Host() private grid: GridComponent) {}
 
@@ -27,7 +32,9 @@ export class GridToolbarActionComponent implements OnInit {
         action.label = this.label;
         action.action = this.action;
 
+        action.disabled = (this.disabled == null) ? (rows: any[]) => false : this.disabled;
+
+
         this.grid.context.toolbarActions.push(action);
     }
 }
-
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 ae24021..5eaa81f 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
@@ -35,10 +35,11 @@
         class="material-icons mat-icon-in-button">playlist_add_check</span>
     </button>
     <div class="dropdown-menu" ngbDropdownMenu>
-      <a class="dropdown-item" (click)="performAction(action)"
-        *ngFor="let action of gridContext.toolbarActions">
+      <button class="dropdown-item" (click)="performAction(action)"
+        *ngFor="let action of gridContext.toolbarActions"
+        [disabled]="shouldDisableAction(action)">
         <span class="ml-2">{{action.label}}</span>
-      </a>
+      </button>
     </div>
   </div>
 
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 5c8b523..a133623 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
@@ -41,6 +41,10 @@ export class GridToolbarComponent implements OnInit {
         action.action(this.gridContext.getSelectedRows());
     }
 
+    shouldDisableAction(action: GridToolbarAction) {
+        return action.disabled(this.gridContext.getSelectedRows());
+    }
+
     printHtml() {
         this.gridPrinter.printGrid();
     }
diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid.ts b/Open-ILS/src/eg2/src/app/share/grid/grid.ts
index a352c0c..35ca542 100644
--- a/Open-ILS/src/eg2/src/app/share/grid/grid.ts
+++ b/Open-ILS/src/eg2/src/app/share/grid/grid.ts
@@ -890,6 +890,7 @@ export class GridContext {
 export class GridToolbarAction {
     label: string;
     action: (rows: any[]) => any;
+    disabled: (rows: any[]) => boolean;
 }
 
 // Buttons are global actions
diff --git a/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html b/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html
index cd003ff..66398fe 100644
--- a/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html
+++ b/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html
@@ -122,6 +122,8 @@ HERasdfE
   [rowFlairCallback]="btGridRowFlairCallback"
   [cellClassCallback]="btGridCellClassCallback"
   [sortable]="true">
+  <eg-grid-toolbar-action label="Action that needs a single row" i18n-label [action]="complimentEvergreen" [disabled]="notOneSelectedRow">
+  </eg-grid-toolbar-action>
   <eg-grid-column name="test" [cellTemplate]="cellTmpl" 
     [cellContext]="btGridTestContext" [sortable]="false">
   </eg-grid-column>
diff --git a/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.ts b/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.ts
index 6178969..0389521 100644
--- a/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.ts
@@ -55,6 +55,9 @@ export class SandboxComponent implements OnInit {
 
     name = 'Jane';
 
+    complimentEvergreen: (rows: IdlObject[]) => void;
+    notOneSelectedRow: (rows: IdlObject[]) => boolean;
+
     constructor(
         private idl: IdlService,
         private org: OrgService,
@@ -108,6 +111,10 @@ export class SandboxComponent implements OnInit {
                 return cbt;
             }));
         };
+
+        this.complimentEvergreen = (rows: IdlObject[]) => alert('Evergreen is great!');
+        this.notOneSelectedRow = (rows: IdlObject[]) => (rows.length != 1);
+
     }
 
     btGridRowClassCallback(row: any): string {

-----------------------------------------------------------------------

Summary of changes:
 .../share/grid/grid-toolbar-action.component.ts    |    9 ++++++++-
 .../src/app/share/grid/grid-toolbar.component.html |    7 ++++---
 .../src/app/share/grid/grid-toolbar.component.ts   |    4 ++++
 Open-ILS/src/eg2/src/app/share/grid/grid.ts        |    1 +
 .../src/app/staff/sandbox/sandbox.component.html   |    3 +++
 .../eg2/src/app/staff/sandbox/sandbox.component.ts |    7 +++++++
 6 files changed, 27 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list