Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["es2015"]
}
65 changes: 65 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Created by https://www.gitignore.io/api/node

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
#Build Directory
build/

# End of https://www.gitignore.io/api/node
Empty file.
20 changes: 20 additions & 0 deletions app/component/gallery/create-gallery.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<section class="create-gallery">
<form name="createGalleryForm"
class="gallery-form"
ng-submit="createGalleryCtrl.createGallery()">

<fieldset>
<label for="name">name</label>
<input name="name" class="input-std" type="text"
ng-model="createGalleryCtrl.gallery.name" required>
</fieldset>

<fieldset>
<label for="desc"> description</label>
<input name="desc" class="input-std" type="text"
ng-model="createGalleryCtrl.gallery.desc" required>
</fieldset>

<button class="btn-std" type="submit"> create gallery</button>
</form>
</section>
21 changes: 21 additions & 0 deletions app/component/gallery/create-gallery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';

module.exports = {
template: require('./create-gallery.html'),
controller: ['$log', 'galleryService', CreateGalleryController],
controllerAs: 'createGalleryCtrl'
};

function CreateGalleryController($log, galleryService) {
$log.debug('CreateGalleryController');

this.gallery = {};

this.createGallery = function() {
galleryService.createGallery(this.gallery)
.then( () => {
this.gallery.name = null;
this.gallery.desc = null;
});
};
};
Empty file.
20 changes: 20 additions & 0 deletions app/component/gallery/create-gallery/create-gallery.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<section class="create-gallery">
<form name="createGalleryForm"
class="gallery-form"
ng-submit="createGalleryCtrl.createGallery()">

<fieldset>
<label for="name">name</label>
<input name="name" class="input-std" type="text"
ng-model="createGalleryCtrl.gallery.name" required>
</fieldset>

<fieldset>
<label for="desc"> description</label>
<input name="desc" class="input-std" type="text"
ng-model="createGalleryCtrl.gallery.desc" required>
</fieldset>

<button class="btn-std" type="submit"> create gallery</button>
</form>
</section>
21 changes: 21 additions & 0 deletions app/component/gallery/create-gallery/create-gallery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';

module.exports = {
template: require('./create-gallery.html'),
controller: ['$log', 'galleryService', CreateGalleryController],
controllerAs: 'createGalleryCtrl'
};

function CreateGalleryController($log, galleryService) {
$log.debug('CreateGalleryController');

this.gallery = {};

this.createGallery = function() {
galleryService.createGallery(this.gallery)
.then( () => {
this.gallery.name = null;
this.gallery.desc = null;
});
};
};
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
6 changes: 6 additions & 0 deletions app/component/landing/login/_login.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@import url('https://fonts.googleapis.com/css?family=Montserrat');

.landing {
font-size: 22px;
color: white;
};
31 changes: 31 additions & 0 deletions app/component/landing/login/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<section class="login-form">
<form
name="loginForm"
ng-submit="loginCtrl.login()" novalidate>
<div
ng-class="{
'error': loginForm.username.$invalid,
'success': loginForm.username.$valid
}">
<input type="text"
name="username"
placeholder="username"
ng-minlength="4"
ng-model="loginCtrl.user.username" required>
</div>

<div
ng-class="{
'error': loginForm.password.$invalid && loginForm.$submitted,
'success': loginForm.password.$valid
}">
<input type="password" name="password"
ng-disabled="loginForm.username.$invalid"
placeholder="password"
ng-minlength="3"
ng-model="loginCtrl.user.password" required>
</div>

<button class="btn-std">Login Here</button>
</form>
</section>
27 changes: 27 additions & 0 deletions app/component/landing/login/login.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use strict';

require('./_login.scss');

module.exports = {
template: require('./login.html'),
controller: ['$log', '$location', 'authService', LoginController],
controllerAs: 'loginCtrl'
};

function LoginController($log, $location, authService) {
$log.debug('LoginController');

authService.getToken()
.then( () => {
$location.url('/home');
});

this.login = function() {
$log.debug('loginCtrl.login');

authService.login(this.user)
.then( () => {
$location.url('/home');
});
};
};
Empty file.
25 changes: 25 additions & 0 deletions app/component/landing/signup/signup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<section class="signup">
<form class="signup-form"
ng-submit="signupCtrl.signup(signupCtrl.user)"
novalidate>

