Explorar o código

Cleaned up the Admin UI. When you go to edit a playlist you no longer see all playlists just the one you intend to edit. Reports are finished and are inserted into the DB in a such a way that they can be easily read and edited. All of the backend functionality is in place I just need to work on the UI for editing a playlists and queues.

Wesley McCann %!s(int64=9) %!d(string=hai) anos
pai
achega
448ab1f8be
Modificáronse 3 ficheiros con 20 adicións e 20 borrados
  1. 14 15
      app/client/client.js
  2. 3 2
      app/client/templates/admin.html
  3. 3 3
      app/client/templates/stations.html

+ 14 - 15
app/client/client.js

@@ -1034,9 +1034,7 @@ Template.admin.helpers({
       return Session.get("userNum");
   },
   allUsers: function(){
-    var users = Users.find({}).fetch();
-    console.log(users);
-  }
+  },
   playlists: function() {
       var playlists = Playlists.find({}).fetch();
       playlists.map(function(playlist) {
@@ -1052,7 +1050,6 @@ Template.admin.helpers({
   reportsCount: function(room) {
     room = room.toLowerCase();
     var reports = Reports.findOne({room:room});
-    console.log(reports);
     return reports && "report" in reports ? reports.report.length : 0;
   }
 });
@@ -1066,21 +1063,23 @@ Template.admin.events({
               window.location = "/" + $("#croom_tag").val();
           }
       });
+  },
+  "click a": function(e){
+    var id = e.currentTarget.id;
+    console.log(id.toLowerCase());
+    Session.set("playlistToEdit", id);
   }
 });
 
 Template.stations.helpers({
-    playlists: function() {
-        var playlists = Playlists.find({}).fetch();
-        playlists.map(function(playlist) {
-            if (Rooms.find({type: playlist.type}).count() !== 1) {
-                return;
-            } else {
-                playlist.display = Rooms.findOne({type: playlist.type}).display;
-                return playlist;
-            }
-        });
-        return playlists;
+    playlist: function() {
+      var query = {type: Session.get("playlistToEdit").toLowerCase()};
+      var playlists = Playlists.find(query).fetch();
+      console.log(Session.get("playlistToEdit"), query, playlists);
+      return playlists;
+    },
+    whichStation: function(){
+      return Session.get("playlistToEdit");
     }
 });
 

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

@@ -23,7 +23,7 @@
                     <td></td>
                     <td>{{reportsCount display}}</td>
                     <td>{{queueCount display}}</td>
-                    <td><a href="/admin/stations">Edit</a></td>
+                    <td><a href="/admin/stations" id={{display}}>Edit</a></td>
                   </tr>
                 </table>
               {{/each}}
@@ -33,7 +33,8 @@
                 <h1>Site statistics</h1>
               </div>
               <p>Total Users Online: {{usersOnline}}</p>
-              <p>Total Registered Users: {{allUsers}}</p>
+              <p>Total Registered Users: </p>
+              <a href="/admin/queues">Edit the queues</a>
             </div>
           </div>
           <div id="addStation" class="modal fade" role="dialog">

+ 3 - 3
app/client/templates/stations.html

@@ -2,12 +2,12 @@
     {{> alerts}}
   <div class="landing">
     {{> header}}
-      <h1 class="col-md-8 col-md-offset-2 admin-header">Playlists:</h1>
-      {{#each playlists}}
+      <h1 class="col-md-8 col-md-offset-2 admin-header">Playlist for {{whichStation}}</h1>
+      {{#each playlist}}
           <div class="col-md-8 col-md-offset-2 admin-playlist-panel">
               <div class="panel panel-primary">
                   <div class="panel-heading">
-                      <h3 class="panel-title"><span>{{display}}</span> playlist</h3> <i class="fa fa-times delete-room" name="Delete room"></i>
+                      <h3 class="panel-title">Delete</h3> <i class="fa fa-times delete-room" name="Delete room"></i>
                   </div>
                   <div class="panel-body admin-panel-body">
                       <table class="table table-striped">