[open-ils-commits] [GIT] Evergreen ILS branch rel_3_2 updated. 2dc42228985912b638e70107abaac3db61b91773
Evergreen Git
git at git.evergreen-ils.org
Wed Jan 23 12:02:14 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, rel_3_2 has been updated
via 2dc42228985912b638e70107abaac3db61b91773 (commit)
via c22dc19b8e6516794d29111dce8c501055878dd9 (commit)
from 9f6db569aba8118f1a654fce9165aa7f6c68a9eb (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 2dc42228985912b638e70107abaac3db61b91773
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 7fd7a86..8a10703 100644
--- a/Open-ILS/src/eg2/src/app/share/grid/grid.ts
+++ b/Open-ILS/src/eg2/src/app/share/grid/grid.ts
@@ -884,7 +884,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 58f1b99..686ce79 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 c22dc19b8e6516794d29111dce8c501055878dd9
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 e04940d..7fd7a86 100644
--- a/Open-ILS/src/eg2/src/app/share/grid/grid.ts
+++ b/Open-ILS/src/eg2/src/app/share/grid/grid.ts
@@ -884,6 +884,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 289ed50..58f1b99 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 92b18dc..6845290 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,
@@ -107,6 +110,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