Browse Source

Merge branch 'CullenIO-february_release' into february_release

Akira Laine 9 years ago
parent
commit
612538cc26

+ 3 - 0
app/client/scripts/helpers.js

@@ -167,6 +167,9 @@ Template.profile.helpers({
     "rank": function () {
         return Session.get("rank");
     },
+    "songs_requested": function () {
+        return Session.get("songs_requested");
+    },
     loaded: function () {
         return Session.get("loaded");
     },

+ 0 - 1
app/client/scripts/main.js

@@ -23,7 +23,6 @@ Deps.autorun(function() {
     Meteor.subscribe("rooms");
     Meteor.subscribe("news");
     Meteor.subscribe("userData", Meteor.userId());
-    Meteor.subscribe("admin");
 });
 
 Handlebars.registerHelper("isAdmin", function(argument){

+ 1 - 12
app/client/scripts/onCreated.js

@@ -1,18 +1,6 @@
 var StationSubscription = undefined;
 var resizeSeekerbarInterval;
 
-Template.landing.onCreated(function(){
-    $("body").css("overflow", "hidden");
-    function pageScroll() {
-        window.scrollBy(0,1);
-        if($(window).scrollTop() + $(window).height() == $(document).height()) {
-            $(window).scrollTop(0);
-        }
-        scrolldelay = setTimeout(pageScroll,50);
-    }
-    pageScroll();
-});
-
 Template.banned.onCreated(function() {
     if (Session.get("rTimeInterval") !== undefined) {
         Meteor.clearInterval(Session.get("rTimeInterval"))
@@ -73,6 +61,7 @@ Template.profile.onCreated(function() {
             Session.set("username", data.profile.username);
             Session.set("first_joined", data.createdAt);
             Session.set("rank", data.profile.rank);
+            Session.set("songs_requested", data.profile.statistics.songsRequested);
             Session.set("liked", data.profile.liked);
             Session.set("disliked", data.profile.disliked);
             Session.set("loaded", true);

+ 32 - 23
app/client/scripts/routes.js

@@ -1,29 +1,34 @@
+Router.configure({
+    loadingTemplate: 'loading',
+    notFoundTemplate: '404'
+});
+
 Router.onBeforeAction(function() {
     var self = this;
     var next = self.next;
-    var isMaintanance = Admin.find().fetch()[0].isMaintanance;
-    if(isMaintanance){
+    var isMaintanance = Meteor.settings.public.maintenance;
+    if(isMaintanance === true){
         var user = Meteor.user();
-        if(user !== undefined && user.profile !== undefined && (user.profile.rank === "admin" || user.profile.rank === "moderator")){
-            self.render("home");
+        console.log(user);
+        if(user !== null && user.profile !== undefined && (user.profile.rank === "admin" || user.profile.rank === "moderator")){
+            next();
         } else {
-            self.render("maintanance");
+            this.render("maintenance");
         }
     } else {
-        this.next();
+        if (Meteor.userId()) {
+            Meteor.call("isBanned", function(err, res) {
+                if (res) {
+                    self.render('banned');
+                } else {
+                    document.title = 'Musare';
+                    next();
+                }
+            });
+        } else {
+            next();
+        }
     }
-    if (Meteor.userId()) {
-        Meteor.call("isBanned", function(err, res) {
-            if (res) {
-                self.render('banned');
-            } else {
-                document.title = 'Musare';
-                next();
-            }
-        });
-    } else {
-       this.next();
-   }
 });
 
 Router.route("/", {
@@ -98,9 +103,9 @@ Router.route("/project", {
     template: "project"
 })
 
-Router.route("/donate", {
+/*Router.route("/donate", {
     template: "donate"
-})
+})*/
 
 Router.route("/admin", {
     waitOn: function() {
@@ -169,10 +174,14 @@ Router.route("/:type", {
     action: function() {
         var user = Meteor.users.findOne({});
         var room = Rooms.findOne({type: this.params.type});
-        if ((room.private === true && user !== undefined && user.profile !== undefined && (user.profile.rank === "admin" || user.profile.rank === "moderator")) || room.private === false) {
-            this.render("room");
+        if (room !== undefined) {
+            if ((room.private === true && user !== undefined && user.profile !== undefined && (user.profile.rank === "admin" || user.profile.rank === "moderator")) || room.private === false) {
+                this.render("room");
+            } else {
+                this.redirect("/");
+            }
         } else {
-            this.redirect("/");
+            this.render("404");
         }
     }
 });

+ 4 - 0
app/client/stylesheets/app.css

@@ -146,6 +146,10 @@ hr{
     background-color: rgb(107, 197, 164) !important;
 }
 
+.musare-text {
+    color: rgb(107, 197, 164) !important;
+}
+
 .range-field > input[type="range"] {
     border-color: #C2C0C2;
     border-right: 0;

+ 11 - 0
app/client/templates/404.html

@@ -0,0 +1,11 @@
+<template name="404">
+    <div class="row">
+        <div class="col l8 s8 m8 offset-l2 offset-m2 offset-s2 teal-text">
+            <i class="material-icons center red-text" style="font-size: 20em; width: 100%;">remove_circle</i>
+            <div class="divider"></div>
+            <h1 class="center-align">404</h1>
+            <h3 class="center-align">It seems like you ended up in the wrong place.</h3>
+            <a class="btn btn-block" href="/">Take me back!</a>
+        </div>
+    </div>
+</template>

+ 3 - 1
app/client/templates/admin.html

@@ -45,7 +45,9 @@
                     <p class="flow-text">Total Registered Users: {{allUsers}}</p>
                 </div>
                 <div class="row">
-
+                    <a class="waves-effect waves-light btn col m12 s12 l12" href="/admin/songs">
+                        Manage Songs
+                    </a>
                 </div>
             </div>
             <div class="col s12 l6 m10 offset-m1 offset-l1 card-panel teal accent-3 white-text" style="height: 80%;">

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

@@ -32,7 +32,7 @@
                 </li>
                 <li>
                     <div class="collapsible-header"><i class="material-icons">help</i>What are the username requirements?</div>
-                    <div class="collapsible-body"><p>Your username should contain between 6 and 26 characters. Your username can only contain letters (a-z), numbers (0-9) and underscore's (_). Your username should be appropriate. Please don't use any offensive, racist or homophobic username.</p></div>
+                    <div class="collapsible-body"><p>Your username should contain between 3 and 26 characters. Your username can only contain letters (a-z), numbers (0-9) and underscore's (_). Your username should be appropriate. Please don't use any offensive, racist or homophobic username.</p></div>
                 </li>
                 <li>
                     <div class="collapsible-header"><i class="material-icons">help</i>Can I change my username?</div>

+ 40 - 15
app/client/templates/home.html

@@ -4,26 +4,51 @@
         {{> alerts}}
             <div class="row">
                 {{#each rooms}}
-                    <div class="col s6 m4 l2">
-                        <div class="card hoverable">
-                            <div class="card-image waves-effect waves-block waves-light">
-                                <a href=/{{type}}>
+                    {{#if private}}
+                        {{#if isModerator}}
+                            <div class="col s6 m4 l2">
+                                <div class="card hoverable">
+                                    <div class="card-image waves-effect waves-block waves-light">
+                                        <a href=/{{type}}>
+                                        <img onerror="this.src='http://static.boredpanda.com/blog/wp-content/uploads/2014/04/amazing-fox-photos-182.jpg'" src={{currentSong.song.img}}>
+                                        <figcaption class="caption center-align">
+                                            <h5>{{currentSong.song.title}}</h5>
+                                            <h5>{{currentSong.song.artist}}</h5>
+                                        </figcaption>
+                                        </a>
+                                    </div>
+                                    <div class="card-content">
+                                        <span class="card-title grey-text text-darken-4">{{display}}</span><div><span class="user-num">{{userNum}}</span> <i class="material-icons">perm_identity</i></div>
+                                        <p>{{roomDesc}}</p>
+                                    </div>
+                                    <div class="card-action">
+                                        <a href=/{{type}} class="teal-text text-accent-4">Join Room</a>
+                                    </div>
+                                </div>
+                            </div>
+                        {{/if}}
+                    {{else}}
+                        <div class="col s6 m4 l2">
+                            <div class="card hoverable">
+                                <div class="card-image waves-effect waves-block waves-light">
+                                    <a href=/{{type}}>
                                     <img onerror="this.src='http://static.boredpanda.com/blog/wp-content/uploads/2014/04/amazing-fox-photos-182.jpg'" src={{currentSong.song.img}}>
                                     <figcaption class="caption center-align">
-                                      <h5>{{currentSong.song.title}}</h5>
-                                      <h5>{{currentSong.song.artist}}</h5>
+                                        <h5>{{currentSong.song.title}}</h5>
+                                        <h5>{{currentSong.song.artist}}</h5>
                                     </figcaption>
-                                </a>
-                            </div>
-                            <div class="card-content">
-                                <span class="card-title grey-text text-darken-4">{{display}}</span><div><span class="user-num">{{userNum}}</span> <i class="material-icons">perm_identity</i></div>
-                                <p>{{roomDesc}}</p>
-                            </div>
-                            <div class="card-action">
-                                <a href=/{{type}} class="teal-text text-accent-4">Join Room</a>
+                                    </a>
+                                </div>
+                                <div class="card-content">
+                                    <span class="card-title grey-text text-darken-4">{{display}}</span><div><span class="user-num">{{userNum}}</span> <i class="material-icons">perm_identity</i></div>
+                                    <p>{{roomDesc}}</p>
+                                </div>
+                                <div class="card-action">
+                                    <a href=/{{type}} class="teal-text text-accent-4">Join Room</a>
+                                </div>
                             </div>
                         </div>
-                    </div>
+                    {{/if}}
                 {{/each}}
             </div>
     </main>

+ 5 - 0
app/client/templates/loading.html

@@ -0,0 +1,5 @@
+<template name="loading">
+    <div class="row">
+        <h1 class="musare-text">Loading...</h1>
+    </div>
+</template>

+ 9 - 0
app/client/templates/maintenance.html

@@ -0,0 +1,9 @@
+<template name="maintenance">
+    <div class="row">
+        <div class="col l8 s8 m8 offset-l2 offset-m2 offset-s2 teal-text">
+            <i class="material-icons center red-text" style="font-size: 20em; width: 100%;">remove_circle</i>
+            <div class="divider"></div>
+            <h3 class="center-align flow-text">Musare is currently in maintenance mode. Please stand by as we work on Musare. Musare should be back shortly.</h3>
+        </div>
+    </div>
+</template>

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

@@ -11,6 +11,7 @@
                         <p>Username: {{username}}</p>
                         <p>First Joined: {{first_joined}}</p>
                         <p>Rank: {{rank}}</p>
+                        <p>Requested Songs: {{songs_requested}}</p>
                     </div>
                 </div>
             </div>

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

@@ -72,6 +72,7 @@
                         <p style="clear: both; line-height: 1.2em; margin-left: 13px; margin-bottom: 0; font-size: 1.2em">{{this.message}}</p>
                     </li>
                 {{/emojione}}
+                <div class="divider" style="margin-top: 15px;"></div>
             {{/each}}
         </ul>
         <div>

+ 0 - 1
app/database/collections.js

@@ -8,4 +8,3 @@ Deleted = new Mongo.Collection("deleted");
 Feedback = new Mongo.Collection("feedback");
 Songs = new Mongo.Collection("songs");
 News = new Mongo.Collection("news");
-Admin = new Mongo.Collection("admin");

+ 3 - 3
app/database/schemas.js

@@ -279,7 +279,7 @@ Schemas.UserProfile = new SimpleSchema({
         type: String,
         label: "Username",
         regEx: /^[a-zA-Z0-9_]+$/,
-        min: 4,
+        min: 3,
         max: 26
     },
     usernameL: {
@@ -429,7 +429,7 @@ Schemas.User = new SimpleSchema({
         // Third-party login packages may not require either. Adjust this schema as necessary for your usage.
         optional: true,
         regEx: /^[a-zA-Z0-9_]+$/,
-        min: 6,
+        min: 3,
         max: 26
     },
     emails: {
@@ -543,4 +543,4 @@ Meteor.users.attachSchema(Schemas.User);
 Reports.attachSchema(Schemas.Report);
 Feedback.attachSchema(Schemas.Feedback);
 Songs.attachSchema(Schemas.FullSong);
-News.attachSchema(Schemas.Article);
+News.attachSchema(Schemas.Article);

+ 1 - 5
app/server/server.js

@@ -570,10 +570,6 @@ Meteor.publish("isModerator", function () {
     return Meteor.users.find({_id: this.userId, "profile.rank": "moderator"});
 });
 
-Meteor.publish("admin", function(){
-    return Admin.find();
-})
-
 Meteor.publish("feedback", function(){
     return Feedback.find();
 })
@@ -824,7 +820,7 @@ Meteor.methods({
                         Chat.insert({
                             type: type,
                             rawrank: rawrank,
-                            rank: "[D]",
+                            rank: "",
                             message: message,
                             time: time,
                             username: username