Skip to content

Commit

Permalink
[FIX] Review
Browse files Browse the repository at this point in the history
* Squash listenTo
* Replace id by class
  • Loading branch information
flyingrub committed Mar 30, 2016
1 parent 2c25aaf commit 8812742
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 31 deletions.
6 changes: 4 additions & 2 deletions app/views/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ const Player = Mn.LayoutView.extend({
},

initialize() {
this.listenTo(application.channel,'reset:UpNext', this.render);
this.listenTo(application.channel, 'player:next', this.next)
this.listenTo(application.channel, {
'reset:UpNext': this.render,
'player:next': this.next
});
this.listenTo(application.appState, 'change:currentTrack',
function(appState, currentTrack) {
if (currentTrack) {
Expand Down
14 changes: 4 additions & 10 deletions app/views/popupPlaylists.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,10 @@ const PopupPlaylists = Mn.CompositeView.extend({
},

initialize() {
this.listenTo(
application.channel,
'playlistPopup:show',
this.showPopup
);
this.listenTo(
application.channel,
'playlistPopup:hide',
this.hidePopup
);
this.listenTo(application.channel, {
'playlistPopup:show': this.showPopup,
'playlistPopup:hide': this.hidePopup
});
},

showPopup(model) {
Expand Down
18 changes: 9 additions & 9 deletions app/views/templates/track.jst
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@
<div class="album-column-cell" role="gridcell"><%- album %>
<div class="actions">
<% if (type != 'upNext') { %>
<button id="add-to-upnext">
<button class="add-to-upnext">
<p class="help">Add To Up Next</p>
<svg>
<use xlink:href="<%= require('../../assets/icons/add-to-playlist-sm.svg') %>"/>
</svg>
</button>
<% } else { %>
<button id="delete-from-upnext">
<button class="delete-from-upnext">
<svg>
<use xlink:href="<%= require('../../assets/icons/cross-sm.svg') %>"/>
</svg>
</button>
<% } %>
<button id="menu">
<button class="menu">
<svg>
<use xlink:href="<%= require('../../assets/icons/more-sm.svg') %>"/>
</svg>
Expand All @@ -32,37 +32,37 @@
<div class="length-column-cell" role="gridcell"><%- duration %></div>
<div id="popup-menu" class="popup-menu">
<ul>
<li id="add-to-playlist">
<li class="add-to-playlist">
<svg>
<use xlink:href="<%= require('../../assets/icons/plus-sm.svg') %>"/>
</svg>
Add To Playlist
<svg class="small">
<use xlink:href="<%= require('../../assets/icons/play-sm.svg') %>"/>
</svg>
<div id="playlist-popup-container">
<div class="playlist-popup-container">
</li>
<% if (type == 'playlist') { %>
<li id="remove-from-playlist">
<li class="remove-from-playlist">
<svg>
<use xlink:href="<%= require('../../assets/icons/cross-sm.svg') %>"/>
</svg>
Remove from Playlist
</li>
<% } %>
<li id="album-to-upnext">
<li class="album-to-upnext">
<svg>
<use xlink:href="<%= require('../../assets/icons/add-to-playlist-sm.svg') %>"/>
</svg>
Add This Album to Up Next
</li>
<li id="edit-details">
<li class="edit-details">
<svg>
<use xlink:href="<%= require('../../assets/icons/edit-sm.svg') %>"/>
</svg>
Edit Details
</li>
<li id="delete">
<li class="delete">
<svg>
<use xlink:href="<%= require('../../assets/icons/trash-sm.svg') %>"/>
</svg>
Expand Down
20 changes: 10 additions & 10 deletions app/views/track.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@ const TrackView = Mn.LayoutView.extend({
tagName: 'li',

ui: {
'menu': '#menu',
'menu': '.menu',
'popupMenu': '#popup-menu',
},

regions: {
playlistPopup: '#playlist-popup-container',
playlistPopup: '.playlist-popup-container',
},

events: {
'click': 'play',
'click @ui.menu': 'toggleMenu',
'click #add-to-upnext':'addToUpNext',
'mouseenter #add-to-playlist':'showPlaylist',
'mouseleave #add-to-playlist':'hidePlaylist',
'click #album-to-upnext':'albumToUpNext',
'click #edit-details':'editDetails',
'click #delete':'delete',
'click #delete-from-upnext': 'deleteFromUpNext',
'click #remove-from-playlist': 'removeFromPlaylist',
'click .add-to-upnext':'addToUpNext',
'mouseenter .add-to-playlist':'showPlaylist',
'mouseleave .add-to-playlist':'hidePlaylist',
'click .album-to-upnext':'albumToUpNext',
'click .edit-details':'editDetails',
'click .delete':'delete',
'click .delete-from-upnext': 'deleteFromUpNext',
'click .remove-from-playlist': 'removeFromPlaylist',
'mouseleave #popup-menu': 'hidePopupMenu',
},

Expand Down

0 comments on commit 8812742

Please sign in to comment.