Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MEAN Stack I - Lyle, Hollis (final) #18

Open
wants to merge 97 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
c45656c
write draft of semantic html
LyleCharlesScott Oct 6, 2015
fd662bd
Add initial file structure
hollislau Oct 6, 2015
c8445f9
add html for social media icon surrounding image
LyleCharlesScott Oct 6, 2015
730927e
Merge pull request #1 from hollislau/file-structure
LyleCharlesScott Oct 6, 2015
1fcf226
Merge branch 'master' of https://github.com/hollislau/mean-stack-1 in…
LyleCharlesScott Oct 6, 2015
403e2eb
Add main.css file
hollislau Oct 6, 2015
b173ee6
Merge pull request #2 from hollislau/ls-initial
hollislau Oct 6, 2015
022fe34
Add file placeholders
hollislau Oct 6, 2015
630b53a
refactor semantic elements in html
LyleCharlesScott Oct 6, 2015
60a98b7
Merge branch 'file-structure'
hollislau Oct 6, 2015
5dae46a
Merge pull request #4 from hollislau/file-structure
LyleCharlesScott Oct 6, 2015
52de00a
Merge branch 'master' of https://github.com/hollislau/mean-stack-1 in…
LyleCharlesScott Oct 6, 2015
f9e1886
Merge pull request #5 from hollislau/ls-initial
hollislau Oct 6, 2015
f7bba09
remove uneccessary parts of HTML, continue refactor
LyleCharlesScott Oct 6, 2015
9e72c73
Add utility files and icons to file structure
hollislau Oct 6, 2015
c5023c5
Merge pull request #6 from hollislau/ls-initial
hollislau Oct 6, 2015
144cc0d
Resolve merge conflicts
hollislau Oct 6, 2015
96063b7
Merge pull request #7 from hollislau/file-structure
LyleCharlesScott Oct 6, 2015
4625546
refactor header in main content article HTML, refactor social media i…
LyleCharlesScott Oct 6, 2015
27e4134
add variables for colors, small HTML modifications
LyleCharlesScott Oct 7, 2015
67aff48
Merge pull request #8 from hollislau/ls-initial
hollislau Oct 7, 2015
19fa88b
Add additional file structure and some component styling
hollislau Oct 7, 2015
380d4cd
Merge branch 'sass'
hollislau Oct 7, 2015
b4ea9f4
Merge pull request #9 from hollislau/sass
LyleCharlesScott Oct 7, 2015
b1525a2
commit before merge, expect package.json conflict
LyleCharlesScott Oct 7, 2015
764e60d
merge conflicts resolved
LyleCharlesScott Oct 7, 2015
0b515fa
create button presentation style
LyleCharlesScott Oct 7, 2015
20aa25b
Merge pull request #10 from hollislau/ls-initial
hollislau Oct 7, 2015
fc83500
Add variables for typography; add base and reset styles
hollislau Oct 7, 2015
61797b1
a lot of sass added to variables file
LyleCharlesScott Oct 7, 2015
83b00a9
Merge pull request #11 from hollislau/typography
LyleCharlesScott Oct 7, 2015
890e9a8
Merge branch 'master' into ls-initial
LyleCharlesScott Oct 7, 2015
aceacd8
last pull request successful, synchronizing
LyleCharlesScott Oct 7, 2015
8e291e9
Merge pull request #12 from hollislau/ls-initial
hollislau Oct 7, 2015
f8a0866
WIP continuing to format content with sass
LyleCharlesScott Oct 7, 2015
9496399
Add social icon components
hollislau Oct 7, 2015
9695a8c
WIP continuing to format content with sass
LyleCharlesScott Oct 8, 2015
dafe3fe
Merge branch 'master' into resolve-conflict
LyleCharlesScott Oct 8, 2015
4cdbd16
Add functioning express server and interactivity with mongodb
hollislau Oct 8, 2015
d803362
Merge branch 'master' into express
hollislau Oct 8, 2015
f51329c
Modify server.js file to remove unnecessary routing
hollislau Oct 8, 2015
7f4effa
Merge pull request #13 from hollislau/social-contacts
LyleCharlesScott Oct 8, 2015
5dc7a8f
WIP continuing to format content with sass
LyleCharlesScott Oct 8, 2015
687cb07
resolve merge conflicts
LyleCharlesScott Oct 8, 2015
4e26813
finish basic typesetting
LyleCharlesScott Oct 8, 2015
c300e5b
finish basic typesetting
LyleCharlesScott Oct 8, 2015
6301f52
most basic of angular app is working
LyleCharlesScott Oct 8, 2015
f98ca85
angular app working with an array of objects.
LyleCharlesScott Oct 8, 2015
479c20e
Merge pull request #14 from hollislau/resolve-conflict
hollislau Oct 8, 2015
6434dfd
Merge pull request #15 from hollislau/express
LyleCharlesScott Oct 8, 2015
e610d05
commit changes before merge to resolve conflicts
LyleCharlesScott Oct 8, 2015
d06288f
Merge branch 'master' of https://github.com/hollislau/mean-stack-1 in…
LyleCharlesScott Oct 8, 2015
9fbbdb7
resolve merge conflicts
LyleCharlesScott Oct 8, 2015
fb601e6
Merge pull request #16 from hollislau/angular
hollislau Oct 8, 2015
a691292
WIP refactor sass
LyleCharlesScott Oct 8, 2015
af081f7
try to make an input form
LyleCharlesScott Oct 9, 2015
ede1917
Modify file structure to align with best practices;
hollislau Oct 11, 2015
4c558d0
Modify file and gulp structure to split up gulp tasks;
hollislau Oct 11, 2015
c4bc83c
Add html to watch task
hollislau Oct 12, 2015
6df0263
contine trying to make form work, WIP. Add adjustments to layout
LyleCharlesScott Oct 12, 2015
aed6021
Add functionality to post to and make calls from database
hollislau Oct 12, 2015
9c17641
Add navigation back to home page
hollislau Oct 12, 2015
f1297f2
Merge pull request #17 from hollislau/angular-crud
LyleCharlesScott Oct 12, 2015
7c82b17
WIP add layout adjustments.
LyleCharlesScott Oct 12, 2015
3d24f42
Add compiled view files to gitignore
hollislau Oct 12, 2015
c627be4
Merge pull request #18 from hollislau/angular-crud
LyleCharlesScott Oct 12, 2015
cdca606
merge conflicts resolved
LyleCharlesScott Oct 12, 2015
f848ec3
Add editing and deleting functionality;
hollislau Oct 12, 2015
4d6aaa5
Merge pull request #19 from hollislau/angular-crud
LyleCharlesScott Oct 12, 2015
bd5a481
merge conflicts resolved. add formatting elements.
LyleCharlesScott Oct 12, 2015
1de6468
finish basic typesetting
LyleCharlesScott Oct 12, 2015
b5b300b
finish new typesetting for forms
LyleCharlesScott Oct 12, 2015
a8b954c
Add jshint and csslint gulp support
hollislau Oct 12, 2015
81f44c7
Remove public views folder to clean up Github repo
hollislau Oct 12, 2015
dd50295
Add public views folder to gitignore
hollislau Oct 12, 2015
63fcfd5
Resolve merge conflicts
hollislau Oct 12, 2015
fd9de78
Merge pull request #20 from hollislau/angular-merge
hollislau Oct 12, 2015
204e451
WIP add vendor prefixes.
LyleCharlesScott Oct 12, 2015
20a37a8
modify gitignore to remove public files from github
LyleCharlesScott Oct 12, 2015
8848c48
modify gitignore to remove public files from github
LyleCharlesScott Oct 12, 2015
60b6390
Merge branch 'master' into vendor-prefixing
LyleCharlesScott Oct 12, 2015
30fbaf7
modify gitignore to remove public files from github
LyleCharlesScott Oct 12, 2015
cbf3afa
modify gitignore to remove public files from github
LyleCharlesScott Oct 12, 2015
5103244
final updates to layout, linting
LyleCharlesScott Oct 12, 2015
88c5dcf
Merge pull request #21 from hollislau/angular-crud
LyleCharlesScott Oct 12, 2015
9cd2406
Merge branch 'master' of https://github.com/hollislau/mean-stack-1
LyleCharlesScott Oct 12, 2015
7378286
Merge branch 'master' into vendor-prefixing
LyleCharlesScott Oct 12, 2015
2496177
Merge pull request #22 from hollislau/vendor-prefixing
hollislau Oct 12, 2015
10172c0
Cleanup extraneous code and files;
hollislau Jan 28, 2016
4bdbb5e
Merge pull request #23 from hollislau/cleanup
hollislau Jan 28, 2016
a07c758
Remove blog comments functionality due to improper implementation;
hollislau Mar 3, 2016
3502803
Merge pull request #24 from hollislau/adjust-model
hollislau Mar 3, 2016
a71cdfc
Update readme file instructions for better clarity
hollislau Mar 3, 2016
fe4e2c8
Merge pull request #25 from hollislau/adjust-model
hollislau Mar 3, 2016
10d2e1a
Update readme file with app screenshots
hollislau Mar 3, 2016
5486285
Merge pull request #26 from hollislau/adjust-model
hollislau Mar 3, 2016
8c859aa
Update package.json with angular and node version;
hollislau Mar 28, 2016
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
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ coverage
# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Compiled files
public/js/main.js
public/css/main.css
public/views

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
.node-version
15 changes: 0 additions & 15 deletions assignment-rules.md

