-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #16: Add 'is_default' attribute to a screen object, set to true…
… for the screen corresponding to default route
- Loading branch information
Showing
1 changed file
with
20 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5c36fb5
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.
Thanks Lionel, this is great!
I'm wondering about the fact that we add this "is_default" directly to the "queried_screen_data" property.
I think (am I wrong?) that we could just do the
'#' + Backbone.history.fragment == app.router.getDefaultRoute()
thing directly in the "isDefaultScreen" template tag.
But I agree that it can also be interesting to have this kind of info directly in queried_screen_data.
My concern is mostly that if we have a "is_default" we'll soon have a "is_launch", "is_404" etc... and our queried_screen_data will look like the "wp_query" object in WP ;) Many properties that have to be handled at each screen change but are not used most of the time and (in our app case) could be retrieved dynamically only when we need it...
Maybe if we decide to keep them, a good compromise can be to have a queried_screen_data.screen_info property where we group this kind of info:
queried_screen_data.screen_info.is_default
queried_screen_data.screen_info.is_404
etc
What do you think?