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/work-packages/wp-attachments-formattable-.../models/single-attachment.ts

22 lines
721 B

import IAugmentedJQuery = angular.IAugmentedJQuery;
export class SingleAttachmentModel {
protected imageFileExtensions:Array<string> = ['jpeg', 'jpg', 'gif', 'bmp', 'png'];
public fileExtension:string;
public fileName:string;
public isAnImage:boolean;
public url:string;
constructor(protected attachment:any) {
if (angular.isDefined(attachment)) {
this.fileName = attachment.fileName || attachment.name;
this.fileExtension = (this.fileName.split('.') as any[]).pop().toLowerCase();
this.isAnImage = this.imageFileExtensions.indexOf(this.fileExtension) > -1;
this.url = angular.isDefined(attachment.downloadLocation) ? attachment.downloadLocation.$link.href : '';
}
}
}