Skip to content

Commit

Permalink
code clean up, re-deployed
Browse files Browse the repository at this point in the history
  • Loading branch information
mau11 committed Jan 26, 2017
1 parent 8f039a5 commit f75de26
Show file tree
Hide file tree
Showing 19 changed files with 344 additions and 222 deletions.
181 changes: 181 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
# Contributing

## General Workflow

1. Fork the repo
1. Create a feature branch from master:
- bug/...
- feat/...
- test/...
- doc/...
- refactor/...
1. Make commits to your feature branch. Prefix each commit like so:
- (feat) Added a new feature
- (fix) Fixed inconsistent tests [Fixes #0]
- (refactor) ...
- (cleanup) ...
- (test) ...
- (doc) ...
1. When you've finished with your fix or feature, Rebase upstream changes into your branch. submit a [pull request][]
directly to master. Include a description of your changes.
1. Your pull request will be reviewed by another maintainer. The point of code
reviews is to help keep the codebase clean and of high quality and, equally
as important, to help you grow as a programmer. If your code reviewer
requests you make a change you don't understand, ask them why.
1. Fix any issues raised by your code reviwer, and push your fixes as a single
new commit.
1. Once the pull request has been reviewed, it will be merged by another member of the team. Do not merge your own commits.

## Detailed Workflow

### Fork the repo

Use github’s interface to make a fork of the repo, then add that repo as an upstream remote:

```
git remote add upstream https://github.com/reactorcore/<NAME_OF_REPO>.git
```

### Cut a namespaced feature branch from master

Your branch should follow this naming convention:
- bug/...
- feat/...
- test/...
- doc/...
- refactor/...

These commands will help you do this:

``` bash

# Creates your branch and brings you there
git checkout -b `your-branch-name`
```

### Make commits to your feature branch.

Prefix each commit like so
- (feat) Added a new feature
- (fix) Fixed inconsistent tests [Fixes #0]
- (refactor) ...
- (cleanup) ...
- (test) ...
- (doc) ...

Make changes and commits on your branch, and make sure that you
only make changes that are relevant to this branch. If you find
yourself making unrelated changes, make a new branch for those
changes.

#### Commit Message Guidelines

- Commit messages should be written in the present tense; e.g. "Fix continuous
integration script".
- The first line of your commit message should be a brief summary of what the
commit changes. Aim for about 70 characters max. Remember: This is a summary,
not a detailed description of everything that changed.
- If you want to explain the commit in more depth, following the first line should
be a blank line and then a more detailed description of the commit. This can be
as detailed as you want, so dig into details here and keep the first line short.

### Rebase upstream changes into your branch

Once you are done making changes, you can begin the process of getting
your code merged into the main repo. Step 1 is to rebase upstream
changes to the master branch into yours by running this command
from your branch:

```bash
git pull --rebase upstream master
```

This will start the rebase process. You must commit all of your changes
before doing this. If there are no conflicts, this should just roll all
of your changes back on top of the changes from upstream, leading to a
nice, clean, linear commit history.

If there are conflicting changes, git will start yelling at you part way
through the rebasing process. Git will pause rebasing to allow you to sort
out the conflicts. You do this the same way you solve merge conflicts,
by checking all of the files git says have been changed in both histories
and picking the versions you want. Be aware that these changes will show
up in your pull request, so try and incorporate upstream changes as much
as possible.

You pick a file by `git add`ing it - you do not make commits during a
rebase.

Once you are done fixing conflicts for a specific commit, run:

```bash
git rebase --continue
```

This will continue the rebasing process. Once you are done fixing all
conflicts you should run the existing tests to make sure you didn’t break
anything, then run your new tests (there are new tests, right?) and
make sure they work also.

If rebasing broke anything, fix it, then repeat the above process until
you get here again and nothing is broken and all the tests pass.

### Make a pull request

Make a clear pull request from your fork and branch to the upstream master
branch, detailing exactly what changes you made and what feature this
should add. The clearer your pull request is the faster you can get
your changes incorporated into this repo.

At least one other person MUST give your changes a code review, and once
they are satisfied they will merge your changes into upstream. Alternatively,
they may have some requested changes. You should make more commits to your
branch to fix these, then follow this process again from rebasing onwards.

Once you get back here, make a comment requesting further review and
someone will look at your code again. If they like it, it will get merged,
else, just repeat again.

Thanks for contributing!

### Guidelines

1. Uphold the current code standard:
- Keep your code [DRY][].
- Apply the [boy scout rule][].
- Follow [STYLE-GUIDE.md](STYLE-GUIDE.md)
1. Run the [tests][] before submitting a pull request.
1. Tests are very, very important. Submit tests if your pull request contains
new, testable behavior.
1. Your pull request is comprised of a single ([squashed][]) commit.

## Checklist:

This is just to help you organize your process

- [ ] Did I cut my work branch off of master (don't cut new branches from existing feature brances)?
- [ ] Did I follow the correct naming convention for my branch?
- [ ] Is my branch focused on a single main change?
- [ ] Do all of my changes directly relate to this change?
- [ ] Did I rebase the upstream master branch after I finished all my
work?
- [ ] Did I write a clear pull request message detailing what changes I made?
- [ ] Did I get a code review?
- [ ] Did I make any requested changes from that code review?

If you follow all of these guidelines and make good changes, you should have
no problem getting your changes merged in.


<!-- Links -->
[style guide]: https://github.com/reactorcore/style-guide
[n-queens]: https://github.com/reactorcore/n-queens
[Underbar]: https://github.com/reactorcore/underbar
[curriculum workflow diagram]: http://i.imgur.com/p0e4tQK.png
[cons of merge]: https://f.cloud.github.com/assets/1577682/1458274/1391ac28-435e-11e3-88b6-69c85029c978.png
[Bookstrap]: https://github.com/hackreactor/bookstrap
[Taser]: https://github.com/hackreactor/bookstrap
[tools workflow diagram]: http://i.imgur.com/kzlrDj7.png
[Git Flow]: http://nvie.com/posts/a-successful-git-branching-model/
[GitHub Flow]: http://scottchacon.com/2011/08/31/github-flow.html
[Squash]: http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
[![Build Status](https://travis-ci.org/mau11/emanie.svg?branch=master)](https://travis-ci.org/mau11/emanie)

# Emanie

> An online community for yarn crafters.
Expand Down
3 changes: 2 additions & 1 deletion components/Container.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export default class Container extends React.Component {
}
return (
<div>
<h1><i>Emanie</i></h1>
<h1><i>Emanie</i>
</h1>
<Nav auth={this.props.route.auth} location={this.props}/>
{children}
</div>
Expand Down
3 changes: 1 addition & 2 deletions pages/About.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import ReactDOM from 'react-dom';

export default class About extends React.Component {
constructor(props) {
Expand All @@ -13,7 +12,7 @@ export default class About extends React.Component {
<h3>About Emanie</h3>
<div className="container">
<img className="aboutPic" src="../img/aboutPic.jpg"/>
<h4><i>Emanie was created by crafter, designer and computer programmer, Maureen in January 2017. What began as a coding project blossomed into an interactive online community for those who love yarn crafts as much as she does. Here at Emanie, crafters have a place to store their patterns, track their supplies and discover new designs.</i>
<h4><i>Emanie was created by crafter, designer and software engineer, Maureen in January 2017. What started as a coding project, transformed into an interactive online community for those who love yarn crafts as much as she does. Here at Emanie, crafters have a place to store their patterns, track their supplies and discover new designs.</i>
</h4>
<h5>Feel free to look around, simply sign up for access to more features. New patterns will be added frequently (all updates will be posted on the homepage).
</h5>
Expand Down
17 changes: 6 additions & 11 deletions pages/AddPattern.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { IndexLink, Link } from 'react-router';
import AuthService from '../utils/AuthService';

Expand Down Expand Up @@ -29,7 +28,7 @@ export default class AddPattern extends React.Component {
this.getAuthInfo();
}

// Get auth0 ID & email from logged in user and add to state
// Get auth0 ID & email from logged in user and add to state.
getAuthInfo() {
var obj = this.state.profile;
for(var key in obj){
Expand All @@ -46,6 +45,7 @@ export default class AddPattern extends React.Component {
}
}

// Ensures pattern will not save unless user checks box.
handleCheckbox() {
if(this.state.checked){
this.setState({checked: false});
Expand All @@ -65,7 +65,7 @@ export default class AddPattern extends React.Component {
}
}

// Add user input to state
// Add user's input to the state.
addPartsToPatt(cb) {
if(!$('#pattName').val() && !$('#pattCraft').val() && !$('#pattTools').val() && !$('#pattNotes').val()){
alert('One field must be filled to submit.');
Expand Down Expand Up @@ -95,7 +95,7 @@ export default class AddPattern extends React.Component {
}
}


// Sends POST request to server to save user input to db.
submitPatt(arr) {
fetch('/api/patterns/new', {
method: 'POST',
Expand All @@ -116,11 +116,6 @@ export default class AddPattern extends React.Component {
$('#pattNotes').val('');
}

handleUpload(e) {
e.preventDefault();

}

render () {
return (
<div>
Expand All @@ -145,11 +140,11 @@ export default class AddPattern extends React.Component {
</div>
<div className="form-group">
<label htmlFor="notes">Notes/Details:</label>
<textarea className="form-control" id="pattNotes" rows="5" name="notesDetails" ></textarea>
<textarea className="form-control" id="pattNotes" rows="5" name="notesDetails" />
</div>
<div className="form-check">
<label className="form-check-label">
<input type="checkbox" className="form-check-input" onClick={this.handleCheckbox.bind(this)}/> Please be aware that all patterns are currently made public. I confirm that I have reviewed my changes and read this message.
<input type="checkbox" className="form-check-input" onClick={this.handleCheckbox.bind(this)}/> Please be aware that all patterns are currently made public. By checking this box, I confirm that I have reviewed my changes and read this message.
</label>
</div>
<button type="submit" className="btn btn-inverse" onClick={this.handleAddPattern.bind(this)}>Add Pattern</button>
Expand Down
26 changes: 6 additions & 20 deletions pages/AddSupplies.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default class AddSupplies extends React.Component {
this.getAuthInfo();
}

// Get auth0 ID & email from logged in user and add to state
// Gets auth0 ID & email from logged in user and adds to state.
getAuthInfo() {
var obj = this.state.profile;
for(var key in obj){
Expand All @@ -55,7 +55,7 @@ export default class AddSupplies extends React.Component {
}
}

// Handle adding yarn
// Handle adding yarn checkbox.
handleCheckboxY() {
if(this.state.checkY){
this.setState({checkY: false});
Expand Down Expand Up @@ -110,6 +110,7 @@ export default class AddSupplies extends React.Component {
}
}

// Sends POST request to server to save user input in db.
submitYarn(arr) {
fetch('/api/yarn/add', {
method: 'POST',
Expand All @@ -132,7 +133,7 @@ export default class AddSupplies extends React.Component {
document.getElementById('yarnBox').checked = false;
}

// Handle adding tools
// Handle adding tools checkbox.
handleCheckboxT() {
if(this.state.checkT){
this.setState({checkT: false});
Expand Down Expand Up @@ -189,6 +190,7 @@ export default class AddSupplies extends React.Component {
}
}

// Sends POST request to server to save user input in db.
submitTools(arr) {
fetch('/api/tools/add', {
method: 'POST',
Expand Down Expand Up @@ -235,7 +237,7 @@ export default class AddSupplies extends React.Component {
</div>
<div className="form-group">
<label>Amount:</label>
<input type="text" className="form-control" id="amount" placeholder="1 Skein" name="amountName" />
<input type="text" className="form-control" id="amount" placeholder="2 Skeins etc" name="amountName" />
</div>
<div className="form-group">
<label htmlFor="notes">Notes/Details:</label>
Expand Down Expand Up @@ -286,19 +288,3 @@ export default class AddSupplies extends React.Component {
);
}
}


/*
$scope.listOfSizesC = ['2.00mm', '2.25mm B/1', '2.50mm', '2.75mm C/2', '3.00mm', '3.25mm D/3', '3.50mm E/4', '3.75mm F/5', '4.0mm G/6', '4.50mm 7','5.00mm H/8', '5.50mm I/9','6.00mm J/10', '6.5mm K/10.5','7.00mm', '8.00mm L/11', '9.00mm M/13','10.00mm N/15'];
$scope.listOfSizesK = ['2.00mm 0', '2.25mm 1', '2.75mm 2', '3.00mm', '3.25mm 3', '3.50mm 4', '3.75mm 5', '4.00mm 6', '4.50mm 7', '5.00mm 8', '5.5mm 9', '6.00mm 10', '6.50mm 10.5', '7.00mm', '7.50mm', '8.00mm 11', '9.00mm 13', '10.00mm 15', '12.00mm 17', '16.00mm 19', '19.00mm 35', '25.00mm 50'];
YARN
$scope.listOfWeights = ['Lace', 'Super Fine/Baby', 'Fine/Sport', 'Light-Worsted', 'Medium/Worsted', 'Bulky/Chunky', 'Super Bulky', 'Jumbo', 'Other'];
*/
9 changes: 4 additions & 5 deletions pages/Browse.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { IndexLink, Link } from 'react-router';

export default class Browse extends React.Component {
Expand Down Expand Up @@ -27,7 +26,7 @@ export default class Browse extends React.Component {
this.getAuthData();
}

// Get auth0 ID from logged in user and add to state
// Get auth0 ID from logged in user and add to state.
getAuthData() {
var obj = this.state.profile;
var emailAndId = [];
Expand All @@ -47,7 +46,7 @@ export default class Browse extends React.Component {
}
}

// Add user's email and id from Auth0 login to DB
// Add user's email and id from Auth0 login to DB.
sendFirstInfo(arr) {
fetch('/api/users/add', {
method: 'POST',
Expand All @@ -65,12 +64,12 @@ export default class Browse extends React.Component {
});
}

// Get all users' avatar and display name.
// Get all users' avatar, display name and bio from db.
getAllProfiles() {
return fetch('/api/users', {method: 'GET', mode: 'no-cors'})
.then((response) => response.json())
.then(allProfiles => {
this.setState({allUsers: allProfiles})
this.setState({allUsers: allProfiles});
});
}

Expand Down
1 change: 0 additions & 1 deletion pages/Contact.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { IndexLink, Link } from 'react-router';

export default class Contact extends React.Component {
Expand Down
Loading

0 comments on commit f75de26

Please sign in to comment.