Skip to content
Snippets Groups Projects
Commit ff27e5ba authored by onny's avatar onny
Browse files

indicate favorite stations

parent 15e95e0e
No related branches found
Tags 0.5.0
No related merge requests found
...@@ -35,6 +35,11 @@ ...@@ -35,6 +35,11 @@
opacity: 0.3; opacity: 0.3;
} }
.starred {
background-image: url('../img/starred.svg');
opacity: 1;
}
.icon-stationfav:hover { .icon-stationfav:hover {
background-image: url('../img/starred.svg'); background-image: url('../img/starred.svg');
opacity: 1; opacity: 1;
......
...@@ -36,10 +36,7 @@ $(function(){ ...@@ -36,10 +36,7 @@ $(function(){
url: baseUrl + '/stations/' + data[station]["id"], url: baseUrl + '/stations/' + data[station]["id"],
method: 'DELETE' method: 'DELETE'
}).done(function(){ }).done(function(){
if ($('li.nav-favorites').hasClass('active')){ $( "tr[data-id='"+data[station]["stationid"]+"']" ).find('.icon-stationfav').removeClass('starred');
$( "tr[data-id='"+data[station]["stationid"]+"']" ).slideUp();
$( "tr[data-id='"+data[station]["stationid"]+"']" ).remove();
};
}); });
}; };
}; };
...@@ -55,6 +52,8 @@ $(function(){ ...@@ -55,6 +52,8 @@ $(function(){
method: 'POST', method: 'POST',
contentType: 'application/json', contentType: 'application/json',
data: JSON.stringify(station) data: JSON.stringify(station)
}).done(function(){
$( "tr[data-id='"+stationid+"']" ).find('.icon-stationfav').addClass('starred');
}); });
}; };
}); });
...@@ -76,23 +75,38 @@ $(function(){ ...@@ -76,23 +75,38 @@ $(function(){
}; };
function render_result(data){ function render_result(data){
$.each(data, function(i, station) {
$('tbody').append('<tr data-src='+station['url']+' data-id='+station['id']+'>\ var baseUrl = OC.generateUrl('/apps/radio');
<td class="favcolumn">\ $.get(baseUrl + '/stations', function ( fav_stations ) {
<a href="#" class="favpls" onclick="station_fav();">\
<span class="icon-stationfav"></span>\ $.each(data, function(i, station) {
<span class="hidden-visually">Favorite</span>\
</a>\ var isstarred = ""
</td>\ for (var fav_station in fav_stations) {
<td class="filename">\ if (fav_stations[fav_station]["stationid"] == station['id']) {
<label for="select-files-3">\ isstarred = "starred";
<div class="thumbnail" style="background-image:url('+station['favicon']+'); background-size: 32px;"></div>\ break;
</label>\ }
<a class="name" href="#">\ };
<span class="nametext"><span class="innernametext">'+station['name']+'</span></span>\
</a>\ $('tbody').append('<tr data-src='+station['url']+' data-id='+station['id']+'>\
</td>\ <td class="favcolumn">\
</tr>'); <a href="#" class="favpls" onclick="station_fav();">\
<span class="icon-stationfav ' + isstarred + '"></span>\
<span class="hidden-visually">Favorite</span>\
</a>\
</td>\
<td class="filename">\
<label for="select-files-3">\
<div class="thumbnail" style="background-image:url('+station['favicon']+'); background-size: 32px;"></div>\
</label>\
<a class="name" href="#">\
<span class="nametext"><span class="innernametext">'+station['name']+'</span></span>\
</a>\
</td>\
</tr>');
});
}); });
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment