window.hello.utils.store('facebook', facebookObj);
};
+ hello.getAccessToken = function()
+ {
+ return hello.utils.store('facebook').access_token;
+ };
+
hello.facebookLogin = function()
{
// get the short term token
--- /dev/null
+'use strict'
+
+//don't put ,[] because that declares a new module. This gets the existing one
+angular.module('DivinElegy.components.simfiles').
+
+directive('simfile', function()
+{
+ return {
+ restrict: 'E',
+ scope: {
+ simfile: '=',
+ rockEndpoint: '=',
+ banner: '=',
+ title: '=',
+ artist: '=',
+ steps: '=',
+ bpmChanges: '=',
+ bgChanges: '=',
+ fgChanges: '='
+ },
+ templateUrl: 'components/simfiles/simfile.html',
+ link: function(scope, element, attrs){
+
+ console.log(scope.simfile);
+ console.log(scope.bpmChanges);
+ }
+ };
+});
\ No newline at end of file
--- /dev/null
+<img ng-src="{{rockEndpoint}}{{banner}}" alt="swage" />
+<table>
+ <tr>
+ <th>Title:</th>
+ <td>{{title}}</td>
+ </tr>
+ <tr>
+ <th>Artist:</th>
+ <td>{{artist}}</td>
+ </tr>
+ <tr ng-if="steps.single">
+ <th>Steps-single:</th>
+ <td>
+ <ul>
+ <li ng-repeat="stepchart in steps.single">
+ <div class="difficulty {{stepchart.difficulty}}">{{stepchart.rating}} ({{stepchart.artist}})</div>
+ </li>
+ </ul>
+ </td>
+ </tr>
+ <tr ng-if="steps.double">
+ <th>Steps-double:</th>
+ <td>
+ <ul>
+ <li ng-repeat="stepchart in steps.double">
+ <span>{{stepchart.difficulty}} {{stepchart.rating}}</span>
+ </li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <th>BPMChanges:</th>
+ <td>{{bpmChanges}}</td>
+ </tr>
+ <tr>
+ <th>BGChanges:</th>
+ <td>{{bgChanges}}</td>
+ </tr>
+ <tr>
+ <th>FGChanges:</th>
+ <td>{{fgChanges}}</td>
+ </tr>
+</table>
+<div class="clearfix"></div>
\ No newline at end of file
angular.module("DivinElegy.components.simfiles", ['DivinElegy.components.config']).
-factory("SimfileService", ['rockEndpoint', '$http', function(rockEndpoint, $http)
+factory("SimfileService", ['rockEndpoint', '$http', '$q', function(rockEndpoint, $http, $q)
{
var simfileAPI = {};
simfileAPI.getSimfiles = function()
{
- return $http({
- url: rockEndpoint + "simfiles/",
- method: "GET"
- });
+ var deferred = $q.defer();
+
+ if(this.cache)
+ {
+ deferred.resolve(this.cache.simfiles);
+ } else {
+ $http({
+ url: rockEndpoint + "simfiles/",
+ method: "GET"
+ }).
+ success(function (data)
+ {
+ simfileAPI.cache = data;
+ deferred.resolve(data.simfiles);
+ });
+ }
+
+ return deferred.promise;
+ };
+
+ simfileAPI.getPacks = function()
+ {
+ var deferred = $q.defer();
+
+ if(this.cache)
+ {
+ deferred.resolve(this.cache.packs);
+ } else {
+ $http({
+ url: rockEndpoint + "simfiles/",
+ method: "GET"
+ }).
+ success(function (data)
+ {
+ simfileAPI.cache = data;
+ deferred.resolve(data.packs);
+ });
+ }
+
+ return deferred.promise;
};
return simfileAPI;
// Declare app level module which depends on views, and components
angular.module('DivinElegy', [
'ngRoute',
- 'DivinElegy.components.hello',
+ //'DivinElegy.components.hello',
'DivinElegy.components.menu',
'DivinElegy.components.userMenu',
+ 'DivinElegy.components.simfiles',
'DivinElegy.pages.index',
'DivinElegy.pages.upload',
'DivinElegy.pages.simfiles'
<script src="components/menu/menu-directive.js"></script>
<script src="components/userMenu/userMenu-directive.js"></script>
<script src="components/simfiles/simfiles-service.js"></script>
+ <script src="components/simfiles/simfile-directive.js"></script>
<!-- pages -->
<script src="pages/index/index.js"></script>
">\r
<a ng-click="openListing($index)">{{simfile.title}}</a>\r
<div class="content" ng-show="isListingActive($index)">\r
- <img ng-src="{{rockEndpoint}}{{simfile.banner}}" alt="swage" />\r
- <table>\r
- <tr>\r
- <th>Title:</th>\r
- <td>{{simfile.title}}</td>\r
- </tr>\r
- <tr>\r
- <th>Artist:</th>\r
- <td>{{simfile.artist}}</td>\r
- </tr>\r
- <tr ng-if="simfile.steps.single">\r
- <th>Steps-single:</th>\r
- <td>\r
- <ul>\r
- <li ng-repeat="stepchart in simfile.steps.single">\r
- <div class="difficulty {{stepchart.difficulty}}">{{stepchart.rating}} ({{stepchart.artist}})</div>\r
- </li>\r
- </ul>\r
- </td>\r
- </tr>\r
- <tr ng-if="simfile.steps.double">\r
- <th>Steps-double:</th>\r
- <td>\r
- <ul>\r
- <li ng-repeat="stepchart in simfile.steps.double">\r
- <span>{{stepchart.difficulty}} {{stepchart.rating}}</span>\r
- </li>\r
- </ul>\r
- </td>\r
- </tr>\r
- <tr>\r
- <th>BPMChanges:</th>\r
- <td>{{simfile.bpmChanges}}</td>\r
- </tr>\r
- <tr>\r
- <th>BGChanges:</th>\r
- <td>{{simfile.bgChanges}}</td>\r
- </tr>\r
- <tr>\r
- <th>FGChanges:</th>\r
- <td>{{simfile.fgChanges}}</td>\r
- </tr>\r
- </table>\r
- <div class="clearfix"></div>\r
+ <simfile rock-endpoint="rockEndpoint"\r
+ simfile="simfile"\r
+ banner="simfile.banner"\r
+ title="simfile.title"\r
+ artist="simfile.artist"\r
+ steps="simfile.steps"\r
+ bpm-changes="simfile.bpmChanges"\r
+ bg-changes="simfile.bgChanges"\r
+ fg-changes="simfile.fgChanges"\r
+ />\r
</div>\r
</li>\r
</ul>
\ No newline at end of file
return !$scope.bpmChangesFilterKeyword || simfile.bpmChanges === 'Yes';
};
- SimfileService.getSimfiles().success(function(response)
+ SimfileService.getSimfiles().then(function(simfiles)
{
- $scope.simfileList = response;
+ $scope.simfileList = simfiles;
+ });
+
+ SimfileService.getPacks().then(function(packs)
+ {
+ $scope.packList = packs;
});
}]);
\ No newline at end of file
<br />
<!-- Example: nv-file-select="" uploader="{Object}" options="{Object}" filters="{String}" -->
<input type="file" nv-file-select="" uploader="uploader" multiple />
+<input type="hidden" name="token" value="{{token}}" />
<h2>The queue. Length: {{ uploader.queue.length}}</h2>
<ul>
<li ng-repeat="item in uploader.queue">
'use strict';
-angular.module("DivinElegy.pages.upload", ['angularFileUpload', 'DivinElegy.components.config'])
+angular.module("DivinElegy.pages.upload", ['angularFileUpload', 'DivinElegy.components.config', 'DivinElegy.components.hello'])
-.controller("UploadController", ['rockEndpoint', '$scope', 'FileUploader', function(rockEndpoint, $scope, FileUploader)
+.controller("UploadController", ['rockEndpoint', 'HelloService', '$scope', 'FileUploader', function(rockEndpoint, HelloService, $scope, FileUploader)
{
+
+ $scope.token = HelloService.getAccessToken();
+
var uploader = $scope.uploader = new FileUploader(
{
url: rockEndpoint + 'simfiles/upload'