Hi there,
I have a hard time finding my way into ember’s concepts after coming from a mainly backend development history. I have posted a question here but no reaction until now. So I thought I would post it here too may we have some detailed discussion and I come to a proper solution.
So please let me know if that question is kind of not clear and I will describe it more here.
I have a data structure which presents days (with full date like 2014-07-16) and have a bunch of data attached to each day
Let’s say we are storing log entries. I would only have one log DS model, one server API /logs and one Ember Router & Controller. Server will return records for all dates in one large list (each day entry is a separate object).
Then you can narrow your search for specific period of time by adding some filter refinement on a controller, or, even better by using Query Params (please note that this is still beta).
After you have loaded correct entries you can display them, grouping by day. Have a look at this answer regarding grouping results:
Yeah, but I don’t think that this routing would be ‘proper’ in most cases because you will most likely want to display custom date ranges in your list, i. e.:
logs?from=2014-2-10&to=from=2014-2-20 — year-month-day — this looks more flexible and user-intuitive to me
Having separate routes seems very limiting:
logs — All records ever? (too many?)
logs/2014 — All records in 2014
logs/2014/29 — All records in 2014 w 29
logs/2014/29/2 — All records in 2014 w 29, 2 (too few?)
When it you would want to see all records in current month?
I can remember there being a discussion (and probably a patch) for ‘Multiple dynamic segments in routes’ before, but it isn’t well documented.
now what would be the proper way when I want to show data in different views?
say:
a yearly view, which gives a kind of overview (count of logs, count of days that have logs and so on).
a monthly view which gives nearly the same kind of overview but only for a specific month and maybe a bit more details (so more computed properties on controller level based on data)
a weekly view which gives is the same as above but only for the week
shall I create multiple routes and multiple controllers and use the same mixin for all those? will this not result in same data to be loaded multiple times?