Explorar el Código

Merge remote-tracking branch 'origin/february_release' into february_release

KrisVos130 hace 9 años
padre
commit
1c47a969aa

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

@@ -1585,10 +1585,13 @@ Template.room.events({
         reportData.type = [];
         reportData.reason = [];
 
-        $(".report-layer-1 > .checkbox input:checked").each(function () {
-            reportData.type.push(this.id);
+        $(".report-layer-1 > div > input:checked").each(function () {
             if (this.id == "report-other") {
-                var otherText = $(".other-textarea").val();
+                var id = this.id;
+                var otherText = $(".other-textarea-ta").val();
+                reportData.type.push({"report-other": otherText});
+            } else {
+                reportData.type.push(this.id);
             }
         });
 
@@ -1597,8 +1600,8 @@ Template.room.events({
         });
 
         console.log(reportData);
-        Meteor.call("submitReport", room, reportData, Session.get("id"), function () {
-            $("#close-modal-r").click();
+        Meteor.call("submitReport", room, reportData, function () {
+            $("report_modal").closeModal();
         });
     },
     "change #si_or_pl": function () {

+ 95 - 44
app/client/scripts/helpers.js

@@ -115,10 +115,13 @@ Template.home.helpers({
 
 Template.playlist.helpers({
     playlist_songs: function () {
-        var parts = location.href.split('/');
-        var id = parts.pop();
-        var type = id.toLowerCase();
-        var data = Songs.find({"genres": type}).fetch();
+        var songIDs = Playlists.find({"type": Session.get("type")}).fetch()[0].songs
+        var data = [];
+        songIDs.forEach(function(id){
+            var song = Songs.findOne({"mid": id});
+            data.push(song);
+        })
+        console.log(data);
         if (data !== undefined) {
             data.map(function (song) {
                 if (Session.get("currentSong") !== undefined && song.mid === Session.get("currentSong").mid) {
@@ -133,17 +136,17 @@ Template.playlist.helpers({
             return [];
         }
     },
-    currentSong: function(){
-        var parts = location.href.split('/');
-        var id = parts.pop();
-        var type = id.toLowerCase();
-        var data = Songs.find({"genres": type}).fetch();
+    nextSong: function(){
+        var song;
+        var data = Playlists.find({"type": Session.get("type")}).fetch()[0].songs
         for(var i = 0; i < data.length; i++){
-            if(data[i].mid === Session.get("currentSong").mid){
+            if(data[i] === Session.get("currentSong").mid){
                 if(i === data.length - 1){
-                    Session.set("nextSong", [data[0]]);
+                    song = Songs.findOne({"mid": data[0]});
+                    Session.set("nextSong", [song])
                 } else{
-                    Session.set("nextSong", [data[i+1]]);
+                    song = Songs.findOne({"mid": data[i+1]});
+                    Session.set("nextSong", [song]);
                 }
             }
         };
@@ -387,49 +390,97 @@ Template.room.helpers({
     private: function () {
         return Rooms.findOne({type: Session.get("type")}).private === true;
     },
-    report: function () {
-        return Session.get("reportObj");
+    currentSong: function(){
+        return Session.get("currentSong");
     },
-    reportSong: function () {
+    reportSong: function(){
+        Meteor.setInterval(function(){
+            if($("#report-song").is(":checked")){
+                Session.set("reportSong", true)
+            } else { Session.set("reportSong", false) }
+        }, 500);
         return Session.get("reportSong");
     },
-    reportTitle: function () {
+    reportSongOther: function(){
+        Meteor.setInterval(function(){
+            if($("#report-song-other").is(":checked")){
+                Session.set("reportSongOther", true)
+            } else { Session.set("reportSongOther", false) }
+        }, 500);
+        return Session.get("reportSongOther");
+    },
+    reportTitle: function(){
+        Meteor.setInterval(function(){
+            if($("#report-title").is(":checked")){
+                Session.set("reportTitle", true)
+            } else { Session.set("reportTitle", false) }
+        }, 500);
         return Session.get("reportTitle");
     },
-    reportAuthor: function () {
-        return Session.get("reportAuthor");
-    },
-    reportDuration: function () {
+    reportTitleOther: function(){
+        Meteor.setInterval(function(){
+            if($("#report-title-other").is(":checked")){
+                Session.set("reportTitleOther", true)
+            } else { Session.set("reportTitleOther", false) }
+        }, 500);
+        return Session.get("reportTitleOther");
+    },
+    reportArtist: function(){
+        Meteor.setInterval(function(){
+            if($("#report-artist").is(":checked")){
+                Session.set("reportArtist", true)
+            } else { Session.set("reportArtist", false) }
+        }, 500);
+        return Session.get("reportArtist");
+    },
+    reportArtistOther: function(){
+        Meteor.setInterval(function(){
+            if($("#report-artist-other").is(":checked")){
+                Session.set("reportArtistOther", true)
+            } else { Session.set("reportArtistOther", false) }
+        }, 500);
+        return Session.get("reportArtistOther");
+    },
+    reportDuration: function(){
+        Meteor.setInterval(function(){
+            if($("#report-duration").is(":checked")){
+                Session.set("reportDuration", true)
+            } else { Session.set("reportDuration", false) }
+        }, 500);
         return Session.get("reportDuration");
     },
-    reportAudio: function () {
-        return Session.get("reportAudio");
-    },
-    reportAlbumart: function () {
+    reportDurationOther: function(){
+        Meteor.setInterval(function(){
+            if($("#report-duration-other").is(":checked")){
+                Session.set("reportDurationOther", true)
+            } else { Session.set("reportDurationOther", false) }
+        }, 500);
+        return Session.get("reportDurationOther");
+    },
+    reportAlbumart: function(){
+        Meteor.setInterval(function(){
+            if($("#report-albumart").is(":checked")){
+                Session.set("reportAlbumart", true)
+            } else { Session.set("reportAlbumart", false) }
+        }, 500);
         return Session.get("reportAlbumart");
     },
-    reportOther: function () {
+    reportAlbumartOther: function(){
+        Meteor.setInterval(function(){
+            if($("#report-albumart-other").is(":checked")){
+                Session.set("reportAlbumartOther", true)
+            } else { Session.set("reportAlbumartOther", false) }
+        }, 500);
+        return Session.get("reportAlbumartOther");
+    },
+    reportOther: function(){
+        Meteor.setInterval(function(){
+            if($("#report-other").is(":checked")){
+                Session.set("reportOther", true)
+            } else { Session.set("reportOther", false) }
+        }, 500);
         return Session.get("reportOther");
     },
-    currentSong: function () {
-        return Session.get("currentSong");
-    },
-    previousSong: function () {
-        return Session.get("previousSong");
-    },
-    currentSongR: function () {
-        return Session.get("currentSongR");
-    },
-    previousSongR: function () {
-        return Session.get("previousSongR");
-    },
-    reportingSong: function () {
-        if (Session.get("reportPrevious")) {
-            return Session.get("previousSongR");
-        } else {
-            return Session.get("currentSongR");
-        }
-    },
     votes: function () {
         console.log(Rooms.findOne({type: Session.get("type")}).votes);
         return Rooms.findOne({type: Session.get("type")}).votes;

+ 8 - 0
app/client/stylesheets/app.css

@@ -373,6 +373,14 @@ hr{
     line-height: 25px;
 }
 
+.report-layer-2{
+    margin-left: 38px;
+}
+
+#report_modal textarea{
+    color: black;
+}
+
 /*Media queries stay on the bottom*/
 @media screen and (max-width: 990px){
     .card i{

+ 1 - 1
app/client/templates/playlist.html

@@ -4,7 +4,7 @@
         <label for="search-playlist">Search playlist by song/artist</label>
     </div>
     <ul id="up-next">
-        {{#each currentSong}}
+        {{#each nextSong}}
             <p style="margin: -20px 0 0 15px; font-weight: 300;">Up Next</p>
             <li class="pl-item" style="color: rgb(107, 197, 164) !important;">
                 <img src={{img}} style="width: 80px; float: left; margin: 0 10px 10px 0;">

+ 200 - 3
app/client/templates/room.html

@@ -5,7 +5,7 @@
                 <ul class="left hide-on-med-and-down">
                     <li><a href="/"><i class="material-icons">home</i></a></li>
                     <li><a href="#add_song_modal" class="tooltipped" data-position="bottom" data-delay="50" data-tooltip="Request a song" id="add-song-modal-button"><i class="material-icons">playlist_add</i></a></li>
-                    <li><a href="#bug_report_modal" class="tooltipped" data-position="bottom" data-delay="50" data-tooltip="Flag a song"><i class="material-icons">flag</i></a></li>
+                    <li><a href="#report_modal" class="tooltipped" data-position="bottom" data-delay="50" data-tooltip="Flag a song" id="report-modal-button"><i class="material-icons">flag</i></a></li>
                     <li><a id="vote-skip" class="tooltipped" data-position="bottom" data-delay="50" data-tooltip="Vote to skip this song"><i class="material-icons left">skip_next</i>{{votes}}</a></li>
                     {{#if isAdmin}}
                         <li><a class='dropdown-button' data-activates='admin-dropdown'><i class="material-icons">control_point</i></a></li>
@@ -73,7 +73,7 @@
                         <span title="{{time}}" style="float: right; margin-top: 15px">{{rtime time}}</span>
                         <small class="rank-{{this.rawrank}}" style="margin-top: 15px">{{this.rank}}</small>
                         <a style="text-decoration: none; font-size: 0.9em; height: 0.9em; font-weight: 500" href="/u/{{this.username}}" target="_blank">{{this.username}}</a>
-                        <p style="clear: both; line-height: 1.2em; margin-left: 13px; margin-bottom: 30px; font-size: 1.2em; height: 0">{{this.message}}</p>
+                        <p style="clear: both; line-height: 1.2em; margin-left: 13px; margin-bottom: 0; font-size: 1.2em">{{this.message}}</p>
                     </li>
                 {{/emojione}}
             {{/each}}
@@ -276,7 +276,204 @@
     <!--Report modal-->
     <div id="report_modal" class="modal">
         <div class="modal-content container">
-
+            <h4>Reporting:</h4>
+            <h5>{{currentSong.title}} <span class="thin">by</span> {{currentSong.artist}}</h5>
+            <div class="report-layer-1">
+                <div>
+                    <input type="checkbox" id="report-song">
+                    <label for="report-song">
+                        Song
+                    </label>
+                </div>
+                <!-- Layer2 -->
+                {{#if reportSong}}
+                    <div class="report-layer-2" id="report-song-list">
+                        <p>
+                            <input type="checkbox" id="report-song-not-playing">
+                            <label for="report-song-not-playing">
+                                Not playing
+                            </label>
+                        </p>
+                        <p>
+                            <input type="checkbox" id="report-song-does-not-exist">
+                            <label for="report-song-does-not-exist">
+                                Does not exist
+                            </label>
+                        </p>
+                        <p>
+                            <input type="checkbox" id="report-song-other">
+                            <label for="report-song-other">
+                                Other:
+                            </label>
+                            {{#if reportSongOther}}
+                                <div class="input-field">
+                                    <textarea class="materialize-textarea" id="report-song-other-ta" type="text"></textarea>
+                                    <label for="report-song-other-ta">What is the issue?</label>
+                                </div>
+                            {{/if}}
+                        </p>
+                    </div>
+                {{/if}}
+                <div class="checkbox">
+                    <input type="checkbox" id="report-title">
+                    <label for="report-title">
+                        Title
+                    </label>
+                </div>
+                <!-- Layer2 -->
+                {{#if reportTitle}}
+                    <div class="report-layer-2" id="report-title-list">
+                        <p>
+                            <input type="checkbox" id="report-title-incorrect">
+                            <label for="report-title-incorrect">
+                                Incorrect
+                            </label>
+                        </p>
+                        <p>
+                            <input type="checkbox" id="report-title-inappropriate">
+                            <label for="report-title-inappropriate">
+                                Inappropriate
+                            </label>
+                        </p>
+                        <p>
+                            <input type="checkbox" id="report-title-other">
+                            <label for="report-title-other">
+                                Other:
+                            </label>
+                            {{#if reportTitleOther}}
+                                <div class="input-field">
+                                    <textarea class="materialize-textarea" id="report-title-other-ta" type="text"></textarea>
+                                    <label for="report-title-other-ta">What is the issue?</label>
+                                </div>
+                            {{/if}}
+                        </p>
+                    </div>
+                {{/if}}
+                <div>
+                    <input type="checkbox" id="report-artist">
+                    <label for="report-artist">
+                        Artist
+                    </label>
+                </div>
+                <!-- Layer2 -->
+                {{#if reportArtist}}
+                    <div class="report-layer-2" id="report-artist-list">
+                        <p>
+                            <input type="checkbox" id="report-artist-incorrect">
+                            <label for="report-artist-incorrect">
+                                Incorrect
+                            </label>
+                        </p>
+                        <p>
+                            <input type="checkbox" id="report-artist-inappropriate">
+                            <label for="report-artist-inappropriate">
+                                Inappropriate
+                            </label>
+                        </p>
+                        <p>
+                            <input type="checkbox" id="report-artist-other">
+                            <label for="report-artist-other">
+                                Other:
+                            </label>
+                            {{#if reportArtistOther}}
+                                <div class="input-field">
+                                    <textarea class="materialize-textarea" id="report-artist-other-ta" type="text"></textarea>
+                                    <label for="report-artist-other-ta">What is the issue?</label>
+                                </div>
+                            {{/if}}
+                        </p>
+                    </div>
+                {{/if}}
+                <div class="checkbox">
+                    <input type="checkbox" id="report-duration">
+                    <label for="report-duration">
+                        Duration
+                    </label>
+                </div>
+                <!-- Layer2 -->
+                {{#if reportDuration}}
+                    <div class="report-layer-2" id="report-duration-list">
+                        <div class="checkbox">
+                            <input type="checkbox" id="report-duration-long">
+                            <label for="report-duration-long">
+                                Too long
+                            </label>
+                        </div>
+                        <div class="checkbox">
+                            <input type="checkbox" id="report-duration-short">
+                            <label for="report-duration-short">
+                                Too short
+                            </label>
+                        </div>
+                        <div class="checkbox">
+                            <input type="checkbox" id="report-duration-other">
+                            <label for="report-duration-other">
+                                Other: <br>
+                            </label>
+                            {{#if reportDurationOther}}
+                                <div class="input-field">
+                                    <textarea class="materialize-textarea" id="report-duration-other-ta" type="text"></textarea>
+                                    <label for="report-duration-other-ta">What is the issue?</label>
+                                </div>
+                            {{/if}}
+                        </div>
+                    </div>
+                {{/if}}
+                <div class="checkbox">
+                    <input type="checkbox" id="report-albumart">
+                    <label for="report-albumart">
+                        Albumart
+                    </label>
+                </div>
+                <!-- Layer2 -->
+                {{#if reportAlbumart}}
+                    <div class="report-layer-2" id="report-albumart-list">
+                        <div class="checkbox">
+                            <input type="checkbox" id="report-albumart-incorrect">
+                            <label for="report-albumart-incorrect">
+                                Incorrect
+                            </label>
+                        </div>
+                        <div class="checkbox">
+                            <input type="checkbox" id="report-albumart-inappropriate">
+                            <label for="report-albumart-inappropriate">
+                                Inappropriate
+                            </label>
+                        </div>
+                        <div class="checkbox">
+                            <input type="checkbox" id="report-albumart-not-showing">
+                            <label for="report-albumart-not-showing">
+                                Not showing
+                            </label>
+                        </div>
+                        <div class="checkbox">
+                            <input type="checkbox" id="report-albumart-other">
+                            <label for="report-albumart-other">
+                                Other:
+                            </label>
+                            {{#if reportAlbumartOther}}
+                                <div class="input-field">
+                                    <textarea class="materialize-textarea" id="report-albumart-other-ta" type="text"></textarea>
+                                    <label for="report-albumart-other-ta">What is the issue?</label>
+                                </div>
+                            {{/if}}
+                        </div>
+                    </div>
+                {{/if}}
+                <div class="checkbox">
+                    <input type="checkbox" id="report-other">
+                    <label for="report-other">
+                        Other: <br>
+                    </label>
+                    {{#if reportOther}}
+                        <div class="input-field">
+                            <textarea class="materialize-textarea" id="report-other-ta" type="text"></textarea>
+                            <label for="report-other-ta">What is the issue?</label>
+                        </div>
+                    {{/if}}
+                </div>
+            </div>
+            <a id="report-song-button" class="waves-effect waves-light btn">Report Song</a>
         </div>
         <div class="divider"></div>
         <div class="modal-footer">