-
Notifications
You must be signed in to change notification settings - Fork 728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFR] View title: Use template #152
Conversation
@@ -1,16 +1,18 @@ | |||
/*global define*/ | |||
|
|||
var inflection; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find another way to make the inflection
object available to the ngInflection filters. I'm not satisfied with it, there must be a better solution. Ping @manuquentin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can maybe use the requirejs shim.exports to specify the global variable name. You should also mark inflection as a dependency of ngInflection in the requireJS configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried ; it doesn't work. Besides, the inflection lib seems to support RequireJS, so I don't understand.
[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:In addition, the default view titles are now better. For instance, for an
Entity('posts')
:I had to add 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.