marmelab/ng-admin — pull request #152 by fzaninotto (2014-11-29 22:57:00+00:00)
Title: [RFR] View title: Use template

This PR deeply changes the way **view titles** are handled. Functions are not accepted anymore by `View.title()` - only strings. But, and "that is a big but", the string is interpreted as a template, and has access to the raw entry. That allows to customize the view title as follows:

```js
post.editionView().title('Edit post "{{ entry.values.title }}"');
```

![image](https://cloud.githubusercontent.com/assets/99944/5236086/f8aad6be-7822-11e4-9d59-a6506250b597.png)

In addition, the default view titles are now better. For instance, for an `Entity('posts')`:

* creationView: "Create new post"
* editionView: "Edit post #123"
* deletionView: "Delete post #123"
* listView: "List posts"

I had to add [inflection](https://github.com/dreamerslab/node.inflection) to handle singularization/pluralization. It's a good library, and I believe we will use it on other places (first, to remove default field label camel case).

I also chose to remove `Entity.addMappedField()`, and to add all non-mapped properties of the rawEntry from the response to the Entry by default. This removes a big WTF effect I had when trying to customize the deletionView title, and has no side effects.

Lastly, to allow the view title to support both a template and a default template, I updated the `Compile` directive to make it transclusive. This was a prerequisite for #118, so it goes in the right direction.

Closes #141.