2
0
Эх сурвалжийг харах

Merge branch 'master' of https://github.com/AkiraLaine/music-app

KrisVos130 9 жил өмнө
parent
commit
83c7e18610

+ 4 - 0
app/app.css

@@ -952,6 +952,10 @@ footer .fa {
     background-color: transparent;
 }
 
+nav form{
+    height: 0;
+}
+
 nav form input[type="image"]{
     width: 100px;
     background-color: transparent !important;

+ 34 - 5
app/app.js

@@ -146,9 +146,9 @@ if (Meteor.isClient) {
               window.location.href = "/";
             })
             Accounts.onLoginFailure(function(){
-                $("input").css("background-color","indianred");
-                $("input").on("click",function(){
-                    $("input").css({
+                $("#login-form input").css("background-color","indianred");
+                $("#login-form input").on("click",function(){
+                    $("#login-form input").css({
                       "-webkit-appearance": "none",
                       "   -moz-appearance": "none",
                       "        appearance": "none",
@@ -167,11 +167,11 @@ if (Meteor.isClient) {
                       "        transition-duration": "0.25s",
                       "font-weight": "300"
                     });
-                    $("input:focus").css({
+                    $("#login-form input:focus").css({
                       "width": "354px",
                       "color": "white"
                     })
-                    $("input").on("blur", function(){
+                    $("#login-form input").on("blur", function(){
                       $(this).css("width", "304px");
                     })
                 })
@@ -618,6 +618,15 @@ if (Meteor.isClient) {
                 }
             });
             return playlists;
+        },
+        users: function(){
+            Meteor.call("getUserNum", function(err, num){
+                if(err){
+                    console.log(err);
+                }
+                Session.set("userNum", num);
+            });
+            return Session.get("userNum");
         }
     });
 
@@ -1024,6 +1033,23 @@ if (Meteor.isServer) {
         }
     });
 
+    var userNum = 0;
+
+    Meteor.onConnection(function(connection){
+        updateUserNum(true)
+        connection.onClose(function(){
+           updateUserNum(false);
+        })
+    });
+
+    function updateUserNum(increment){
+        if(increment === true){
+            userNum += 1;
+        } else if(increment === false){
+            userNum -= 1;
+        }
+    }
+
     var stations = [];
 
     var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_";
@@ -1554,6 +1580,9 @@ if (Meteor.isServer) {
             } else {
                 throw new Meteor.Error(403, "Invalid permissions.");
             }
+        },
+        getUserNum: function(){
+            return userNum;
         }
     });
 }

+ 1 - 0
app/templates/admin.html

@@ -2,6 +2,7 @@
     <div class="landing">
         {{> header}}
         <div class="row">
+            <h1 class="col-md-8 col-md-offset-2" style="color: white">Total Users: {{{users}}}</h1>
             <h1 class="col-md-8 col-md-offset-2 admin-header">Queues:</h1>
             {{#each queues}}
                 <div class="col-md-8 col-md-offset-2 admin-queue-panel">

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 4 - 1
app/templates/header.html


+ 1 - 1
app/templates/login.html

@@ -3,7 +3,7 @@
     {{> header}}
     <div class="container">
         <h1>Login</h1>
-        <form class="form">
+        <form class="form" id="login-form">
             <input type="text" autocorrect="off" name="loginUsername" placeholder="Enter your username" onfocus="this.placeholder = ''" onblur="this.placeholder='Enter your username'" required/>
             <input type="password" autocorrect="off" name="loginPassword" placeholder="Enter your password" onfocus="this.placeholder = ''" onblur="this.placeholder='Enter your password'" required/>
             <button type="submit">Login</button>

+ 3 - 4
app/templates/room.html

@@ -58,7 +58,6 @@
                             {{else}}
                             <button title="You need to be logged to smile this song." type="button" id="smile-modal" class="btn btn-success btn-lg" data-toggle="modal" data-target="#myModal" disabled><i class="fa fa-smile-o"> 79</i></button>
                             <button title="You need to be logged to dislike this song." type="button" id="meh-modal" class="btn btn-danger btn-lg" data-toggle="modal" data-target="#myModal" disabled><i class="fa fa-meh-o"> 14</i></button>
-							<button title="You need to be logged to report this song!" type="button" id="song-modal" class="btn btn-warning btn-lg" data-toggle="modal" data-target="#myModal" disabled><i class="fa fa-flag"></i></button>
 							{{/if}}
                             <button title="Report this song!" type="button" id="report-modal" class="btn btn-warning btn-lg report-button" data-toggle="modal" data-target="#reportModal"><i class="fa fa-flag"></i></button>
                         </div>
@@ -96,11 +95,11 @@
                                     <option name="soundcloud" id="soundcloud">SoundCloud</option>
                                 </select>
                                 <label for="id" class="song-input-label">Song ID</label>
-                                <input class="song-input" name="id" id="id" type="text" />
+                                <input class="song-input" name="id" id="id" type="text"/>
                                 <label for="id" class="song-input-label">Song Artist</label>
-                                <input class="song-input" name="artist" id="artist" type="text" />
+                                <input class="song-input" name="artist" id="artist" type="text"/>
                                 <label for="title" class="song-input-label">Song Title</label>
-                                <input class="song-input" name="title" id="title" type="text" />
+                                <input class="song-input" name="title" id="title" type="text"/>
                                 <label for="img" class="song-input-label">Song Img</label>
                                 <input class="song-input" name="img" id="img" type="text" />
                                 <button type="button" id="add-song-button" class="button">Add Song</button>

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно