Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Slimgur</title>
- <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
- <%= stylesheet_link_tag 'bootstrap', media: 'all', 'data-turbolinks-track' => true %>
- <%= stylesheet_link_tag 'bootstrap-theme', media: 'all', 'data-turbolinks-track' => true %>
- <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
- <%= csrf_meta_tags %>
- </head>
- <body>
- <%= yield %>
- <div class='container'>
- <div id="ember-app">
- </div>
- </div>
- </body>
- </html>
- //This is the page that is rendered by rails.
- <h1>Static#index</h1>
- <p>Find me in app/views/static/index.html.erb</p>
- /* Application.js file. After all require statements. */
- App = Ember.Application.create({rootElement: '#ember-app'});
- /* Router.js */
- // --------------------------
- App.Router.map(function() {
- this.resource('posts');
- this.resource('post', { path: 'posts/:id' });
- })
- /* Application.hbs. */
- // --------------------------
- <header>
- <article>
- <div class="logo">
- <h1>
- <a href="#">App</a>
- </h1>
- </div>
- </article>
- </header>
- {{!-- This is intended to render all Ember Templates. --}}
- <section id="main">
- {{{outlet}}}
- </section>
- <footer>
- <p> Testing Footer one two three </p>
- </footer>
- /* posts.hbs */
- // --------------------------
- <article id="posts">
- <h1>Posts</h1>
- <ul>
- {{#each post in model}}
- <li>{{#link-to 'post' post}}{{post.title}}{{/link-to}}</li>
- {{/each}}
- </ul>
- </article>
- {{outlet}}
- /* post.hbs*/
- // --------------------------
- <h2>{{title}}</h2>
- /* Ember Routes: */
- // --------------------------
- App.PostsRoute = Ember.Route.extend({
- model: function(){
- return this.store.find('post');
- },
- })
- App.PostRoute = Ember.Route.extend({
- model: function(params){
- return this.store.find('post', params.id);
- },
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement