Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/public/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ app.config(function (
controller: 'StreamCtrl'
})
.state('charts', {
url: '/',
url: '/charts/:genre',
templateUrl: 'views/charts/charts.html',
controller: 'ChartsCtrl'
})
Expand Down
149 changes: 144 additions & 5 deletions app/public/js/charts/chartsCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,163 @@

app.controller('ChartsCtrl', function (
$scope,
$filter,
$rootScope,
SCapiService,
SC2apiService,
utilsService
utilsService,
$stateParams
) {
var tracksIds = [];
$scope.genres = [
{
"link": 'all-music',
"title": "All"
},
{
"link": 'alternativerock',
"title": "Alternative Rock"
},
{
"link": 'ambient',
"title": "Ambient"
},
{
"link": 'classical',
"title": "Classical"
},
{
"link": 'country',
"title": "Country"
},
{
"link": 'danceedm',
"title": "Dance & EDM"
},
{
"link": 'dancehall',
"title": "Dancehall"
},
{
"link": 'deephouse',
"title": "Deep House"
},
{
"link": 'disco',
"title": "Disco"
},
{
"link": 'drumbass',
"title": "Drum & Bass"
},
{
"link": 'dubstep',
"title": "Dubstep"
},
{
"link": 'electronic',
"title": "Electronic"
},
{
"link": 'folksingersongwriter',
"title": "Folk & Singer-Songwriter"
},
{
"link": 'hiphoprap',
"title": "Hip-hop & Rap"
},
{
"link": 'house',
"title": "House"
},
{
"link": 'indie',
"title": "Indie"
},
{
"link": 'jazzblues',
"title": "Jazz & Blues"
},
{
"link": 'latin',
"title": "Latin"
},
{
"link": 'metal',
"title": "Metal"
},
{
"link": 'piano',
"title": "Piano"
},
{
"link": 'pop',
"title": "Pop"
},
{
"link": 'rbsoul',
"title": "R&B & Soul"
},
{
"link": 'reggae',
"title": "Reggae"
},
{
"link": 'reggaeton',
"title": "Reggaeton"
},
{
"link": 'rock',
"title": "Rock"
},
{
"link": 'soundtrack',
"title": "Soundtrack"
},
{
"link": 'techno',
"title": "Techno"
},
{
"link": 'trance',
"title": "Trance"
},
{
"link": 'trap',
"title": "Trap"
},
{
"link": 'triphop',
"title": "Triphop"
},
{
"link": 'world',
"title": "World"
}
]

var url_genre = $stateParams.genre;
var genre = {};
if(!url_genre){
genre = {
"link" : "all-music",
"title" : "All Music"
}
}else{
genre = $filter('filter')($scope.genres, {"link":url_genre}, true)[0]
}

$scope.title = 'Top 50';
$scope.title = 'Top 50 - '+genre.title;
$scope.originalData = '';
$scope.data = '';
$scope.busy = false;

SC2apiService.getCharts()

SC2apiService.getCharts(genre.link)
.then(filterCollection)
.then(function (collection) {
$scope.originalData = collection;
$scope.data = collection;

loadTracksInfo(collection);
})
.catch(function (error) {
Expand Down Expand Up @@ -101,4 +240,4 @@ app.controller('ChartsCtrl', function (
});
}

});
});
4 changes: 2 additions & 2 deletions app/public/js/common/SC2apiService.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ app.service('SC2apiService', function (
* Get charts (top 50)
* @returns {Promise.<T>}
*/
this.getCharts = function () {
this.getCharts = function (genre) {
// kind=top&genre=soundcloud%3Agenres%3Aall-music&limit=50

var params = {
kind: 'top',
genre: 'soundcloud:genres:all-music',
genre: 'soundcloud:genres:'+genre,
limit: 50
};
return sendRequest('charts', { params: params })
Expand Down
3 changes: 2 additions & 1 deletion app/public/stylesheets/css/app.css.map

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions app/public/stylesheets/sass/_components/_charts.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.genre-selector {
width: 50%;
overflow: hidden;
height: 60px;
transition: height 0.4s;
&:hover{
height: 400px;
}
}

.genre-selector button.button{
margin-top: 5px;
width: 32%;
}
5 changes: 5 additions & 0 deletions app/public/stylesheets/sass/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@

@import "_components/_songlist";

/* ==========================================================================
@Charts
========================================================================== */
@import "_components/_charts";

/* ==========================================================================
@Playlist songList
========================================================================== */
Expand Down
12 changes: 10 additions & 2 deletions app/views/charts/charts.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<div class="streamView">
<h1> {{ title }}</h1>
<h1 class="pull-left"> {{ title }}</h1>

<!-- Genre Selector -->
<div class="genre-selector pull-right" >
<h3>Charts By Genre</h3>
<div class="btn-group">
<button ui-sref="charts({genre:'{{genre.link}}'})" ui-sref-opts="{reload:true}" class="button inline" ng-repeat="genre in genres">{{genre.title}}</button>
</div>
</div>
<div class="clearfix"></div>
<!-- Song list wrapper -->
<div class="streamView_inner">
<ul class="songList"
Expand All @@ -20,4 +28,4 @@ <h1> {{ title }}</h1>

<div ng-include="'views/common/loading.html'"></div>

</div>
</div>
6 changes: 2 additions & 4 deletions tasks/sass.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
module.exports = {
options: {
sourceMap: true
},
production: {
options: {
outputStyle: 'compressed'
outputStyle: 'compressed',
sourceMap: true
},
files: {
'<%= settings.app %>/public/stylesheets/css/app.css': '<%= settings.app %>/public/stylesheets/sass/app.scss'
Expand Down