Skip to content

Commit

Permalink
Use SASS instead of CSS + Complete ReFormat + Update Dependecies + Ad…
Browse files Browse the repository at this point in the history
…ded several missing semicolons + Several smaller changes
  • Loading branch information
gevalo1 committed Dec 13, 2016
1 parent a5ebe9b commit 25993b1
Show file tree
Hide file tree
Showing 48 changed files with 1,971 additions and 1,739 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
WebApps 3: Project
WebApps: Project
=

Drawing Web Application
Expand All @@ -14,6 +14,7 @@ Features:
* Authentication (& sessions)
* Custom colors
* Custom brush size
* Change Canvas Background color
* Clear the Canvas
* Home Page showing several saved drawings
* More to come...
Expand Down
10 changes: 5 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const server = http.createServer(app);
const io = require('socket.io').listen(server);

const mongoose = require('mongoose'),
db = mongoose.connection,
User = require('./server/models/user');
db = mongoose.connection,
User = require('./server/models/user');

mongoose.Promise = global.Promise;
mongoose.connect('mongodb://localhost/draw');
Expand Down Expand Up @@ -62,9 +62,9 @@ io.on('connection', (socket) => {
socket.on('clearCanvas', () => {
socket.broadcast.emit('clearCanvas');
});
socket.on('bgColorChange', (bgColor) => {
socket.broadcast.emit('bgColorChange', {bgColor});
});
socket.on('bgColorChange', (bgColor) => {
socket.broadcast.emit('bgColorChange', {bgColor});
});
});

// catch 404 and forward to error handler
Expand Down
25 changes: 12 additions & 13 deletions client/app/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// Import our app config files
import constants from './config/app.constants';
import appConfig from './config/app.config';
Expand All @@ -9,7 +8,7 @@ import './config/app.templates';
import './layout';
import './components';
import './home';
import './services'
import './services';
import './auth';
import './canvas';
//development
Expand All @@ -18,16 +17,16 @@ import './canvas';

// Create and bootstrap application
const requires = [
'ui.router',
'templates',
'app.layout',
'app.components',
'app.home',
'app.services',
'app.auth',
'app.canvas',
'ngMaterial',
'ngSanitize'
'ui.router',
'templates',
'app.layout',
'app.components',
'app.home',
'app.services',
'app.auth',
'app.canvas',
'ngMaterial',
'ngSanitize'
];

// Mount on window for testing
Expand All @@ -40,5 +39,5 @@ angular.module('app').config(appConfig);
angular.module('app').run(appRun);

angular.bootstrap(document, ['app'], {
strictDi: true
strictDi: true
});
53 changes: 27 additions & 26 deletions client/app/auth/auth.config.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
function AuthConfig($stateProvider, $httpProvider) {
'ngInject';
'ngInject';

// Define the routes
$stateProvider
// Define the routes
$stateProvider

.state('app.login', {
url: '/login',
controller: 'AuthCtrl as $ctrl',
templateUrl: 'auth/auth.html',
title: 'Sign in',
resolve: {
auth: (User) => {
return User.ensureAuthIs(false);
}
}
})
.state('app.login', {
url: '/login',
controller: 'AuthCtrl as $ctrl',
templateUrl: 'auth/auth.html',
title: 'Sign in',
resolve: {
auth: (User) => {
return User.ensureAuthIs(false);
}
}
})

.state('app.register', {
url: '/register',
controller: 'AuthCtrl as $ctrl',
templateUrl: 'auth/auth.html',
title: 'Sign up',
resolve: {
auth: (User) => {
return User.ensureAuthIs(false);
}
}
});
.state('app.register', {
url: '/register',
controller: 'AuthCtrl as $ctrl',
templateUrl: 'auth/auth.html',
title: 'Sign up',
resolve: {
auth: (User) => {
return User.ensureAuthIs(false);
}
}
});

}

};
AuthConfig.$inject = ["$stateProvider", "$httpProvider"]; //Explicit annotation needed!

export default AuthConfig;
49 changes: 24 additions & 25 deletions client/app/auth/auth.controller.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
class AuthCtrl {
constructor(User, $state) {
'ngInject';

this._User = User;
this._$state = $state;

this.title = $state.current.title;
this.authType = $state.current.name.replace('app.', '');

}

submitForm() {

this.isSubmitting = true;

this._User.attemptAuth(this.authType, this.formData).then(
(res) => {
this._$state.go('app.home');
},
(err) => {
this.isSubmitting = false;
this.errors = err.data;
}
);
}
constructor(User, $state) {
'ngInject';

this._User = User;
this._$state = $state;

this.title = $state.current.title;
this.authType = $state.current.name.replace('app.', '');

}

submitForm() {

this.isSubmitting = true;

this._User.attemptAuth(this.authType, this.formData).then(
(res) => {
this._$state.go('app.home');
},
(err) => {
this.isSubmitting = false;
this.errors = err.data;
});
}

}

