浏览代码

Added Iron Router and added basic support for 'rooms'

KrisVos130 9 年之前
父节点
当前提交
862a731ac4
共有 4 个文件被更改,包括 63 次插入29 次删除
  1. 2 0
      app/.meteor/packages
  2. 8 0
      app/.meteor/versions
  3. 35 27
      app/app.html
  4. 18 2
      app/app.js

+ 2 - 0
app/.meteor/packages

@@ -23,3 +23,5 @@ accounts-github
 service-configuration
 twbs:bootstrap
 jquery
+iron:router
+ejson

+ 8 - 0
app/.meteor/versions

@@ -39,6 +39,14 @@ htmljs@1.0.5
 http@1.1.1
 id-map@1.0.4
 insecure@1.0.4
+iron:controller@1.0.8
+iron:core@1.0.8
+iron:dynamic-template@1.0.8
+iron:layout@1.0.8
+iron:location@1.0.9
+iron:middleware-stack@1.0.9
+iron:router@1.0.9
+iron:url@1.0.9
 jquery@1.11.4
 launch-screen@1.0.4
 livedata@1.0.15

+ 35 - 27
app/app.html

@@ -21,33 +21,6 @@
 </head>
 
 <body onload="init()">
-  {{#if currentUser}}
-    <div id="dashboard">
-      {{> dashboard}}
-    </div>
-  {{else}}
-    <div class="landing">
-      <div id="login-view">
-        {{> login}}
-      </div>
-      <div id="register-view" style="display:none">
-        {{> register}}
-      </div>
-      <ul class="bg-bubbles">
-        <li></li>
-        <li></li>
-        <li></li>
-        <li></li>
-        <li></li>
-        <li></li>
-        <li></li>
-        <li></li>
-        <li></li>
-        <li></li>
-      </ul>
-      {{> footer}}
-    </div>
-  {{/if}}
 </body>
 
 <template name="register">
@@ -112,3 +85,38 @@
     <a href="https://github.com/Septimus" target="_blank">@Septimus</a></p>
   </footer>
 </template>
+
+
+<template name="Home">
+    {{#if currentUser}}
+    <div id="dashboard">
+      {{> dashboard}}
+    </div>
+  {{else}}
+    <div class="landing">
+      <div id="login-view">
+        {{> login}}
+      </div>
+      <div id="register-view" style="display:none">
+        {{> register}}
+      </div>
+      <ul class="bg-bubbles">
+        <li></li>
+        <li></li>
+        <li></li>
+        <li></li>
+        <li></li>
+        <li></li>
+        <li></li>
+        <li></li>
+        <li></li>
+        <li></li>
+      </ul>
+      {{> footer}}
+    </div>
+  {{/if}}    
+</template>
+
+<template name="Room">
+    <h1>{{{type}}}</h1>
+</template>

+ 18 - 2
app/app.js

@@ -1,4 +1,4 @@
-if (Meteor.isClient) {
+if (Meteor.isClient) {  
   Template.register.events({
     "submit form": function(e){
         e.preventDefault();
@@ -71,7 +71,15 @@ if (Meteor.isClient) {
       })
       $(".station .song-info").html("<h6 class='song-title'>Immortals</h6><p class='song-artist'>Fall Out Boy</p>")
     }
-  })
+  });
+  
+  Template.Room.helpers({
+      type: function() {
+        var parts = location.href.split('/');
+        var id = parts.pop();
+        return id;
+      }
+  });
 }
 
 if (Meteor.isServer) {
@@ -95,3 +103,11 @@ if (Meteor.isServer) {
       secret: "375939d001ef1a0ca67c11dbf8fb9aeaa551e01b"
   });
 }
+
+Router.route("/", {
+    template: "Home"
+});
+
+Router.route("/:type", {
+    template: "Room"
+});