Skip to content

Commit

Permalink
angular: adjusts to relationships
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Jul 29, 2022
1 parent aec96e5 commit 4875636
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,21 @@ _%>
<dt><span <%= jhiPrefix %>Translate="<%= i18nKeyPrefix %>.<%= relationshipName %>"><%- this._getEntityClientTranslation(i18nKeyPrefix + '.' + relationshipName) %></span></dt>
<dd>
<%_ if (relationship.otherEntityUser) { _%>
<%_ if (relationship.relationshipManyToMany) { _%>
<%_ if (relationship.collection) { _%>
<span *ngFor="let <%= relationshipFieldName %> of <%= entityInstance %>.<%= relationshipFieldNamePlural %>; let last = last">
{{ <%= relationshipFieldName %><% if (!relationship.relatedField.id) { %>?<% } %>.<%= otherEntityField %> }}{{ last ? '' : ', ' }}
{{ <%= relationshipFieldName %>.<%= otherEntityField %> }}{{ last ? '' : ', ' }}
</span>
<%_ } else { _%>
<span>{{ <%= entityInstance %>.<%= relationshipFieldName %><% if (!relationship.relatedField.id) { %>?<% } %>.<%= otherEntityField %> }}</span>
<span>{{ <%= entityInstance %>.<%= relationshipFieldName %>?.<%= otherEntityField %> }}</span>
<%_ } _%>
<%_ } else { _%>
<%_ if (relationship.relationshipManyToMany) { _%>
<%_ if (relationship.collection) { _%>
<span *ngFor="let <%= relationshipFieldName %> of <%= entityInstance %>.<%= relationshipFieldNamePlural %>; let last = last">
<a [routerLink]="['/<%= otherEntityStateName %>', <%= relationshipFieldName %>.<%= relationship.otherEntity.primaryKey.name %>, 'view']">{{ <%= relationshipFieldName %><% if (!relationship.relatedField.id) { %>?<% } %>.<%= otherEntityField %> }}</a>{{ last ? '' : ', ' }}
<a [routerLink]="['/<%= otherEntityStateName %>', <%= relationshipFieldName %>.<%= relationship.otherEntity.primaryKey.name %>, 'view']">{{ <%= relationshipFieldName %>.<%= otherEntityField %> }}</a>{{ last ? '' : ', ' }}
</span>
<%_ } else { _%>
<div *ngIf="<%= entityInstance + '.' + relationshipFieldName %>">
<a [routerLink]="['/<%= otherEntityStateName %>', <%= entityInstance + '.' + relationshipFieldName + '.' + relationship.otherEntity.primaryKey.name %>, 'view']">{{ <%= entityInstance %>.<%= relationshipFieldName %><% if (!relationship.relatedField.id) { %>?<% } %>.<%= otherEntityField %> }}</a>
<a [routerLink]="['/<%= otherEntityStateName %>', <%= entityInstance + '.' + relationshipFieldName + '.' + relationship.otherEntity.primaryKey.name %>, 'view']">{{ <%= entityInstance %>.<%= relationshipFieldName %>?.<%= otherEntityField %> }}</a>
</div>
<%_ } _%>
<%_ } _%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,21 +132,21 @@ _%>
_%>
<td>
<%_ if (relationship.otherEntityUser) { _%>
<%_ if (relationship.relationshipManyToMany) { _%>
<%_ if (relationship.collection) { _%>
<span *ngFor="let <%= relationshipFieldName %> of <%= entityInstance %>.<%= relationshipFieldNamePlural %>; let last = last">
{{ <%= relationshipFieldName %><% if (!relationship.relatedField.id) { %>?<% } %>.<%= otherEntityField %> }}{{ last ? '' : ', ' }}
{{ <%= relationshipFieldName %>.<%= otherEntityField %> }}{{ last ? '' : ', ' }}
</span>
<%_ } else { _%>
{{ <%= entityInstance %>.<%= relationshipFieldName %><% if (!relationship.relatedField.id) { %>?<% } %>.<%= otherEntityField %> }}
{{ <%= entityInstance %>.<%= relationshipFieldName %>?.<%= otherEntityField %> }}
<%_ } _%>
<%_ } else { _%>
<%_ if (relationship.relationshipManyToMany) { _%>
<%_ if (relationship.collection) { _%>
<span *ngFor="let <%= relationshipFieldName %> of <%= entityInstance %>.<%= relationshipFieldNamePlural %>; let last = last">
<a class="form-control-static" [routerLink]="['/<%= relationship.otherEntity.entityPage %>', <%= relationshipFieldName %>.<%= relationship.otherEntity.primaryKey.name %>, 'view']">{{ <%= relationshipFieldName %><% if (!relationship.relatedField.id) { %>?<% } %>.<%= otherEntityField %> }}</a>{{ last ? '' : ', ' }}
<a class="form-control-static" [routerLink]="['/<%= relationship.otherEntity.entityPage %>', <%= relationshipFieldName %>.<%= relationship.otherEntity.primaryKey.name %>, 'view']">{{ <%= relationshipFieldName %>.<%= otherEntityField %> }}</a>{{ last ? '' : ', ' }}
</span>
<%_ } else { _%>
<div *ngIf="<%= entityInstance + "." + relationshipFieldName %>">
<a [routerLink]="['/<%= relationship.otherEntity.entityPage %>', <%= entityInstance %>.<%= relationshipFieldName %>.<%= relationship.otherEntity.primaryKey.name %>, 'view']">{{ <%= entityInstance %>.<%= relationshipFieldName %><% if (!relationship.relatedField.id) { %>?<% } %>.<%= otherEntityField %> }}</a>
<a [routerLink]="['/<%= relationship.otherEntity.entityPage %>', <%= entityInstance %>.<%= relationshipFieldName %>.<%= relationship.otherEntity.primaryKey.name %>, 'view']">{{ <%= entityInstance %>.<%= relationshipFieldName %>?.<%= otherEntityField %> }}</a>
</div>
<%_ } _%>
<%_ } _%>
Expand Down

0 comments on commit 4875636

Please sign in to comment.