Skip to content

Instantly share code, notes, and snippets.

@lvbreda
Created July 31, 2012 22:16
Show Gist options
  • Select an option

  • Save lvbreda/3221138 to your computer and use it in GitHub Desktop.

Select an option

Save lvbreda/3221138 to your computer and use it in GitHub Desktop.

Revisions

  1. lvbreda revised this gist Jul 31, 2012. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion client.js
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,8 @@ if (Meteor.is_client) {
    document.body.innerHTML = "";
    page = page?page:"index";
    var frag = Meteor.ui.render(function () {
    return Template[page]();
    var i = Template[page]?Template[page]():"";
    return i;
    });
    document.body.appendChild(frag);
    }
  2. lvbreda created this gist Jul 31, 2012.
    23 changes: 23 additions & 0 deletions client.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    if (Meteor.is_client) {
    var Router = Backbone.Router.extend({
    routes: {
    "" : "main",
    ":page": "main" //this will be http://your_domain/
    },
    main: function(page) {
    document.body.innerHTML = "";
    page = page?page:"index";
    var frag = Meteor.ui.render(function () {
    return Template[page]();
    });
    document.body.appendChild(frag);
    }
    });
    var app = new Router;
    Meteor.startup(function () {
    Backbone.history.start({pushState: true});
    });


    }

    3 changes: 3 additions & 0 deletions hello.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    <template name="hello">
    hello
    </template>
    3 changes: 3 additions & 0 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    <template name="index">
    home
    </template>
    9 changes: 9 additions & 0 deletions stackover.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    <head>
    <title>Stackoverflow</title>
    </head>

    <body>

    </body>