0

For example we make a Gmail clone in canjs. Consider each item in the sidebar being rendered with a component of its own. Now I want a single control bar just like gmail to control the activities inside the components.

How should I approach it???

At present am looking at the change event of localStorage, is there a better solution to this???

Abhilash Nanda
  • 339
  • 2
  • 4
  • 13

1 Answers1

0

I would recommend using an appstate Map or a page level component that holds the state for the features of your toolbar. If using an appstate, you could use can.route.map to bind certain features of the appstate Map to the route, so the state of your app can be controlled by the URL. A page attribute, for example, would control which main page is displayed (say, the message list or the contacts list.) You could then listen for certain values of page in your stache template to switch to showing the correct page. This snippet would show the message-list whenever the page attribute of the appstate is 'messages': {{#is appstate.page 'messages}}<message-list></message-list>{{/is}}

If you had more specifics of which feature is hardest to figure out how to implement, I might be able to give more specific advice.

Marshall Thompson
  • 945
  • 2
  • 8
  • 17
  • Hi Marshall, thanks for replying, I was loosing hope that anyone would. :D So at present I have already implemented the menu interface like gmail where if you click on inbox it will go to inbox and if on sent messages and so on. However, as we know they provide different control bars on a common bar. This is what I want to implement. I have also explored a few things and now betting on having a page level component and then child components and set communication between them. Parent will contain the control bar. What say??? – Abhilash Nanda Jul 13 '15 at 05:20
  • It sounds like you're on the right track. Is this for work or for an open-source project? I have slowly been working on the Postaci-Webmail, open-source email project. I made the design and the HTML template, but haven't started the app, yet. https://github.com/Postaci-Webmail/Postaci/tree/next There's an image on that page. Is the toolbar you're talking about like the tools/icons above the message pane on the right-hand side of the image? – Marshall Thompson Jul 14 '15 at 13:50
  • No Marshall, unfortunately it is a closed source project for my company. www.mywash.in Since am the Tech Lead in the company I push for CanJS (coz I can do that :D ). It's a lovely piece of work. I wish I had enough spare time though to get involved in some open source project. Btw, thanks for all the help. Appreciated. :) – Abhilash Nanda Jul 15 '15 at 12:02