Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 18 07:05
    HDB8129 commented #42
  • Oct 07 04:35
    GhostRecon03 opened #222
  • Oct 06 09:35
    KevWal opened #221
  • Sep 21 13:29
    wake2ouk opened #220
  • Sep 11 16:32
    kilbot commented #218
  • Aug 29 16:57
    thomasmery unassigned #18
  • Aug 29 16:57
    thomasmery removed as member
  • Aug 29 16:56
    thomasmery removed as member
  • Aug 29 16:48
    itsDawn opened #219
  • Aug 28 09:06
    atxcowboy edited #218
  • Aug 28 09:05
    atxcowboy opened #218
  • Aug 16 04:03
    kirahmadlare opened #217
  • Aug 13 12:17
    kilbot synchronize #214
  • Aug 13 12:17

    kilbot on 0.4

    0.4.24 (compare)

  • Aug 05 20:47
    italomoraes commented #39
  • Jun 08 09:06
    kilbot closed #216
  • Jun 08 09:06
    kilbot commented #216
  • Jun 07 09:57
    KingTheLjar opened #216
  • May 31 15:17
    Sderev opened #23
  • May 27 05:24
    doug-6sense commented #215
Paul Kilmurray
@kilbot
sorry that should be bb.Radio
so lets add that above the ReportsView
Thomas Mery
@thomasmery
so I shall create an initializefunction in my Route so something like this
like you do for the pos/products Route
Paul Kilmurray
@kilbot
actually, you’re right!
if it’s above the ReportsView it will return undefined because the app hasn’t started yet
in the Route.initialize is the correct spot for this
so everytime the reports route is triggered, it will get an instance of the orders collection
Thomas Mery
@thomasmery
blob
pushed what I did to the repo
Paul Kilmurray
@kilbot
cool, you managed to pick my bug .. the missing ‘get'
awesome, very impressed
so we’ll pass that into the Reports View as an option
Thomas Mery
@thomasmery
mmm not so :) I actually copied from pos/products/route.js
but thanks ;)
ok on to the View
Paul Kilmurray
@kilbot
ie:
{
  collection: this.collection
}
Thomas Mery
@thomasmery
ok, I guess I have to render after fetch has finished
Paul Kilmurray
@kilbot
good work … I was going to explain that after .. but it’s great that you’re reading the code
so, as part of my custom Route object, it will call the fetch method (if there is one)
this returns a promise, so that the view does not render until the data is available
in the case of IndexedDB this is 10-20 ms
in the case of WC REST API this could be a minute on some servers
so in the Route, the fetch must complete before the render starts
Thomas Mery
@thomasmery
from what I understand your custom Route makes sure of that
Paul Kilmurray
@kilbot
yep
Thomas Mery
@thomasmery
ok I'll probably dig to see how it's wired
Paul Kilmurray
@kilbot
the custom route file also loads a ‘loading’ view while the data is downloading
what you’re doing is great … all entities and routes and views will follow this pattern
Thomas Mery
@thomasmery
should I be able to log this.collectionin the template function in the View?
Paul Kilmurray
@kilbot
the template function will actually get an array of items, see here: http://marionettejs.com/docs/v2.4.7/marionette.itemview.html#rendering-a-collection-in-an-itemview
we’ll deal with that later .. because it’s a bit complicated
Thomas Mery
@thomasmery
ok
Paul Kilmurray
@kilbot
for now, lets just use a Marionette helper called templateHelpers http://marionettejs.com/docs/v2.4.7/marionette.view.html#viewtemplatehelpers
Thomas Mery
@thomasmery
ok I'll have a look - can we resume in an hour or so? will u be here?
Paul Kilmurray
@kilbot
yep, I’ll be here!
Thomas Mery
@thomasmery
ok - à tout à l'heure !
Paul Kilmurray
@kilbot
I’m about to head out, so I’ll just post the full ReportsView here:
    var ReportsView = app.ItemView.extend({
        template: _.template('<%= total %>'),
        templateHelpers: function () {
            return {
                total: _.sum( this.collection.map('total') )
            };
        }
    });
I mostly wanted to introduce Backbone.Radio as a way to pass data around the app.
And also the Entities service
Thomas Mery
@thomasmery
ok
I'll have a look at all that in details
Paul Kilmurray
@kilbot
That’s pretty much it though … the route (controller) and the view gets filled out and pretty soon you have a reports page :)
I should also point out that the current repo has known bugs .. so don’t be too alarmed if you see something broken
Thomas Mery
@thomasmery
ok,
I'll probably only be available afternoons this week end but same time monday would work for me if you want to go on with other areas
Paul Kilmurray
@kilbot
just sent you a quick email … I’ll be online this weekend so send me an email or ping me here if you want to chat
bonne nuit!
Thomas Mery
@thomasmery
got the email, thanks - really enjoyed these sessions - talk to you soon!
Jordan Bartholomew
@tourdejord
Hello