Skip to content

Commit

Permalink
♻️ refactor(Validators): deliverable metadata fields required
Browse files Browse the repository at this point in the history
  • Loading branch information
MetalPrime committed Jun 17, 2024
1 parent a9ce801 commit 2ad3c13
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@
[#-- Is deliverable new --]
[#assign isDeliverableNew = action.isDeliverableNew(deliverable.id) /]

[#-- Is deliverable in progress phase and is not completed --]
[#assign validateIsProgressWithStatus = action.validateIsProgressWithStatus(deliverable.deliverableInfo.status)]

<input id="indexTab" name="indexTab" type="hidden" value="${(indexTab)!0}">
<div class="deliverableTabs">
[#-- Deliverable Menu --]
Expand All @@ -241,7 +244,7 @@
[/#if]

</ul>
[#assign validateIsProgressWithStatus = action.validateIsProgressWithStatus(deliverable.deliverableInfo.status)]

<div class="tab-content ">
[#-- Deliverable Information --]
<div id="deliverable-mainInformation" role="tabpanel" class="tab-pane fade [#if indexTab==1 || indexTab==0]in active[/#if]">
Expand All @@ -265,7 +268,7 @@
[#-- Metadata (included publications) --]
<h3 class="headTitle">[@s.text name="project.deliverable.dissemination.metadataSubtitle" /]</h3>
<div class="simpleBox">
[@deliverableMacros.deliverableMetadataMacro /]
[@deliverableMacros.deliverableMetadataMacro validateIsProgressWithStatus=validateIsProgressWithStatus/]
</div>
</div>
[#-- Deliverable qualityCheck --]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@
</div>
[/#macro]

[#macro deliverableMetadataMacro flagshipslistName="programs" crpsListName="crps" allowFlagships=true]
[#macro deliverableMetadataMacro flagshipslistName="programs" crpsListName="crps" allowFlagships=true validateIsProgressWithStatus=true]
<div class="form-group">
[@metadataField title="title" encodedName="dc.title" type="input" require=validateIsProgressWithStatus /]
</div>
Expand Down Expand Up @@ -1272,11 +1272,11 @@
<input type="hidden" class="hide" name="${customName}.hide" value="${mElementHide?string}" />
<input type="hidden" name="${customName}.metadataElement.id" value="${metadataID}" />
[#if type == "input"]
[@customForm.input name="${customName}.elementValue" required=(require!false && validateIsProgressWithStatus!true) value="${metadataValue}" className="metadataValue " type="text" i18nkey="metadata.${title}" help="metadata.${title}.help" readOnly=mElementHide editable=editable/]
[@customForm.input name="${customName}.elementValue" required=require value="${metadataValue}" className="metadataValue " type="text" i18nkey="metadata.${title}" help="metadata.${title}.help" readOnly=mElementHide editable=editable/]
[#elseif type == "textArea"]
[@customForm.textArea name="${customName}.elementValue" required=(require!false && validateIsProgressWithStatus!true) value="${metadataValue}" className="metadataValue " i18nkey="metadata.${title}" help="metadata.${title}.help" readOnly=mElementHide editable=editable/]
[@customForm.textArea name="${customName}.elementValue" required=require value="${metadataValue}" className="metadataValue " i18nkey="metadata.${title}" help="metadata.${title}.help" readOnly=mElementHide editable=editable/]
[#elseif type == "select"]
[@customForm.select name="${customName}.elementValue" required=(require!false && validateIsProgressWithStatus!true) value="${metadataValue}" className="metadataValue " i18nkey="metadata.${title}" listName=list disabled=mElementHide editable=editable /]
[@customForm.select name="${customName}.elementValue" required=require value="${metadataValue}" className="metadataValue " i18nkey="metadata.${title}" listName=list disabled=mElementHide editable=editable /]
[#elseif type == "hidden"]
<input type="hidden" name="${customName}.elementValue" value="${metadataValue}" class="metadataValue "/>
[#elseif type == "text"]
Expand Down

0 comments on commit 2ad3c13

Please sign in to comment.