mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
#706 custom empty tepmlate for task details
This commit is contained in:
parent
c734ba509e
commit
3b9a10dbfc
@ -103,6 +103,26 @@ No events
|
||||
**taskId**: { string } required) The id of the task details that we
|
||||
are asking for.
|
||||
|
||||
### Custom 'empty Activiti Task Details' template
|
||||
|
||||
By default the Activiti Task Details provides the following message for the empty task details:
|
||||
|
||||
'No Tasks'
|
||||
|
||||
|
||||
This can be changed by adding the following custom html template:
|
||||
|
||||
```html
|
||||
<activiti-task-details [taskId]="taskId">
|
||||
<no-task-details-template>
|
||||
<template>
|
||||
<h1>Sorry, no tasks here</h1>
|
||||
<img src="example.jpg">
|
||||
</template>
|
||||
</no-task-details-template>
|
||||
</activiti-task-details>
|
||||
```
|
||||
|
||||
## Basic usage example Activiti Filter
|
||||
The component shows all the available filters.
|
||||
|
||||
|
@ -18,8 +18,9 @@
|
||||
import { ActivitiTaskList } from './src/components/activiti-tasklist.component';
|
||||
import { ActivitiTaskDetails } from './src/components/activiti-task-details.component';
|
||||
import { ActivitiFilters } from './src/components/activiti-filters.component';
|
||||
import { NoTaskDetailsTemplateComponent } from './src/components/no-task-detail-template.component';
|
||||
|
||||
export * from './src/components/activiti-tasklist.component';
|
||||
export * from './src/services/activiti-tasklist.service';
|
||||
|
||||
export const ALFRESCO_TASKLIST_DIRECTIVES: [any] = [ActivitiFilters, ActivitiTaskList, ActivitiTaskDetails];
|
||||
export const ALFRESCO_TASKLIST_DIRECTIVES: [any] = [NoTaskDetailsTemplateComponent, ActivitiFilters, ActivitiTaskList, ActivitiTaskDetails];
|
||||
|
@ -1,4 +1,12 @@
|
||||
<div *ngIf="!taskDetails">{{ 'TASK_DETAILS.MESSAGES.NONE' | translate }}</div>
|
||||
<div *ngIf="!taskDetails">
|
||||
<template *ngIf="noTaskDetailsTemplateComponent" ngFor [ngForOf]="[data]"
|
||||
[ngForTemplate]="noTaskDetailsTemplateComponent">
|
||||
{{ 'TASK_DETAILS.MESSAGES.NONE' | translate }}
|
||||
</template>
|
||||
<div *ngIf="!noTaskDetailsTemplateComponent">
|
||||
{{ 'TASK_DETAILS.MESSAGES.NONE' | translate }}
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="taskDetails">
|
||||
<h2 class="mdl-card__title-text">{{taskDetails.name}}</h2>
|
||||
<activiti-task-header [taskDetails]="taskDetails" #activitiheader></activiti-task-header>
|
||||
|
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, Input, OnInit, ViewChild, Output, EventEmitter } from '@angular/core';
|
||||
import { Component, Input, OnInit, ViewChild, Output, EventEmitter, TemplateRef } from '@angular/core';
|
||||
import { AlfrescoTranslationService, AlfrescoAuthenticationService, AlfrescoPipeTranslate } from 'ng2-alfresco-core';
|
||||
import { ActivitiTaskListService } from './../services/activiti-tasklist.service';
|
||||
import { ActivitiTaskHeader } from './activiti-task-header.component';
|
||||
@ -81,6 +81,8 @@ export class ActivitiTaskDetails implements OnInit {
|
||||
|
||||
taskPeople: User[] = [];
|
||||
|
||||
noTaskDetailsTemplateComponent: TemplateRef<any>;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param auth
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
Directive,
|
||||
ContentChild,
|
||||
TemplateRef,
|
||||
AfterContentInit
|
||||
} from '@angular/core';
|
||||
import { ActivitiTaskDetails } from './activiti-task-details.component';
|
||||
|
||||
@Directive({
|
||||
selector: 'no-task-details-template'
|
||||
})
|
||||
export class NoTaskDetailsTemplateComponent implements AfterContentInit {
|
||||
|
||||
@ContentChild(TemplateRef)
|
||||
template: any;
|
||||
|
||||
constructor(
|
||||
private activitiTaskDetails: ActivitiTaskDetails) {
|
||||
}
|
||||
|
||||
ngAfterContentInit() {
|
||||
this.activitiTaskDetails.noTaskDetailsTemplateComponent = this.template;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user