Skip to content
Snippets Groups Projects
Commit 6fd11cd7 authored by Florent Poittevin's avatar Florent Poittevin
Browse files

Add property name decorator

parent 84ff21e3
No related branches found
No related tags found
No related merge requests found
import {ChangeDetectionStrategy, Component, Input} from "@angular/core";
import {FormBuilder, Validators} from "@angular/forms";
import {DateUtil} from "@app/core/utils/date.util";
import {
DepositsModel,
LanguagesModel,
......@@ -9,8 +10,8 @@ import {
SubmissionPoliciesModel,
} from "@app/generated-api";
import {AbstractFormComponent} from "@app/shared/components/abstract-form/abstract-form.component";
import {PropertyName} from "@app/shared/decorators/property-name.decorator";
import {BaseFormDefinition} from "@app/shared/models/base-form-definition.model";
import {DateUtil} from "@app/core/utils/date.util";
import AccessModelEnum = DepositsModel.AccessModelEnum;
@Component({
......@@ -89,17 +90,17 @@ export class FormComponent extends AbstractFormComponent<DepositsModel> {
}
class FormComponentFormDefinition extends BaseFormDefinition {
organizationalUnitId: string = "organizationalUnitId";
title: string = "title";
description: string = "description";
languageId: string = "languageId";
publicationDate: string = "publicationDate";
collectionBegin: string = "collectionBegin";
collectionEnd: string = "collectionEnd";
author: string = "author";
accessLevel: string = "accessLevel";
hasEmbargo: string = "hasEmbargo";
licenseId: string = "licenseId";
submissionPolicyId: string = "submissionPolicyId";
preservationPolicyId: string = "preservationPolicyId";
@PropertyName() organizationalUnitId: string;
@PropertyName() title: string;
@PropertyName() description: string;
@PropertyName() languageId: string;
@PropertyName() publicationDate: string;
@PropertyName() collectionBegin: string;
@PropertyName() collectionEnd: string;
@PropertyName() author: string;
@PropertyName() accessLevel: string;
@PropertyName() hasEmbargo: string;
@PropertyName() licenseId: string;
@PropertyName() submissionPolicyId: string;
@PropertyName() preservationPolicyId: string;
}
import {ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges} from "@angular/core";
import {FormBuilder, Validators} from "@angular/forms";
import {DateUtil} from "@app/core/utils/date.util";
import {OrganizationalUnitsModel, PreservationPoliciesModel, SubmissionPoliciesModel} from "@app/generated-api";
import {AbstractFormComponent} from "@app/shared/components/abstract-form/abstract-form.component";
import {PropertyName} from "@app/shared/decorators/property-name.decorator";
import {ModelAttributeEnum} from "@app/shared/enums/model-attribute.enum";
import {BaseFormDefinition} from "@app/shared/models/base-form-definition.model";
import {DateUtil} from "@app/core/utils/date.util";
import _ from "lodash";
@Component({
......@@ -72,11 +73,11 @@ export class FormComponent extends AbstractFormComponent<OrganizationalUnitsMode
}
class FormComponentFormDefinition extends BaseFormDefinition {
name: string = "name";
description: string = "description";
isEmpty: string = "isEmpty";
closingDate: string = "closingDate";
openingDate: string = "openingDate";
submissionPolicies: string = ModelAttributeEnum.submissionPolicies;
open: string = "open";
@PropertyName() name: string;
@PropertyName() description: string;
@PropertyName() isEmpty: string;
@PropertyName() closingDate: string;
@PropertyName() openingDate: string;
@PropertyName() submissionPolicies: string;
@PropertyName() open: string;
}
export function PropertyName(prefix: string = "", suffix: string = ""): PropertyDecorator {
return (target: Object, propertyKey: string | symbol) => {
target[propertyKey] = prefix + propertyKey.toString() + suffix;
};
}
export abstract class BaseFormDefinition {
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment