Lots of wankery.
authorCameron Ball <cameron@getapproved.com.au>
Thu, 18 Dec 2014 07:48:49 +0000 (15:48 +0800)
committerCameron Ball <cameron@getapproved.com.au>
Thu, 18 Dec 2014 07:48:49 +0000 (15:48 +0800)
17 files changed:
app/components/menu/menu.html
app/components/simfiles/latestpack-directive.js
app/components/simfiles/latestsimfile-directive.js
app/components/simfiles/mostdownloaded-directive.js
app/components/simfiles/simfile-directive.js
app/components/uiSettings/uisettings-service.js
app/components/userMenu/userMenu-directive.js
app/components/userMenu/userMenu.html
app/css/animations.css
app/css/buttons.css [new file with mode: 0644]
app/css/divinelegy.css
app/divinelegy.js
app/images/page_loading.png [new file with mode: 0644]
app/index.html
app/pages/account/account.html
app/pages/account/account.js
app/pages/packs/packs.js

index f4d2a4a..206c008 100644 (file)
@@ -1,14 +1,14 @@
 <img id="floater" src="images/Arrow_Floating.gif" />
 <h1 style="text-align:center;">DivinElegy</h1>
-<ul class="menu">
-    <li>
+<ul class="menu" style="text-align: center">
+    <!--<li>
         <a href="#/simfiles">
             <img ng-mouseover  = "archiveImg='simfiles_hover.png'; page='Simfile Archive (Individual Files)'"
                  ng-mouseleave = "archiveImg='simfiles.png'"
                  ng-init       = "archiveImg='simfiles.png'"
                  ng-src="images/{{archiveImg}}"/>
         </a>
-    </li>
+    </li>-->
     <li>
         <a href="#/packs">
             <img ng-mouseover  = "fImg='simfiles_hover.png'; page='Simfile Archive (Packs)'"
@@ -44,9 +44,9 @@
 </ul>
 <div class="clearfix"></div>
 <hr style="margin-top: 5px;"/>
-<div class='page-title'>{{page}}</div>
+<div class='page-title'>{{page || 'hello : )'}}</div>
 <hr style="margin-top: 5px;" />
-<div latest-simfile></div>
+<!--<div latest-simfile></div>-->
 <div latest-pack></div>
 <hr />
 <div most-downloaded></div>
\ No newline at end of file
index 3fd6799..02ff3de 100644 (file)
@@ -3,10 +3,11 @@
 //don't put ,[] because that declares a new module. This gets the existing one
 angular.module('DivinElegy.components.simfiles').
         
