#1 auto height for simfile list
authorCameron Ball <cameron@getapproved.com.au>
Mon, 16 Feb 2015 03:16:47 +0000 (11:16 +0800)
committerCameron Ball <cameron@getapproved.com.au>
Mon, 16 Feb 2015 03:16:47 +0000 (11:16 +0800)
app/components/uiSettings/uisettings-service.js
app/css/divinelegy.css
app/pages/account/account.html
app/pages/account/account.js
app/pages/packs/packs.js

index 8c51782..28a0c89 100644 (file)
@@ -9,13 +9,14 @@ factory("UiSettingsService", ['$localStorage', function($localStorage)
     $localStorage.$default({
         ui: {
             'simfilesPerPage': 10,
+            'simfilesPerPageAuto': true,
             'showDownloadWarning' : 'Yes'
         }
     });
     
     UiSettingsService.setDirective = function(directive, value)
     {
-        if($localStorage.ui[directive]) $localStorage.ui[directive] = value;
+        if($localStorage.ui.hasOwnProperty(directive)) $localStorage.ui[directive] = value;
     };
     
     UiSettingsService.getDirective = function(directive)
index f479677..2ee1ccf 100644 (file)
@@ -40,7 +40,7 @@ table {
     margin-bottom: 20px;
 }
 
-input, select {
+input[type="text"], select {
     box-sizing:content-box;
     -ms-box-sizing:content-box;
     -moz-box-sizing:content-box;
index 4b74a34..93143fc 100644 (file)
@@ -8,7 +8,9 @@
 </div>
 <div class="modal-body">
     <h2>Simfiles per page</h2>
-    <input type="text" ng-model="simfilesPerPage"/>
+    <input type="text" ng-model="simfilesPerPage" ng-disabled="simfilesPerPageAuto"/><br />
+    <label for="auto">Automatic</label>
+    <input name="auto" type="checkbox" ng-model="simfilesPerPageAuto"/>
     <h2>Download Warnings</h2>
     <select ng-model="downloadWarnings">
         <option value="Yes">Yes</option>
index 19f8d86..30369c2 100644 (file)
@@ -6,11 +6,13 @@ angular.module("DivinElegy.pages.account", ['DivinElegy.components.ui'])
 {
     $scope.hidden = true;
     $scope.simfilesPerPage = UiSettingsService.getDirective('simfilesPerPage');
+    $scope.simfilesPerPageAuto = UiSettingsService.getDirective('simfilesPerPageAuto');
     $scope.downloadWarnings = UiSettingsService.getDirective('showDownloadWarning');
     
     $scope.ok = function()
     {
         UiSettingsService.setDirective('simfilesPerPage', $scope.simfilesPerPage);
+        UiSettingsService.setDirective('simfilesPerPageAuto', $scope.simfilesPerPageAuto);
         UiSettingsService.setDirective('showDownloadWarning', $scope.downloadWarnings);
         $scope.hidden = false;
         $scope.messageType = 'success';
index ece5f86..34bbcbf 100644 (file)
@@ -2,7 +2,7 @@
 
 angular.module("DivinElegy.pages.packs", ["DivinElegy.components.simfiles","DivinElegy.components.user","DivinElegy.components.config","DivinElegy.components.ui", "ui.bootstrap"])
 
-.controller("PackController", ['$scope', 'SimfileService', 'UiSettingsService', 'filterFilter', '$routeParams', '$location', function($scope, SimfileService, UiSettingsService, filterFilter, $routeParams, $location)
+.controller("PackController", ['$scope', 'SimfileService', 'UiSettingsService', 'filterFilter', '$routeParams', '$location', '$window', function($scope, SimfileService, UiSettingsService, filterFilter, $routeParams, $location, $window)
 {
     $scope.packTitleFilterKeyword = null;
     $scope.artistFilterKeyWord = null;
@@ -151,7 +151,7 @@ angular.module("DivinElegy.pages.packs", ["DivinElegy.components.simfiles","Divi
 //            //TODO: 404 page?
 //            if(!$scope.pack) $location.path('/');
         } else {
-            $scope.pageSize = UiSettingsService.getDirective('simfilesPerPage');
+            $scope.pageSize = UiSettingsService.getDirective('simfilesPerPageAuto') ? Math.floor(($window.innerHeight - 280)/40) : UiSettingsService.getDirective('simfilesPerPage');
             $scope.currentPage = 1;
             $scope.packList = packs;
             $scope.filteredPackList = packs;