This file was deleted.

Binary file removed comps/[email protected]
Binary file not shown.
Binary file removed comps/[email protected]
Binary file not shown.
18 changes: 18 additions & 0 deletions gulp/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
var dest = "./public";
var src = "./src";

module.exports = {
javascript: {
entryPoint: src + "/app/entry.js",
src: src + "/app/**/*.js",
dest: dest + "/js/"
},
sass: {
src: src + "/sass/**/*.scss",
dest: dest + "/css/"
},
html: {
src: src + "/app/**/*.html",
dest: dest + "/views/",
},
};
9 changes: 9 additions & 0 deletions gulp/tasks/csslint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var gulp = require("gulp");
var config = require("../config").sass;
var csslint = require("gulp-csslint");

gulp.task("csslint", function () {
return gulp.src(config.dest + "**/*.css")
.pipe(csslint())
.pipe(csslint.reporter());
});
3 changes: 3 additions & 0 deletions gulp/tasks/default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var gulp = require("gulp");

gulp.task("default", ["sass", "html", "webpack", "watch", "jshint", "serve"]);
7 changes: 7 additions & 0 deletions gulp/tasks/html.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var gulp = require("gulp");
var config = require('../config').html;

gulp.task('html', function() {
return gulp.src(config.src)
.pipe(gulp.dest(config.dest));
});
10 changes: 10 additions & 0 deletions gulp/tasks/jshint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
var gulp = require("gulp");
var config = require("../config").javascript;
var jshint = require("gulp-jshint");
var stylish = require("jshint-stylish");

