Skip to content

Commit

Permalink
Added song number to history
Browse files Browse the repository at this point in the history
Also changed how history filtering works internally

Fixes #52
  • Loading branch information
mqpteam committed Apr 25, 2016
1 parent a13bf8c commit 05d45e7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 22 deletions.
3 changes: 2 additions & 1 deletion webserver/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,8 @@
<div class="nav btn-clear-filter" data-ng-click="historyList.filter = null"><div class="mdi mdi-close small"></div></div>
</div>
<div class="hist-songs">
<div class="hist-sng" data-ng-repeat="h in filteredHistory(historyList.filter)" data-cid="{{h.song.cid}}">
<div class="hist-sng" data-ng-repeat="h in historyList.history" data-cid="{{h.song.cid}}" data-ng-show="filteredHistory(h, ">
<div class="nav">{{$index + 1}}</div>
<div class="nav btn-grab btn-grab-history">
<div class="mdi mdi-plus-circle-outline"></div>
<div class="popup playlists-grab-history playlists-grab">
Expand Down
2 changes: 1 addition & 1 deletion webserver/public/lib/css/menus.css
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ div.minicolors{
text-overflow: ellipsis;
}
.hist-sng .texts {
width: calc(100% - 412px);
width: calc(100% - 452px);
float: left;
margin: 20px 10px;
}
Expand Down
26 changes: 6 additions & 20 deletions webserver/public/lib/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7173,26 +7173,12 @@
return false;
};

$scope.filteredHistory = function(filterBy) {
var result = [];
if (filterBy == undefined || filterBy == null || filterBy == "") {
return $scope.historyList ? $scope.historyList.history : [];
}
angular.forEach($scope.historyList.history, function(h) {
try {
if (h.song.title.toLowerCase().indexOf(filterBy.toLowerCase()) > -1) {
result.push(h);
}
else if (h.song.cid.toLowerCase().indexOf(filterBy.toLowerCase()) > -1) {
result.push(h);
}
else if (h.user.un.toLowerCase().indexOf(filterBy.toLowerCase()) > -1) {
result.push(h);
}
}
catch (e) {}
});
return result;
$scope.filteredHistory = function(h, filterBy) {
try{
return !(filterBy = filterBy.toLowerCase()) || h.song.title.toLowerCase().indexOf(filterBy) > -1 || h.song.cid.toLowerCase().indexOf(filterBy) > -1 || h.user.un.toLowerCase().indexOf(filterBy) > -1;
} catch(e){
return true;
}
};

$scope.makeBadgeStyle = function(opts){
Expand Down

0 comments on commit 05d45e7

Please sign in to comment.