forked from linnovate/mean
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
299 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/** | ||
* Module dependencies. | ||
*/ | ||
var mongoose = require('mongoose'), | ||
Eventos = mongoose.model('Eventos'), | ||
_ = require('lodash'); | ||
|
||
|
||
/** | ||
* Find article by id | ||
*/ | ||
exports.article = function(req, res, next, id) { | ||
Eventos.load(id, function(err, article) { | ||
if (err) return next(err); | ||
if (!article) return next(new Error('Failed to load article ' + id)); | ||
req.article = article; | ||
next(); | ||
}); | ||
}; | ||
|
||
|
||
/** | ||
* Show cadastroEvento form | ||
*/ | ||
exports.cadastro = function(req, res) { | ||
res.render('eventos/cadastro', { | ||
title: 'Sign up', | ||
eventos: new Eventos() | ||
}); | ||
}; | ||
|
||
/** | ||
* Create a article | ||
*/ | ||
exports.create = function(req, res) { | ||
var article = new Eventos(req.body); | ||
article.user = req.user; | ||
|
||
article.save(function(err) { | ||
if (err) { | ||
return res.send('users/signup', { | ||
errors: err.errors, | ||
article: article | ||
}); | ||
} else { | ||
res.jsonp(article); | ||
} | ||
}); | ||
}; | ||
|
||
/** | ||
* Update a article | ||
*/ | ||
exports.update = function(req, res) { | ||
var article = req.article; | ||
|
||
article = _.extend(article, req.body); | ||
|
||
article.save(function(err) { | ||
res.jsonp(article); | ||
}); | ||
}; | ||
|
||
/** | ||
* Delete an article | ||
*/ | ||
exports.destroy = function(req, res) { | ||
var article = req.article; | ||
|
||
article.remove(function(err) { | ||
if (err) { | ||
res.render('error', { | ||
status: 500 | ||
}); | ||
} else { | ||
res.jsonp(article); | ||
} | ||
}); | ||
}; | ||
|
||
/** | ||
* Show an article | ||
*/ | ||
exports.show = function(req, res) { | ||
res.jsonp(req.article); | ||
}; | ||
|
||
/** | ||
* List of Eventoss | ||
*/ | ||
exports.all = function(req, res) { | ||
Eventos.find().sort('-created').populate('user', 'name username').exec(function(err, articles) { | ||
if (err) { | ||
res.render('error', { | ||
status: 500 | ||
}); | ||
} else { | ||
res.jsonp(articles); | ||
} | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* Module dependencies. | ||
*/ | ||
var mongoose = require('mongoose'), | ||
config = require('../../config/config'), | ||
Schema = mongoose.Schema; | ||
|
||
|
||
/** | ||
* Article Schema | ||
*/ | ||
var EventosSchema = new Schema({ | ||
created: { | ||
type: Date, | ||
default: Date.now | ||
}, | ||
name: { | ||
type: String, | ||
default: '', | ||
trim: true | ||
}, | ||
locale: { | ||
type: String, | ||
default: '', | ||
trim: true | ||
}, | ||
user: { | ||
type: Schema.ObjectId, | ||
ref: 'User' | ||
} | ||
}); | ||
|
||
/** | ||
* Statics | ||
*/ | ||
EventosSchema.statics.load = function(id, cb) { | ||
this.findOne({ | ||
_id: id | ||
}).populate('user', 'name username').exec(cb); | ||
}; | ||
|
||
mongoose.model('Eventos', EventosSchema); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<section data-ng-controller="EventosController"> | ||
<form class="form-horizontal" data-ng-submit="create()"> | ||
<div class="control-group"> | ||
<label class="control-label" for="title">Nome</label> | ||
<div class="controls"> | ||
<input type="text" data-ng-model="name" id="name" placeholder="Nome" required> | ||
</div> | ||
</div> | ||
<div class="control-group"> | ||
<label class="control-label" for="content">Local</label> | ||
<div class="controls"> | ||
<input type="text" data-ng-model="locale" id="locale" placeholder="Local" required> | ||
</div> | ||
</div> | ||
<div class="control-group"> | ||
<div class="controls"> | ||
<input type="submit" class="btn"> | ||
</div> | ||
</div> | ||
</form> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
extends auth | ||
|
||
block auth | ||
form.signup.form-horizontal(action="/cadastro", method="post") | ||
.control-group | ||
label.control-label(for='name') Nome: | ||
.controls | ||
input#name(type='text', name="name", placeholder='Nome', value=user.name) | ||
|
||
.control-group | ||
label.control-label(for='email') Endereço: | ||
.controls | ||
input#email(type='text', name="email", placeholder='Endereço', value=user.email) | ||
|
||
.control-group | ||
label.control-label(for='email') E-mail: | ||
.controls | ||
input#username(type='text', name="email", placeholder='E-mail', value=user.email) | ||
|
||
.control-group | ||
label.control-label(for='password') Password | ||
.controls | ||
input#password(type='password', name="password", placeholder='Password', value=user.password) | ||
|
||
.control-group | ||
label.control-label(for='cpf') CPF | ||
.controls | ||
input#password(type='text', name="cpf", placeholder='CPF', value=user.cpf) | ||
|
||
.form-actions | ||
button.btn.btn-primary(type='submit') Sign up | ||
| ||
| or | ||
a.show-login(href="/signin") login |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
extends auth | ||
|
||
block auth | ||
form.signup.form-horizontal(action="/cadastroBeneficiario/create", method="post") | ||
.control-group | ||
label.control-label(for='name') Nome: | ||
.controls | ||
input#name(type='text', name="name", placeholder='Nome', value=user.name) | ||
|
||
.control-group | ||
label.control-label(for='email') Endereço: | ||
.controls | ||
input#email(type='text', name="email", placeholder='Endereço', value=user.email) | ||
|
||
.control-group | ||
label.control-label(for='email') E-mail: | ||
.controls | ||
input#username(type='text', name="email", placeholder='E-mail', value=user.email) | ||
|
||
.control-group | ||
label.control-label(for='password') Password | ||
.controls | ||
input#password(type='password', name="password", placeholder='Password', value=user.password) | ||
|
||
.control-group | ||
label.control-label(for='cpf') CPF | ||
.controls | ||
input#password(type='text', name="cpf", placeholder='CPF', value=user.cpf) | ||
|
||
.form-actions | ||
button.btn.btn-primary(type='submit') Sign up | ||
| ||
| or | ||
a.show-login(href="/signin") login |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
angular.module('mean.system').controller('IndexController', ['$scope', 'Global', function ($scope, Global) { | ||
$scope.global = Global; | ||
}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<section data-ng-controller="EventosController"> | ||
<form class="form-horizontal" data-ng-submit="create()"> | ||
<div class="control-group"> | ||
<label class="control-label" for="title">Nome</label> | ||
<div class="controls"> | ||
<input type="text" data-ng-model="name" id="name" placeholder="Nome" required> | ||
</div> | ||
</div> | ||
<div class="control-group"> | ||
<label class="control-label" for="content">Local</label> | ||
<div class="controls"> | ||
<input type="text" data-ng-model="locale" id="locale" placeholder="Local" required> | ||
</div> | ||
</div> | ||
<div class="control-group"> | ||
<div class="controls"> | ||
<input type="submit" class="btn"> | ||
</div> | ||
</div> | ||
</form> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
<section data-ng-controller="IndexController"> | ||
<h1>This is the home view</h1> | ||
</section> | ||
<div data-ng-controller="IndexController"> | ||
<div class="container"> | ||
<h1 class="logo">causasdobem</h1> | ||
<hr> | ||
<div class="jumbotron"> | ||
<p> | ||
<a class="btn btn-lg btn-success" href="#">Voluntários</a> | ||
<a class="btn btn-lg btn-success" href="#">Beneficiário</a> | ||
</p> | ||
</div> | ||
<p> | ||
Quero <a href="#" class="btn btn-default">Ajudar!</a> / <a href="#" class="btn btn-default">Ser ajudado!</a> | ||
</p> | ||
|
||
</div> | ||
</div> |