Browse Source

started maintanance page

Akira Laine 9 years ago
parent
commit
fa408bc612

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

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

+ 12 - 9
app/client/scripts/routes.js

@@ -1,10 +1,17 @@
-Router.configure({
-    loadingTemplate: 'loading'
-});
-
 Router.onBeforeAction(function() {
     var self = this;
     var next = self.next;
+    var isMaintanance = Admin.find().fetch()[0].isMaintanance;
+    if(isMaintanance){
+        var user = Meteor.user();
+        if(user !== undefined && user.profile !== undefined && (user.profile.rank === "admin" || user.profile.rank === "moderator")){
+            self.render("home");
+        } else {
+            self.render("maintanance");
+        }
+    } else {
+        this.next();
+    }
     if (Meteor.userId()) {
         Meteor.call("isBanned", function(err, res) {
             if (res) {
@@ -16,7 +23,7 @@ Router.onBeforeAction(function() {
         });
     } else {
        this.next();
-    }
+   }
 });
 
 Router.route("/", {
@@ -87,10 +94,6 @@ Router.route("/news", {
     template: "news"
 })
 
-Router.route("/welcome", {
-    template: "landing"
-})
-
 Router.route("/project", {
     template: "project"
 })

+ 0 - 14
app/client/templates/landing.html

@@ -1,14 +0,0 @@
-<template name="landing">
-    <div class="layer-content">
-        <h1 class="center-align">Musare</h1>
-        <p class="flow-text">Musare is a modern, open-source music app that allows you to collaboratively listen to music in out genre specific stations.</p>
-        <a href="/login" class="waves-effect waves-light btn">Login to Musare</a>
-        <p>or</p>
-        <a href="/" class="waves-effect waves-light btn">Continue without logging in</a>
-    </div>
-    <div class="album-art-row">
-        {{#each songs}}
-            <img src={{img}} />
-        {{/each}}
-    </div>
-</template>

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

@@ -1,7 +0,0 @@
-<template name="loading">
-    <div class="landing">
-        <div id="spinner-container">
-            <i class="fa fa-spinner fa-pulse" id="spinner"></i>
-        </div>
-    </div>
-</template>

+ 2 - 1
app/database/collections.js

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

+ 4 - 0
app/server/server.js

@@ -570,6 +570,10 @@ 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();
 })