Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #43 from stenington/34-badge-index

Show all available badges on GET /
  • Loading branch information...
commit dd4a4f39f1149a5af9c415dcf592a83615ed74c5 2 parents dbf7e5d + 2889422
@brianloveswords brianloveswords authored
Showing with 49 additions and 1 deletion.
  1. +2 −1  app.js
  2. +6 −0 routes/admin.js
  3. +41 −0 views/public/all.html
View
3  app.js
@@ -37,6 +37,7 @@ app.configure(function () {
}));
app.use(user.requireAuth({
whitelist: [
+ '/',
'/login',
'/logout',
'/badge/*', // public badge resources
@@ -65,7 +66,7 @@ app.post('/admin/config', issuer.update);
// Badge listing
// -------------
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/badges', indexMiddleware, admin.badgeIndex);
View
6 routes/admin.js
@@ -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) {
return res.render('public/claim.html', {
csrf: req.session._csrf,
View
41 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 %}
Please sign in to comment.
Something went wrong with that request. Please try again.