Fixed bugs
parent
15c9411b91
commit
14a952e80e
|
@ -1,5 +1,5 @@
|
|||
# Tracman
|
||||
###### v 0.4.0
|
||||
###### v 0.4.2
|
||||
|
||||
node.js application to display a map with user's location.
|
||||
|
||||
|
@ -16,6 +16,11 @@ $ npm start
|
|||
|
||||
## Changelog
|
||||
|
||||
#### v0.4.2
|
||||
|
||||
* Fixed Streetview covering buttons
|
||||
* Fixed error when viewing map of nonexistant user
|
||||
|
||||
#### v0.4.1
|
||||
|
||||
* Users can view/change email address
|
||||
|
|
|
@ -48,7 +48,7 @@ passport.use(new GoogleStrategy({
|
|||
(function checkSlug(s,cb) {
|
||||
//console.log('checking ',s);
|
||||
User.findOne({slug:s}, function(err, existingUser){
|
||||
if (err) { console.log('Slug check error for ',slug(request.name).toLowerCase(),+':',err); }
|
||||
if (err) { console.log('No user found for ',slug,':',err); }
|
||||
if (existingUser){
|
||||
s = '';
|
||||
while (s.length<6) {
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
var emailTemplate = require('email-templates').EmailTemplate,
|
||||
path = require('path');
|
||||
var secret = require('./secrets.js'),
|
||||
templateDir = path.join(__dirname, 'mail');
|
||||
var mailgun = require('mailgun-js')({
|
||||
apiKey: secret.mailgunAPI,
|
||||
domain: 'tracman.org'
|
||||
});
|
||||
|
||||
var renderMail = function(template, params, next) {
|
||||
new emailTemplate(path.join(templateDir, template))
|
||||
.render(params, function (err, msg) {
|
||||
if (err) { console.log('Error rendering mail. Params: \n'+params+'\n'+err); }
|
||||
next(msg);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
mailgun:mailgun,
|
||||
|
||||
sendInvite: function(params, cb){
|
||||
renderMail('invite', {id:params.id, name:params.name}, function(msg) {
|
||||
mailgun.messages().send({
|
||||
from: 'Tracman <invites@tracman.org>',
|
||||
to: params.email,
|
||||
subject: 'You are invited to use Tracman beta!',
|
||||
html: msg.html,
|
||||
text: msg.text
|
||||
}, cb);
|
||||
});
|
||||
},
|
||||
|
||||
sendSuggestion: function(params, cb){
|
||||
renderMail('suggestion', params, function(msg) {
|
||||
var name = (params.name)?params.name:'Tracman';
|
||||
var email = (params.email)?' <'+params.email+'>':' <suggestions@tracman.org>';
|
||||
mailgun.messages().send({
|
||||
from: name+email,
|
||||
to: 'Keith Irwin <suggestions@tracman.org>',
|
||||
subject: 'A suggestion for Tracman',
|
||||
html: msg.html,
|
||||
text: msg.text
|
||||
}, cb);
|
||||
});
|
||||
},
|
||||
|
||||
sendBugReport: function(params, cb){
|
||||
renderMail('suggestion', params, function(msg) {
|
||||
var name = (params.name)?params.name:'Tracman';
|
||||
var email = (params.email)?' <'+params.email+'>':' <suggestions@tracman.org>';
|
||||
mailgun.messages().send({
|
||||
from: name+email,
|
||||
to: 'Keith Irwin <bugs@tracman.org>',
|
||||
subject: 'A Bug Report for Tracman',
|
||||
html: msg.html,
|
||||
text: msg.text
|
||||
}, cb);
|
||||
});
|
||||
},
|
||||
|
||||
};
|
|
@ -1,13 +0,0 @@
|
|||
<html>
|
||||
<body>
|
||||
<h1>Bug Report</h1>
|
||||
<p>Source: {{ source }}</p>
|
||||
<h2>Error message</h2>
|
||||
<p>{{ errorMessage }}</p>
|
||||
<h2>Recreation</h2>
|
||||
<p>{{ recreation }}</p>
|
||||
<h2>Bug details</h2>
|
||||
<p>{{ bug }}</p>
|
||||
<p><em>{{ name }}</em><br>{{ email }}</p>
|
||||
</body>
|
||||
</html>
|
|
@ -1,16 +0,0 @@
|
|||
BUG REPORT
|
||||
|
||||
|
||||
Source: {{ source }}
|
||||
|
||||
Error message
|
||||
{{ errorMessage }}
|
||||
|
||||
Recreation
|
||||
{{ recreation }}
|
||||
|
||||
Bug details
|
||||
{{ bug }}
|
||||
|
||||
{{ name }}
|
||||
{{ email }}
|
|
@ -1,7 +0,0 @@
|
|||
<html>
|
||||
<body>
|
||||
<h1>Suggestion</h1>
|
||||
<p>{{ suggestion }}</p>
|
||||
<p>{{ name }}<br>{{ email }}</p>
|
||||
</body>
|
||||
</html>
|
|
@ -1,6 +0,0 @@
|
|||
SUGGESTION
|
||||
|
||||
{{ suggestion }}
|
||||
|
||||
{{ name }}
|
||||
{{ email }}
|
|
@ -1,10 +0,0 @@
|
|||
var mongoose = require('mongoose');
|
||||
|
||||
module.exports = mongoose.model('Request', {
|
||||
name: {type:String, required:true},
|
||||
email: {type:String, required:true, unique:true},
|
||||
beg: String,
|
||||
requestedTime: Date,
|
||||
granted: Date,
|
||||
userId: String
|
||||
});
|
|
@ -1,9 +1,7 @@
|
|||
var router = require('express').Router(),
|
||||
fs= require('fs'),
|
||||
mw = require('../middleware.js'),
|
||||
mail = require('../mail.js'),
|
||||
User = require('../models/user.js'),
|
||||
Request = require('../models/request.js');
|
||||
User = require('../models/user.js');
|
||||
|
||||
router.route('/')
|
||||
.all(mw.ensureAdmin, function(req,res,next){
|
||||
|
@ -27,12 +25,7 @@ router.route('/')
|
|||
res.locals.user = found;
|
||||
checkCBC(req,res,err);
|
||||
});
|
||||
|
||||
Request.find({}).sort({requestedTime:-1}).exec(function(err, found){
|
||||
res.locals.requests = found;
|
||||
checkCBC(req,res,err);
|
||||
});
|
||||
|
||||
|
||||
User.find({}).sort({lastLogin:-1}).exec(function(err, found){
|
||||
res.locals.users = found;
|
||||
checkCBC(req,res,err);
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
var router = require('express').Router(),
|
||||
mw = require('../middleware.js'),
|
||||
mail = require('../mail.js'),
|
||||
secret = require('../secrets.js'),
|
||||
User = require('../models/user.js'),
|
||||
Request = require('../models/request.js');
|
||||
User = require('../models/user.js');
|
||||
|
||||
router.route('/')
|
||||
.get(function(req,res,next){
|
||||
|
|
|
@ -11,8 +11,7 @@ router.get('/:slug?', function(req,res,next){
|
|||
// Confirm sucessful queries
|
||||
function checkQuery(err,found) {
|
||||
if (err){ mw.throwErr(req,err); }
|
||||
if (!found){ next(); }
|
||||
else { return found; }
|
||||
if (found){ return found; }
|
||||
}
|
||||
|
||||
// Call renderMap() on completion
|
||||
|
@ -40,10 +39,10 @@ router.get('/:slug?', function(req,res,next){
|
|||
// Show map
|
||||
function renderMap() {
|
||||
// GET /map shows logged-in user's map
|
||||
if (mapuser==''&&user=='') {
|
||||
if (!mapuser && !user) {
|
||||
res.redirect('/');
|
||||
} else {
|
||||
if (user!=''&&mapuser=='') { mapuser = user; }
|
||||
if (user!==''&&mapuser==='') { mapuser = user; }
|
||||
res.render('map.html', {
|
||||
api: secret.mapAPI,
|
||||
mapuser: mapuser,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "tracman",
|
||||
"version": "0.4.1",
|
||||
"version": "0.4.2",
|
||||
"description": "Tracks user's GPS location",
|
||||
"main": "server.js",
|
||||
"dependencies": {
|
||||
|
@ -8,11 +8,9 @@
|
|||
"browserify": "^13.0.1",
|
||||
"connect-flash": "^0.1.1",
|
||||
"cookie-parser": "^1.4.1",
|
||||
"email-templates": "^2.1.0",
|
||||
"express": "^4.13.3",
|
||||
"express-session": "^1.13.0",
|
||||
"kerberos": "0.0.17",
|
||||
"mailgun-js": "^0.7.7",
|
||||
"moment": "^2.12.0",
|
||||
"mongodb": "^2.1.4",
|
||||
"mongoose": "^4.3.5",
|
||||
|
|
|
@ -53,41 +53,6 @@
|
|||
<script src="/static/js/moment.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
// /* TABS */ {
|
||||
|
||||
// // Check for location.hash capability (IE9+)
|
||||
// if (!'onhashchange' in window) {
|
||||
// if (!confirm("location.hash won't work in IE<9. If you don't know how to fix this, click cancel. ")){
|
||||
// window.open("https://whatbrowser.org/");
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Match jQuery's .ui-tabs-active with bootstrap's .active
|
||||
// function setActive() {
|
||||
// $('.nav-tabs > .active').removeClass('active');
|
||||
// $('.ui-tabs-active').addClass('active');
|
||||
// }
|
||||
|
||||
// // Set tab on hash change
|
||||
// $(window).on('hashchange', function (){
|
||||
// $('#tabs > ul > li > a').each(function (index, a) {
|
||||
// if ($(a).attr('href') == location.hash) {
|
||||
// $('#tabs').tabs('option', 'active', index);
|
||||
// setActive();
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
|
||||
// // Setup tabs
|
||||
// $('#tabs').tabs({
|
||||
// active: (location.hash=='#requests')?1:0,
|
||||
// beforeActivate: function(event,ui){
|
||||
// location.hash = '#'+ui.newPanel.attr('id');
|
||||
// setActive();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
/* DATE/TIME FORMATS */ {
|
||||
|
||||
// Users
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#notset {display:none}
|
||||
|
||||
.btn {
|
||||
z-index: 50;
|
||||
background: #222;
|
||||
} .btn:hover {
|
||||
background: #333;
|
||||
|
|
Loading…
Reference in New Issue