Skip to content
This repository has been archived by the owner on Jan 14, 2020. It is now read-only.

Commit

Permalink
Merge pull request #43 from stenington/34-badge-index
Browse files Browse the repository at this point in the history
Show all available badges on GET /
  • Loading branch information
brianloveswords committed Nov 10, 2012
2 parents dbf7e5d + 2889422 commit dd4a4f3
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app.js
Expand Up @@ -37,6 +37,7 @@ app.configure(function () {
})); }));
app.use(user.requireAuth({ app.use(user.requireAuth({
whitelist: [ whitelist: [
'/',
'/login', '/login',
'/logout', '/logout',
'/badge/*', // public badge resources '/badge/*', // public badge resources
Expand Down Expand Up @@ -65,7 +66,7 @@ app.post('/admin/config', issuer.update);
// Badge listing // Badge listing
// ------------- // -------------
var indexMiddleware = [badge.findAll, behavior.findAll]; var indexMiddleware = [badge.findAll, behavior.findAll];
app.get('/', indexMiddleware, admin.badgeIndex); app.get('/', badge.findAll, admin.all);
app.get('/admin', indexMiddleware, admin.badgeIndex); app.get('/admin', indexMiddleware, admin.badgeIndex);
app.get('/admin/badges', indexMiddleware, admin.badgeIndex); app.get('/admin/badges', indexMiddleware, admin.badgeIndex);


Expand Down
6 changes: 6 additions & 0 deletions routes/admin.js
Expand Up @@ -76,6 +76,12 @@ exports.criteria = function criteria(req, res) {
}); });
} }


exports.all = function all(req, res) {
return res.render('public/all.html', {
badges: req.badges,
});
};

exports.claim = function claim(req, res) { exports.claim = function claim(req, res) {
return res.render('public/claim.html', { return res.render('public/claim.html', {
csrf: req.session._csrf, csrf: req.session._csrf,
Expand Down
41 changes: 41 additions & 0 deletions views/public/all.html
@@ -0,0 +1,41 @@
{% extends "public/layout.html" %}
{% block head %}
<link rel="stylesheet" href="/stylesheets/criteria.css">
{% endblock %}
{% block body %}
<div class="row">
<div class="span7">
<h2>Mozilla Webmaker Badges</h2>
</div>
<div class="span10">
<strong>Webmaker Badges are here!</strong>
<p>
Badges are digital records of skills, achievements and participation. Now you can earn Webmaker Badges to recognize the skills that you learn while making awesome webmaking projects, as well as for participating in the Webmaker community and events.
</p>
<p>
Head over to <a href="https://thimble.webmaker.org">Thimble</a>, pick a project and sign in to start earning!
</p>
</div>
</div>
{% for badge in badges %}
<div class="media card">
<img class="img badge" src="{{ badge.relativeUrl('image')}}">
<div class="bd">
<hgroup>
<span class="wordmark">Mozilla</span>
<h1>{{ badge.name }}</h1>
</hgroup>
<dl class="dl-horizontal narrow-dt">
<dt>Description:</dt>
<dd>
{% if badge.criteria.content %}
{{ badge.criteria.content | markdown }}
{% else %}
{{ badge.description | stupidSafe }}
{% endif %}
</dd>
</dl>
</div>
</div>
{% endfor %}
{% endblock %}

0 comments on commit dd4a4f3

Please sign in to comment.