Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Slimgur</title>
  5. <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
  6. <%= stylesheet_link_tag 'bootstrap', media: 'all', 'data-turbolinks-track' => true %>
  7. <%= stylesheet_link_tag 'bootstrap-theme', media: 'all', 'data-turbolinks-track' => true %>
  8. <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
  9. <%= csrf_meta_tags %>
  10. </head>
  11. <body>
  12. <%= yield %>
  13.  
  14. <div class='container'>
  15. <div id="ember-app">
  16. </div>
  17. </div>
  18.  
  19. </body>
  20. </html>
  21.  
  22. //This is the page that is rendered by rails.
  23. <h1>Static#index</h1>
  24. <p>Find me in app/views/static/index.html.erb</p>
  25.  
  26. /* Application.js file. After all require statements. */
  27. App = Ember.Application.create({rootElement: '#ember-app'});
  28.  
  29. /* Router.js */
  30. // --------------------------
  31. App.Router.map(function() {
  32. this.resource('posts');
  33. this.resource('post', { path: 'posts/:id' });
  34. })
  35.  
  36. /* Application.hbs. */
  37. // --------------------------
  38. <header>
  39. <article>
  40. <div class="logo">
  41. <h1>
  42. <a href="#">App</a>
  43. </h1>
  44. </div>
  45. </article>
  46. </header>
  47.  
  48. {{!-- This is intended to render all Ember Templates. --}}
  49. <section id="main">
  50. {{{outlet}}}
  51. </section>
  52.  
  53. <footer>
  54. <p> Testing Footer one two three </p>
  55. </footer>
  56.  
  57. /* posts.hbs */
  58. // --------------------------
  59. <article id="posts">
  60. <h1>Posts</h1>
  61.  
  62. <ul>
  63. {{#each post in model}}
  64. <li>{{#link-to 'post' post}}{{post.title}}{{/link-to}}</li>
  65. {{/each}}
  66. </ul>
  67. </article>
  68.  
  69. {{outlet}}
  70.  
  71. /* post.hbs*/
  72. // --------------------------
  73. <h2>{{title}}</h2>
  74.  
  75. /* Ember Routes: */
  76. // --------------------------
  77. App.PostsRoute = Ember.Route.extend({
  78. model: function(){
  79. return this.store.find('post');
  80. },
  81. })
  82.  
  83. App.PostRoute = Ember.Route.extend({
  84. model: function(params){
  85. return this.store.find('post', params.id);
  86. },
  87. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement