Browse Source

whereiwas

windhamdavid 8 years ago
parent
commit
334f0b901e
5 changed files with 24 additions and 24 deletions
  1. 2 1
      app.js
  2. 11 6
      controllers/user_control.js
  3. 10 5
      gulpfile.js
  4. 0 1
      models/user.js
  5. 1 11
      src/views/account/profile.jade

+ 2 - 1
app.js

@@ -107,7 +107,8 @@ var apiController = require('./controllers/api_control');
 router.get('/', homeController.index);
 router.get('/', homeController.index);
 router.get('/login', userController.getLogin);
 router.get('/login', userController.getLogin);
 router.post('/login', userController.postLogin);
 router.post('/login', userController.postLogin);
-router.get('/user/:username', userController.getUserURL);
+router.get('/:username', userController.getUserURL);
+
 router.get('/logout', userController.logout);
 router.get('/logout', userController.logout);
 router.get('/forgot', userController.getForgot);
 router.get('/forgot', userController.getForgot);
 router.post('/forgot', userController.postForgot);
 router.post('/forgot', userController.postForgot);

+ 11 - 6
controllers/user_control.js

@@ -21,15 +21,20 @@ exports.getLogin = function (req, res) {
 
 
 /********** User GET / User URL **************/
 /********** User GET / User URL **************/
 
 
-exports.getUserURL = function (req, res, next) {
-  return User.find({ username: req.params.id }, function (err, username) {
-    if (username) {
+exports.getUserURL = function (req, res) {
+  User.find({ username: 'windhamdavid' }, function (err, username) {
+    console.log('%s', User.username);
+    console.log(req.originalUrl);
+    console.log(req.baseUrl);
+    console.log(req.path);
+    if (err) {
       res.render('404', { url: req.url, error: '404 Not found' });
       res.render('404', { url: req.url, error: '404 Not found' });
       return;
       return;
     }
     }
-    return res.render('account/user', {
-      title: profile.username,
-      url: profile.username
+    var username = req.params.username;
+    res.render('account/user', {
+      title: username.User,
+      url: username.User
     });
     });
   });
   });
 };
 };

+ 10 - 5
gulpfile.js

@@ -86,12 +86,12 @@ var watchTask = function() {
     .pipe(concat('main.min.js'))
     .pipe(concat('main.min.js'))
     .pipe(uglify())
     .pipe(uglify())
     .pipe(gulp.dest('./app/js'));
     .pipe(gulp.dest('./app/js'));
-  gulp.src('./src/views/**/*')
-    //.pipe(uglify())
-    .pipe(gulp.dest('./app/views'));
   gulp.src('./src/models/**/*')
   gulp.src('./src/models/**/*')
     //.pipe(uglify())
     //.pipe(uglify())
     .pipe(gulp.dest('./app/models'));
     .pipe(gulp.dest('./app/models'));
+  gulp.src('./src/views/**/*')
+    //.pipe(uglify())
+    .pipe(gulp.dest('./app/views'));
   gulp.src('./src/controllers/**/*')
   gulp.src('./src/controllers/**/*')
     //.pipe(uglify())
     //.pipe(uglify())
     .pipe(gulp.dest('./app/controllers'));
     .pipe(gulp.dest('./app/controllers'));
@@ -127,8 +127,13 @@ var nodemonTask = function() {
     env: { 'NODE_ENV': 'development' },
     env: { 'NODE_ENV': 'development' },
     script: 'app.js',
     script: 'app.js',
     verbose: true,
     verbose: true,
-    watch: ['./src/'],
-    ext: 'css js html jade hbs'
+    watch: [
+      './src/',
+      './models/',
+      './controllers',
+      './app.js'
+    ],
+    ext: 'js jade hbs html css'
   });
   });
 };
 };
 
 

+ 0 - 1
models/user.js

@@ -10,7 +10,6 @@ var userSchema = new mongoose.Schema({
   profile: {
   profile: {
     name: { type: String, default: '' },
     name: { type: String, default: '' },
     username: { type: String, default: '' },
     username: { type: String, default: '' },
-    gender: { type: String, default: '' },
     location: { type: String, default: '' },
     location: { type: String, default: '' },
     website: { type: String, default: '' },
     website: { type: String, default: '' },
     bio: { type: String, default: '' },
     bio: { type: String, default: '' },

+ 1 - 11
src/views/account/profile.jade

@@ -22,15 +22,6 @@ block content
             label.col-sm-3.control-label(for='username') Username
             label.col-sm-3.control-label(for='username') Username
             .col-sm-7
             .col-sm-7
               input.form-control(type='text', name='username', id='username', value='#{user.profile.username}')
               input.form-control(type='text', name='username', id='username', value='#{user.profile.username}')
-          .form-group
-            label.col-sm-3.control-label(for='gender') Gender
-            .col-sm-4
-              label.radio.col-sm-4
-                input(type='radio', checked=user.profile.gender=='male', name='gender', value='male', data-toggle='radio')
-                span Male
-              label.radio.col-sm-4
-                input(type='radio', checked=user.profile.gender=='female', name='gender', value='female', data-toggle='radio')
-                span Female
           .form-group
           .form-group
             label.col-sm-3.control-label(for='location') Location
             label.col-sm-3.control-label(for='location') Location
             .col-sm-7
             .col-sm-7
@@ -86,5 +77,4 @@ block content
             .col-sm-offset-3.col-sm-4
             .col-sm-offset-3.col-sm-4
               button.btn.btn-danger(type='submit')
               button.btn.btn-danger(type='submit')
                 i.fa.fa-trash
                 i.fa.fa-trash
-                | Delete my account
-
+                | Delete my account