mirror of
https://github.com/jsbin/jsbin.git
synced 2026-02-01 16:46:05 +00:00
Now render history with all bins
This commit is contained in:
parent
fc21633502
commit
9af55ebae7
@ -147,20 +147,34 @@ module.exports = handlers = {
|
||||
var template = handlers.templateFromBin(bin),
|
||||
jsbin = handlers.jsbin(bin, req.helpers.production ? req.helpers.set('version') : 'debug', req.session._csrf);
|
||||
|
||||
req.helpers.analytics(function (err, analytics) {
|
||||
res.render('index', {
|
||||
tips: '{}',
|
||||
revision: bin.revision || 1,
|
||||
home: req.session.user ? req.session.user.name : null,
|
||||
jsbin: JSON.stringify(jsbin),
|
||||
json_template: JSON.stringify(template),
|
||||
version: jsbin.version,
|
||||
analytics: analytics,
|
||||
token: req.session._csrf,
|
||||
url: req.path,
|
||||
'production?': req.helpers.production
|
||||
function onComplete(err, history) {
|
||||
req.helpers.analytics(function (err, analytics) {
|
||||
res.render('index', {
|
||||
tips: '{}',
|
||||
revision: bin.revision || 1,
|
||||
home: req.session.user ? req.session.user.name : null,
|
||||
jsbin: JSON.stringify(jsbin),
|
||||
json_template: JSON.stringify(template),
|
||||
version: jsbin.version,
|
||||
analytics: analytics,
|
||||
token: req.session._csrf,
|
||||
url: req.path,
|
||||
list_history: history || '',
|
||||
'production?': req.helpers.production
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (req.session.user) {
|
||||
req.models.user.getBins(req.session.user.name, function (err, bins) {
|
||||
if (err) {
|
||||
return onComplete(err);
|
||||
}
|
||||
handlers.formatHistory(bins, req.helpers, onComplete);
|
||||
});
|
||||
} else {
|
||||
onComplete();
|
||||
}
|
||||
},
|
||||
renderFiles: function (req, res, files) {
|
||||
files = files || handlers.defaultFiles();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user