-directive('latestPack', ['rockEndpoint', '$http', 'UserService', 'HelloService', '$rootScope', function(rockEndpoint, $http, UserService, HelloService, $rootScope) 
+directive('latestPack', ['rockEndpoint', '$http', 'UserService', 'HelloService', 'UiSettingsService', '$rootScope', function(rockEndpoint, $http, UserService, HelloService, UiSettingsService, $rootScope) 
 {
     return {
         templateUrl: 'components/simfiles/latest-pack.html',
+        scope: {},
         link: function($scope) {
             $http({
                 url: rockEndpoint + "simfiles/latest/pack",
@@ -55,7 +56,13 @@ directive('latestPack', ['rockEndpoint', '$http', 'UserService', 'HelloService',
                         } else {
                             //TODO: Maybe access token should be in user obj?
                             var url = rockEndpoint + '' + simfile.mirrors[0].uri + '?token=' + HelloService.getAccessToken(); //0th mirror will always be de
-                            $rootScope.$broadcast('message.warning', 'You are about to download ' + simfile.title + ' which is ' + simfile.size + '. Your current quota is ' + user.quotaRemaining + ' click <a ng-click="updateUserCache()" href="' + url + '">here</a> to confirm.'); 
+                            if(UiSettingsService.getDirective('showDownloadWarning') === 'Yes')
+                            {
+                                $rootScope.$broadcast('message.warning', 'You are about to download ' + simfile.title + ' which is ' + simfile.size + '. Your current quota is ' + user.quotaRemaining + ' click <a ng-click="updateUserCache()" href="' + url + '">here</a> to confirm.'); 
+                            } else {
+                                window.location = url;
+                                $rootScope.updateUserCache();
+                            }
                         }
                     });
                 };
@@ -63,7 +70,7 @@ directive('latestPack', ['rockEndpoint', '$http', 'UserService', 'HelloService',
                 $scope.pack = data;
                 $scope.rockEndpoint = rockEndpoint;
                 $scope.contributors = data.contributors.join(', ');
-                $scope.$$phase || $scope.$apply();
+                $rootScope.$$phase || $rootScope.$apply();
             });
         }
     };
index 4c1e23e..c62271c 100644 (file)
@@ -3,10 +3,11 @@
 //don't put ,[] because that declares a new module. This gets the existing one
 angular.module('DivinElegy.components.simfiles').
         
-directive('latestSimfile', ['rockEndpoint', '$http', 'UserService', 'HelloService', '$rootScope', function(rockEndpoint, $http, UserService, HelloService, $rootScope) 
+directive('latestSimfile', ['rockEndpoint', '$http', 'UserService', 'HelloService', 'UiSettingsService', '$rootScope', function(rockEndpoint, $http, UserService, HelloService, UiSettingsService, $rootScope) 
 {
     return {
         templateUrl: 'components/simfiles/latest-simfile.html',
+        scope: {},
         link: function($scope) {
             $http({
                 url: rockEndpoint + "simfiles/latest/simfile",
@@ -64,7 +65,13 @@ directive('latestSimfile', ['rockEndpoint', '$http', 'UserService', 'HelloServic
                         } else {
                             //TODO: Maybe access token should be in user obj?
                             var url = rockEndpoint + '' + simfile.download + '?token=' + HelloService.getAccessToken(); //0th mirror will always be de
-                            $rootScope.$broadcast('message.warning', 'You are about to download ' + simfile.title + ' which is ' + simfile.size + '. Your current quota is ' + user.quotaRemaining + ' click <a ng-click="updateUserCache()" href="' + url + '">here</a> to confirm.'); 
+                            if(UiSettingsService.getDirective('showDownloadWarning') === 'Yes')
+                            {
+                                $rootScope.$broadcast('message.warning', 'You are about to download ' + simfile.title + ' which is ' + simfile.size + '. Your current quota is ' + user.quotaRemaining + ' click <a ng-click="updateUserCache()" href="' + url + '">here</a> to confirm.'); 
+                            } else {
+                                window.location = url;
+                                $rootScope.updateUserCache();
+                            }
                         }
                     });
                 };
@@ -72,7 +79,7 @@ directive('latestSimfile', ['rockEndpoint', '$http', 'UserService', 'HelloServic
                 $scope.simfile = data;
                 $scope.rockEndpoint = rockEndpoint;
                 $scope.authors = authors.join(', ');
-                $scope.$$phase || $scope.$apply();
+                $rootScope.$$phase || $rootScope.$apply();
             });
         }
     };
index 8bf3684..3d1f40f 100644 (file)
@@ -3,7 +3,7 @@
 //don't put ,[] because that declares a new module. This gets the existing one
 angular.module('DivinElegy.components.simfiles').
         
-directive('mostDownloaded', ['rockEndpoint', '$http', 'UserService', 'HelloService', '$rootScope', function(rockEndpoint, $http, UserService, HelloService, $rootScope) 
+directive('mostDownloaded', ['rockEndpoint', '$http', 'UserService', 'UiSettingsService', 'HelloService', '$rootScope', function(rockEndpoint, $http, UserService, UiSettingsService, HelloService, $rootScope) 
 {
     return {
         templateUrl: 'components/simfiles/most-downloaded.html',
@@ -62,7 +62,14 @@ directive('mostDownloaded', ['rockEndpoint', '$http', 'UserService', 'HelloServi
                             } else {
                                 url = rockEndpoint + '' + simfile.download + '?token=' + HelloService.getAccessToken(); //0th mirror will always be de
                             }
-                            $rootScope.$broadcast('message.warning', 'You are about to download ' + simfile.title + ' which is ' + simfile.size + '. Your current quota is ' + user.quotaRemaining + ' click <a ng-click="updateUserCache()" href="' + url + '">here</a> to confirm.'); 
+                            
+                            if(UiSettingsService.getDirective('showDownloadWarning') === 'Yes')
+                            {
+                                $rootScope.$broadcast('message.warning', 'You are about to download ' + simfile.title + ' which is ' + simfile.size + '. Your current quota is ' + user.quotaRemaining + ' click <a ng-click="updateUserCache()" href="' + url + '">here</a> to confirm.'); 
+                            } else {
+                                window.location = url;
+                                $rootScope.updateUserCache();
+                            }
                         }
                     });
 
index f7dfe9f..649e2df 100644 (file)
@@ -3,7 +3,7 @@
 //don't put ,[] because that declares a new module. This gets the existing one
 angular.module('DivinElegy.components.simfiles').
         
-directive('simfile', ['$rootScope', 'UserService', 'HelloService', 'rockEndpoint', function($rootScope, UserService, HelloService, rockEndpoint
+directive('simfile', ['$rootScope', 'UserService', 'HelloService', 'rockEndpoint', 'UiSettingsService', function($rootScope, UserService, HelloService, rockEndpoint, UiSettingsService
 {
     return {
         restrict: 'E',
@@ -63,7 +63,13 @@ directive('simfile', ['$rootScope', 'UserService', 'HelloService', 'rockEndpoint
                     } else {
                         //TODO: Maybe access token should be in user obj?
                         var url = rockEndpoint + '' + simfile.download + '?token=' + HelloService.getAccessToken(); //0th mirror will always be de
-                        $rootScope.$broadcast('message.warning', 'You are about to download ' + simfile.title + ' which is ' + simfile.size + '. Your current quota is ' + user.quotaRemaining + ' click <a ng-click="updateUserCache()" href="' + url + '">here</a> to confirm.'); 
+                        if(UiSettingsService.getDirective('showDownloadWarning') === 'Yes')
+                        {
+                            $rootScope.$broadcast('message.warning', 'You are about to download ' + simfile.title + ' which is ' + simfile.size + '. Your current quota is ' + user.quotaRemaining + ' click <a ng-click="updateUserCache()" href="' + url + '">here</a> to confirm.'); 
+                        } else {
+                            window.location = url;
+                            $rootScope.updateUserCache();
+                        }
                     }
                 });
             };
index 18ad9d0..8c51782 100644 (file)
@@ -9,7 +9,7 @@ factory("UiSettingsService", ['$localStorage', function($localStorage)
     $localStorage.$default({
         ui: {
             'simfilesPerPage': 10,
-            'showDownloadWarning' : true
+            'showDownloadWarning' : 'Yes'
         }
     });
     
index 939e8fc..b213b58 100644 (file)
@@ -7,8 +7,11 @@ directive('userMenu', ['HelloService', 'UserService', '$modal', function(HelloSe
     return {
         templateUrl: 'components/userMenu/userMenu.html',
         link: function(scope, element){
+            scope.menuReady = !HelloService.isLoggedIn()
+            
             scope.doLogin = function()
             {
+                scope.menuReady = false;
                 HelloService.facebookLogin();
             };
 
@@ -25,6 +28,7 @@ directive('userMenu', ['HelloService', 'UserService', '$modal', function(HelloSe
                     scope.quota = user.quota;
                     scope.quotaRemaining = user.quotaRemaining;
                     scope.loggedIn = true;
+                    scope.menuReady = true;
                     scope.$$phase || scope.$apply();
                 });
             });
index 46aa1d1..2e3d692 100644 (file)
@@ -1,29 +1,35 @@
 <img id="targets" src="images/Targets.png" />
-<h1 ng-if="loggedIn">Welcome!</h1>
-<h1 ng-if="!loggedIn">Hello!</h1>
-<ul>
-    <li>
-        {{welcomeMessage}}
-        <a class="de-link" ng-if="loggedIn" ng-click="doLogout()">logout</a>
-        <span ng-if="!loggedIn"><a class="de-link" ng-click="doLogin()">Login</a> to access your own control panel.</span>
-    </li>
-</ul>
-<div ng-if="loggedIn">
-    <h1>My Arrows</h1>
+<div ng-if="menuReady">
+    <h1 ng-if="loggedIn">Welcome!</h1>
+    <h1 ng-if="!loggedIn">Hello!</h1>
     <ul>
-        <li><a href="#/profile">Public Profile</a></li>
-        <li><a class="de-link" ng-click='openAccountSettings()'>Account Settings</a></li>
+        <li>
+            {{welcomeMessage}}
+            <a class="de-link" ng-if="loggedIn" ng-click="doLogout()">logout</a>
+            <span ng-if="!loggedIn"><a class="de-link" ng-click="doLogin()">Login</a> to access your own control panel.</span>
+        </li>
     </ul>
-    <!--<ul>
-        <li>My Uploads</li>
-        <li>My Favourite Files</li>
-        <li>My Favourite Uploaders</li>
-        <li>My Followers</li>
-    </ul>
-    <br />
-    <ul>
-        <li>All Members</li>
-    </ul>-->
-    <h1>My Quota</h1>
-    {{quotaRemaining}} of {{quota}} remaining
+    <div ng-if="loggedIn">
+        <h1>My Arrows</h1>
+        <ul>
+            <!--<li><a href="#/profile">Public Profile</a></li>-->
+            <li><a class="de-link" ng-click='openAccountSettings()'>Account Settings</a></li>
+        </ul>
+        <!--<ul>
+            <li>My Uploads</li>
+            <li>My Favourite Files</li>
+            <li>My Favourite Uploaders</li>
+            <li>My Followers</li>
+        </ul>
+        <br />
+        <ul>
+            <li>All Members</li>
+        </ul>-->
+        <h1>My Quota</h1>
+        {{quotaRemaining}} of {{quota}} remaining
+    </div>
+</div>
+<div ng-if="!menuReady" style="text-align:center; padding-top: 10px; padding-bottom: 10px;">
+    <img class="rotato" src="images/page_loading.png" />
+    <h2>Just a moment...</h2>
 </div>
\ No newline at end of file
index abe4cfd..331aeef 100644 (file)
@@ -34,4 +34,25 @@ tbody.collapse.in {
   -webkit-transition-property: height, visibility;
        -o-transition-property: height, visibility;
           transition-property: height, visibility;
-}
\ No newline at end of file
+}
+
+.rotato{
+    -webkit-animation-name: rotate; 
+    -webkit-animation-duration: 2s; 
+    -webkit-animation-iteration-count: infinite;
+    -webkit-animation-timing-function: linear;
+    -moz-animation-name: rotate; 
+    -moz-animation-duration: 2s; 
+    -moz-animation-iteration-count: infinite;
+    -moz-animation-timing-function: linear;
+}
+
+@-webkit-keyframes rotate {
+    from {-webkit-transform: rotate(0deg);}
+    to {-webkit-transform: rotate(360deg);}
+}
+
+@-moz-keyframes rotate {
+    from {-moz-transform: rotate(0deg);}
+    to {-moz-transform: rotate(360deg);}
+}
diff --git a/app/css/buttons.css b/app/css/buttons.css
new file mode 100644 (file)
index 0000000..7369612
--- /dev/null
@@ -0,0 +1,44 @@
+.btn-primary {
+    color: #fff;
+    background-color: #428bca;
+    border-color: #357ebd;
+}
+
+.btn {
+    display: inline-block;
+    padding: 6px 12px;
+    margin-bottom: 0;
+    font-size: 14px;
+    font-weight: 400;
+    line-height: 1.42857143;
+    text-align: center;
+    white-space: nowrap;
+    vertical-align: middle;
+    cursor: pointer;
+    -webkit-user-select: none;
+    -moz-user-select: none;
+    -ms-user-select: none;
+    user-select: none;
+    background-image: none;
+    border: 1px solid transparent;
+    border-radius: 4px;
+}
+
+button {
+    font-family: inherit;
+    font-size: inherit;
+    line-height: inherit;
+}
+
+.btn-warning {
+    color: #fff;
+    background-color: #f0ad4e;
+    border-color: #eea236;
+}
+
+.btn-xs {
+    padding: 1px 5px;
+    font-size: 12px;
+    line-height: 1.5;
+    border-radius: 3px;
+}
\ No newline at end of file
index 90be263..da2b8cc 100644 (file)
@@ -40,7 +40,7 @@ table {
     margin-bottom: 20px;
 }
 
-input[type="text"], #filters select {
+input[type="text"], select {
     box-sizing:content-box;
     -ms-box-sizing:content-box;
     -moz-box-sizing:content-box;
@@ -171,8 +171,18 @@ h2 {
     margin-bottom: -40px;
 }
 
-#message-box {
+#message-box button{
+    position: absolute;
+    right: 10px;
+    top: 5px;
+}
+
+#message-box #message {
+    display: block;
     text-align: center;
+}
+
+#message-box {
     font-weight: bold;
     margin-top: 40px;
     padding: 10px;
@@ -182,6 +192,7 @@ h2 {
     border-radius: 10px;
     -moz-border-radius: 10px;
     -webkit-border-radius: 10px;
+    position: relative;
 }
 
 #message-box .ok {
index d0c163f..d28cccf 100644 (file)
@@ -20,8 +20,8 @@ config(['$routeProvider', '$locationProvider', function($routeProvider) {
     $routeProvider.
     when('/',
     {
-        templateUrl: 'pages/index/index.html',
-        controller: 'IndexController'
+        templateUrl: 'pages/packs/packs.html',
+        controller: 'PackController'
     }).
     when('/upload',
     {
diff --git a/app/images/page_loading.png b/app/images/page_loading.png
new file mode 100644 (file)
index 0000000..dd62da2
Binary files /dev/null and b/app/images/page_loading.png differ
index 2c9cb65..6cd75fa 100644 (file)
@@ -13,6 +13,7 @@
         <link rel="stylesheet" href="css/animations.css"/>
         <link rel="stylesheet" href="css/pager.css"/>
         <link rel="stylesheet" href="css/modal.css"/>
+        <link rel="stylesheet" href="css/buttons.css"/>
         <link rel="stylesheet" href="css/divinelegy.css"/>
         <!-- endbuild -->
         
@@ -58,7 +59,7 @@
                                                                                       'error' : messageType == 'error',
                                                                                       'success' : messageType == 'success',
                                                                                       'hidden' : hidden}">
-                    <span message="message"></span> <span class="ok" ng-click="hide()">OK</span>
+                    <span id="message" message="message"></span> <button class="btn btn-warning btn-xs" ng-click="hide()">X</button>
                 </div>
             </div>
             <div class="box_side alpha">
index c5143a6..f695b02 100644 (file)
@@ -1,11 +1,17 @@
 <div class="modal-header">
     <h1 class="modal-title">Account Settings</h1>
+    <h2 ng-if="status">{{status}}</h2>
 </div>
 <div class="modal-body">
     <h2>Simfiles per page</h2>
     <input type="text" ng-model="simfilesPerPage"/>
+    <h2>Download Warnings</h2>
+    <select ng-model="downloadWarnings">
+        <option value="Yes">Yes</option>
+        <option value="No">No</option>
+    </select>
 </div>
 <div class="modal-footer">
     <button class="btn btn-primary" ng-click="ok()">Save</button>
-    <button class="btn button-warning" ng-click="cancel()">Cancel</button>
+    <button class="btn" ng-click="cancel()">Close</button>
 </div>
\ No newline at end of file
index b460436..cfc58e7 100644 (file)
@@ -5,10 +5,13 @@ angular.module("DivinElegy.pages.account", ['DivinElegy.components.ui'])
 .controller("AccountController", ['$scope', '$modalInstance', 'UiSettingsService', function($scope, $modalInstance, UiSettingsService)
 {
     $scope.simfilesPerPage = UiSettingsService.getDirective('simfilesPerPage');
+    $scope.downloadWarnings = UiSettingsService.getDirective('showDownloadWarning');
     
     $scope.ok = function()
     {
         UiSettingsService.setDirective('simfilesPerPage', $scope.simfilesPerPage);
+        UiSettingsService.setDirective('showDownloadWarning', $scope.downloadWarnings);
+        $scope.status = "Saved!";
     };
     
     $scope.cancel = function()
index c1f9208..3eeab02 100644 (file)
@@ -56,7 +56,13 @@ angular.module("DivinElegy.pages.packs", ["DivinElegy.components.simfiles","Divi
             } else {
                 //TODO: Maybe access token should be in user obj?
                 var url = rockEndpoint + '' + pack.mirrors[0].uri + '?token=' + HelloService.getAccessToken(); //0th mirror will always be de
-                $rootScope.$broadcast('message.warning', 'You are about to download ' + pack.title + ' which is ' + pack.size + '. Your current quota is ' + user.quotaRemaining + ' click <a ng-click="updateUserCache()" href="' + url + '">here</a> to confirm.'); 
+                if(UiSettingsService.getDirective('showDownloadWarning') === 'Yes')
+                {
+                    $rootScope.$broadcast('message.warning', 'You are about to download ' + pack.title + ' which is ' + pack.size + '. Your current quota is ' + user.quotaRemaining + ' click <a ng-click="updateUserCache()" href="' + url + '">here</a> to confirm.'); 
+                } else {
+                    window.location = url;
+                    $rootScope.updateUserCache();
+                }
             }
         });
     };