OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/frontend/app/components/wp-fast-table/builders/details-link-builder.ts

44 lines
1.2 KiB

import {WorkPackageResource} from './../../api/api-v3/hal-resources/work-package-resource.service';
import {injectorBridge} from '../../angular/angular-injector-bridge.functions';
import {UiStateLinkBuilder} from './ui-state-link-builder';
export const detailsLinkClassName = 'wp-table--details-link';
export class DetailsLinkBuilder {
// Injections
public I18n:op.I18n;
public text:any;
private uiStatebuilder:UiStateLinkBuilder;
constructor() {
injectorBridge(this);
this.text = {
button: this.I18n.t('js.button_open_details')
};
this.uiStatebuilder = new UiStateLinkBuilder();
}
public build(workPackage:WorkPackageResource, row:HTMLElement) {
// Append details button
let td = document.createElement('td');
td.classList.add('wp-table--details-column', 'hide-when-print', '-short');
let detailsLink = this.uiStatebuilder.linkToDetails(
workPackage.id,
this.text.button,
''
);
detailsLink.classList.add(detailsLinkClassName, 'hidden-for-sighted');
let icon = document.createElement('i');
icon.classList.add('icon', 'icon-view-split');
detailsLink.appendChild(icon);
td.appendChild(detailsLink);
row.appendChild(td);
}
}
DetailsLinkBuilder.$inject = ['I18n'];