diff --git a/demo-shell-ng2/app/app.routes.ts b/demo-shell-ng2/app/app.routes.ts index 3e35f00d1f..c2bea7144d 100644 --- a/demo-shell-ng2/app/app.routes.ts +++ b/demo-shell-ng2/app/app.routes.ts @@ -25,7 +25,8 @@ import { LoginDemoComponent, ActivitiDemoComponent, WebscriptComponent, - AboutComponent + AboutComponent, + FormViewer } from './components/index'; export const routes: RouterConfig = [ @@ -37,6 +38,7 @@ export const routes: RouterConfig = [ { path: 'login', component: LoginDemoComponent }, { path: 'search', component: SearchComponent }, { path: 'activiti', component: ActivitiDemoComponent }, + { path: 'activiti/tasks/:id', component: FormViewer }, { path: 'webscript', component: WebscriptComponent }, { path: 'about', component: AboutComponent } ]; diff --git a/demo-shell-ng2/app/components/activiti/form-viewer.component.css b/demo-shell-ng2/app/components/activiti/form-viewer.component.css new file mode 100644 index 0000000000..0e5cdfdd65 --- /dev/null +++ b/demo-shell-ng2/app/components/activiti/form-viewer.component.css @@ -0,0 +1,3 @@ +.activiti-form-viewer { + margin: 10px; +} diff --git a/demo-shell-ng2/app/components/activiti/form-viewer.component.html b/demo-shell-ng2/app/components/activiti/form-viewer.component.html new file mode 100644 index 0000000000..df826d2116 --- /dev/null +++ b/demo-shell-ng2/app/components/activiti/form-viewer.component.html @@ -0,0 +1,3 @@ +
+ +
diff --git a/demo-shell-ng2/app/components/activiti/form-viewer.component.ts b/demo-shell-ng2/app/components/activiti/form-viewer.component.ts new file mode 100644 index 0000000000..da2d8768d7 --- /dev/null +++ b/demo-shell-ng2/app/components/activiti/form-viewer.component.ts @@ -0,0 +1,62 @@ +/*! + * @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 { Component, OnInit, OnDestroy, AfterViewChecked } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { ActivitiForm, FormService } from 'ng2-activiti-form'; +import { Subscription } from 'rxjs/Rx'; + +declare let __moduleName: string; +declare var componentHandler; + +@Component({ + moduleId: __moduleName, + selector: 'form-viewer', + templateUrl: './form-viewer.component.html', + styleUrls: ['./form-viewer.component.css'], + directives: [ActivitiForm], + providers: [FormService] +}) +export class FormViewer implements OnInit, OnDestroy, AfterViewChecked { + + private sub: Subscription; + + taskId: string; + + constructor(private formService: FormService, + private route: ActivatedRoute, + private router: Router) { + } + + ngOnInit() { + this.sub = this.route.params.subscribe(params => { + this.taskId = params['id']; + }); + } + + ngOnDestroy() { + this.sub.unsubscribe(); + } + + ngAfterViewChecked() { + // workaround for MDL issues with dynamic components + if (componentHandler) { + componentHandler.upgradeAllRegistered(); + } + } + +} diff --git a/demo-shell-ng2/app/components/files/files.component.html b/demo-shell-ng2/app/components/files/files.component.html index b7e044a0dd..c5dca88622 100644 --- a/demo-shell-ng2/app/components/files/files.component.html +++ b/demo-shell-ng2/app/components/files/files.component.html @@ -90,6 +90,11 @@ title="{{'DOCUMENT_LIST.ACTIONS.DOCUMENT.DELETE' | translate}}" handler="delete"> + + this.setupBpmActions(defs || []), err => console.log(err) ); } + viewActivitiForm(event?: any) { + this.router.navigate(['/activiti/tasks', '1']); + } + private setupBpmActions(actions: any[]) { actions.map(def => { let documentAction = new DocumentActionModel(); diff --git a/demo-shell-ng2/app/components/index.ts b/demo-shell-ng2/app/components/index.ts index 412bb7f97d..368d7ea43e 100644 --- a/demo-shell-ng2/app/components/index.ts +++ b/demo-shell-ng2/app/components/index.ts @@ -21,6 +21,7 @@ export { SearchComponent } from './search/search.component'; export { SearchBarComponent } from './search/search-bar.component'; export { LoginDemoComponent } from './login/login-demo.component'; export { ActivitiDemoComponent } from './activiti/activiti-demo.component'; +export { FormViewer } from './activiti/form-viewer.component'; export { WebscriptComponent } from './webscript/webscript.component'; export { AboutComponent } from './about/about.component'; export { FilesComponent } from './files/files.component'; diff --git a/ng2-components/ng2-activiti-form/src/components/widgets/tabs/tabs.widget.html b/ng2-components/ng2-activiti-form/src/components/widgets/tabs/tabs.widget.html index bf3eb019dd..4c2f2cd5cb 100644 --- a/ng2-components/ng2-activiti-form/src/components/widgets/tabs/tabs.widget.html +++ b/ng2-components/ng2-activiti-form/src/components/widgets/tabs/tabs.widget.html @@ -1,5 +1,5 @@ -
-