Add timeline row in inline create

[ci skip]
pull/5456/head
Oliver Günther 8 years ago
parent bbeae48dbc
commit c7546ecbf9
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 16
      frontend/app/components/wp-fast-table/builders/modes/rows-builder.ts
  2. 6
      frontend/app/components/wp-fast-table/builders/timeline/timeline-row-builder.ts
  3. 4
      frontend/app/components/wp-inline-create/wp-inline-create.directive.ts

@ -37,6 +37,18 @@ export abstract class RowsBuilder {
return true;
}
/**
* Called after a row is added through +appendRow+.
* Inserts a new cell to the synced timeline, if open.
* @param workPackage
* @param timelineBody
*/
public addToTimeline(workPackage:WorkPackageResourceInterface|null, timelineBody:HTMLElement|DocumentFragment) {
// Append row into timeline
this.timelinebuilder.build(workPackage, timelineBody);
}
/**
* Refresh a single row after structural changes.
* Will perform dirty checking for when a work package is currently being edited.
@ -68,9 +80,7 @@ export abstract class RowsBuilder {
timelineBody:DocumentFragment) {
tableBody.appendChild(row);
// Append row into timeline
this.timelinebuilder.build(workPackage, timelineBody);
this.addToTimeline(workPackage, timelineBody);
}
/**

@ -18,10 +18,14 @@ export class TimelineRowBuilder {
$injectFields(this, 'states', 'wpTableTimeline', 'wpCacheService');
}
public build(workPackage:WorkPackageResourceInterface|null, timelineBody:DocumentFragment) {
public build(workPackage:WorkPackageResourceInterface|null, timelineBody:DocumentFragment|HTMLElement) {
const cell = document.createElement('div');
cell.classList.add(timelineCellClassName);
if (workPackage) {
cell.id = `wp-timeline-row-${workPackage.id}`;
}
// TODO skip if inserting rows that are not work packages
// We may either need to extend the timelinecell to handle these cases
// or alter the rendering of (e.g.,) relations to draw over these rows

@ -27,7 +27,6 @@
// ++
import {onClickOrEnter} from "../wp-fast-table/handlers/click-or-enter-handler";
import {SingleRowBuilder} from '../wp-fast-table/builders/rows/single-row-builder';
import {opWorkPackagesModule} from "../../angular-modules";
import {WorkPackageTableColumnsService} from "../wp-fast-table/state/wp-table-columns.service";
import {WorkPackageTableFiltersService} from '../wp-fast-table/state/wp-table-filters.service';
@ -43,7 +42,6 @@ import {scopeDestroyed$, scopedObservable} from "../../helpers/angular-rx-utils"
import {States} from "../states.service";
import {WorkPackageEditForm} from "../wp-edit-form/work-package-edit-form";
import {WorkPackageTable} from "../wp-fast-table/wp-fast-table";
import {RowRefreshBuilder} from "../wp-fast-table/builders/rows/row-refresh-builder";
import {WorkPackageTableRow} from "../wp-fast-table/wp-table.interfaces";
export class WorkPackageInlineCreateController {
@ -140,6 +138,7 @@ export class WorkPackageInlineCreateController {
this.workPackageEditForm = new WorkPackageEditForm('new');
const row = this.rowBuilder.buildNew(wp, this.workPackageEditForm);
this.table.rowBuilder.addToTimeline(wp, this.table.timelineBody);
this.$element.append(row);
this.$timeout(() => {
@ -192,6 +191,7 @@ export class WorkPackageInlineCreateController {
this.states.editing.get('new').clear();
this.states.workPackages.get('new').clear();
this.$element.find('#wp-row-new').remove();
jQuery(this.table.timelineBody).find('#wp-timeline-row-new').remove();
}
public showRow() {

Loading…
Cancel
Save