зеркало из https://github.com/mozilla/CSOL-site.git
Add a /myapplications/:id endpoint.
This commit is contained in:
Родитель
360232bab7
Коммит
b82af27e78
|
@ -128,8 +128,7 @@ module.exports = function (app) {
|
|||
});
|
||||
|
||||
app.get('/myapplications', [
|
||||
loggedIn,
|
||||
openbadger.middleware('getUserBadges')
|
||||
loggedIn
|
||||
], function (req, res, next) {
|
||||
var user = req.session.user;
|
||||
applications.findAll({where: {LearnerId: user.id}}).success(function (applications) {
|
||||
|
@ -137,7 +136,6 @@ module.exports = function (app) {
|
|||
_.each(applications, function(app) {
|
||||
_.extend(app, _.findWhere(data.badges, {id: app.badgeId}));
|
||||
});
|
||||
console.log(applications);
|
||||
res.render('user/applications.html', {
|
||||
items: _.map(applications, function(badge) {
|
||||
badge.url = '/myapplications/' + badge.id;
|
||||
|
@ -147,6 +145,17 @@ module.exports = function (app) {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/myapplications/:id', [
|
||||
loggedIn
|
||||
], function (req, res, next) {
|
||||
var user = req.session.user;
|
||||
applications.find({where: {LearnerId: user.id, BadgeId: req.params.id}}).success(function (application) {
|
||||
res.render('user/application.html', {
|
||||
item: application
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/favorites/:view?', function (req, res, next) {
|
||||
var badge = {
|
||||
|
|
Загрузка…
Ссылка в новой задаче