{
if(contribs.length) return contribs.join(', ');
};
-
+
+ var slugify = function(text)
+ {
+ return text.toString().toLowerCase()
+ .replace(/\s+/g, '-') // Replace spaces with -
+ .replace(/[^\w\-]+/g, '') // Remove all non-word chars
+ .replace(/\-\-+/g, '-') // Replace multiple - with single -
+ .replace(/^-+/, '') // Trim - from start of text
+ .replace(/-+$/, ''); // Trim - from end of text
+ }
+
var filesizeBytes = function(size)
{
//units are already bytes
};
$scope.contributors = getContributors($scope.pack.contributors);
+
+ if($scope.pack.mirrors[$scope.pack.mirrors.length - 1].source !== 'Standalone Link')
+ {
+ $scope.pack.mirrors.push({
+ source: 'Standalone Link',
+ uri: "#/pack/" + $scope.pack.hash.substr(0,8) + "/" + slugify($scope.pack.title)
+ });
+ }
+
$scope.rockEndpoint = rockEndpoint;
}
};
<td>{{pack.size}}</td>
</tr>
<tr>
- <th>Uploaded Date:</th>
+ <th>Uploaded:</th>
<td>{{pack.uploaded}}</td>
</tr>
<tr ng-if="pack.mirrors">
}).
when('/pack/:hash/:name',
{
- templateUrl: 'pages/packs/pack.html',
+ templateUrl: 'pages/packs/packs.html',
controller: 'PackController'
}).
when('/packs/test',
-<div id="filters">\r
+<div ng-if="packList && packList.length" d="filters">\r
<div id="text-filters">\r
- <input type="text" ng-model="packTitleFilterKeyword" placeholder="Pack Title"/>\r
- <input type="text" ng-model="artistFilterKeyword" placeholder="Song Artist"/>\r
- <input type="text" ng-model="songTitleFilterKeyword" placeholder="Song Title"/>\r
- <input type="text" ng-model="stepArtistFilterKeyword" placeholder="Step Artist"/>\r
- <input type="text" ng-model="ratingFilterKeyword" placeholder="Block Rating"/>\r
+ <input type="text" ng-model="$parent.packTitleFilterKeyword" placeholder="Pack Title"/>\r
+ <input type="text" ng-model="$parent.artistFilterKeyword" placeholder="Song Artist"/>\r
+ <input type="text" ng-model="$parent.songTitleFilterKeyword" placeholder="Song Title"/>\r
+ <input type="text" ng-model="$parent.stepArtistFilterKeyword" placeholder="Step Artist"/>\r
+ <input type="text" ng-model="$parent.ratingFilterKeyword" placeholder="Block Rating"/>\r
</div>\r
<div id="select-filters">\r
- <select ng-model="modeFilterKeyword">\r
+ <select ng-model="$parent.modeFilterKeyword">\r
<option value="Any" disabled selected>Mode</option>\r
<option value="Any">Any</option>\r
<option value="single">Singles</option>\r
<option value="double">Doubles</option>\r
</select>\r
\r
- <select ng-model="difficultyFilterKeyword">\r
+ <select ng-model="$parent.difficultyFilterKeyword">\r
<option value="Any" disabled selected>Difficulty</option>\r
<option value="Any">Any</option>\r
<option value="Novice">Novice</option>\r
<option value="Expert">Expert</option>\r
</select>\r
\r
- <select ng-model="fgChangesFilterKeyword">\r
+ <select ng-model="$parent.fgChangesFilterKeyword">\r
<option value="Any" disabled selected>FG Changes</option>\r
<option value="Any">Any</option>\r
<option value="Yes">Yes</option>\r
<option value="No">No</option>\r
</select>\r
\r
- <select ng-model="bgChangesFilterKeyword">\r
+ <select ng-model="$parent.bgChangesFilterKeyword">\r
<option value="Any" disabled selected>BG Changes</option>\r
<option value="Any">Any</option>\r
<option value="Yes">Yes</option>\r
<option value="No">No</option>\r
</select>\r
\r
- <select ng-model="bpmChangesFilterKeyword">\r
+ <select ng-model="$parent.bpmChangesFilterKeyword">\r
<option value="Any" disabled selected>BPM Changes</option>\r
<option value="Any">Any</option>\r
<option value="Yes">Yes</option>\r
</div>\r
</div>\r
\r
-<accordion close-others="false">\r
+<accordion ng-if="packList && packList.length" close-others="false">\r
<accordion-group class = "simfileListing"\r
is-open = "isOpen"\r
ng-mouseover = "beast = true"\r
</div>\r
</accordion>\r
\r
+<h1 ng-if="pack">{{pack.title}}</h1>\r
+<div ng-if="pack" class="simfileListing">\r
+ <!-- rofl -->\r
+ <pack pack="pack" />\r
+</div>\r
+\r
angular.module("DivinElegy.pages.packs", ["DivinElegy.components.simfiles","DivinElegy.components.user","DivinElegy.components.config","DivinElegy.components.ui", "ui.bootstrap"])
-.controller("PackController", ['$scope', '$rootScope', 'rockEndpoint', 'SimfileService', 'UserService', 'UiSettingsService', 'HelloService', 'filterFilter', '$routeParams', function($scope, $rootScope, rockEndpoint, SimfileService, UserService, UiSettingsService, HelloService, filterFilter, $routeParams)
+.controller("PackController", ['$scope', 'SimfileService', 'UiSettingsService', 'filterFilter', '$routeParams', '$location', function($scope, SimfileService, UiSettingsService, filterFilter, $routeParams, $location)
{
- $scope.rockEndpoint = rockEndpoint;
$scope.packTitleFilterKeyword = null;
$scope.artistFilterKeyWord = null;
$scope.songTitleFilterKeyword = null;
{
if($routeParams.hash)
{
- $scope.swageVar = 'duh herro'
+ if($routeParams.hash.length < 8) $location.path('/');
+
+ for(var i=0; i<packs.length; i++)
+ {
+ if(packs[i].hash.substring(0, $routeParams.hash.length) == $routeParams.hash)
+ {
+ $scope.pack = packs[i];
+ break;
+ }
+ }
+
+// //TODO: 404 page?
+// if(!$scope.pack) $location.path('/');
} else {
$scope.pageSize = UiSettingsService.getDirective('simfilesPerPage');
$scope.currentPage = 1;