Browse Source

whereiwas

windhamdavid 4 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('/login', userController.getLogin);
 router.post('/login', userController.postLogin);
-router.get('/user/:username', userController.getUserURL);
+router.get('/:username', userController.getUserURL);
+
 router.get('/logout', userController.logout);
 router.get('/forgot', userController.getForgot);
 router.post('/forgot', userController.postForgot);

+ 11 - 6
controllers/user_control.js

@@ -21,15 +21,20 @@ exports.getLogin = function (req, res) {
 
 /********** 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' });
       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(uglify())
     .pipe(gulp.dest('./app/js'));
-  gulp.src('./src/views/**/*')
-    //.pipe(uglify())
-    .pipe(gulp.dest('./app/views'));
   gulp.src('./src/models/**/*')
     //.pipe(uglify())
     .pipe(gulp.dest('./app/models'));
+  gulp.src('./src/views/**/*')
+    //.pipe(uglify())
+    .pipe(gulp.dest('./app/views'));
   gulp.src('./src/controllers/**/*')
     //.pipe(uglify())
     .pipe(gulp.dest('./app/controllers'));
@@ -127,8 +127,13 @@ var nodemonTask = function() {
     env: { 'NODE_ENV': 'development' },
     script: 'app.js',
     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: {
     name: { type: String, default: '' },
     username: { type: String, default: '' },
-    gender: { type: String, default: '' },
     location: { type: String, default: '' },
     website: { type: String, default: '' },
     bio: { type: String, default: '' },

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

@@ -23,15 +23,6 @@ block content
             .col-sm-7
               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
             label.col-sm-3.control-label(for='location') Location
             .col-sm-7
               input.form-control(type='text', name='location', id='location', value='#{user.profile.location}')
@@ -86,5 +77,4 @@ block content
             .col-sm-offset-3.col-sm-4
               button.btn.btn-danger(type='submit')
                 i.fa.fa-trash
-                | Delete my account
-
+                | Delete my account