Guest User

Untitled

a guest
Jan 22nd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. sandplate2.applicationView = Backbone.View.extend({
  2. el: 'div',
  3.  
  4. template: _.template($("appl.ejs").html()),
  5.  
  6. initialize: function(){
  7. console.log("Application view initialize");
  8.  
  9. _.bindAll(this, "render");
  10.  
  11. this.render();
  12. },
  13.  
  14. render: function(){
  15. console.log("Application view rendering");
  16. this.$el.html(this.template());
  17. return this;
  18. }
  19. });
  20.  
  21. Backbone.LayoutManager.configure({
  22. manage: true,
  23.  
  24. paths: {
  25. layout: "templates/layouts/",
  26. template: "templates/"
  27. },
  28.  
  29. fetch: function(path) {
  30. path = path + ".html";
  31.  
  32. if (!JST[path]) {
  33. $.ajax({ url: app.root + path, async: false }).then(function(contents) {
  34. JST[path] = Handlebars.compile(contents);
  35. });
  36. }
  37.  
  38. return JST[path];
  39. }
  40. });
Add Comment
Please, Sign In to add comment