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 lab-khalid/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": "es2015"
}
21 changes: 21 additions & 0 deletions lab-khalid/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"rules": {
"no-console": "off",
"indent": [ "error", 2 ],
"quotes": [ "error", "single" ],
"semi": ["error", "always"],
"linebreak-style": [ "error", "unix" ]
},
"env": {
"es6": true,
"node": true,
"mocha": true,
"jasmine": true
},
"ecmaFeatures": {
"modules": true,
"experimentalObjectRestSpread": true,
"impliedStrict": true
},
"extends": "eslint:recommended"
}
33 changes: 33 additions & 0 deletions lab-khalid/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Created by https://www.gitignore.io/api/node,vim,macos,linux,windows
.DS_Store
node_modules/
.env
### Node ###
# Logs
logs
*.log
npm-debug.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

# node-waf configuration
.lock-wscript


.env
1 change: 1 addition & 0 deletions lab-khalid/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<section class="create-gallery">
<form name="createGalleryForm"
ng-submit="createGalleryCtrl.createGallery()">

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

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

<button class="btn-std">create</button>
</form>
</section>
22 changes: 22 additions & 0 deletions lab-khalid/app/component/gallery/create-gallery/create-gallery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'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.
16 changes: 16 additions & 0 deletions lab-khalid/app/component/gallery/edit-gallery/edit-gallery.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<section>
<form name="editGallery" class="edit-gallery" ng-submit="editGalleryCtrl.updateGallery()" novalidate>

<fieldset>
<span class="item-label"> name: </span>
<input type="text" name="name" ng-model="editGalleryCtrl.gallery.name">
</fieldset>

<fieldset>
<span>desciption: </span>
<input type="text" name="desc" ng-model="editGalleryCtrl.gallery.desc">
</fieldset>

<button> update </button>
</form>
</section>
19 changes: 19 additions & 0 deletions lab-khalid/app/component/gallery/edit-gallery/edit-gallery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

module.exports = {
template: require('./edit-gallery.html'),
controller: ['$log', 'galleryService', EditGalleryController],
controllerAs: 'editGalleryCtrl',
bindings: {
gallery:'<'
}
};

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

this.updateGallery = function(){
$log.debug('EditGalleryController.updateGallery');
galleryService.updateGallery(this.gallery._id, this.gallery);
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.gallery-item{
background-color: crimson;
}
21 changes: 21 additions & 0 deletions lab-khalid/app/component/gallery/gallery-item/gallery-item.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<li class="gallery-item">
<div class="current-item" ng-if="!galleryItemCtrl.showEditGallery">
<div>
<span class="item-label">name:</span>
<span>{{ galleryItemCtrl.gallery.name }}</span>
</div>

<div>
<span class="item-label">description:</span>
<span>{{ galleryItemCtrl.gallery.desc }}</span>
</div>
</div>

<edit-gallery ng-if="galleryItemCtrl.showEditGallery" gallery="galleryItemCtrl.gallery"></edit-gallery>

<span
ng-click="galleryItemCtrl.showEditGallery = !galleryItemCtrl.showEditGallery">
edit
</span>
<span ng-click="galleryItemCtrl.deleteGallery()">delete</span>
</li>
22 changes: 22 additions & 0 deletions lab-khalid/app/component/gallery/gallery-item/gallery-item.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';

require('./_gallery-item.scss');

module.exports = {
template: require('./gallery-item.html'),
controller: ['$log', 'galleryService', GalleryItemController],
controllerAs: 'galleryItemCtrl',
bindings: {
gallery: '<'
}
};

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

this.showEditGallery = false;

this.deleteGallery = function(){
galleryService.deleteGallery(this.gallery._id);
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<dev class="thumbnail-container">
<h3>{{ thumbnailContainerCtrl.gallery.name }}</h3>
<upload-pic gallery="thumbnailContainerCtrl.gallery"></upload-pic>

<div class="thumbs">
<thumbnail ng-repeat="item in thumbnailContainerCtrl.gallery.pics" pic="item"></thumbnail>
</div>
</dev>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use strict';

require('./_thumbnail-container.scss');

module.exports = {
template: require('./thumbnail-container.html'),
controllerAs: 'thumbnailContainerCtrl',
bindings: {
gallery: '<'
}
};

//finish maybe
Empty file.
5 changes: 5 additions & 0 deletions lab-khalid/app/component/gallery/thumbnail/thumbnail.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div>
<img ng-src="{{ thumbnailCtrl.pic.imageURI }}" alt="{thumbnailCtrl.pic.desc}">
<span ng-click="thumbnailCtrl.deletePic()">delete</span>
<!-- TODO: build out the delete service/controller methods -->
</div>
24 changes: 24 additions & 0 deletions lab-khalid/app/component/gallery/thumbnail/thumbnail.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict';


require('./_thumbnail.scss');

module.exports = {
template: require('./thumbnail.html'),
controller: ['$log', 'picService', ThumbnailController],
controllerAs: 'thumbnailCtrl',
bindings: {
pic: '<'
}
};

function ThumbnailController($log, picService){
$log.debug('ThumbnailController');

this.deletePic = function(){
$log.debug('thumbnailCtrl.deletePic');
};

}

//finish
Empty file.
25 changes: 25 additions & 0 deletions lab-khalid/app/component/gallery/upload-pic/upload-pic.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<section class="upload-pic">
<form
ng-submit="uploadPicCtrl.uploadPic()" novalidate>

<h3>upload a new pic</h3>

<fieldset>
<input type="text" ng-model="uploadPicCtrl.pic.name" placeholder="name">
<input type="text" ng-model="uploadPicCtrl.pic.desc" placeholder="desc">
</fieldset>

<div>
<p class="grab-img"
ngf-select
ng-model="uploadPicCtrl.pic.file">
======================\n
select a pic to upload\n
======================
</p>

<button>upload</button>
</div>

</form>
</section>
29 changes: 29 additions & 0 deletions lab-khalid/app/component/gallery/upload-pic/upload-pic.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use sthis.pic.name = null;rict';

require('./_upload-pic.scss');

module.exports = {
template: require('./upload-pic.html'),
controller: [ '$log', 'picService', UploadPicController],
controllerAs: 'uploadPicCtrl',
bindings: {
gallery: '<'
}
};


function UploadPicController($log, picService){
$log.debug('uploadPicController');

this.pic = {};

this.uploadPic = function(){
picService.uploadGalleryPic(this.gallery, this.pic)
.then( () => {
this.pic.name = null;
this.pic.desc = null;
this.pic.file = null;
});
};

}
Empty file.
26 changes: 26 additions & 0 deletions lab-khalid/app/component/landing/login/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<section class="login-form">
<form name="loginForm" action="" ng-submit="loginCtrl.login()" novalidate>
<legend>sign in</legend>
<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="loginForm.user.password" required>
</div>
<button class="btn-std"> sign in </button>
</form>
</section>
27 changes: 27 additions & 0 deletions lab-khalid/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');
});
};
}
Loading