-
Notifications
You must be signed in to change notification settings - Fork 2
[charlie] [veronica] Todo list and app views created #15
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
base: master
Are you sure you want to change the base?
Changes from all commits
16d9e48
5907de1
21a1c40
94859d4
bfb3f63
f2ada02
c6fe35e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,73 @@ | ||
| ./scripts/bootstrap.sh | ||
| # Todo List App | ||
|
|
||
| The Todo List App is an application for creating and sharing todolists. | ||
|
|
||
| This repo contains: | ||
|
|
||
| * Resources for creating users, todo lists, todos, and todo list permissions. | ||
| * User tests for the above resources. | ||
|
|
||
|
|
||
| ## Environment Setup | ||
|
|
||
| Clone the repository: | ||
|
|
||
| `git clone https://github.com/cfierro/todo.git` | ||
|
|
||
| Grab your fork: | ||
|
|
||
| 'git remote add [yourname] https://github.com/[yourname]/todo.git' | ||
|
|
||
| Install dependencies using the bootstrap script: | ||
|
|
||
| `./scripts/bootstrap.sh` | ||
|
|
||
|
|
||
| ## Directory Structure | ||
|
|
||
| * app/authentication - resources for user authentication | ||
| * log in | ||
| * log out | ||
| * get logged in user info | ||
| * app/lib - shared libraries across multiple resources | ||
| * /authenticaion - decorator for requiring a user to be logged in | ||
| * /models - includes a base table mixin for all data tables | ||
| * /response_uit - methods for building status responses | ||
| * /status - classes for returning raised exceptions | ||
| * app/permissions - model and resources for list permissions | ||
| * app/todo_lists - model and resources for todo lists | ||
| * app/todos - model and resources for todos | ||
| * app/users - model and resources for users | ||
| * app/__init__.py - initialize python packages. Includes: | ||
| * Import Flask libraries | ||
| * Error handler | ||
| * database creation | ||
| * Model imports | ||
| * Resources urls for APIs | ||
| * env - virtual environment | ||
| * scripts - bootstrap script fo installing dependencies | ||
| * unittest/resources - unittests for user, todo, todo_list, and auth resources | ||
| * .gitignore - files to ignore upon git commit | ||
| * config.py - | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As a reminder, the |
||
| * README.md - this file! | ||
| * requirements.txt - required libraries | ||
| * run.py - runs the application. | ||
| * shell.py - | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you remove the |
||
|
|
||
|
|
||
| ## Development | ||
|
|
||
| Run the following from the top level directory: | ||
|
|
||
| Activate your virutual environment. | ||
|
|
||
| `source env/bin/activate` | ||
|
|
||
| To run the app: | ||
|
|
||
| `python run.py` | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can update this to use our |
||
|
|
||
| To run unit tests: | ||
|
|
||
| `py.test unittest` | ||
|
|
||
| source env/bin/activate | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| body { | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because this is just output from our compiled sass file, it would be great if we didn't track it in our git history. Could you this file to our .gitignore? |
||
| font-family: 'Josefin Sans', sans-serif; | ||
| font-size: 18px; | ||
| background: #BAA5D6; } | ||
|
|
||
| .todo-app h1 { | ||
| text-align: center; } | ||
|
|
||
| .todo-lists-container { | ||
| width: 50%; | ||
| margin: 0 auto; } | ||
| .todo-lists-container ul { | ||
| list-style: none; | ||
| margin-left: 0; | ||
| padding-left: 0; } | ||
|
|
||
| .listName { | ||
| outline: none; | ||
| border: none; | ||
| background: transparent; | ||
| font-family: 'Josefin Sans', sans-serif; | ||
| font-size: 1.5em; | ||
| text-align: center; | ||
| width: 80%; } | ||
| .listName:focus + .deleteList { | ||
| display: inline-block; } | ||
|
|
||
| .todo { | ||
| outline: none; | ||
| padding: 3px; | ||
| width: 80%; } | ||
|
|
||
| .addList { | ||
| margin: 0 auto; } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| var gulp = require('gulp'); | ||
| var sass = require('gulp-sass'); | ||
|
|
||
| gulp.task('styles', function() { | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add a small comment on this task too? As you did below. |
||
| gulp.src('sass/**/*.scss') | ||
| .pipe(sass().on('error', sass.logError)) | ||
| .pipe(gulp.dest('./app/static/css')); | ||
| }); | ||
|
|
||
| //Watch task | ||
| gulp.task('default',function() { | ||
| gulp.watch('sass/**/*.scss',['styles']); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice job! Just a couple of very minor nits. Could you add a space between |
||
| }); | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| var Backbone = require('backbone'); | ||
|
|
||
| var TodoModel = require('../Model/TodoModel.js'); | ||
|
|
||
| var TodoCollection = Backbone.Collection.extend({ | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding a comment to the whole class is also a good idea. Could be a simple comment, such as, |
||
| initialize: function(models, options){ | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add a comment to this constructor? Comment format for a function is usually: So for example: |
||
| this.id = options.id | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needs a semi-colon |
||
| }, | ||
| model: TodoModel, | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I typically see this moved all the way to the top, so that the reader knows immediately what models this collection should hold. Also, could you add a comment. For properties and variables in the defaults dictionary, the comment is very similar: So for example: |
||
| url: function(){ | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a comment for this function. |
||
| return '/todos?todoListId=' + this.id; | ||
| }, | ||
| parse: function(response){ | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a comment for this function. |
||
| return response.result; | ||
| } | ||
| }) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This also needs a semi-colon. |
||
|
|
||
| module.exports = TodoCollection; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| var Backbone = require('backbone'); | ||
|
|
||
| var TodoListModel = require('../Model/TodoListModel.js'); | ||
|
|
||
| var TodoListCollection = Backbone.Collection.extend({ | ||
| model: TodoListModel, | ||
| url: '/todolists', | ||
| parse: function(response){ | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please add comments to the properties and functions in this collection? |
||
| return response.result; | ||
| } | ||
| }) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needs semi-colon. Things like if statements, functions, for loops don't need a semi-colon, but |
||
|
|
||
| module.exports = TodoListCollection; | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| var Backbone = require('backbone'); | ||
| // var TodoListCollection = require('../Collection/TodoListCollection.js') | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's delete unused imports or commented out code like this :) |
||
|
|
||
| var TodoListModel = Backbone.Model.extend({ | ||
| urlRoot: '/todolists', | ||
| defaults: { | ||
| name: 'List Name', | ||
| creator: 'User' | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As a reminder, you use the same kind of comment for class properties as you would for these default attributes. |
||
| }, | ||
| parse: function(response, options){ | ||
| if (options.collection) { | ||
| return response; | ||
| } | ||
| return response.result; | ||
| } | ||
| }) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please add semi-colons and comments where necessary in this file? |
||
|
|
||
| module.exports = TodoListModel; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| var Backbone = require('backbone'); | ||
|
|
||
| var TodoModel = Backbone.Model.extend({ | ||
| urlRoot: 'todos/', | ||
| defaults: { | ||
| subject: 'Subject', | ||
| dueDate: null, | ||
| description: '', | ||
| priority: null, | ||
| completed: false, | ||
| assignee: null, | ||
| }, | ||
| parse: function(response, options){ | ||
| if (options.collection) { | ||
| return response; | ||
| } | ||
| return response.result; | ||
| } | ||
| }) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as above, please add semi-colons and comments where necessary. |
||
|
|
||
| module.exports = TodoModel; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| var Backbone = require('backbone'); | ||
|
|
||
| var UserModel = Backbone.Model.extend({ | ||
| url: '/me', | ||
| parse: function(response){ | ||
| return response.result; | ||
| } | ||
|
|
||
| }) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's remove unnecessary white space (empty line 8), and add a few comments. |
||
|
|
||
| module.exports = UserModel; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps also add documentation about the js side of our app below now too.