JSFiddle - React, Tailwind, and code Playground

by schawaska

HTML

<script src="http://cloud.github.com/downloads/wycats/handlebars.js/handlebars-1.0.0.beta.6.js"></script>
<script src="http://cloud.github.com/downloads/emberjs/ember.js/ember-1.0.pre.js"></script>
<script type="text/x-handlebars" data-template-name="application">
    <h1>Application</h1>
    <a {{action gotoHome}}>Home</a> | <a {{action gotoInfo}}>Info</a>
    {{outlet}}
</script>

<script type="text/x-handlebars" data-template-name="home">
  <h2>Home</h2>
  <p>Some Text</p>
</script>

<script type="text/x-handlebars" data-template-name="info">
  <h2>Info</h2>
  <p>Some information..etc..etc</p>
</script>

CSS

h1 {
    font-weight:bold;
    font-size: 16pt;
}

h2{font-size: 14pt; font-weight: bold}
a {
    cursor: pointer;
    text-decoration: underline;
    color: blue;
}

JavaScript

App = null

$(function() {
    App = Ember.Application.create();

    App.ApplicationController = Ember.Controller.extend();
    App.ApplicationView = Ember.View.extend({
        templateName: 'application'
    });

    App.HomeView = Em.View.extend({ templateName: 'home' });
    App.InfoView = Em.View.extend({ templateName: 'info' });
    
    App.Router = Ember.Router.extend({
        enableLogging: true,
        root: Ember.Route.extend({
            
            gotoHome: Em.Route.transitionTo('root.home'),
            gotoInfo: Em.Route.transitionTo('root.info'),
            
            index: Ember.Route.extend({
                route: '/',
                redirectsTo: 'home'
            }),
            home: Ember.Route.extend({
                route: '/home',
                connectOutlets: function(router) {
                  router.get('applicationController')
                        .connectOutlet("home");
                },
                enter: function(router){
                    console.log('The "enter" event of "home" route has been fired');
                },
                exit: function(router) {
                    console.log('The "exit" event of "home" route has been fired');
                }
            }),
            info: Ember.Route.extend({
                route: '/info',
                connectOutlets: function(router) {
                  router.get('applicationController')
                        .connectOutlet("info");
                },
                enter: function(router){
                    console.log('The "enter" event of "info" route has been fired');
                },
                exit: function(router) {
                    console.log('The "exit" event of "info" route has been fired');
                }

            })
        })
    });

    App.initialize();
});