diff --git a/generators/app/__snapshots__/generator.spec.mjs.snap b/generators/app/__snapshots__/generator.spec.mjs.snap index 9c019f96..9e730c94 100644 --- a/generators/app/__snapshots__/generator.spec.mjs.snap +++ b/generators/app/__snapshots__/generator.spec.mjs.snap @@ -488,7 +488,7 @@ exports[`SubGenerator app of ionic JHipster blueprint > run > should succeed 1`] ".husky/pre-commit": { "stateCleared": "modified", }, - ".lintstagedrc.cjs": { + ".lintstagedrc.js": { "stateCleared": "modified", }, ".prettierignore": { @@ -1000,7 +1000,7 @@ exports[`SubGenerator app of ionic JHipster blueprint > with custom ionic path > ".husky/pre-commit": { "stateCleared": "modified", }, - ".lintstagedrc.cjs": { + ".lintstagedrc.js": { "stateCleared": "modified", }, ".prettierignore": { diff --git a/generators/ionic/resources/base/src/app/pages/entities/entities.page.html b/generators/ionic/resources/base/src/app/pages/entities/entities.page.html index 60daea76..78318a82 100644 --- a/generators/ionic/resources/base/src/app/pages/entities/entities.page.html +++ b/generators/ionic/resources/base/src/app/pages/entities/entities.page.html @@ -6,10 +6,14 @@ - + @for (let entity of entities) { +

{{entity.name}}

+ }
-
{{ 'EMPTY_ENTITIES_MESSAGE' | translate }}
+@if (entities.length === 0) { +
{{ 'EMPTY_ENTITIES_MESSAGE' | translate }}
+}
diff --git a/generators/ionic/templates/src/app/pages/entities/_entity-detail.html.ejs b/generators/ionic/templates/src/app/pages/entities/_entity-detail.html.ejs index 34fdb971..56a1069e 100644 --- a/generators/ionic/templates/src/app/pages/entities/_entity-detail.html.ejs +++ b/generators/ionic/templates/src/app/pages/entities/_entity-detail.html.ejs @@ -38,21 +38,25 @@ <%_ if (fields[idx].fieldIsEnum) { _%> {{<%= entityInstance %>.<%= fieldName %>}} <%_ } else if (['byte[]', 'ByteBuffer'].includes(fieldType) && fieldTypeBlobContent === 'image') { _%> -
+ @if (<%= entityInstance %>.<%= fieldName %>) { +
<%=entityInstance %> image {{<%= entityInstance %>.<%= fieldName %>ContentType}}, {{byteSize(<%= entityInstance %>.<%= fieldName %>)}}
+ } <%_ } else if (['Instant', 'ZonedDateTime'].includes(fieldType)) { _%> {{<%=entityInstance %>.<%= fieldName %> | date:'medium'}} <%_ } else if (fieldType === 'LocalDate') { _%> {{<%=entityInstance %>.<%= fieldName %> | date:'mediumDate'}} <%_ } else if (['byte[]', 'ByteBuffer'].includes(fieldType) && fieldTypeBlobContent === 'any') { _%> -
+ @if (<%= entityInstance %>.<%= fieldName %>) { +
open {{<%= entityInstance %>.<%= fieldName %>ContentType}}, {{byteSize(<%= entityInstance %>.<%= fieldName %>)}}
+ } <%_ } else { _%> {{<%= entityInstance %>.<%= fieldName %>}} <%_ } _%> @@ -78,9 +82,11 @@ <%_ if (otherEntityName === 'user') { _%> <%_ if (relationshipType === 'many-to-many') { _%>
- + @for (<%= relationshipFieldName %> of <%= entityInstance %>.<%= relationshipFieldNamePlural %>; let last = $last) { + {{<%= relationshipFieldName %>.<%= otherEntityField %>}}{{last ? '' : ', '}} + }
<%_ } else { _%> <%_ if (dto === 'no') { _%> @@ -92,19 +98,25 @@ <%_ } else { _%> <%_ if (relationshipType === 'many-to-many') { _%>
- + @for (<%= relationshipFieldName %> of <%= entityInstance %>.<%= relationshipFieldNamePlural %>; let last = $last) { + {{<%= relationshipFieldName %>.<%= otherEntityField %>}}{{last ? '' : ', '}} + }
<%_ } else { _%> <%_ if (dto === 'no') { _%> -
+ @if (<%= entityInstance + '.' + relationshipFieldName %>) { +
{{<%= entityInstance + "." + relationshipFieldName + "?." + otherEntityField %>}}
+ } <%_ } else { _%> -
"> + @if (<%= entityInstance + '.' + relationshipFieldName + "Id" %>) { +
{{<%= entityInstance + "." + relationshipFieldName + otherEntityFieldCapitalized %>}}
+ } <%_ } _%> <%_ } _%> <%_ } _%> diff --git a/generators/ionic/templates/src/app/pages/entities/_entity-update.html.ejs b/generators/ionic/templates/src/app/pages/entities/_entity-update.html.ejs index 256ddca6..0181497d 100644 --- a/generators/ionic/templates/src/app/pages/entities/_entity-update.html.ejs +++ b/generators/ionic/templates/src/app/pages/entities/_entity-update.html.ejs @@ -28,8 +28,11 @@ _%> - {{'DONE_BUTTON' | translate}} - + @if (platform.is('ios')) { + {{'DONE_BUTTON' | translate}} + } else { + + } @@ -37,7 +40,8 @@ _%> -
+@if (form) { + ID @@ -79,9 +83,12 @@ _%> <%_ } else if (['byte[]', 'ByteBuffer'].includes(fieldType) && fieldTypeBlobContent !== 'text') { _%>
<%_ if (fieldTypeBlobContent === 'image') { _%> - <%=entityInstance %> image + @if (<%= entityInstance %>?.<%= fieldName %>) { + <%=entityInstance %> image + } <%_ } _%> -
+ @if (<%= entityInstance %>.<%= fieldName %>) { +

{{<%= entityInstance %>.<%= fieldName %>ContentType}}, {{byteSize(<%= entityInstance %>.<%= fieldName %>)}}

<%_ if (fieldTypeBlobContent === 'image') { _%> @@ -93,13 +100,18 @@ _%> <%_ } _%>
+ } <%_ if (fieldTypeBlobContent === 'image') { _%> - - + } + @if (!<%= entityInstance %>?.<%= fieldName %>) { + {{ 'ITEM_CREATE_CHOOSE_IMAGE' | translate }} + } <%_ } else { _%> <%_ } _%> @@ -138,18 +150,25 @@ _%> <%_ if (!relationshipRequired) { _%> <%_ } else { _%> - + @if (!form.value.<%= relationshipName %>) { + + } <%_ } _%> - {{<%=otherEntityName %>Option.<%=otherEntityField %>}} + @for (<%=otherEntityName %>Option of <%=otherEntityNamePlural%>; track track<%=otherEntityNameCapitalized %>ById) { + {{<%=otherEntityName %>Option.<%=otherEntityField %>}} <%_ } else { _%> required<% } %>> <%_ if (!relationshipRequired) { _%> <%_ } else { _%> - + @if (!form.value.<%= relationshipName %>Id) } + + } <%_ } _%> - {{<%=otherEntityName %>Option.<%=otherEntityField %>}} + @for (let <%=otherEntityName %>Option of <%=otherEntityNamePlural%>; track track<%=otherEntityNameCapitalized %>ById) { + {{<%=otherEntityName %>Option.<%=otherEntityField %>}} + } <%_ } _%> @@ -161,18 +180,26 @@ _%> <%_ if (!relationshipRequired) { _%> <%_ } else { _%> - + @if (!form.value.<%= relationshipName %>) { + + } <%_ } _%> - {{<%=otherEntityName %>Option.<%=otherEntityField %>}} + @for (<%=otherEntityName %>Option of <%=relationshipFieldNamePlural.toLowerCase() %>; track track<%=otherEntityNameCapitalized %>ById) { + {{<%=otherEntityName %>Option.<%=otherEntityField %>}} + } <%_ } else { _%> required<% } %>> <%_ if (!relationshipRequired) { _%> <%_ } else { _%> - + @if (!form.value.<%= relationshipName %>Id) { + + } <%_ } _%> - {{<%=otherEntityName %>Option.<%=otherEntityField %>}} + @for (<%=otherEntityName %>Option of <%=relationshipFieldNamePlural.toLowerCase() %>; track track<%=otherEntityNameCapitalized %>ById) { + {{<%=otherEntityName %>Option.<%=otherEntityField %>}} + } <%_ } _%> @@ -180,7 +207,9 @@ _%> <%= relationshipNameHumanized %> required<% } %>> - {{<%=otherEntityName %>Option.<%=otherEntityField %>}} + @for (<%=otherEntityName %>Option of <%=otherEntityNamePlural.toLowerCase() %>; track track<%=otherEntityNameCapitalized %>ById) { + {{<%=otherEntityName %>Option.<%=otherEntityField %>}} + } <%_ } _%> @@ -197,4 +226,5 @@ _%> <%_ } _%> +} diff --git a/generators/ionic/templates/src/app/pages/entities/_entity.html.ejs b/generators/ionic/templates/src/app/pages/entities/_entity.html.ejs index 88814874..d0146a3d 100644 --- a/generators/ionic/templates/src/app/pages/entities/_entity.html.ejs +++ b/generators/ionic/templates/src/app/pages/entities/_entity.html.ejs @@ -33,7 +33,8 @@ - + @for (<%=entityInstance %> of <%=entityInstancePlural %>; trackBy: trackId) { + <%_ for (idx in fields) { @@ -42,9 +43,11 @@ const fieldType = fields[idx].fieldType; const fieldTypeBlobContent = fields[idx].fieldTypeBlobContent; _%> <%_ if (['byte[]', 'ByteBuffer'].includes(fieldType) && fieldTypeBlobContent === 'image') { _%> - item-start<% } %> *ngIf="<%= entityInstance %>.<%= fieldName %>"> + @if (<%= entityInstance %>.<%= fieldName %>) { + item-start<% } %>> + } <%_ } else if (fields[idx].fieldIsEnum) { _%>

{{<%=entityInstance %>.<%=fieldName%>}}

@@ -71,12 +74,15 @@
+ }
- +@if (!<%=entityInstancePlural %>?.length) { + No <%= entityClassPluralHumanized %> found. +} diff --git a/generators/server/__snapshots__/generator.spec.mjs.snap b/generators/server/__snapshots__/generator.spec.mjs.snap index 62d91742..d068fd8d 100644 --- a/generators/server/__snapshots__/generator.spec.mjs.snap +++ b/generators/server/__snapshots__/generator.spec.mjs.snap @@ -20,7 +20,7 @@ exports[`SubGenerator server of ionic JHipster blueprint > run > should succeed ".husky/pre-commit": { "stateCleared": "modified", }, - ".lintstagedrc.cjs": { + ".lintstagedrc.js": { "stateCleared": "modified", }, ".mvn/jvm.config": {