gulp.task("jshint", function () {
return gulp.src(config.src)
.pipe(jshint())
.pipe(jshint.reporter(stylish));
});
14 changes: 14 additions & 0 deletions gulp/tasks/sass.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var gulp = require('gulp');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var handleErrors = require('../util/handleErrors');
var config = require('../config').sass;

gulp.task('sass', function () {
return gulp.src(config.src)
.pipe(sourcemaps.init())
.pipe(sass())
.on('error', handleErrors)
.pipe(sourcemaps.write())
.pipe(gulp.dest(config.dest));
});
7 changes: 7 additions & 0 deletions gulp/tasks/serve.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var gulp = require("gulp");
var server = require("gulp-express");

gulp.task("serve", function () {
server.run(["server.js"]);
gulp.watch(["server.js"], [server.run]);
});
8 changes: 8 additions & 0 deletions gulp/tasks/watch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var gulp = require("gulp");
var config = require("../config");

gulp.task('watch', function() {
gulp.watch(config.html.src, ["html"]);
gulp.watch(config.javascript.src, ["webpack", "jshint"]);
gulp.watch(config.sass.src, ["sass"]);
});
13 changes: 13 additions & 0 deletions gulp/tasks/webpack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
var gulp = require("gulp");
var config = require("../config").javascript;
var webpack = require("webpack-stream");

