Skip to content

Commit

Permalink
Merged from master, adding teams.
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Schodde committed Sep 12, 2014
2 parents 76b7c5b + 8528639 commit 133646c
Show file tree
Hide file tree
Showing 58 changed files with 1,163 additions and 5,533 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ Get GruntFile
-------------
![Screenshot of get grunt file page](http://i.imgur.com/EdBGd5U.png)

Mobile
------
![Screenshot of mobile home page](http://i.imgur.com/gOewysS.png)
![Screenshot of mobile login page](http://i.imgur.com/tgDUqIq.png)
![Screenshot of mobile navbar](http://i.imgur.com/YQPxXl3.png)


TODO
-----
Expand All @@ -55,6 +61,10 @@ API Docs
grunt apidoc
```

Demo
------
http://linesperbeat.herokuapp.com/

Test
----
```bash
Expand Down
17 changes: 9 additions & 8 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,23 @@
"version": "0.0.1",
"description": "Hackathon LeaderBoard",
"dependencies": {
"angular": ">=1.2.*",
"angular": "^1.3.*",
"json3": "~3.3.1",
"es5-shim": "~3.0.1",
"jquery": "~1.11.0",
"angular-resource": ">=1.2.*",
"angular-cookies": ">=1.2.*",
"angular-sanitize": ">=1.2.*",
"angular-route": ">=1.2.*",
"angular-resource": "^1.3.*",
"angular-cookies": "^1.3.*",
"angular-sanitize": "^1.3.*",
"angular-route": "^1.3.*",
"font-awesome": "~4.1.0",
"lodash": "~2.4.1",
"angular-motion": "~0.3.3",
"offline": "~0.7.7"
"offline": "~0.7.7",
"angular-material": "~0.0.2"
},
"devDependencies": {
"angular-mocks": ">=1.2.*",
"angular-scenario": ">=1.2.*"
"angular-mocks": "^1.3.*",
"angular-scenario": "^1.3.*"
},
"overrides": {
"offline": {
Expand Down
8 changes: 8 additions & 0 deletions client/app/Toast/Toast.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

angular.module('linesPerBeatApp').controller('ToastCtrl', ['$scope', '$timeout', '$hideToast', 'closeTime', 'message', function ($scope, $timeout, $hideToast, closeTime, message) {
$scope.message = message;
$timeout(function () {
$hideToast();
}, closeTime);
}]);
21 changes: 21 additions & 0 deletions client/app/Toast/Toast.controller.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';

describe('Controller: ToastCtrl', function () {

// load the controller's module
beforeEach(module('linesperbeatApp'));

var ToastCtrl, scope;

// Initialize the controller and a mock scope
beforeEach(inject(function ($controller, $rootScope) {
scope = $rootScope.$new();
ToastCtrl = $controller('ToastCtrl', {
$scope: scope
});
}));

it('should ...', function () {
expect(1).toEqual(1);
});
});
82 changes: 57 additions & 25 deletions client/app/admin/main/main.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,36 @@ angular.module('linesPerBeatApp')
$scope.userList = $scope.mergeByProperty(userList, processList, 'username');
} catch(e) {
$materialToast({
template: e.message,
duration: 4000,
position: 'left bottom'
controller: 'ToastCtrl',
templateUrl: 'components/toast/toast.html',
position: 'bottom left',
locals: {
closeTime: 4000,
message: e.message
}
});
}
}).error(function (error) {
$materialToast({
template: error.message,
duration: 2000,
position: 'left bottom'
controller: 'ToastCtrl',
templateUrl: 'components/toast/toast.html',
position: 'bottom left',
locals: {
closeTime: 2000,
message: error.message
}
});
});
}).error(function (error) {
$materialToast({
template: error.message,
duration: 2000,
position: 'left bottom'
});
controller: 'ToastCtrl',
templateUrl: 'components/toast/toast.html',
position: 'bottom left',
locals: {
closeTime: 2000,
message: error.message
}
});
});
$scope.$on('deleteAccount', function (event, data) {
if($scope.userList) {
Expand Down Expand Up @@ -62,16 +74,24 @@ angular.module('linesPerBeatApp')
};
Adminservice.deleteProcess(processData).success(function (processResponse) {
$materialToast({
template: processResponse.message,
duration: 700,
position: 'left bottom'
controller: 'ToastCtrl',
templateUrl: 'components/toast/toast.html',
position: 'bottom left',
locals: {
closeTime: 700,
message: processResponse.message
}
});
$hideDialog();
}).error(function (error, statusCode){
$materialToast({
template: error.message,
duration: 2000,
position: 'left bottom'
controller: 'ToastCtrl',
templateUrl: 'components/toast/toast.html',
position: 'bottom left',
locals: {
closeTime: 2000,
message: error.message
}
});
if(statusCode === 401) {
$location.path('/login');
Expand All @@ -84,9 +104,13 @@ angular.module('linesPerBeatApp')
$scope.openDeleteModal = function(username, index, e) {
if(username === $window.localStorage.getItem('user')) {
$materialToast({
template: 'Can\'t delete your own account.',
duration: 2000,
position: 'left bottom'
controller: 'ToastCtrl',
templateUrl: 'components/toast/toast.html',
position: 'bottom left',
locals: {
closeTime: 2000,
message: 'Can\'t delete your own account.'
}
});
} else {
$materialDialog({
Expand All @@ -100,17 +124,25 @@ angular.module('linesPerBeatApp')
};
Adminservice.deleteAccount(userData).success(function (deleteResp) {
$materialToast({
template: deleteResp.message,
duration: 700,
position: 'left bottom'
controller: 'ToastCtrl',
templateUrl: 'components/toast/toast.html',
position: 'bottom left',
locals: {
closeTime: 700,
message: deleteResp.message
}
});
$rootScope.$broadcast('deleteAccount', {index: index});
$hideDialog();
}).error(function (error, statusCode) {
$materialToast({
template: error.message,
duration: 2000,
position: 'left bottom'
controller: 'ToastCtrl',
templateUrl: 'components/toast/toast.html',
position: 'bottom left',
locals: {
closeTime: 2000,
message: error.message
}
});
if(statusCode === 401) {
$location.path('/login');
Expand Down
6 changes: 3 additions & 3 deletions client/app/admin/main/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ <h2>{{user.username}}</h2>
<div class="material-tile-content">
</div>
<div class="material-tile-right">
<button type="button" id="adminButton" class="material-button material-theme-green" ng-show="user.admin">Admin</button>
<button type="button" class="material-button material-button-raised material-button-colored" ng-click="openProcessModal(user.pid, user.username, $event)" offline-disabled>Kill Process</button>
<button type="button" class="material-button material-button-raised material-theme-red" ng-click="openDeleteModal(user.username, $index, $event)" offline-disabled>Delete</button>
<material-button type="button" id="adminButton" class="material-button material-theme-green" ng-show="user.admin">Admin</material-button>
<material-button type="button" class="material-button material-button-raised material-button-colored" ng-click="openProcessModal(user.pid, user.username, $event)" offline-disabled>Kill Process</material-button>
<material-button type="button" class="material-button material-button-raised material-theme-red" ng-click="openDeleteModal(user.username, $index, $event)" offline-disabled>Delete</material-button>
</div>
</material-item>
<material-item ng-show="userList.length === 0" ng-cloak>
Expand Down
29 changes: 17 additions & 12 deletions client/app/admin/register/register.controller.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use strict';

angular.module('linesPerBeatApp')
.controller('AdminRegisterCtrl', ['$scope', 'Adminservice', '$rootScope', '$window', '$materialToast', '$location', function ($scope, Adminservice, $rootScope, $window, $materialToast, $location) {
$scope.register = function() {
angular.module('linesPerBeatApp').controller('AdminRegisterCtrl', ['$scope', 'Adminservice', '$rootScope', '$window', '$materialToast', '$location', function ($scope, Adminservice, $rootScope, $window, $materialToast, $location) {
$scope.register = function() {
var registerData = {
username: $scope.username,
password: $scope.password,
Expand All @@ -11,18 +10,24 @@ angular.module('linesPerBeatApp')
Adminservice.register(registerData).success(function (registerResp) {
$window.localStorage.setItem('user', $scope.username);
$materialToast({
template: registerResp.message,
duration: 700,
position: 'left bottom'
});
$rootScope.$emit('isLoggedIn', {value: true, user: $scope.username});
// TODO This redirect never lands because the $emit fires $watch which fires a $location.path as well to the root page.
controller: 'ToastCtrl',
templateUrl: 'components/toast/toast.html',
position: 'bottom left',
locals: {
closeTime: 1000,
message: registerResp.message
}
});
$location.path('/linkLastFm');
}).error(function (error) {
$materialToast({
template: error.message,
duration: 2000,
position: 'left bottom'
controller: 'ToastCtrl',
templateUrl: 'components/toast/toast.html',
position: 'bottom left',
locals: {
closeTime: 2000,
message: error.message
}
});
});
};
Expand Down
26 changes: 13 additions & 13 deletions client/app/admin/register/register.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<div>
<material-card>
<material-content>
<material-card flex>
<h2>Administrative Registration</h2>
<form ng-submit="register()" class="form-horizontal adminRegisterForm">
<div class="material-input-group material-input-group-theme-light">
<material-input-group class="material-input-group-theme-light">
<label>Username</label>
<input type="text" ng-model="username" required autofocus>
</div>
<div class="material-input-group material-input-group-theme-light">
<material-input type="text" ng-model="username" required autofocus>
</material-input-group>
<material-input-group class="material-input-group-theme-light">
<label>Password</label>
<input type="password" ng-model="password" required>
</div>
<div class="material-input-group material-input-group-theme-light">
<material-input type="password" ng-model="password" required>
</material-input-group>
<material-input-group class="material-input-group-theme-light">
<label>Confirm Password</label>
<input type="password" ng-model="confirmPassword" required>
</div>
<button type="submit" class="material-button material-button-raised material-button-colored">Submit</button>
<material-input type="password" ng-model="confirmPassword" required>
</material-input-group>
<material-button type="submit" class="material-button material-button-raised material-button-colored" offline-disabled>Submit</material-button>
</form>
</material-card>
</div>
</material-content>
12 changes: 8 additions & 4 deletions client/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,27 @@ angular.module('linesPerBeatApp', [
'ngResource',
'ngSanitize',
'ngRoute',
'ngAnimate',
'ngMaterial'
]).config(function ($routeProvider, $locationProvider) {
$routeProvider
.otherwise({
redirectTo: '/'
});

$locationProvider.html5Mode(true);
}).run(function (Adminservice, $materialToast, $rootScope, $location) {
var adminRoutes = ['/admin', '/admin/register'];
$rootScope.$on('$locationChangeStart', function (event) {
if(adminRoutes.indexOf($location.path()) !== -1) {
Adminservice.checkCookie().error(function (error) {
$materialToast({
template: error.message,
duration: 2000,
position: 'left bottom'
controller: 'ToastCtrl',
templateUrl: 'components/toast/toast.html',
position: 'bottom left',
locals: {
closeTime: 2000,
message: error.message
}
});
event.preventDefault();
$location.path('/login');
Expand Down
Loading

0 comments on commit 133646c

Please sign in to comment.