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-sarah/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["es2015"]
}
2 changes: 2 additions & 0 deletions lab-sarah/.coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
service_name: travis-ci
repo_token: UZF6NYyHYhqQjOFw7vdYhJchfWBZIrCZU
5 changes: 5 additions & 0 deletions lab-sarah/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/node_modules/*
**/vendor/*
**/*.min.js
**/coverage/*
**/build/*
31 changes: 31 additions & 0 deletions lab-sarah/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"rules": {
"no-console": "off",
"indent": [ "error", 2 ],
"semi": ["error", "always"],
"linebreak-style": [ "error", "unix" ],
"comma-dangle": ["error", "always-multiline"],
"quotes": ["error", "single", { "allowTemplateLiterals": true }]
},
"env": {
"es6": true,
"node": true,
"mocha": true,
"jasmine": true
},
"globals": {
"angular": true,
"window": false,
"__API_URL__": false,
"__GOOGLE_CLIENT_ID__": false,
"__DEBUG__": false,
"document": false,
"__TITLE__": false
},
"ecmaFeatures": {
"modules": true,
"experimentalObjectRestSpread": true,
"impliedStrict": true
},
"extends": "eslint:recommended"
}
132 changes: 132 additions & 0 deletions lab-sarah/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# sarahgram ignore
db
*.env
data/*
coverage
html-report
client-test
# Created by https://www.gitignore.io/api/osx,vim,linux,windows,node

### OSX ###
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk


### Vim ###
# swap
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
# session
Session.vim
# temporary
.netrwhist
*~
# auto-generated tag files
tags


### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*


### Windows ###
# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk


### 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

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

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz
20 changes: 20 additions & 0 deletions lab-sarah/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
language: node_js
node_js:
- '4.4.3'
services:
- mongodb
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.8
- g++-4.8
env:
- CXX=g++-4.8
sudo: required
before_script: npm i
after_success: 'npm run coveralls'
script:
- npm test
- npm run lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@import "theme";


form {
width: 10px;
margin: auto;
margin-top: 20px;
}
29 changes: 29 additions & 0 deletions lab-sarah/app/component/gallery/create-gallery/create-gallery.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<section class="create-gallery-container">
<form name="createGalleryForm"
class="form-inline"
novalidate
ng-submit="createGalleryCtrl.createGallery()">

<div class="form-group">
<label for="name"> Name: </label>
<input name="name"
class="form-control"
type="text"
uib-tooltip="name required"
ng-model="createGalleryCtrl.gallery.name"
required>
</div>

<div class="form-group">
<label for="desc"> Description: </label>
<input name="desc"
class="form-control"
type="text"
uib-tooltip="description required"
ng-model="createGalleryCtrl.gallery.desc"
required>
</div>

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

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

//only the create-gallery template has access to this controller. each controller only has access to the one view created by the template
function CreateGalleryController($log, galleryService){
$log.debug('init createGalleryCtrl');
//this.gallery is a single gallery object created when the user inputs a name and description, which then changes the ng-model createGalleryCtrl.gallery.name/desc, so this.gallery becomes the gallery the user inputted
this.gallery = {};

//create method called createGallery on the instance of the CreateGallery Controller, and within this method, call the galleryService.createGallery method
this.createGallery = function() {
//this is what happens when + is pressed
galleryService.createGallery(this.gallery)
.then(() => {
//clear out the form fields
this.gallery.name = null;
this.gallery.desc = null;
});

};
}
20 changes: 20 additions & 0 deletions lab-sarah/app/component/gallery/edit-gallery/edit-gallery.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<div>
<form
class="edit-gallery"
name="editGallery"
ng-submit="editGalleryCtrl.updateGallery()"
novalidate>
<div class="form-group">
<label for="name"> Name: </label>
<input name="name" class="form-control" ng-model="editGalleryCtrl.gallery.name">
</div>

<div class="form-group">
<label for="desc"> Description: </label>
<input name="desc" class="form-control" ng-model="editGalleryCtrl.gallery.desc">
</div>

<button class="btn btn-warning"> Update </button>
</form>

</div>
18 changes: 18 additions & 0 deletions lab-sarah/app/component/gallery/edit-gallery/edit-gallery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';

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

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

this.updateGallery = function(){
galleryService.updateGallery(this.gallery, this.gallery._id);
};
}
24 changes: 24 additions & 0 deletions lab-sarah/app/component/gallery/gallery-li/_gallery-li.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@import "theme";


.gallery-li {
margin: 2%;
padding: 2%;

.glyphicons {
display: flex;
flex-direction: row;

span {
margin: 0% .5%;
}
}

h3, p {
text-align: left;
}

hr {
width: 80%;
}
}
10 changes: 10 additions & 0 deletions lab-sarah/app/component/gallery/gallery-li/gallery-li.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<li class="gallery-li">
<h3> Name: {{ galleryLICtrl.gallery.name }} </h3>
<h4> Description: {{ galleryLICtrl.gallery.desc }} </p>
<div class="glyphicons">
<button ng-click="galleryLICtrl.showEditGallery = !galleryLICtrl.showEditGallery" class="glyphicon glyphicon-pencil" > </button>
<button ng-click="galleryLICtrl.deleteGallery()" class="glyphicon glyphicon-trash"> </button>
</div>
<edit-gallery ng-if="galleryLICtrl.showEditGallery" gallery="galleryLICtrl.gallery"> </edit-gallery>
<hr>
</li>
29 changes: 29 additions & 0 deletions lab-sarah/app/component/gallery/gallery-li/gallery-li.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use strict';

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

module.exports = {
template: require('./gallery-li.html'),
controller: ['$log', 'galleryService', GalleryLIController],
controllerAs: 'galleryLICtrl',
bindings: {
gallery: '<',
deleteDone: '&',
},
};

function GalleryLIController($log, galleryService){
$log.debug('init galleryLICtrl');

this.showEditGallery = false;

this.deleteGallery = function(){
galleryService.deleteGallery(this.gallery._id)
.then(() => {
//deleteDone was defined in a separate controller and passed in using &
//when deletedone was originally defined, took in one argument, an object. But here it takes in an object with a galleryData property, so it is different. Gets changed in the home.html template
//galleryData corresponds to the parameter passed in to delete-done in home.html
this.deleteDone({galleryData: this.gallery});
});
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@import "theme";

.thumbnail-container {
display: flex;
flex-direction: row;
width: 40%;

thumbnail {
width: 40%;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<div class="thumbnail-container">
<h2> {{thumbnailContainerCtrl.gallery.name}} </h2>
<upload-pic gallery="thumbnailContainerCtrl.gallery"></upload-pic>
<searchbar
search-assets="search by name"
search-term="homeCtrl.pictureNameSearchTerm"></searchbar>
<searchbar
search-assets="search by description"
search-term="homeCtrl.pictureDescSearchTerm"></searchbar>
<thumbnail gallery="thumbnailContainerCtrl.gallery" ng-repeat="item in thumbnailContainerCtrl.gallery.pics | searchFilter : homeCtrl.pictureNameSearchTerm : homeCtrl.pictureDescSearchTerm" pic="item">
</thumbnail>
</div>
Loading