示例#1
0
  ], ViewMiddleware.checkPageNumbers, (req, res, next) => {
    if(app.locals.Settings.homepage) {
      return BlogController.view(req, res, next);
    }

    next();
  });
示例#2
0
  router.get('/' + slugs.page + '/:page', ViewMiddleware.checkPageNumbers, (req, res, next) => {
    if(!app.locals.Settings.homepage) {
      return BlogController.view(req, res, next);
    }

    next();
  });
示例#3
0
 router.get('/', (req, res, next) => {
   if(app.locals.Settings.homepage) {
     // Homepage
     return PostController.customHomepage(req, res, next);
   } else {
     // Blog index
     return BlogController.view(req, res, next);
   }
 });
示例#4
0
文件: users.js 项目: hackference/cfp
router.get('/list', utils.ensureAdmin, function(req, res) {
  // View options
  var options = {
    include_docs: true
  };

  // Grab the talks
  user.view('user', 'byemail', options, function(err, data) {
    res.render('user/list', { title: 'Users', users: data.rows });
  });
});
示例#5
0
passport.deserializeUser(function(email, done) {
  var filter = {};
  filter.key = email;
  filter.include_docs = true;
  filter.limit = 1;
  couch.view(dbName, 'usersByEmail', filter, function(err, res) {
    var storedUser;
    if (res.rows && res.rows.length === 1) {
      storedUser = res.rows[0].doc;
    }
    return done(err, storedUser);
  });
});
示例#6
0
文件: hjt.js 项目: yangjc/hjt
    view: function(source, data){
      data = this.get_data(data);

      switch (typeof source) {
        case 'string':
          if (source in this._index) {
            return this._fn[this._index[source]](data, this._log);
          }

          if (source.charAt(0) === '#') {
            var node = document.getElementById(source.substr(1));
            if (node && node.innerHTML) {
              var index = this.compile(trim(node.innerHTML), source);
              this._index[source] = index;
              return this._fn[index](data, this._log);
            }
          } else {
            try {
              var fn = require(this._build_path + source).view;
            } catch(e) {
              if (this._debug) {
                this._log.push(['view', source, e]);
              }
            }

            if (typeof fn !== 'function') {
              return this._debug ? '[Hjt] view : require(' + source + ') error' : '';
            }

            this._index[source] = this._fn.length;
            this._fn.push(fn);

            return fn(data, this._log);
          }
          break;
        case 'number':
          if (this._fn[source]) {
            return this._fn[source](data, this._log);
          }
          return this._debug ? '[Hjt] view : uncached source ' + source : '';
      }

      return this._debug ? '[Hjt] view : unexpected source ' + source : '';
    },
示例#7
0
文件: logger.js 项目: mangvlad/after
			'started': function(callback){
				db.view('app/started', {include_docs:true} , function(err, res){

					// Filter just worker related documents/tasks
					var workerDocs = res.filter(function(change){
						return change.doc.worker === worker;
					});

					var resetDocs = workerDocs.map(function(change){
						change.doc.status = 'waiting';
						return change.doc;
					});

					db.save(resetDocs, function(err, res){
						callback(err, res);
					});

				});
			}
示例#8
0
 .action(function(type, key) {
   var server = new Server();
   process.env.COMMAND = 'view';
   server.view(type, key);
 });