gulp.task("webpack", function (callback) {
return gulp.src(config.entryPoint)
.pipe(webpack({
output: {
filename: "main.js",
}
}))
.pipe(gulp.dest(config.dest));
});
15 changes: 15 additions & 0 deletions gulp/util/handleErrors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var notify = require("gulp-notify");

module.exports = function () {

var args = Array.prototype.slice.call(arguments);

// Send error to notification center with gulp-notify
notify.onError({
title: "Compile Error",
message: "<%= error %>"
}).apply(this, args);

// Keep gulp from hanging on this task
this.emit("end");
};
17 changes: 17 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
gulpfile.js
===========
Rather than manage one giant configuration file responsible
for creating multiple tasks, each task has been broken out into
its own file in gulp/tasks. Any files in that directory get
automatically required below.

To add a new task, simply add a new task file that directory.
gulp/tasks/default.js specifies the default set of tasks to run
when you run `gulp`.
*/

var requireDir = require('require-dir');

// Require all tasks in gulp/tasks, including subfolders
requireDir('./gulp/tasks', { recurse: true });
Binary file added images/intelly_blog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/intelly_blog_form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/intelly_blog_list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/intelly_footer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/intelly_header.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions models/blog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"use strict";

var mongoose = require("mongoose");

var BlogSchema = new mongoose.Schema({
title: String,
content: String,
author: String,
date: String,
});

module.exports = mongoose.model("Blog", BlogSchema);
39 changes: 39 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "mean-stack-1",
"version": "1.0.0",
"description": "Intelly - a simple MEAN stack blog app",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/hollislau/mean-stack-1.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/hollislau/mean-stack-1/issues"
},
"homepage": "https://github.com/hollislau/mean-stack-1",
"dependencies": {
"angular": "1.4.x",
"angular-route": "^1.4.7",
"body-parser": "^1.14.1",
"express": "^4.13.3",
"gulp": "^3.9.0",
"gulp-csslint": "^0.2.0",
"gulp-express": "^0.3.5",
"gulp-jshint": "^1.11.2",
"gulp-notify": "^2.2.0",
"gulp-sass": "^2.0.4",
"gulp-sourcemaps": "^1.6.0",
"jshint-stylish": "^2.0.1",
"mongoose": "^4.1.10",
"require-dir": "^0.3.0",
"webpack-stream": "^2.1.1"
},
"engines": {
"node": "0.12.x"
}
}
Binary file added public/css/fonts/icomoon.eot
Binary file not shown.
16 changes: 16 additions & 0 deletions public/css/fonts/icomoon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/css/fonts/icomoon.ttf
Binary file not shown.
Binary file added public/css/fonts/icomoon.woff
Binary file not shown.
49 changes: 16 additions & 33 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,27 @@
# Week Six - MEAN Stack I
# Intelly Blog

Last week we focussed on JavaScript basics. This week we're going to build up a function web application. You'll be expected to build on knowledge you've already learned (semantic HTML, Sass instead of CSS, in addition to all of the Angular work we'll be doing) and produce a "production-ready" blog for your assignment this week.
A responsive, single-page blog app was reconstructed from a provided design comp using JavaScript, HTML5, Sass, and MEAN stack components. This simple app supports basic CRUD functionality and allows a user to read, post, edit, and delete blog entries.

We want this assignment to feel like a 'week on the job.' And by that we mean, we will provide a completed comp and an expected outcome specification. It is up to you to deliver on this project specification.
![Intelly Header](/images/intelly_header.png "Intelly Header")

## The Comp
![Intelly Blog List](/images/intelly_blog_list.png "Intelly Blog List")

