Giter Club home page Giter Club logo

Comments (6)

jonjamz avatar jonjamz commented on June 17, 2024

Thank you--I'm glad you like the package!

I think you'd want to put template helpers on the tabbed interface. The individual tabs should share that context. The {{#tabContent}} block doesn't specify any data, so in my experience it would take on the direct parent template's context (for example, {{#basictabs}}), allowing you to use its helpers as well.

As for subscriptions--I think the fastest way to deal with subscriptions is to decouple them from specific routes or tabs as much as possible. I never bought into waitOn, personally.

It's crazy how fast your app runs across routes when you don't have to wait for subscriptions each time. Same thing with tabs.

from blaze-tabs.

centinel3 avatar centinel3 commented on June 17, 2024

Thanks for getting back with me Jon. I have tried a few ways to get helpers working and seem to be missing something.

How would I go about adding helpers to the basicTabs context?

  • I have tried adding a property to the ReactiveTabs.createInterface function.
  • I have tried it like this: Template.basicTabs.helpers({})

Regarding subscriptions, I'm all for quick as possible page loads. If your suggestion is to decouple them from tabs and routes, then where would they live if you need to reference the cursor to display data to the user? Would you move them to the individual page template controllers? If so, aren't you still making a db call every time the page loads? The difference would be that the page would load quicker initially as it wasn't waitingOn anything, though wouldn't the data then possibly not all be there initially when the user hits the page?

Thanks again and will talk with you soon. Chris

from blaze-tabs.

jonjamz avatar jonjamz commented on June 17, 2024

I'll have to look into this more. Template.basicTabs.helpers should work.

To start, I typically load subs based on whether a user is logged in. Then I get more granular from there. Usually I just paginate subscriptions and sort them in a way that makes sense. When more specific data is needed that isn't already on the client, I subscribe to that data separately and use a reactive loading state that gets turned off when onReady is fired from the sub.

General subs are usually in their own directory in /client/subs and feature-specific granular subs are in a feature's directory, like client/features/[featureName]/subs.js. This prevents me from needing to resubscribe to everything based on what page the user is on, and it removes that logic from the scope of the router entirely, and it allows me flexibility to handle loading messages either at the page's level or the individual template's level.

from blaze-tabs.

jonjamz avatar jonjamz commented on June 17, 2024

Maybe putting the helpers on the template that contains basicTabs?

from blaze-tabs.

centinel3 avatar centinel3 commented on June 17, 2024

Hey Jon,

I figured it out with your help. It was as you said, keeping the helper on the main parent context. My issue from there was scope related. I needed to get the id of the project which was on the parent context as well, though since I moved it to the tab, it was then in a child scope. I used the following to correct the scope issue.

filesItems: function() {
return FilesCollection.find({projectId: Template.parentData(1)._id});
},

Regarding the subscriptions, I want to wrap my head around this (as I'm still fairly new to Meteor), so please bear with me. I'm using iron router and also do a check to make sure the user is logged in. I'm dealing with (sometimes) multiple collections needed on the same page (around 5-7 tops) and figured that it would make sense to use the waitOn method that iron router has. By moving them out from the router onto a shared folder all by themselves (in the lib folder I presume?), you would gain in page load speed? Essentially you are subscribing to all necessary collections upfront when the user logs in, then using the collection.find() on whatever pages need the data? Just want make sure that I understand that correctly.

Thanks again Jon. The tabs are awesome and will be taking some time to hook them all up.

Sincerely,
Chris Campbell

from blaze-tabs.

katopz avatar katopz commented on June 17, 2024

Hi @jonjamz @centinel3 ,

I just hit this issue, Anyone have simple example for this?
Data is there waiting outside scope and I can't find the way to make it work.

        {{#tabContent slug="post"}}
            <div class="row" id="champion-messages">
                <div class="col-md-9">
                    <!-- if I move this out of scope this will work, but not in here -->
                    <div class="template-posts">
                        {{#each posts}}
                            {{> post}}
                        {{else}}
                            {{> noData}}
                        {{/each}}
                    </div>
                </div>
            </div>
        {{/tabContent}}

Thanks

from blaze-tabs.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.