#540 hide/show save and complete button forms

This commit is contained in:
Mario Romano 2016-08-12 12:32:28 +01:00
parent 2f941c95a5
commit 65ec34041b
3 changed files with 27 additions and 1 deletions

View File

@ -19,3 +19,7 @@
.activiti-form-debug-container .debug-toggle-text:hover { .activiti-form-debug-container .debug-toggle-text:hover {
font-weight: bold; font-weight: bold;
} }
.activiti-form-hide-button {
display: none;
}

View File

@ -20,6 +20,7 @@
<button *ngFor="let outcome of form.outcomes" <button *ngFor="let outcome of form.outcomes"
alfresco-mdl-button alfresco-mdl-button
[class.mdl-button--colored]="!outcome.isSystem" [class.mdl-button--colored]="!outcome.isSystem"
[class.activiti-form-hide-button]="!isOutcomeButtonEnabled(outcome)"
(click)="onOutcomeClicked(outcome, $event)"> (click)="onOutcomeClicked(outcome, $event)">
{{outcome.name}} {{outcome.name}}
</button> </button>

View File

@ -53,6 +53,10 @@ declare var componentHandler;
* *
* {showRefreshButton} boolean - to hide the refresh button of the form pass false, default true; * {showRefreshButton} boolean - to hide the refresh button of the form pass false, default true;
* *
* {showCompleteButton} boolean - to hide the complete button of the form pass false, default true;
*
* {showSaveButton} boolean - to hide the save button of the form pass false, default true;
*
* @Output * @Output
* {formLoaded} EventEmitter - This event is fired when the form is loaded, it pass all the value in the form. * {formLoaded} EventEmitter - This event is fired when the form is loaded, it pass all the value in the form.
* {formsaved} EventEmitter - This event is fired when the form is saved, it pass all the value in the form. * {formsaved} EventEmitter - This event is fired when the form is saved, it pass all the value in the form.
@ -85,6 +89,12 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges {
@Input() @Input()
showTitle: boolean = true; showTitle: boolean = true;
@Input()
showCompleteButton: boolean = true;
@Input()
showSaveButton: boolean = true;
@Input() @Input()
readOnly: boolean = false; readOnly: boolean = false;
@ -104,6 +114,9 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges {
debugMode: boolean = false; debugMode: boolean = false;
constructor(private formService: FormService) {
}
hasForm(): boolean { hasForm(): boolean {
return this.form ? true : false; return this.form ? true : false;
} }
@ -112,7 +125,15 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges {
return this.form.taskName && this.showTitle; return this.form.taskName && this.showTitle;
} }
constructor(private formService: FormService) {} isOutcomeButtonEnabled(outcome: any): boolean {
if (outcome.name === 'Complete') {
return this.showCompleteButton;
}
if (outcome.name === 'Save') {
return this.showSaveButton;
}
return true;
}
ngOnInit() { ngOnInit() {
if (this.taskId) { if (this.taskId) {