Expand Down
82 changes: 41 additions & 41 deletions client/app/auth/auth.html
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
<div class="auth-page">
<div class="row">
<div class="auth-header">
<ul>
<li class="nav-item canvas-button">
<a class="nav-link"
ui-sref-active="active"
ui-sref="app.home">
Home
</a>
</li>
<h1 class="auth-title" ng-bind="::$ctrl.title"></h1>
<div class="block"></div>
</ul>
</div>
<div class="auth-header">
<ul>
<li class="nav-item canvas-button">
<a class="nav-link"
ui-sref-active="active"
ui-sref="app.home">
Home
</a>
</li>
<h1 class="auth-title" ng-bind="::$ctrl.title"></h1>
<div class="block"></div>
</ul>

</div>
<p>
<a ui-sref="app.login" ng-show="$ctrl.authType === 'register'">
Have an account?
</a>
<a ui-sref="app.register" ng-show="$ctrl.authType === 'login'">
Need an account?
</a>
<a ui-sref="app.login" ng-show="$ctrl.authType === 'register'">
Have an account?
</a>
<a ui-sref="app.register" ng-show="$ctrl.authType === 'login'">
Need an account?
</a>
</p>

<p class="auth-error">{{$ctrl.errors}}</p>

<form name="authForm" novalidate ng-submit="$ctrl.submitForm()" id="authForm">
<fieldset ng-disabled="$ctrl.isSubmitting">
<p class="auth-error">{{$ctrl.errors}}</p>

<form name="authForm" novalidate ng-submit="$ctrl.submitForm()" id="authForm">
<fieldset ng-disabled="$ctrl.isSubmitting">

<input class="auth-input"
type="text"
placeholder="Username"
ng-model="$ctrl.formData.username"
ng-pattern="/^([A-Za-z0-9\-\_]{3,16}$)+$/" ng-required="$ctrl.authType === 'register'" ng-show="$ctrl.authType === 'register'"/>
<input class="auth-input"
type="text"
placeholder="Username"
ng-model="$ctrl.formData.username"
ng-pattern="/^([A-Za-z0-9\-\_]{3,16}$)+$/" ng-required="$ctrl.authType === 'register'" ng-show="$ctrl.authType === 'register'"/>

<input class="auth-input"
type="email"
placeholder="Email"
ng-model="$ctrl.formData.email" required/>
<input class="auth-input"
type="email"
placeholder="Email"
ng-model="$ctrl.formData.email" required/>

<input class="auth-input"
type="password"
placeholder="Password"
ng-model="$ctrl.formData.password" required/>
<input class="auth-input"
type="password"
placeholder="Password"
ng-model="$ctrl.formData.password" required/>

<md-button class="authSubmit md-raised" type="submit" ng-bind="$ctrl.title" ng-disabled="authForm.$invalid" aria-label="auth"/>
</fieldset>
</form>
</div>
<md-button class="authSubmit md-raised" type="submit" ng-bind="$ctrl.title" ng-disabled="authForm.$invalid" aria-label="auth"/>
</fieldset>
</form>
</div>
</div>
29 changes: 15 additions & 14 deletions client/app/canvas/canvas.config.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
function CanvasConfig($stateProvider) {
'ngInject';
'ngInject';

$stateProvider
.state('app.canvas', {
url: '/canvas',
controller: 'CanvasCtrl as $ctrl',
templateUrl: 'canvas/canvas.html',
title: 'Canvas',
resolve: {
auth: function(User) {
return User.ensureAuthIs(true);
}
}
});
$stateProvider
.state('app.canvas', {
url: '/canvas',
controller: 'CanvasCtrl as $ctrl',
templateUrl: 'canvas/canvas.html',
title: 'Canvas',
resolve: {
auth: function (User) {
return User.ensureAuthIs(true);
}
}
});

}

};
CanvasConfig.$inject = ["$stateProvider"]; //Explicit annotation needed!

export default CanvasConfig;
Loading

0 comments on commit 25993b1

Please sign in to comment.