Ember Latest

The latest build of Ember.

by emerson

HTML

<script src="http://builds.emberjs.com/handlebars-1.0.0-rc.4.js"></script>
<script src="http://builds.emberjs.com/ember-latest.js"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css">
<script type="text/x-handlebars" data-template-name="application">
    <h1>Route Issue</h1>
    <hr>
    {{outlet}}
</script>

<script type="text/x-handlebars" data-template-name="index">
    <h2>IndexRoute</h2>
    {{#linkTo posts 'example'}}Start by Visiting the PostsRoute{{/linkTo}}
</script>

<script type="text/x-handlebars" data-template-name="posts">
    <h2>PostsRoute</h2>
    <p>You should have seen an alert when this loaded.</p>
    {{#linkTo posts.whatever 'example'}}Visit PostsWhateverRoute{{/linkTo}}
</script>

<script type="text/x-handlebars" data-template-name="whatever">
    <h2>PostsWhateverRoute</h2>
    <p>Going back to the PostsRoute doesn't work from this context...</p>
    {{#linkTo posts 'example'}}Back to PostsRoute{{/linkTo}}
</script>

CSS

h1 { font-size: 1.6em; padding-bottom: 10px; }
h2 { font-size: 1.4em; }
ul { padding: 15px; font-size: 1.4em; color: green; }

JavaScript

App = Ember.Application.create({});

App.Router.map(function() {
  this.resource('posts', {path: '/post/:post_slug'}, function() {
    this.route('whatever');
  });
});

App.IndexRoute = Ember.Route.extend({});

App.PostsRoute = Ember.Route.extend({
    setupController: function(controller) {
        alert('you hit the PostsRoute');
    }
});

App.PostsWhateverRoute = Ember.Route.extend({
    renderTemplate: function(controller) {
        this.render('whatever', {into: 'application'});
    }
});