Commit 937e6d25 authored by Gautam Chitnis's avatar Gautam Chitnis

Refactor (delete item): Changed position and functionality of delete button

This commit moves out the delete button from top bar of playlist.
The delete button is now next to each item in playlist.
Previously it just removed the top most item in playlist, now it can be used to remove any particular item in the list.

Gautam C.
parent df5245c5
......@@ -64,6 +64,9 @@
<ol type="1">
<li v-for="item in this.$parent.playlistItems">
<button v-on:click="play(item.src, item.id)" class="playlistItem">{{ item.title }}</button>
<button v-on:click="removeItem(item.id)" type="button" class="btn-circle col-xs">
<i class="glyphicon glyphicon-trash"></i>
</button>
</li>
</ol>
</div>
......@@ -87,7 +90,6 @@
<div class="row">
<button type="button" class="btn-circle col-xs" data-toggle="modal" data-target="#equalizerModal"><i class="glyphicon glyphicon-equalizer"></i></button>
<button type="button" class="btn-circle col-xs" data-toggle="modal" data-target="#fileModal"><i class="glyphicon glyphicon-plus"></i></button>
<button type="button" class="btn-circle col-xs" id="removeButton"><i class="glyphicon glyphicon-trash"></i></button>
</div>
</div>
</div>
......
......@@ -7,12 +7,13 @@ Vue.component('playlist-buttons', {
toggleRepeat: function ()
{
sendCommand(0,"command=pl_repeat");
},
}
/*,
removeCurrent: function ()
{
sendCommand(0,"command=pl_delete&id="+this.$parent.$parent.$data.playlistItems[0].id);
bus.$emit('removeItem',this.$parent.$parent.$data.playlistItems[0].id);
}
//sendCommand(0,"command=pl_delete&id="+this.$parent.$parent.$data.playlistItems[0].id);
//bus.$emit('removeItem',this.$parent.$parent.$data.playlistItems[0].id);
}*/
},
created: function()
{
......@@ -21,9 +22,11 @@ Vue.component('playlist-buttons', {
this.toggleRepeat();
}.bind(this));
bus.$on('removeCurrent', function()
/*bus.$on('removeCurrent', function(e)
{
console.log(e);
console.log("here");
this.removeCurrent();
}.bind(this));
}.bind(this));*/
}
});
\ No newline at end of file
......@@ -20,6 +20,8 @@ Vue.component('playlist', {
}
},
removeItem: function(id) {
console.log(id);
sendCommand(0,"command=pl_delete&id="+id);
this.$parent.playlistItems.splice({ id: id });
sendCommand(1);
},
......@@ -78,6 +80,13 @@ Vue.component('playlist', {
this.refreshPlaylist();
}.bind(this));
bus.$on('removeCurrent', function(e)
{
console.log(e);
console.log("here");
//this.removeCurrent();
}.bind(this));
this.refreshPlaylist();
}
});
......
......@@ -34,9 +34,6 @@ $(function() { // Handler for .ready() called.
$('#vlmButton').on('click',function (e){
notifyBus("executeVLM");
});
$('#removeButton').on('click',function (e){
notifyBus("removeCurrent");
});
$('#repeatButton').on('click',function (e){
notifyBus("toggleRepeat");
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment