2
0
KrisVos130 9 жил өмнө
parent
commit
00becbb0c5

+ 2 - 2
app/client/scripts/helpers.js

@@ -313,7 +313,7 @@ Template.room.helpers({
         if (Meteor.userId()) {
             var currentSong = Session.get("currentSong");
             if (currentSong && Meteor.user().profile.liked.indexOf(currentSong.mid) !== -1) {
-                return "active";
+                return "liked";
             } else {
                 return "";
             }
@@ -325,7 +325,7 @@ Template.room.helpers({
         if (Meteor.userId()) {
             var currentSong = Session.get("currentSong");
             if (currentSong && Meteor.user().profile.disliked.indexOf(currentSong.mid) !== -1) {
-                return "active";
+                return "disliked";
             } else {
                 return "";
             }

+ 1 - 1
app/client/scripts/onCreated.js

@@ -193,7 +193,7 @@ Template.room.onCreated(function () {
 
     function resizeSeekerbar() {
         if (Session.get("state") === "playing") {
-            $("#seeker-bar").width(((getTimeElapsed() / 1000) / Session.get("duration") * 100) + "%");
+            $(".seeker-bar").width(((getTimeElapsed() / 1000) / Session.get("duration") * 100) + "%");
         }
     }
 

+ 4 - 4
app/client/stylesheets/app.css

@@ -190,12 +190,12 @@ textarea{
   cursor: pointer;
 }
 
-#thumbs_up:hover {
-  color: #00bfa5;
+#thumbs_up:hover, .liked {
+  color: #00bfa5 !important;
 }
 
-#thumbs_down:hover {
-  color: #e53935;
+#thumbs_down:hover, .disliked {
+  color: #e53935 !important;
 }
 
 .feedback-message{

+ 2 - 2
app/client/templates/room.html

@@ -80,8 +80,8 @@
                                     </form>
                                     <div class="right col s4 m2 l2">
                                         <ul>
-                                            <li class="left"><i id="thumbs_up" class="material-icons">thumb_up</i></li>
-                                            <li class="right"><i id="thumbs_down" class="material-icons">thumb_down</i>
+                                            <li id="like" class="left"><i id="thumbs_up" class="material-icons {{liked}}">thumb_up</i></li>
+                                            <li id="dislike" class="right"><i id="thumbs_down" class="material-icons {{disliked}}">thumb_down</i>
                                             </li>
                                         </ul>
                                     </div>

+ 6 - 6
app/server/server.js

@@ -806,15 +806,15 @@ Meteor.methods({
             var user = Meteor.user();
             if (user.profile.liked.indexOf(mid) === -1) {
                 Meteor.users.update({"profile.username": user.profile.username}, {$push: {"profile.liked": mid}});
-                Playlists.update({"songs.mid": mid}, {$inc: {"songs.$.likes": 1}})
+                Songs.update({mid: mid}, {$inc: {"likes": 1}})
             } else {
                 Meteor.users.update({"profile.username": user.profile.username}, {$pull: {"profile.liked": mid}});
-                Playlists.update({"songs.mid": mid}, {$inc: {"songs.$.likes": -1}})
+                Songs.update({mid: mid}, {$inc: {likes: -1}})
             }
 
             if (user.profile.disliked.indexOf(mid) !== -1) {
                 Meteor.users.update({"profile.username": user.profile.username}, {$pull: {"profile.disliked": mid}});
-                Playlists.update({"songs.mid": mid}, {$inc: {"songs.$.dislikes": -1}})
+                Songs.update({mid: mid}, {$inc: {dislikes: -1}})
             }
             return true;
         } else {
@@ -826,15 +826,15 @@ Meteor.methods({
             var user = Meteor.user();
             if (user.profile.disliked.indexOf(mid) === -1) {
                 Meteor.users.update({"profile.username": user.profile.username}, {$push: {"profile.disliked": mid}});
-                Playlists.update({"songs.mid": mid}, {$inc: {"songs.$.dislikes": 1}});
+                Songs.update({mid: mid}, {$inc: {dislikes: 1}});
             } else {
                 Meteor.users.update({"profile.username": user.profile.username}, {$pull: {"profile.disliked": mid}});
-                Playlists.update({"songs.mid": mid}, {$inc: {"songs.$.dislikes": -1}});
+                Songs.update({mid: mid}, {$inc: {dislikes: -1}});
             }
 
             if (user.profile.liked.indexOf(mid) !== -1) {
                 Meteor.users.update({"profile.username": user.profile.username}, {$pull: {"profile.liked": mid}});
-                Playlists.update({"songs.mid": mid}, {$inc: {"songs.$.likes": -1}});
+                Songs.update({mid: mid}, {$inc: {likes: -1}});
             }
             return true;
         } else {