Skip to content

Commit

Permalink
marmelab#1158 allow full-row field templates in embedded view
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardBradley committed Aug 3, 2016
1 parent 1ed81b7 commit 01b8634
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions doc/Relationships.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ When displaying a post:

![embedded_list in editionView](images/embedded_list_in_editionView.png)

Caution: If you want to use [`Field.template()`](./Theming.md#customizing-the-template-for-a-given-field)
to customise the view of an embedded field, be aware that the default "<ma-field>" template string takes
different attribute values in embedded view to the regular view.
See the [maEmbeddedListField source](../src/javascripts/ng-admin/crud/field/maEmbeddedListField.js).

## Embedded entity

APIs may render a many-to-one relationship by embedding the related entry in the main entry:
Expand Down
2 changes: 1 addition & 1 deletion src/javascripts/ng-admin/Crud/field/maEmbeddedListField.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default function maEmbeddedListField() {
<div class="remove_button_container">
<a class="btn btn-default btn-sm" ng-click="remove(entry)"><span class="glyphicon glyphicon-minus-sign" aria-hidden="true"></span>&nbsp;<span translate="REMOVE"></span></a>
</div>
<div class="form-field form-group" ng-repeat="field in ::fields track by $index">
<div class="form-field form-group" ng-repeat="field in ::fields track by $index" compile="::field.getTemplateValueWithLabel(entry)">
<ma-field field="::field" value="entry.values[field.name()]" entry="entry" entity="::targetEntity" form="formName" datastore="::datastore()"></ma-field>
</div>
<hr/>
Expand Down

0 comments on commit 01b8634

Please sign in to comment.