<input class="input-std"
type="text"
placeholder="name"
ng-minlength="4"
ng-model="signupCtrl.user.username" required>

<input class="input-std"
type="email"
placeholder="email"
ng-model="signupCtrl.user.email">

<input class="input-std"
type="password"
placeholder="password"
ng-minlength="3"
ng-model="signupCtrl.user.password" required>

<input type="submit" class="btn-std" value="sign up">
</form>
</section>
25 changes: 25 additions & 0 deletions app/component/landing/signup/signup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'use strict';

module.exports = {
template: require('./signup.html'),
controller: ['$log', '$location', 'authService', SignupController],
controllerAs: 'signupCtrl'
};

function SignupController($log, $location, authService) {
$log.debug('SignupController');

authService.getToken()
.then( () => {
$location.url('/home');
});

this.signup = function(user) {
$log.debug('signupCtrl.signup');

authService.signup(user)
.then( () => {
$location.url('/home')
});
};
};
Empty file.
9 changes: 9 additions & 0 deletions app/component/navbar/navbar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<section class="navbar">
<h2> cfgram </h2>

<nav>
<div ng-hide="navbarCtrl.hideButtons">
<button class="btn-std" ng-clic="navbarCtrl.logout()">logout</button>
</div>
</nav>
</section>
43 changes: 43 additions & 0 deletions app/component/navbar/navbar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
'use strict';

require('./_navbar.scss');

module.exports = {
template: require('./navbar.html'),
controller: ['$log', '$location', '$rootScope', 'authService', NavbarController],
controllerAs: 'navbarCtrl'
};

function NavbarController($log, $Location, $rootScope, authService) {
$log.debug('NavbarController');

this.checkPath = function() {
let path =$location.path();
if (path === '/join') {
this.hideButtons = true;
};

if (path !== '/join') {
this.hideButtons = false;
authService.getToken()
.catch( () => {
$locaton.url('/join#login');
});
};
};

this.checkPath();

$rootScope.$on('$locationChangeSuccess', () => {
this.checkPath();
});

this.logout = function () {
$log.log('navbarCtrl.logout');
this.hideButtons = true;
authService.logout()
.then( () => {
$location.url('/');
});
};
};
7 changes: 7 additions & 0 deletions app/config/log-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

module.exports = ['$logProvider', logConfig];

function logConfig($logProvider) {
$logProvider.debugEnabled(__DEBUG__);
};
30 changes: 30 additions & 0 deletions app/config/route-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use strict';

module.exports = ['$stateProvider', '$urlRouterProvider', routerConfig];

function routerConfig($stateProvider, $urlRouterProvider) {
$urlRouterProvider.when('', '/join#signup');
$urlRouterProvider.when('/', '/join#signup');
$urlRouterProvider.when('/signup', '/join#signup');
$urlRouterProvider.when('/login', '/join#login');

let states = [
{
name: 'home',
url: '/home',
template: require('../view/home/home.html'),
controller: 'HomeController',
controllerAs: 'homeCtrl'
},
{
name: 'landing',
url: '/join',
template: require('../view/landing/landing.html'),
controller: 'LandingController',
controllerAs: 'landingCtrl'
}
];
states.forEach( state => {
$stateProvider.state(state);
});
};
30 changes: 30 additions & 0 deletions app/config/router-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use strict';

module.exports = ['$stateProvider', '$urlRouterProvider', routerConfig];

function routerConfig($stateProvider, $urlRouterProvider) {
$urlRouterProvider.when('', '/join#signup');
$urlRouterProvider.when('/', '/join#signup');
$urlRouterProvider.when('/signup', '/join#signup');
$urlRouterProvider.when('/login', '/join#login');

let states = [
{
name: 'home',
url: '/home',
template: require('../view/home/home.html'),
controller: 'HomeController',
controllerAs: 'homeCtrl'
},
{
name: 'landing',
url: '/join',
template: require('../view/landing/landing.html'),
controller: 'LandingController',
controllerAs: 'landingCtrl'
}
];
states.forEach( state => {
$stateProvider.state(state);
});
};
Loading