Initial commit.
authorCameron Ball <cameron@getapproved.com.au>
Fri, 26 Sep 2014 04:37:25 +0000 (12:37 +0800)
committerCameron Ball <cameron@getapproved.com.au>
Fri, 26 Sep 2014 04:37:25 +0000 (12:37 +0800)
27 files changed:
.bowerrc [new file with mode: 0644]
.gitignore [new file with mode: 0644]
.jshintrc [new file with mode: 0644]
.travis.yml [new file with mode: 0644]
LICENSE [new file with mode: 0644]
app/Controllers/Index/index.html [new file with mode: 0644]
app/Controllers/Index/index.js [new file with mode: 0644]
app/Controllers/Upload/style.css [new file with mode: 0644]
app/Controllers/Upload/upload.html [new file with mode: 0644]
app/Controllers/Upload/upload.js [new file with mode: 0644]
app/components/version/interpolate-filter.js [new file with mode: 0644]
app/components/version/interpolate-filter_test.js [new file with mode: 0644]
app/components/version/version-directive.js [new file with mode: 0644]
app/components/version/version-directive_test.js [new file with mode: 0644]
app/components/version/version.js [new file with mode: 0644]
app/components/version/version_test.js [new file with mode: 0644]
app/divinelegy.js [new file with mode: 0644]
app/index.html [new file with mode: 0644]
app/nbproject/private/private.properties [new file with mode: 0644]
app/nbproject/project.properties [new file with mode: 0644]
app/nbproject/project.xml [new file with mode: 0644]
app/style.css [new file with mode: 0644]
bower.json [new file with mode: 0644]
e2e-tests/protractor.conf.js [new file with mode: 0644]
e2e-tests/scenarios.js [new file with mode: 0644]
karma.conf.js [new file with mode: 0644]
package.json [new file with mode: 0644]