You can download the view that you are to complete [here](https://github.com/SEA-Design-Dev/mean-stack-1/tree/master/comps). It is provided as a Photoshop format, if you do not have access to Photoshop, other applications like Pixelmator are able to open these layered files as well.
![Intelly Footer](/images/intelly_footer.png "Intelly Footer")

![Intelly Blog Detail](/images/intelly_blog.png "Intelly Blog Detail")

## The spec
![Intelly Blog Form](/images/intelly_blog_form.png "Intelly Blog Form")

As a product owner, I need a functional prototype of the application. The final prototype must be visible in a desktop browser.
## Instructions To Use The App:

Prototype is to use best practices in coding HTML/CSS as there is the potential that some or all of the code will made it into production.
*You must have Node.js, npm, and MongoDB installed locally.*

Aside from images as content, all visual assets should be produced via CSS or typography. The only background image asset allowed will be the main page header.
In the terminal:

The user should be able to create, read, update, and delete blog posts from the application. There should be at least two different views - one a list of available blog posts, the other a detail view of the blog post. You do not need to worry about authentication or user management for this assignment.
1. Clone this repository
2. Navigate to the root directory of the cloned repository
3. Run `npm install`
4. Start MongoDB
5. Run either `gulp` or `node server`

### Requirements

1. Semantically correct HTML is required as this will be the model for prod app integration
1. Think in terms of '*components*'; if all parts of the UI were lego blocks, who would you code that?
1. Images are to be cropped correctly and compression is to take performance into account
1. All CSS measurements should use elastic units unless a pixel specific unit is required for both mobile and desktop
1. JavaScript code is expected to be written cleanly and maintainably using the best practices covered during lectures
1. After checking out the repository, I must be able to run `npm install` and `gulp serve` in order to access the application locally
1. Write up a description for every plugin used (no limit, but you must justify them)
1. jQuery is not allowed. Angular's built-in DOM manipulation can manage most of what you'd need jQuery for.

### Constraints

1. Must work in all major browsers of latest versions;
* Desktop (IE Edge, Safari, Chrome and Firefox)
1. All interactions must be clearly functional
1. All code must pass HTML Tidy, CSS Lint, and JSHint.

__DO NOT__ fence yourself in with invisible constraints. Unless it is specifically listed and/or we discussed it in lecture, there is not an expectation to meet an objective that has not been set.

## The expectation

In this assignment, you should be able to demonstrate mastery over the basics of Angular as well as creating a simple CRUD application. We're looking for you to build on best practices that you've already learned (proper HTML and CSS) as well as incorporate the new practices discussed during the course of the week.
Open a web browser and view the app at **http://localhost:5000**.
104 changes: 104 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
"use strict";

var express = require("express");
var mongoose = require("mongoose");
var bodyParser = require("body-parser");
var app = express();
var router = express.Router();
var Blog = require("./models/blog");

mongoose.connect("mongodb://localhost/intelly");

app.set("port", (process.env.PORT || 5000));
app.use(bodyParser.json());

router.get("/", function (req, res) {
res.sendFile(__dirname + "/public/views/index.html");
});

app.use(express.static(__dirname + "/public"));
app.use("/", router);

// CREATE

var blogsRoute = router.route("/api/blogs");

blogsRoute.post(function (req, res) {
var blog = new Blog();

blog.title = req.body.title;
blog.content = req.body.content;
blog.author = req.body.author;
blog.date = req.body.date;

blog.save(function (err) {
if (err) {
res.send(err);
}

res.json(blog);
});
});

// READ

blogsRoute.get(function (req, res) {
Blog.find(function (err, blogs) {
if (err) {
res.send(err);
}

res.json(blogs);
});
});

var blogRoute = router.route("/api/blogs/:blog_id");

blogRoute.get(function (req, res) {
Blog.findById(req.params.blog_id, function (err, blog) {
if (err) {
res.send(err);
}

res.json(blog);
});
});

// UPDATE

blogRoute.put(function (req, res) {
Blog.findById(req.params.blog_id, function (err, blog) {
if (err) {
res.send(blog);
}

blog.title = req.body.title;
blog.content = req.body.content;
blog.author = req.body.author;
blog.date = req.body.date;

blog.save(function (err) {
if (err) {
res.send(err);
}

res.json(blog);
});
});
});

// DELETE

blogRoute.delete(function (req, res) {
Blog.findByIdAndRemove(req.params.blog_id, function(err) {
if (err) {
res.send(err);
}

res.json({ message: "Successfully removed blog." });
});
});

app.listen(app.get("port"), function() {
console.log("Express server is running on port", app.get("port"));
});
Loading