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

otheruser_forbackend #25

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions MongoDBCommands
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
To List all data bases: show dbs
to select a data base: use 'dbnme'
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,17 @@ Node provides the RESTful API. Angular provides the frontend and accesses the AP

- [Node and npm](http://nodejs.org)
- MongoDB: Make sure you have your own local or remote MongoDB database URI configured in `config/database.js`
- MongoDB folder if installed with Hebrew : Mongodb path : /usr/local/Cellar/mongodb/3.2.10/bin
- to Start MongoDB: mongod
- to stop MongoDB:
- to get mongo terminal : Go to MongoDB Path and enter cmd 'Mongo'

## Installation

step1: install git
step2: install npm
step3: npm install -g nodemon

1. Clone the repository: `git clone [email protected]:scotch-io/node-todo`
2. Install the application: `npm install`
3. Place your own MongoDB URI in `config/database.js`
Expand Down
4 changes: 4 additions & 0 deletions Tasks_Format
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
A task is a unit of work.
Task can have several characterisitcs.
Task can be of several types. Task can be dependent on another task. A task can have sub tasks.
1) Defect Task: { defect id, ETA, isFrontend, iserrorinlogs, replicable, subtask: {update QC, commited code, }}
4 changes: 4 additions & 0 deletions app/models/todo.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@ module.exports = mongoose.model('Todo', {
text: {
type: String,
default: ''
},
quad: {
type: String,
default: 'imp-urg'
}
});
3 changes: 1 addition & 2 deletions app/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ module.exports = function (app) {

// create a todo, information comes from AJAX request from Angular
Todo.create({
text: req.body.text,
done: false
text: req.body.text
}, function (err, todo) {
if (err)
res.send(err);
Expand Down
4 changes: 4 additions & 0 deletions mongodb_tut
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
To get mongo terminal
go to installation folder.
if you installed with hebrew go to /usr/local/Cellar/mongodb/3.2.10/bin and type mongo
test
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"author": "Scotch",
"dependencies": {
"body-parser": "^1.4.3",
"express": "^4.13.4",
"express": "^4.14.0",
"method-override": "^2.1.3",
"mongoose": "^4.4.12",
"morgan": "^1.1.1"
Expand Down
105 changes: 76 additions & 29 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,49 +35,96 @@
<div class="jumbotron text-center">
<h1>I'm a Todo-aholic <span class="label label-info">{{ todos.length }}</span></h1>
</div>

<!-- TODO LIST -->
<div id="todo-list" class="row">
<div class="col-sm-4 col-sm-offset-4">
<div class="row">
<div class="col-sm-6">



<!-- LOOP OVER THE TODOS IN $scope.todos -->
<div class="checkbox" ng-repeat="todo in todos">
<label>
<input type="checkbox" ng-click="deleteTodo(todo._id)"> {{ todo.text }}
</label>

<!-- TODO LIST -->
<div id="todo-list" class="row">
<div class="col-sm-8 col-sm-offset-4">



<!-- LOOP OVER THE TODOS IN $scope.todos -->
<div class="checkbox" ng-repeat="todo in todos">
<label>
<input type="checkbox" ng-click="deleteTodo(todo._id)"> {{ todo.text }}
</label>
</div>

<p class="text-center" ng-show="loading">
<span class="fa fa-spinner fa-spin fa-3x"></span>
</p>

</div>
</div>
<!-- FORM TO CREATE TODOS -->
<div id="todo-form-quad1" class="row">
<div class="col-sm-10 col-sm-offset-2 text-center">
<form>
<div class="form-group">

<!-- BIND THIS VALUE TO formData.text IN ANGULAR -->
<input type="text" class="form-control input-lg text-center" placeholder="Add a Task" ng-model="quad1formData.text">
</div>

<!-- createToDo() WILL CREATE NEW TODOS -->
<button type="submit" id="quad1" class="btn btn-primary btn-lg" ng-click="createTodo($event)">Add</button>
</form>
</div>
</div>


</div>

<div class="col-sm-6">

<p class="text-center" ng-show="loading">
<span class="fa fa-spinner fa-spin fa-3x"></span>
</p>


</div>
</div>
<!-- TODO LIST -->
<div id="todo-list" class="row">
<div class="col-sm-8 col-sm-offset-4">



<!-- FORM TO CREATE TODOS -->
<div id="todo-form" class="row">
<div class="col-sm-8 col-sm-offset-2 text-center">
<form>
<div class="form-group">
<!-- LOOP OVER THE TODOS IN $scope.todos -->
<div class="checkbox" ng-repeat="todo in todos">
<label>
<input type="checkbox" ng-click="deleteTodo(todo._id)"> {{ todo.text }}
</label>
</div>

<!-- BIND THIS VALUE TO formData.text IN ANGULAR -->
<input type="text" class="form-control input-lg text-center" placeholder="I want to buy a puppy that will love me forever" ng-model="formData.text">
<p class="text-center" ng-show="loading">
<span class="fa fa-spinner fa-spin fa-3x"></span>
</p>

</div>
</div>
<!-- FORM TO CREATE TODOS -->
<div id="todo-form-quad2" class="row">
<div class="col-sm-10 col-sm-offset-2 text-center">
<form>
<div class="form-group">

<!-- BIND THIS VALUE TO formData.text IN ANGULAR -->
<input type="text" class="form-control input-lg text-center" placeholder="Add a Task" ng-model="quad2formData.text">
</div>

<!-- createToDo() WILL CREATE NEW TODOS -->
<button type="submit" id="quad2" class="btn btn-primary btn-lg" ng-click="createTodo($event)">Add</button>
</form>
</div>
</div>

<!-- createToDo() WILL CREATE NEW TODOS -->
<button type="submit" class="btn btn-primary btn-lg" ng-click="createTodo()">Add</button>
</form>

</div>
</div>

<div class="text-center text-muted">
<p>A demo by <a href="http://scotch.io">Scotch</a>.</p>
<p>Read the <a href="http://scotch.io/tutorials/javascript/creating-a-single-page-todo-app-with-node-and-angular">tutorial</a>.</p>
</div>


</div>


</body>
</html>
5 changes: 3 additions & 2 deletions public/js/controllers/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ angular.module('todoController', [])

// CREATE ==================================================================
// when submitting the add form, send the text to the node API
$scope.createTodo = function() {

$scope.createTodo = function(event) {
$scope.button=event.target.id;
console.log($scope.button);
// validate the formData to make sure that something is there
// if form is empty, nothing will happen
if ($scope.formData.text != undefined) {
Expand Down
1 change: 1 addition & 0 deletions public/js/services/todos.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ angular.module('todoService', [])
.factory('Todos', ['$http',function($http) {
return {
get : function() {
console.log("in get function");
return $http.get('/api/todos');
},
create : function(todoData) {
Expand Down