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 II with Github API - Lyle, Hollis (final) #19

Open
wants to merge 108 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 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
278ff5d
Replace mongodb and node read functionality with GitHub API;
hollislau Oct 15, 2015
b71ed58
Add detail view and pagination functionality
hollislau Oct 15, 2015
af4f04b
Merge pull request #1 from LyleCharlesScott/gist
LyleCharlesScott Oct 15, 2015
7c6067a
fix pagination bug, now cannot page lower than first page or higher t…
LyleCharlesScott Oct 15, 2015
14e0bc8
typeset pagination button locations to be consistent
LyleCharlesScott Oct 15, 2015
217a30f
Add create and delete functionality with gist API
hollislau Oct 15, 2015
c39ecfd
correct pagination button presentation
LyleCharlesScott Oct 15, 2015
a864525
add additional prev & next buttons on top, correct presentation of ot…
LyleCharlesScott Oct 15, 2015
318eea7
Add edit functionality with Gist API and remove mongodb dependency
hollislau Oct 15, 2015
ca75fe2
Merge pull request #2 from LyleCharlesScott/pagination
hollislau Oct 15, 2015
c7f5f97
Resolve merge conflicts
hollislau Oct 15, 2015
3ba513f
Remove unnecessary semicolon
hollislau Oct 15, 2015
7b0d4bf
Merge pull request #3 from LyleCharlesScott/gist
LyleCharlesScott Oct 15, 2015
58505cf
Add href and styling to social links
hollislau Oct 16, 2015
7a54c16
Add rootUrl variable to reduce repetitive code
hollislau Oct 16, 2015
7a74b78
Merge pull request #4 from LyleCharlesScott/gist
LyleCharlesScott Oct 16, 2015
3f42590
Modify readme to include instructions for adding a GitHub token to th…
hollislau Oct 16, 2015
54a1cb5
Merge pull request #5 from LyleCharlesScott/gist
LyleCharlesScott Oct 16, 2015
f9fb8b8
Modify readme to include instructions to locate API key
hollislau Oct 18, 2015
4965e9a
Merge pull request #6 from LyleCharlesScott/gist
hollislau Oct 18, 2015
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
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@ 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

# Angular config
src/app/token.js
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", "serve", "jshint"]);
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]);
});
9 changes: 9 additions & 0 deletions gulp/tasks/watch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
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"]);
// gulp.watch(config.sass.dest + "**/*.css", ["csslint"]);
});
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");
};
19 changes: 19 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
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 });


35 changes: 35 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"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.7",
"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",
"require-dir": "^0.3.0",
"webpack-stream": "^2.1.1"
}
}
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.
20 changes: 13 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# NOTE TO INSTRUCTORS FOR GRADING:

You will need Hollis' Github API token to make this app work properly. Please refer to the comments attached to his Canvas assignment to find it. Create a "token.js" file in the "src" directory and create a module.exports object with a property and value of "oauthToken" and the API key, respectively. Just run "npm install" followed by "gulp", and you should now be able to CRUD some sample blogs. Enjoy!



# Week Six - MEAN Stack I

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.
Expand All @@ -11,15 +17,15 @@ You can download the view that you are to complete [here](https://github.com/SEA

## The spec

As a product owner, I need a functional prototype of the application. The final prototype must be visible in a desktop browser.
As a product owner, I need a functional prototype of the application. The final prototype must be visible in a desktop browser.

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

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

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.

### Requirements
### 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?
Expand All @@ -30,15 +36,15 @@ The user should be able to create, read, update, and delete blog posts from the
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
### 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.
__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
## 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.
18 changes: 18 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"use strict";

var express = require("express");
var app = express();
var router = express.Router();

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

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

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

app.listen(app.get("port"), function() {
console.log("Express server is running on port", app.get("port"));
});
32 changes: 32 additions & 0 deletions src/app/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"use strict";

require("angular");
require("angular-route");

(function () {

var app = angular.module("intellyBlog", ["ngRoute"]);

app.config(["$routeProvider", function ($routeProvider) {
$routeProvider.when("/blogs", {
templateUrl: "views/blogs/blogs_list.html",
controller: "BlogsCtrl as vm",
})
.when("/blogs/new", {
templateUrl: "views/blog/blog_form.html",
controller: "BlogFormCtrl as vm",
})
.when("/blogs/:blog_id/edit", {
templateUrl: "views/blog/blog_form.html",
controller: "BlogFormCtrl as vm",
})
.when("/blogs/:blog_id", {
templateUrl: "views/blog/blog_detail.html",
controller: "BlogCtrl as vm",
})
.otherwise({
redirectTo: "/blogs",
});
}]);

})();
62 changes: 62 additions & 0 deletions src/app/blog/blog.ctrl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
"use strict";

require("../app.js");

(function () {

angular.module("intellyBlog").controller("BlogCtrl", ["BlogsService", "$routeParams", "$http", "$filter", "$log", "$q", "$location", function (BlogsService, $routeParams, $http, $filter, $log, $q, $location) {
var vm = this;

vm.delete = deleteBlog;

initialize();

function initialize() {
BlogsService
.get($routeParams.blog_id)
.then(successHandler, errorHandler);
}

function successHandler (resp) {
var data = resp.data;
var blogObj = data.files.blog;

$http
.get(blogObj.raw_url)
.then(function (resp) {
setBlogInfo(data, resp.data);
}, function (resp) {
$log.error("Could not request " + blogObj.raw_url, resp);
});

$log.info("read", resp);
}

function errorHandler (resp) {
vm.error = resp.data;
$log.error("Could not read " + resp);
}

function setBlogInfo (gist, content) {
vm.blog = {
title: gist.description,
content: content,
author: gist.owner.login,
date: $filter("date")(gist.updated_at),
comments: gist.comments + " comments",
id: gist.id
};
}

function deleteBlog (blog) {
BlogsService.delete(blog).then(function (resp) {
$location.path("/blogs");
$log.info("deleted", resp);
}, function (resp) {
$log.error("Could not delete " + resp);
});
}

}]);

})();
Loading