Skip to content

Instantly share code, notes, and snippets.

@unscriptable
Forked from getify/gist:482494
Created July 20, 2010 04:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unscriptable/482544 to your computer and use it in GitHub Desktop.
Save unscriptable/482544 to your computer and use it in GitHub Desktop.
cujo.js equivalent (in-browser):
file: myApp.view.LoginPanel.html
<div class="myapp-view-loginpanel">
<span data-attach="greeting">${display.greeting}</span>
<a data-attach="action" href="{$config.loginUrl}">{$display.loginAction}</a>
</div>
logout version extends login version (inheritance defined in myApp.view.LogoutPanel.js:
file: myApp.view.LogoutPanel.html
<div data-cujo="{inherit:true}" class="myapp-view-logoutpanel" data-override="mixin">
<a data-attach="action" href="{$config.logoutUrl}" data-override="mixin">{$display.logoutAction}</a>
</div>
When LogoutPanel overrides LoginPanel, the final output looks like this (sample data and i18n strings included for completeness):
<div data-cujo="{inherit:true}" class="myapp-view-loginpanel myapp-view-logoutpanel" data-override="mixin">
<span data-attach="greeting">Hello, Tommy!</span>
<a data-attach="action" href="/logout/" data-override="mixin">logout</a>
</div>
Notice that the class attributes were combined to allow OOCSS "inheritance".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment