ソースを参照

Made admin page genre selector display all rooms.

KrisVos130 9 年 前
コミット
a501d66c7c
2 ファイル変更13 行追加2 行削除
  1. 9 0
      app/app.js
  2. 4 2
      app/templates/admin.html

+ 9 - 0
app/app.js

@@ -193,6 +193,12 @@ if (Meteor.isClient) {
         }
     });
 
+    Template.admin.helpers({
+        rooms: function() {
+            return Rooms.find({});
+        }
+    });
+
     Template.playlist.helpers({
         playlist_songs: function() {
             var data = Playlists.find({type: type}).fetch();
@@ -204,6 +210,8 @@ if (Meteor.isClient) {
         }
     });
 
+    Meteor.subscribe("rooms");
+
     Template.room.onCreated(function () {
         var tag = document.createElement("script");
         tag.src = "https://www.youtube.com/iframe_api";
@@ -337,6 +345,7 @@ if (Meteor.isClient) {
 
         Meteor.subscribe("history");
         Meteor.subscribe("playlists");
+        Session.set("loaded", true);
         Meteor.subscribe("rooms", function() {
             Session.set("loaded", false);
             console.log(Rooms.find({type: type}).fetch().length);

+ 4 - 2
app/templates/admin.html

@@ -4,8 +4,10 @@
         <form>
             <label for="genre">Song Genre</label>
             <select name="genre" id="genre">
-                <option name="edm" id="edm">EDM</option>
-                <option name="nightcore" id="nightcore">Nightcore</option>
+                {{#each rooms}}
+                    <option name="{{type}}" id="{{type}}">{{type}}</option>
+                {{/each}}
+                <!--option name="nightcore" id="nightcore">Nightcore</option-->
             </select>
             <label for="type">Song Type</label>
             <select name="type" id="type">