Skip to content

Commit

Permalink
Merge pull request #108 from TF2Stadium/v0.4.0-alpha
Browse files Browse the repository at this point in the history
Version v0.4.0-alpha
  • Loading branch information
mcapu committed Dec 26, 2015
2 parents 1b47834 + 0c2e390 commit cf6e0a2
Show file tree
Hide file tree
Showing 55 changed files with 1,466 additions and 467 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/
gulp/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ dist/
src/assets/
src/app/app.config.js
Frontend.iml
coverage/
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Changelog

## [Unreleased]

## [0.4.0] - 2015-12-26

* Added changelog file.
* Updated angular-material to v1.0.0.
* Allow y-scrolling for short viewports.
* Added websocket disconnection handling.
* Added quotes and noscript warn to splash screen (https://github.com/TF2Stadium/Frontend/issues/87).
* Style: added animation support.
* Notifications: reworked toasts.
* Chat: improved handling of long messages.
* Settings: move logout to new user account section.
* LobbyServie: clean mumble URL to use a valid username (https://github.com/TF2Stadium/QA/issues/18).
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"angular": "~1.4.7",
"angular-animate": "~1.4.0",
"angular-audio": "~1.7.1",
"angular-material": "1.0.0-rc4",
"angular-material": "1.0.0",
"angular-scroll-glue": "~2.0.6",
"angular-ui-router": "~0.2.15",
"clipboard": "~1.5.3",
"wsevent.js": "~1.0.0"
"wsevent.js": "~1.0.1"
},
"devDependencies": {
"angular-mocks": "~1.4.7"
Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies:
test:
override:
- gulp lint
- gulp test
- gulp test-browsers
deployment:
master:
branch: master
Expand Down
3 changes: 2 additions & 1 deletion gulp/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ function isFixed(file) {

function runLinter(tryToFix) {
var codePath = path.join(conf.paths.src, 'app');
return gulp.src(path.join(codePath, '**/*.js'))
return gulp.src([path.join(codePath, '**/*.js'),
path.join(conf.paths.test, '**/*.js')])
.pipe($.eslint({ fix: tryToFix }))
.pipe($.eslint.format())
.pipe($.if(isFixed, gulp.dest(codePath)))
Expand Down
69 changes: 50 additions & 19 deletions gulp/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,58 @@ var karma = require('karma');

var $ = require('gulp-load-plugins')();

function runUnitTestsOn(browsers, done) {
var src_files = [];
var src_glob = path.join(conf.paths.src, '/app/**/*.js');

var preprocessors = {};
preprocessors[src_glob] = ['coverage'];

gulp.src(src_glob)
.pipe($.angularFilesort())
.on('data', function (file) {
src_files.push(file.path);
}).on('end', function () {
var server = new karma.Server({
browsers: browsers,
frameworks: ['mocha', 'chai-sinon'],
files:
mainBowerFiles({ includeDev: true })
.concat(
// Note: es5-shim needed to fix some phantomjs issues,
// including no Function.prototype.bind . This can be
// removed (along with the es5-shim dependency) once an
// upgrade to phantomjs2 is complete
'node_modules/es5-shim/es5-shim.js',
src_files,
path.join(conf.paths.test, '/karma/**/*.js')),
singleRun: true,
reporters: ['progress', 'coverage'],
preprocessors: preprocessors
});

server.on('run_complete', function (browsers, results) {
// NB If the argument of done() is not null or not undefined,
// e.g. a string, the next task in a series won't run.
done(results.error ? 'There are test failures' : null);
});
server.start();
});
}

gulp.task('test:unit', function (done) {
var server = new karma.Server({
browsers: ['PhantomJS'],
frameworks: ['mocha', 'chai-sinon'],
files: mainBowerFiles({ includeDev: true }).concat([
'dist/scripts/app-*.js',
'test/karma/**/*.js'
]),
logLevel: 'DEBUG',
singleRun: true
});

server.on('run_complete', function (browsers, results) {
// NB If the argument of done() is not null or not undefined,
// e.g. a string, the next task in a series won't run.
done(results.error ? 'There are test failures' : null);
});

server.start();
runUnitTestsOn(['PhantomJS'], done)
});

gulp.task('test-browsers:unit', function (done) {
runUnitTestsOn(['PhantomJS', 'Firefox', 'Chrome'], done)
});

gulp.task('test', function (cb) {
runSequence('build', 'test:unit', cb);
runSequence('test:unit', cb);
});


gulp.task('test-browsers', function (cb) {
runSequence('test-browsers:unit', cb);
});
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"license": "GPL-3.0",
"repository": "https://github.com/TF2Stadium/Frontend",
"readme": "readme.md",
"version": "0.3.3",
"version": "0.4.0",
"dependencies": {
"del": "~1.2.0",
"uglify-save-license": "~0.4.1",
Expand Down Expand Up @@ -41,6 +41,7 @@
"chalk": "^1.1.1",
"concat-stream": "~1.5.0",
"connect-history-api-fallback": "^1.1.0",
"es5-shim": "^4.4.1",
"eslint": "^1.10.1",
"eslint-plugin-angular": "^0.14.0",
"glob": "^6.0.1",
Expand All @@ -53,6 +54,9 @@
"http-proxy-middleware": "~0.0.5",
"karma": "^0.13.15",
"karma-chai-sinon": "^0.1.5",
"karma-chrome-launcher": "^0.2.2",
"karma-coverage": "^0.5.3",
"karma-firefox-launcher": "^0.1.7",
"karma-mocha": "^0.2.1",
"karma-phantomjs-launcher": "^0.2.1",
"merge-stream": "~0.1.7",
Expand All @@ -61,7 +65,8 @@
"require-dir": "~0.3.0",
"run-sequence": "^1.1.5",
"selenium-webdriver": "^2.48.2",
"sinon": "^1.17.2"
"sinon": "^1.17.2",
"sinon-chai": "^2.8.0"
},
"engines": {
"node": ">=0.10.0"
Expand Down
5 changes: 2 additions & 3 deletions src/app/app.filter.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
(function () {
'use strict';


angular.module('tf2stadium')
angular.module('tf2stadium.filters')
.filter('capitalize', capitalize)
.filter('reverse', reverse)
.filter('trusted', trusted)
Expand All @@ -14,7 +13,7 @@
/** @ngInject */
function capitalize() {
return function (input) {
if(typeof input === 'undefined' || input === '') {
if (angular.isUndefined(input) || input === '') {
return input;
}
return input.charAt(0).toUpperCase() + input.substr(1).toLowerCase();
Expand Down
4 changes: 4 additions & 0 deletions src/app/app.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@
'use strict';

angular.module('tf2stadium', [
'tf2stadium.controllers',
'tf2stadium.services',
'tf2stadium.filters',
'ngAnimate',
'ui.router',
'ngMaterial',
'luegg.directives',
'ngAudio'
]);

angular.module('tf2stadium.controllers', []);
angular.module('tf2stadium.services', []);
angular.module('tf2stadium.filters', []);

})();
73 changes: 15 additions & 58 deletions src/app/app.notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,67 +2,45 @@
'use strict';

angular.module('tf2stadium')
.factory('Notifications', NotificationsFactory)
.controller('NotificationsController', NotificationsController);
.factory('Notifications', NotificationsFactory);

/** @ngInject */
function NotificationsFactory($mdToast, $document, $timeout, $log, ngAudio) {
function NotificationsFactory($mdToast, $window, $document, $timeout, $log, ngAudio) {

var notificationsService = {};

var notifications = {};
var nextId = 0;

var toastDefault = {
templateUrl: 'app/shared/notifications/toast.html',
message: 'Default',
actionMessage: 'OK',
action: function () {
$mdToast.hide();
},
action: function () {},
controller: 'ToastController',
controllerAs: 'toast',
bindToController: true,
error: false,
parent: $document[0].querySelector('#toasts'),
hideDelay: 0
};

notificationsService.add = function (message, level) {
notifications[nextId] = {message: message, level: level};
nextId++;
};

notificationsService.remove = function (id) {
delete notifications[id];
};

notificationsService.clearNotifications = function () {
for (var notificationKey in notifications) {
delete notifications[notificationKey];
}
};

notificationsService.getNotifications = function () {
return notifications;
autoWrap: false,
hideDelay: 5000
};

notificationsService.toast = function (options) {
for (var key in toastDefault) {
if (!options[key]) {
options[key] = toastDefault[key];
}
}
$mdToast.show(options);
$mdToast
.show(angular.extend({}, toastDefault, options))
.then(function (clicked) {
if (clicked === 'ok') {
options.action();
}
});
};

notificationsService.notifyBrowser = function (options) {

if (!('Notification' in window)) {
if (!('Notification' in $window)) {
$log.log('Browser doesn\'t support HTML5 notifications');
return;
}

var Notification = $window.Notification;

if (($document[0].hasFocus() && !options.showAlways) || Notification.permission === 'denied') {
return;
}
Expand Down Expand Up @@ -100,25 +78,4 @@

}

/** @ngInject */
function NotificationsController(Notifications) {

var vm = this;

vm.remove = function (id) {
Notifications.remove(id);
};

vm.add = function (message, level) {
Notifications.add(message, level);
};

vm.isEmpty = function () {
return Object.keys(vm.notifications).length < 1;
};

vm.notifications = Notifications.getNotifications();

}

})();
3 changes: 2 additions & 1 deletion src/app/app.run.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
timeout: 3,
showAlways: true
});
}
},
hideDelay: 0
});
}, 2000);

Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/lobby/create/header.controller.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function () {
'use strict';

angular.module('tf2stadium')
angular.module('tf2stadium.controllers')
.controller('LobbyCreateHeaderController', LobbyCreateHeaderController);

/** @ngInject */
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/lobby/create/lobby-create.controller.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function () {
'use strict';

angular.module('tf2stadium')
angular.module('tf2stadium.controllers')
.controller('LobbyCreateController', LobbyCreateController);

/** @ngInject */
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/lobby/create/step-format.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ng-repeat="format in lobbyCreate.formats.options | LobbyCreateOptionFilter:'formats':lobbyCreate.searchString | orderBy:'title'"
ng-click="lobbyCreate.select(lobbyCreate.formats, format)"
ng-if="format.value!='debug' || $root.userProfile.role=='administrator'"
ng-class="{'fade-in-top no-animate': lobbyCreate.searchString===null, 'selected': lobbyCreate.isSelected(lobbyCreate.formats, format)}"
ng-class="{'no-animate': lobbyCreate.searchString===null, 'selected': lobbyCreate.isSelected(lobbyCreate.formats, format)}"
ng-style="{'animation-delay': 0.03 * ($index+1) + 's'}">
<div class="tile-image" ng-style="{'background-image': 'url(/assets/img/formats/' + format.value + '.jpg),
linear-gradient(
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/lobby/create/step-league.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
md-colspan="12" md-rowspan="2"
ng-repeat="league in lobbyCreate.leagues.options | LobbyCreateOptionFilter:'leagues':lobbyCreate.searchString"
ng-click="lobbyCreate.select(lobbyCreate.leagues, league)"
ng-class="{'fade-in-top no-animate': lobbyCreate.searchString===null, 'selected': lobbyCreate.isSelected(lobbyCreate.leagues, league)}"
ng-class="{'no-animate': lobbyCreate.searchString===null, 'selected': lobbyCreate.isSelected(lobbyCreate.leagues, league)}"
ng-style="{'animation-delay': 0.03 * ($index+1) + 's'}">
<div class="tile-text">
<h2>{{::league.title}}</h2>
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/lobby/create/step-map.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
md-colspan="{{map.important ? 6 : 6}}" md-rowspan="{{map.important ? 4 : 2}}"
ng-repeat="map in lobbyCreate.maps.options | LobbyCreateOptionFilter:'maps':lobbyCreate.searchString"
ng-click="lobbyCreate.select(lobbyCreate.maps, map)"
ng-class="{'fade-in-top no-animate': lobbyCreate.searchString===null, 'selected': lobbyCreate.isSelected(lobbyCreate.maps, map)}"
ng-class="{'no-animate': lobbyCreate.searchString===null, 'selected': lobbyCreate.isSelected(lobbyCreate.maps, map)}"
ng-style="{'animation-delay': 0.03 * ($index+1) + 's'}">
<div class="tile-image" ng-style="{'background-image': 'url(/assets/img/maps/lobby-create/' + map.value + '.jpg)'}"></div>
<div class="tile-text">
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/lobby/create/wizard-steps.controller.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function () {
'use strict';

angular.module('tf2stadium')
angular.module('tf2stadium.controllers')
.controller('WizardStepsController', WizardStepsController);

/** @ngInject */
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/lobby/list/header.controller.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function () {
'use strict';

angular.module('tf2stadium')
angular.module('tf2stadium.controllers')
.controller('LobbyListHeaderController', LobbyListHeaderController);

/** @ngInject */
Expand Down
Loading

0 comments on commit cf6e0a2

Please sign in to comment.