Skip to content

Commit

Permalink
[FIX] Add track to playlist (rdubigny#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronan authored and m4dz committed Apr 13, 2016
1 parent 81b20f5 commit 3741dd1
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 11 deletions.
1 change: 1 addition & 0 deletions app/styles/playlists.styl
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ div[role='toolbar']
overflow: hidden
text-overflow: "…"
white-space: nowrap

a
width: 100%
height: 100%
Expand Down
2 changes: 1 addition & 1 deletion app/styles/popup-menu.styl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
color: $text-dark
align-items: center

a
p
width: 100%
height: 100%
text-decoration: none
Expand Down
6 changes: 4 additions & 2 deletions app/views/playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import application from '../application';

const PlaylistView = Mn.ItemView.extend({

template: require('./templates/playlist'),

tagName: 'li',

initialize(options) {
this.template = options.template;
},

className() {
let currentPlaylist = application.appState.get('currentPlaylist');
let selected = currentPlaylist == this.model ? 'selected' : ''
Expand Down
4 changes: 4 additions & 0 deletions app/views/playlists.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ const Playlists = Mn.CompositeView.extend({

childView: PlaylistView,

childViewOptions: {
template: require('./templates/playlist')
},

modelEvents: {
"change:currentPlaylist": "render"
},
Expand Down
11 changes: 10 additions & 1 deletion app/views/popupPlaylists.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@ const PopupPlaylists = Mn.CompositeView.extend({

childView: PlaylistView,

childViewOptions: {
template: require('./templates/popupPlaylist')
},

ui: {
addPlaylist: '#add-playlist',
playlistText: '#playlist-text',
playlistPopup: '#playlist-popup-menu'
},

events: {
'click li': 'addToPlaylist',
'click li p': 'addToPlaylist',
'click @ui.addPlaylist': 'showInput',
'keyup @ui.playlistText': 'keyupPlaylistText',
},
Expand Down Expand Up @@ -69,6 +73,11 @@ const PopupPlaylists = Mn.CompositeView.extend({
newPlaylist.addTrack(this.model);
application.allPlaylists.add(newPlaylist);
this.ui.playlistText.val('');
let notification = {
status: 'ok',
message: 'Added to ' + newPlaylist.get('title')
}
application.channel.request('notification', notification);
}
},

Expand Down
2 changes: 1 addition & 1 deletion app/views/templates/content.jst
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<div role="complementary"></div>
<div id="tracks"></div>
<div id="tracks"></div>
2 changes: 1 addition & 1 deletion app/views/templates/notification.jst
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
</svg>
<% } %>
<p><%= message %></p>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/templates/player.jst
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@
</svg>
</button>
</div>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/templates/playlist.jst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<a href="#playlists/<%= _id %>/tracks"><%= title %>
<a href="#playlists/<%= _id %>/tracks"><%= title %></a>
2 changes: 1 addition & 1 deletion app/views/templates/playlists.jst
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
<input id="playlist-text" type="text" placeholder="Add Playlist"/>
<h4><%= t('add playlist') %></h4>
</div>
</div>
</div>
1 change: 1 addition & 0 deletions app/views/templates/popupPlaylist.jst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p data-id="<%= _id %>"><%= title %></p>
2 changes: 1 addition & 1 deletion app/views/templates/popupPlaylists.jst
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
<p>Add to New Playlist</p>
</div>

</div>
</div>
2 changes: 1 addition & 1 deletion app/views/templates/tracks.jst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
<div class="album-column-cell" role="gridcell">ALBUM</div>
<div class="length-column-cell" role="gridcell">LENGTH</div>
</div>
<ul id="track-list"></ul>
<ul id="track-list"></ul>

0 comments on commit 3741dd1

Please sign in to comment.