Jelajahi Sumber

Made chat show what rank your in

Still working on CSS on chat, hope to get most of the CSS bugs fixed
today
Johand 10 tahun lalu
induk
melakukan
09142a604b
3 mengubah file dengan 7 tambahan dan 2 penghapusan
  1. 4 0
      app/client/app.css
  2. 1 1
      app/client/templates/room.html
  3. 2 1
      app/server/server.js

+ 4 - 0
app/client/app.css

@@ -1176,6 +1176,10 @@ nav form input[type="image"]{
     padding-left: 15px;
     padding-right: 15px;
 }
+.chat-rank {
+    color: white;
+    font-size: 10px;
+}
 .row {
     margin: 0;
 }

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

@@ -102,7 +102,7 @@
                             <h2 class="chat-title">Chat</h2>
                             <ul id="chat-ul">
                                 {{#each chat}}
-                                <li class="chat-message"><b class="bold">{{this.username}}:</b> {{this.message}}</li>
+                                <li class="chat-message"><small class="chat-rank">[{{this.rank}}]</small> <b class="bold">{{this.username}}:</b> {{this.message}}</li>
                                 <hr>
                                 {{/each}}
                             </ul>

+ 2 - 1
app/server/server.js

@@ -390,13 +390,14 @@ Meteor.methods({
             var user = Meteor.user();
             var time = new Date();
             var username = user.profile.username;
+            var rank = user.profile.rank;
             if (message.length === 0) {
                 throw new Meteor.Error(406, "Message length cannot be 0.");
             }
             if (message.length > 300) {
                 throw new Meteor.Error(406, "Message length cannot be more than 300 characters long..");
             }
-            Chat.insert({type: type, message: message, time: time, username: username});
+            Chat.insert({type: type, rank: rank, message: message, time: time, username: username});
             return true;
         } else {
             throw new Meteor.Error(403, "Invalid permissions.");