Browse Source

Readded loading. Fixed Akira's derp. Added maintenance page.

KrisVos130 9 năm trước cách đây
mục cha
commit
f7cb60f9d2

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

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

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

@@ -1,18 +1,6 @@
 var StationSubscription = undefined;
 var StationSubscription = undefined;
 var resizeSeekerbarInterval;
 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() {
 Template.banned.onCreated(function() {
     if (Session.get("rTimeInterval") !== undefined) {
     if (Session.get("rTimeInterval") !== undefined) {
         Meteor.clearInterval(Session.get("rTimeInterval"))
         Meteor.clearInterval(Session.get("rTimeInterval"))

+ 22 - 18
app/client/scripts/routes.js

@@ -1,29 +1,33 @@
+Router.configure({
+   loadingTemplate: 'loading'
+});
+
 Router.onBeforeAction(function() {
 Router.onBeforeAction(function() {
     var self = this;
     var self = this;
     var next = self.next;
     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();
         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 {
         } else {
-            self.render("maintanance");
+            this.render("maintenance");
         }
         }
     } else {
     } 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("/", {
 Router.route("/", {

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

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

+ 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>

+ 0 - 1
app/database/collections.js

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

+ 1 - 1
app/database/schemas.js

@@ -543,4 +543,4 @@ Meteor.users.attachSchema(Schemas.User);
 Reports.attachSchema(Schemas.Report);
 Reports.attachSchema(Schemas.Report);
 Feedback.attachSchema(Schemas.Feedback);
 Feedback.attachSchema(Schemas.Feedback);
 Songs.attachSchema(Schemas.FullSong);
 Songs.attachSchema(Schemas.FullSong);
-News.attachSchema(Schemas.Article);
+News.attachSchema(Schemas.Article);

+ 2 - 4
app/server/server.js

@@ -29,6 +29,8 @@ Meteor.startup(function () {
     }
     }
 
 
     Rooms.update({}, {$set: {userList: []}});
     Rooms.update({}, {$set: {userList: []}});
+
+    console.log(Meteor.settings);
 });
 });
 
 
 var default_song = {
 var default_song = {
@@ -570,10 +572,6 @@ Meteor.publish("isModerator", function () {
     return Meteor.users.find({_id: this.userId, "profile.rank": "moderator"});
     return Meteor.users.find({_id: this.userId, "profile.rank": "moderator"});
 });
 });
 
 
-Meteor.publish("admin", function(){
-    return Admin.find();
-})
-
 Meteor.publish("feedback", function(){
 Meteor.publish("feedback", function(){
     return Feedback.find();
     return Feedback.find();
 })
 })