浏览代码

Added setting page, link to settings page, improved profile page.

KrisVos130 9 年之前
父节点
当前提交
c5b16aa14a

+ 7 - 0
app/client/client.js

@@ -97,6 +97,13 @@ Template.profile.onCreated(function() {
     });
 });
 
+Template.settings.helpers({
+    username: function() {
+        return Meteor.user().profile.username;
+    }
+});
+
+
 curPath=function(){var c=window.location.pathname;var b=c.slice(0,-1);var a=c.slice(-1);if(b==""){return"/"}else{if(a=="/"){return b}else{return c}}};
 
 Handlebars.registerHelper('active', function(path) {

+ 10 - 0
app/client/routes.js

@@ -30,6 +30,16 @@ Router.route("/signup", {
     }
 });
 
+Router.route("/settings", {
+    action: function() {
+        if (!Meteor.userId()) {
+            this.redirect("/");
+        } else {
+            this.render("settings");
+        }
+    }
+});
+
 Router.route("/terms", {
     template: "terms"
 });

+ 1 - 1
app/client/templates/header.html

@@ -27,7 +27,7 @@
                       <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{currentUser.profile.username}} <span class="caret"></span></a>
                         <ul class="dropdown-menu">
                             <li><a href="/u/{{currentUser.profile.username}}">Profile</a></li>
-                            <li><a href="#">Settings</a></li>
+                            <li><a href="/settings">Settings</a></li>
                             <li role="separator" class="divider"></li>
                             <li><a class="logout" href="#">Logout</a></li>
                         </ul>

+ 1 - 1
app/client/templates/profile.html

@@ -6,7 +6,7 @@
         {{#if loaded}}
             <h1 id="profile-name">{{username}}</h1>
 
-            <div class="col-md-4">
+            <div class="col-md-4 col-md-offset-2">
                 <div class="panel panel-primary">
                     <div class="panel-heading">Basic Info</div>
                     <div class="panel-body">

+ 26 - 0
app/client/templates/settings.html

@@ -0,0 +1,26 @@
+<template name="settings">
+    {{> header}}
+    <div class="row">
+        <h1 id="profile-name">{{username}}</h1>
+        <div class="col-md-4 col-md-offset-4">
+            <div class="panel panel-primary">
+                <div class="panel-heading">Basic Info</div>
+                <div class="panel-body">
+                    <h3 class="text text-warning text-center">Unfortunately, there is currently nothing for you to edit.</h3>
+                </div>
+            </div>
+        </div>
+    </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>
+</template>