diff --git a/.bowerrc b/.bowerrc
new file mode 100644 (file)
index 0000000..8c58c8e
--- /dev/null
+++ b/.bowerrc
@@ -0,0 +1,3 @@
+{
+  "directory": "app/bower_components"
+}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..ce4f8a0
--- /dev/null
@@ -0,0 +1,8 @@
+logs/*
+!.gitkeep
+node_modules/
+bower_components/
+tmp
+.DS_Store
+.idea
+npm-debug.log
diff --git a/.jshintrc b/.jshintrc
new file mode 100644 (file)
index 0000000..6f00218
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,13 @@
+{
+  "globalstrict": true,
+  "globals": {
+    "angular": false,
+    "describe": false,
+    "it": false,
+    "expect": false,
+    "beforeEach": false,
+    "afterEach": false,
+    "module": false,
+    "inject": false
+  }
+}
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
new file mode 100644 (file)
index 0000000..cce5c68
--- /dev/null
@@ -0,0 +1,14 @@
+language: node_js
+node_js:
+  - "0.10"
+
+before_script:
+  - export DISPLAY=:99.0
+  - sh -e /etc/init.d/xvfb start
+  - npm start > /dev/null &
+  - npm run update-webdriver
+  - sleep 1 # give server time to start
+
+script:
+  - node_modules/.bin/karma start karma.conf.js --no-auto-watch --single-run --reporters=dots --browsers=Firefox
+  - node_modules/.bin/protractor e2e-tests/protractor.conf.js --browser=firefox
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..9ced331
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,22 @@
+The MIT License
+
+Copyright (c) 2010-2014 Google, Inc. http://angularjs.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
diff --git a/app/Controllers/Index/index.html b/app/Controllers/Index/index.html
new file mode 100644 (file)
index 0000000..45379b4
--- /dev/null
@@ -0,0 +1 @@
+<h3>{{simpleVariable}}</h3>
\ No newline at end of file
diff --git a/app/Controllers/Index/index.js b/app/Controllers/Index/index.js
new file mode 100644 (file)
index 0000000..44752de
--- /dev/null
@@ -0,0 +1,17 @@
+'use strict';
+
+angular.module("DivinElegy.Controllers.Index", ['ngRoute'])
+
+.config(['$routeProvider', function($routeProvider)
+{
+  $routeProvider.when('/',
+  {
+    templateUrl: 'Controllers/Index/index.html',
+    controller: 'IndexController'
+  });
+}])
+
+.controller("IndexController", ['$scope', function($scope)
+{
+    $scope.simpleVariable = 'hello';
+}]);
\ No newline at end of file
diff --git a/app/Controllers/Upload/style.css b/app/Controllers/Upload/style.css
new file mode 100644 (file)
index 0000000..7dc5985
--- /dev/null
@@ -0,0 +1,69 @@
+canvas {
+    background-color: #f3f3f3;
+    -webkit-box-shadow: 3px 3px 3px 0 #e3e3e3;
+    -moz-box-shadow: 3px 3px 3px 0 #e3e3e3;
+    box-shadow: 3px 3px 3px 0 #e3e3e3;
+    border: 1px solid #c3c3c3;
+    height: 100px;
+    margin: 6px 0 0 6px;
+}
+.nv-file-over {
+    background-color: #FFBEA3;
+}
+.other-drop-zone {
+    border: 2px dashed burlywood;
+    padding: 4px;
+    height: 100px;
+}
+.other-over-zone {
+    background-color: moccasin;
+}
+.bg {
+    background-color: lightgreen;
+}
+.over-zone {
+    border: 2px dashed lavender;
+    height: 100px;
+    padding: 4px;
+}
+.item-progress-box {
+    height: 20px;
+    margin-top: -20px;
+    margin-left: 60px;
+    margin-right: 10px;
+}
+.item-progress {
+    background-color: #90B8DA;
+    height: 100%;
+    width: 0;
+}
+.total-progress-box {
+    height: 20px;
+    margin-top: -20px;
+    margin-left: 90px;
+    margin-right: 10px;
+}
+.total-progress {
+    background-color: #90B8DA;
+    height: 100%;
+    width: 0;
+}
+.box {
+    margin: 20px;
+}
+.progress {
+    background-color: mediumpurple;
+    height: 20px;
+}
+.uploaded {
+    background-color: lightgreen;
+    height: 20px;
+    width: 100px;
+}
+ul > li:nth-child(odd) {
+    background-color: #f5f5f5;
+    margin: 2px;
+}
+.zone {
+    width: 49%;
+}
\ No newline at end of file
diff --git a/app/Controllers/Upload/upload.html b/app/Controllers/Upload/upload.html
new file mode 100644 (file)
index 0000000..154791b
--- /dev/null
@@ -0,0 +1,48 @@
+<div ng-show="uploader.isHTML5">
+    <div class="over-zone zone" nv-file-drop="" nv-file-over="" uploader="uploader" style="float: left;">
+        Base drop zone indication
+    </div>
+    <div style="clear: both;"></div>
+</div>
+<br />
+<!-- Example: nv-file-select="" uploader="{Object}" options="{Object}" filters="{String}" -->
+<input type="file" nv-file-select="" uploader="uploader" multiple />
+<h2>The queue. Length: {{ uploader.queue.length}}</h2>
+<ul>
+    <li ng-repeat="item in uploader.queue">
+        <div>Name: {{ item.file.name}}</div>
+        <div>Size: {{ item.file.size / 1024 / 1024|number:2 }} Mb</div>
+        <div ng-show="uploader.isHTML5">
+            Progress: {{ item.progress}}
+            <div class="item-progress-box">
+                <div class="item-progress" ng-style="{ 'width': item.progress + '%' }"></div>
+            </div>
+        </div>
+        <div ng-if="controller.isImage(item._file)">
+            Thumbnail (only images):
+            <!-- Image preview -->
+            <!--auto height-->
+            <!--<div ng-thumb="{ file: item.file, width: 100 }"></div>-->
+            <!--auto width-->
+            <div ng-thumb="{ file: item._file, height: 100 }"></div>
+            <!--fixed width and height -->
+            <!--<div ng-thumb="{ file: item.file, width: 100, height: 100 }"></div>-->
+        </div>
+        <div>
+            <button ng-click="item.upload()" ng-disabled="item.isReady || item.isUploading || item.isSuccess">Upload</button>
+            <button ng-click="item.cancel()" ng-disabled="!item.isUploading">Cancel</button>
+            <button ng-click="item.remove()">Remove</button>
+        </div>
+    </li>
+</ul>
+<div>
+    <div>
+        Total progress: {{ uploader.progress}}
+        <div class="total-progress-box">
+            <div class="total-progress" ng-style="{ 'width': uploader.progress + '%' }"></div>
+        </div>
+    </div>
+    <button ng-click="uploader.uploadAll()" ng-disabled="!uploader.getNotUploadedItems().length">Upload all</button>
+    <button ng-click="uploader.cancelAll()" ng-disabled="!uploader.isUploading">Cancel all</button>
+    <button ng-click="uploader.clearQueue()" ng-disabled="!uploader.queue.length">Remove all</button>
+</div>
\ No newline at end of file
diff --git a/app/Controllers/Upload/upload.js b/app/Controllers/Upload/upload.js
new file mode 100644 (file)
index 0000000..05274b9
--- /dev/null
@@ -0,0 +1,29 @@
+'use strict';
+
+angular.module("DivinElegy.Controllers.Upload", ['ngRoute', 'angularFileUpload'])
+
+.config(['$routeProvider', function($routeProvider)
+{
+  $routeProvider.when('/upload',
+  {
+    templateUrl: 'Controllers/Upload/upload.html',
+    controller: 'UploadController'
+  });
+}])
+
+.controller("UploadController", ['$scope', 'FileUploader', function($scope, FileUploader)
+{
+    var uploader = $scope.uploader = new FileUploader(
+    {
+        url: 'http://rock.divinelegy.meeples/simfiles/upload'
+    });
+    
+    uploader.filters.push(
+    {
+        name: 'customFilter',
+        fn: function(item, options)
+        {
+            return this.queue.length < 10;
+        }
+    })
+}]);
\ No newline at end of file
diff --git a/app/components/version/interpolate-filter.js b/app/components/version/interpolate-filter.js
new file mode 100644 (file)
index 0000000..03bb198
--- /dev/null
@@ -0,0 +1,9 @@
+'use strict';
+
+angular.module('myApp.version.interpolate-filter', [])
+
+.filter('interpolate', ['version', function(version) {
+  return function(text) {
+    return String(text).replace(/\%VERSION\%/mg, version);
+  };
+}]);
diff --git a/app/components/version/interpolate-filter_test.js b/app/components/version/interpolate-filter_test.js
new file mode 100644 (file)
index 0000000..ff56c52
--- /dev/null
@@ -0,0 +1,15 @@
+'use strict';
+
+describe('myApp.version module', function() {
+  beforeEach(module('myApp.version'));
+
+  describe('interpolate filter', function() {
+    beforeEach(module(function($provide) {
+      $provide.value('version', 'TEST_VER');
+    }));
+
+    it('should replace VERSION', inject(function(interpolateFilter) {
+      expect(interpolateFilter('before %VERSION% after')).toEqual('before TEST_VER after');
+    }));
+  });
+});
diff --git a/app/components/version/version-directive.js b/app/components/version/version-directive.js
new file mode 100644 (file)
index 0000000..74088f8
--- /dev/null
@@ -0,0 +1,9 @@
+'use strict';
+
+angular.module('myApp.version.version-directive', [])
+
+.directive('appVersion', ['version', function(version) {
+  return function(scope, elm, attrs) {
+    elm.text(version);
+  };
+}]);
diff --git a/app/components/version/version-directive_test.js b/app/components/version/version-directive_test.js
new file mode 100644 (file)
index 0000000..4a59e11
--- /dev/null
@@ -0,0 +1,17 @@
+'use strict';
+
+describe('myApp.version module', function() {
+  beforeEach(module('myApp.version'));
+
+  describe('app-version directive', function() {
+    it('should print current version', function() {
+      module(function($provide) {
+        $provide.value('version', 'TEST_VER');
+      });
+      inject(function($compile, $rootScope) {
+        var element = $compile('<span app-version></span>')($rootScope);
+        expect(element.text()).toEqual('TEST_VER');
+      });
+    });
+  });
+});
diff --git a/app/components/version/version.js b/app/components/version/version.js
new file mode 100644 (file)
index 0000000..cb7a10f
--- /dev/null
@@ -0,0 +1,8 @@
+'use strict';
+
+angular.module('myApp.version', [
+  'myApp.version.interpolate-filter',
+  'myApp.version.version-directive'
+])
+
+.value('version', '0.1');
diff --git a/app/components/version/version_test.js b/app/components/version/version_test.js
new file mode 100644 (file)
index 0000000..4ca6880
--- /dev/null
@@ -0,0 +1,11 @@
+'use strict';
+
+describe('myApp.version module', function() {
+  beforeEach(module('myApp.version'));
+
+  describe('version service', function() {
+    it('should return current version', inject(function(version) {
+      expect(version).toEqual('0.1');
+    }));
+  });
+});
diff --git a/app/divinelegy.js b/app/divinelegy.js
new file mode 100644 (file)
index 0000000..c4b3935
--- /dev/null
@@ -0,0 +1,11 @@
+'use strict';
+
+// Declare app level module which depends on views, and components
+angular.module('DivinElegy', [
+  'ngRoute',
+  'DivinElegy.Controllers.Index',
+  'DivinElegy.Controllers.Upload'
+]).
+config(['$routeProvider', function($routeProvider) {
+  $routeProvider.otherwise({redirectTo: '/'});
+}]);
diff --git a/app/index.html b/app/index.html
new file mode 100644 (file)
index 0000000..2b5e323
--- /dev/null
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html lang="en" ng-app="DivinElegy" class="no-js"> <!--<![endif]-->
+    <head>
+        <meta charset="utf-8">
+        <meta http-equiv="X-UA-Compatible" content="IE=edge">
+        <title>DivinElegy - Rock n Roll</title>
+        
+        <!-- Styles -->
+        <link rel="stylesheet" href="style.css"/>
+        <link rel="stylesheet" href="Controllers/Upload/style.css"/>
+        <!-- end -->
+        
+        <!-- In production use:
+        <script src="//ajax.googleapis.com/ajax/libs/angularjs/x.x.x/angular.min.js"></script>
+        -->
+        <script src="bower_components/angular/angular.js"></script>
+        <script src="bower_components/angular-route/angular-route.js"></script>
+        <script src="bower_components/angular-file-upload/angular-file-upload.js"></script>
+        
+        <!-- Controllers -->
+        <script src="Controllers/Index/index.js"></script>
+        <script src="Controllers/Upload/upload.js"></script>
+        <!-- End -->
+        
+        <!-- good luck cameron -->
+        <script src="divinelegy.js"></script>  
+    </head>
+    <body>
+        <ul class="menu">
+            <li><a href="#/">Home</a></li>
+            <li><a href="#/upload">Upload</a></li>
+        </ul>
+
+        <div ng-view>
+            <!-- extreme hard rock for DivinElegy gets loaded in here. -->
+        </div>
+
+        <div>Angular seed app: v<span app-version></span></div>
+    </body>
+</html>
diff --git a/app/nbproject/private/private.properties b/app/nbproject/private/private.properties
new file mode 100644 (file)
index 0000000..3b1a22e
--- /dev/null
@@ -0,0 +1 @@
+browser=Chrome.INTEGRATED
diff --git a/app/nbproject/project.properties b/app/nbproject/project.properties
new file mode 100644 (file)
index 0000000..b702a75
--- /dev/null
@@ -0,0 +1,5 @@
+config.folder=
+file.reference.roll.divinelegy-app=.
+files.encoding=UTF-8
+site.root.folder=${file.reference.roll.divinelegy-app}
+test.folder=
diff --git a/app/nbproject/project.xml b/app/nbproject/project.xml
new file mode 100644 (file)
index 0000000..6d45fcc
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.web.clientproject</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/clientside-project/1">
+            <name>roll.divinelegy</name>
+        </data>
+    </configuration>
+</project>
diff --git a/app/style.css b/app/style.css
new file mode 100644 (file)
index 0000000..c925240
--- /dev/null
@@ -0,0 +1,30 @@
+/* app css stylesheet */
+
+.menu {
+  list-style: none;
+  border-bottom: 0.1em solid black;
+  margin-bottom: 2em;
+  padding: 0 0 0.5em;
+}
+
+.menu:before {
+  content: "[";
+}
+
+.menu:after {
+  content: "]";
+}
+
+.menu > li {
+  display: inline;
+}
+
+.menu > li:before {
+  content: "|";
+  padding-right: 0.3em;
+}
+
+.menu > li:nth-child(1):before {
+  content: "";
+  padding: 0;
+}
diff --git a/bower.json b/bower.json
new file mode 100644 (file)
index 0000000..6afd91a
--- /dev/null
@@ -0,0 +1,16 @@
+{
+  "name": "angular-seed",
+  "description": "A starter project for AngularJS",
+  "version": "0.0.0",
+  "homepage": "https://github.com/angular/angular-seed",
+  "license": "MIT",
+  "private": true,
+  "dependencies": {
+    "angular": "1.2.x",
+    "angular-route": "1.2.x",
+    "angular-loader": "1.2.x",
+    "angular-mocks": "~1.2.x",
+    "html5-boilerplate": "~4.3.0",
+    "angular-file-upload": "1.1.1"
+  }
+}
diff --git a/e2e-tests/protractor.conf.js b/e2e-tests/protractor.conf.js
new file mode 100644 (file)
index 0000000..b45a117
--- /dev/null
@@ -0,0 +1,19 @@
+exports.config = {
+  allScriptsTimeout: 11000,
+
+  specs: [
+    '*.js'
+  ],
+
+  capabilities: {
+    'browserName': 'chrome'
+  },
+
+  baseUrl: 'http://localhost:8000/app/',
+
+  framework: 'jasmine',
+
+  jasmineNodeOpts: {
+    defaultTimeoutInterval: 30000
+  }
+};
diff --git a/e2e-tests/scenarios.js b/e2e-tests/scenarios.js
new file mode 100644 (file)
index 0000000..e66d140
--- /dev/null
@@ -0,0 +1,42 @@
+'use strict';
+
+/* https://github.com/angular/protractor/blob/master/docs/toc.md */
+
+describe('my app', function() {
+
+  browser.get('index.html');
+
+  it('should automatically redirect to /view1 when location hash/fragment is empty', function() {
+    expect(browser.getLocationAbsUrl()).toMatch("/view1");
+  });
+
+
+  describe('view1', function() {
+
+    beforeEach(function() {
+      browser.get('index.html#/view1');
+    });
+
+
+    it('should render view1 when user navigates to /view1', function() {
+      expect(element.all(by.css('[ng-view] p')).first().getText()).
+        toMatch(/partial for view 1/);
+    });
+
+  });
+
+
+  describe('view2', function() {
+
+    beforeEach(function() {
+      browser.get('index.html#/view2');
+    });
+
+
+    it('should render view2 when user navigates to /view2', function() {
+      expect(element.all(by.css('[ng-view] p')).first().getText()).
+        toMatch(/partial for view 2/);
+    });
+
+  });
+});
diff --git a/karma.conf.js b/karma.conf.js
new file mode 100644 (file)
index 0000000..44bb29f
--- /dev/null
@@ -0,0 +1,33 @@
+module.exports = function(config){
+  config.set({
+
+    basePath : './',
+
+    files : [
+      'app/bower_components/angular/angular.js',
+      'app/bower_components/angular-route/angular-route.js',
+      'app/bower_components/angular-mocks/angular-mocks.js',
+      'app/components/**/*.js',
+      'app/view*/**/*.js'
+    ],
+
+    autoWatch : true,
+
+    frameworks: ['jasmine'],
+
+    browsers : ['Chrome'],
+
+    plugins : [
+            'karma-chrome-launcher',
+            'karma-firefox-launcher',
+            'karma-jasmine',
+            'karma-junit-reporter'
+            ],
+
+    junitReporter : {
+      outputFile: 'test_out/unit.xml',
+      suite: 'unit'
+    }
+
+  });
+};
diff --git a/package.json b/package.json
new file mode 100644 (file)
index 0000000..7ed7df3
--- /dev/null
@@ -0,0 +1,34 @@
+{
+  "name": "angular-seed",
+  "private": true,
+  "version": "0.0.0",
+  "description": "A starter project for AngularJS",
+  "repository": "https://github.com/angular/angular-seed",
+  "license": "MIT",
+  "devDependencies": {
+    "karma": "~0.10",
+    "protractor": "^1.1.1",
+    "http-server": "^0.6.1",
+    "bower": "^1.3.1",
+    "shelljs": "^0.2.6",
+    "karma-junit-reporter": "^0.2.2"
+  },
+  "scripts": {
+    "postinstall": "bower install",
+
+    "prestart": "npm install",
+    "start": "http-server -p 8000 -c-1",
+
+    "pretest": "npm install",
+    "test": "karma start karma.conf.js",
+    "test-single-run": "karma start karma.conf.js  --single-run",
+
+    "preupdate-webdriver": "npm install",
+    "update-webdriver": "webdriver-manager update",
+
+    "preprotractor": "npm run update-webdriver",
+    "protractor": "protractor e2e-tests/protractor.conf.js",
+
+    "update-index-async": "node -e \"require('shelljs/global'); sed('-i', /\\/\\/@@NG_LOADER_START@@[\\s\\S]*\\/\\/@@NG_LOADER_END@@/, '//@@NG_LOADER_START@@\\n' + sed(/sourceMappingURL=angular-loader.min.js.map/,'sourceMappingURL=bower_components/angular-loader/angular-loader.min.js.map','app/bower_components/angular-loader/angular-loader.min.js') + '\\n//@@NG_LOADER_END@@', 'app/index-async.html');\""
+  }
+}