Browse Source

added reports view on manageStations

Akira Laine 9 years ago
parent
commit
5710f73c72

+ 10 - 8
app/client/scripts/events.js

@@ -883,6 +883,14 @@ Template.manageStation.events({
                 Session.set("song", newSong);
                 Session.set("song", newSong);
             }
             }
         });
         });
+    },
+    "click .remove-report-button": function(){
+        var parts = location.href.split('/');
+        parts.pop();
+        var id = parts.pop();
+        var query = {room: id.toLowerCase()};
+        var obj = $(this)[0];
+        Meteor.call("removeReport", query, obj);
     }
     }
 });
 });
 
 
@@ -1585,14 +1593,8 @@ Template.room.events({
         reportData.type = [];
         reportData.type = [];
         reportData.reason = [];
         reportData.reason = [];
 
 
-        $(".report-layer-1 > div > input:checked").each(function () {
-            if (this.id == "report-other") {
-                var id = this.id;
-                var otherText = $(".other-textarea-ta").val();
-                reportData.type.push({"report-other": otherText});
-            } else {
-                reportData.type.push(this.id);
-            }
+        $(".report-layer-1 > div > input:checked").each(function (){
+            reportData.type.push(this.id);
         });
         });
 
 
         $(".report-layer-2 input:checked").each(function () {
         $(".report-layer-2 input:checked").each(function () {

+ 8 - 0
app/client/scripts/helpers.js

@@ -269,6 +269,14 @@ Template.manageStation.helpers({
         var id = parts.pop();
         var id = parts.pop();
         var type = id.toLowerCase();
         var type = id.toLowerCase();
         return type;
         return type;
+    },
+    reports: function() {
+        var parts = location.href.split('/');
+        parts.pop();
+        var id = parts.pop();
+        var query = {room: id.toLowerCase()};
+        var reports = Reports.find(query).fetch();
+        return reports;
     }
     }
 });
 });
 
 

+ 28 - 1
app/client/templates/manageStation.html

@@ -58,6 +58,33 @@
                     </table>
                     </table>
                 </div>
                 </div>
             </div>
             </div>
+            <div class="col m12 s12 l8 offset-l2 admin-playlist-panel card-panel teal accent-3">
+                <div class="card-content white-text">
+                    <h3 class="text-center">Reports</h3>
+                    <table class="bordered">
+                        <thead>
+                            <tr>
+                                <th>Song mid</th>
+                                <th>Report Type</th>
+                                <th>Report Reason</th>
+                                <th>Remove</th>
+                            </tr>
+                        </thead>
+                        <tbody>
+                            {{#each reports}}
+                                {{#each report}}
+                                    <tr>
+                                        <td>{{song}}</td>
+                                        <td>{{type}}</td>
+                                        <td>{{reason}}</td>
+                                        <td><a class="btn red remove-report-button"><i class="material-icons">remove_circle</i></a></td>
+                                    </tr>
+                                {{/each}}
+                            {{/each}}
+                        </tbody>
+                    </table>
+                </div>
+            </div>
         </div>
         </div>
     </div>
     </div>
     <div id="editModal" class="modal modal-fixed-footer">
     <div id="editModal" class="modal modal-fixed-footer">
@@ -183,4 +210,4 @@
             <a href="#!" class="modal-action modal-close waves-effect waves-light btn-flat white">X</a>
             <a href="#!" class="modal-action modal-close waves-effect waves-light btn-flat white">X</a>
         </div>
         </div>
     </div>
     </div>
-</template>
+</template>