fix issue 138: New badger_example app and standalone test scaffolding
* Moved badger_example out of tests directory and up to package root * Clean out playdoh / jinja templates, since they live in badg.us * Misc tweaks to get tests working standalone
This commit is contained in:
Родитель
3bab1afb3b
Коммит
b3544906d7
|
@ -0,0 +1,22 @@
|
||||||
|
language: python
|
||||||
|
|
||||||
|
python:
|
||||||
|
- "2.7"
|
||||||
|
|
||||||
|
env:
|
||||||
|
- DB=mysql
|
||||||
|
|
||||||
|
before_install:
|
||||||
|
- sudo apt-get update -qq
|
||||||
|
- sudo apt-get install build-essential python-dev python-pip python-virtualenv python-imaging python-lxml python-pyquery libxml2-dev libxslt-dev libjpeg8 libjpeg62-dev libfreetype6 libfreetype6-dev zlib1g-dev python-bcrypt sqlite3
|
||||||
|
- sudo ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib
|
||||||
|
- sudo ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib
|
||||||
|
|
||||||
|
install:
|
||||||
|
- pip install -r badger/requirements/tests.txt --use-mirrors
|
||||||
|
|
||||||
|
script: python manage.py test badger
|
||||||
|
|
||||||
|
notifications:
|
||||||
|
email:
|
||||||
|
- me@lmorchard.com
|
|
@ -2,6 +2,9 @@
|
||||||
django-badger
|
django-badger
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
.. image:: https://secure.travis-ci.org/lmorchard/django-badger.png?branch=master
|
||||||
|
:target: http://travis-ci.org/lmorchard/django-badger
|
||||||
|
|
||||||
Badger is a family of Django apps intended to help introduce badges into your
|
Badger is a family of Django apps intended to help introduce badges into your
|
||||||
project, to track and award achievements by your users. This can be used to
|
project, to track and award achievements by your users. This can be used to
|
||||||
help encourage certain behaviors, recognize skills, or just generally
|
help encourage certain behaviors, recognize skills, or just generally
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
Django==1.4.3
|
||||||
|
PIL==1.1.7
|
||||||
|
lxml==3.1beta1
|
||||||
|
pyquery==1.2.4
|
||||||
|
South==0.7.6
|
||||||
|
argparse==1.2.1
|
||||||
|
cssselect==0.7.1
|
||||||
|
distribute==0.6.24
|
||||||
|
django-nose==1.1
|
||||||
|
feedparser==5.1.3
|
||||||
|
nose==1.2.1
|
||||||
|
wsgiref==0.1.2
|
|
@ -1,120 +0,0 @@
|
||||||
{% extends "badger_playdoh/base.html" %}
|
|
||||||
|
|
||||||
{% set user = award.user %}
|
|
||||||
{% set award_url = request.build_absolute_uri(url('badger.views.award_detail', award.badge.slug, award.id)) %}
|
|
||||||
{% if award.image %}
|
|
||||||
{% set image_url = award.image.url %}
|
|
||||||
{% elif badge.image %}
|
|
||||||
{% set image_url = badge.image.url %}
|
|
||||||
{% else %}
|
|
||||||
{# TODO: Put the URL for default badge image in settings #}
|
|
||||||
{% set image_url = "/media/img/default-badge.png" %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% block pageid %}award_detail{% endblock %}
|
|
||||||
|
|
||||||
{% block extrahead %}
|
|
||||||
<link rel="alternate" type="application/json"
|
|
||||||
title="{{ _('{title} (JSON)') | f(title=award) }}"
|
|
||||||
href="{{ request.build_absolute_uri(url('badger.award_detail_json', badge.slug, award.pk)) }}" />
|
|
||||||
|
|
||||||
<meta property="og:type" content="article">
|
|
||||||
<meta property="og:url" content="{{ award_url }}">
|
|
||||||
<meta property="og:site_name" content="{{ settings.SITE_TITLE }}">
|
|
||||||
<meta property="og:image" content="{{ request.build_absolute_uri(image_url) }}">
|
|
||||||
<meta property="og:title" content="{{ badge.title }}">
|
|
||||||
<meta property="og:description" content="{{ award.user }} earned the badge "{{ badge.title }}" on {{ settings.SITE_TITLE }}!">
|
|
||||||
<meta property="og:updated_time" content="{{ award.created.isoformat() }}Z">
|
|
||||||
<meta property="article:published_time" content="{{ award.created.isoformat() }}Z">
|
|
||||||
<meta property="article:author" content="{{ request.build_absolute_uri(url('profiles.profile_view', award.creator.username)) }}">
|
|
||||||
{% for tag in badge.tags.all() %}
|
|
||||||
<meta property="article:tag" content="{{ tag.name }}">
|
|
||||||
{% endfor %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<header class="page-header">
|
|
||||||
<h2 class="badge-title">
|
|
||||||
{% if award.user == request.user %}
|
|
||||||
{{ _("Your Awarded Badge: {badge_title}") | f(badge_title=badge.title) }}
|
|
||||||
{% else %}
|
|
||||||
{{ _("Awarded Badge: {badge_title}") | f(badge_title=badge.title) }}
|
|
||||||
{% endif %}
|
|
||||||
</h2>
|
|
||||||
</header>
|
|
||||||
<section class="row-fluid">
|
|
||||||
|
|
||||||
<section class="badge span4">
|
|
||||||
{% include "badger_playdoh/includes/badge_full.html" %}
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section class="award span8">
|
|
||||||
{% include "badger_playdoh/includes/award_full.html" %}
|
|
||||||
<dl class="share">
|
|
||||||
<dt>{{ _('Share:') }}</dt>
|
|
||||||
<dd><ul>
|
|
||||||
|
|
||||||
{% if award.user == request.user %}
|
|
||||||
<li><form class="obi_issuer">
|
|
||||||
<button class="btn issue" style="width: 18em"><img class="obi_icons" width="32" style="margin: 0 0em 0em 0; float: left" src="http://openbadges.org/img/index/backpack.png" />
|
|
||||||
<strong>{{_("Add this badge to your Mozilla Badge Backpack")}}</strong></button>
|
|
||||||
</form></li>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if award.user == request.user %}
|
|
||||||
<li><a href="https://twitter.com/share" class="twitter-share-button"
|
|
||||||
data-text="I earned the badge "{{ badge.title }}" on {{ settings.SITE_TITLE }}!"
|
|
||||||
data-size="large"
|
|
||||||
data-url="{{ award_url }}" data-hashtags="badgus">...</a></li>
|
|
||||||
{% else %}
|
|
||||||
<li><a href="https://twitter.com/share" class="twitter-share-button"
|
|
||||||
data-text="{{ award.user }} earned the badge "{{ badge.title }}" on {{ settings.SITE_TITLE }}!"
|
|
||||||
data-size="large"
|
|
||||||
data-url="{{ award_url }}" data-hashtags="badgus">...</a></li>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<li><div class="g-plus" data-href="{{ award_url }}" data-action="share"
|
|
||||||
data-annotation="bubble" data-height="24"></div></li>
|
|
||||||
|
|
||||||
<li><div class="fb-like" data-href="{{ award_url }}" data-send="true"
|
|
||||||
data-width="450" data-show-faces="false"></div></li>
|
|
||||||
|
|
||||||
</ul></dd>
|
|
||||||
</dl>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<div id="fb-root"></div>
|
|
||||||
<script>
|
|
||||||
window.fbAsyncInit = function() {
|
|
||||||
FB.init({
|
|
||||||
appId : '235454449896211', // App ID
|
|
||||||
channelUrl : '{{ request.build_absolute_uri('/media/fb-channel.html') }}', // Channel File
|
|
||||||
status : true, // check login status
|
|
||||||
cookie : true, // enable cookies to allow the server to access the session
|
|
||||||
xfbml : true // parse XFBML
|
|
||||||
});
|
|
||||||
// Additional initialization code here
|
|
||||||
};
|
|
||||||
|
|
||||||
// Load the SDK Asynchronously
|
|
||||||
(function(d){
|
|
||||||
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
|
|
||||||
if (d.getElementById(id)) {return;}
|
|
||||||
js = d.createElement('script'); js.id = id; js.async = true;
|
|
||||||
js.src = "//connect.facebook.net/en_US/all.js";
|
|
||||||
ref.parentNode.insertBefore(js, ref);
|
|
||||||
}(document));
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block js %}
|
|
||||||
<script type="text/javascript"
|
|
||||||
src="{{ settings.OBI_BASE_URL }}issuer.js"></script>
|
|
||||||
<script type="text/javascript"
|
|
||||||
src="//platform.twitter.com/widgets.js"></script>
|
|
||||||
<script type="text/javascript"
|
|
||||||
src="https://apis.google.com/js/plusone.js"></script>
|
|
||||||
{% endblock %}
|
|
|
@ -1,35 +0,0 @@
|
||||||
{% extends "badger_playdoh/base.html" %}
|
|
||||||
|
|
||||||
{% block pageid %}badge_awards_by_badge{% endblock %}
|
|
||||||
|
|
||||||
{% block extrahead %}
|
|
||||||
<link rel="alternate" type="application/atom+xml"
|
|
||||||
title="{{ _('Recent awards') }}"
|
|
||||||
href="{{ url('badger.feeds.awards_by_badge', 'atom', badge.slug) }}" />
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
|
|
||||||
<section class="row-fluid">
|
|
||||||
<section>
|
|
||||||
<header class="page-header">
|
|
||||||
<h2>{{ _("Badge detail for {title}") | f(title=badge.title) }}</h2>
|
|
||||||
</header>
|
|
||||||
{% include "badger_playdoh/includes/badge_full.html" %}
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section>
|
|
||||||
<header class="page-header">
|
|
||||||
<h2>{{_("Awards")}}</h2>
|
|
||||||
</header>
|
|
||||||
<ul class="awards">
|
|
||||||
{% for award in awards %}
|
|
||||||
<li>
|
|
||||||
{% include "badger_playdoh/includes/award_as_user.html" %}
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
|
@ -1,18 +0,0 @@
|
||||||
{% extends "badger_playdoh/base.html" %}
|
|
||||||
|
|
||||||
{% block pageid %}badge_awards_by_user{% endblock %}
|
|
||||||
|
|
||||||
{% block extrahead %}
|
|
||||||
<link rel="alternate" type="application/atom+xml"
|
|
||||||
title="{{ _('Recent awards') }}"
|
|
||||||
href="{{ url('badger.feeds.awards_by_user', 'atom', user.username) }}" />
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<section class="awards_list">
|
|
||||||
<header class="page-header">
|
|
||||||
<h2>{{ _("Awards for {user}") | f(user=user) }}</h2>
|
|
||||||
</header>
|
|
||||||
{% include "badger_playdoh/includes/awards_as_badges_list.html" %}
|
|
||||||
</section>
|
|
||||||
{% endblock %}
|
|
|
@ -1,24 +0,0 @@
|
||||||
{% extends "badger_playdoh/base.html" %}
|
|
||||||
|
|
||||||
{% block pageid %}awards{% endblock %}
|
|
||||||
|
|
||||||
{% block extrahead %}
|
|
||||||
<link rel="alternate" type="application/atom+xml"
|
|
||||||
title="{{ _('Recent badge awards') }}"
|
|
||||||
href="{{ url('badger.feeds.awards_recent', 'atom') }}" />
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
|
|
||||||
<section class="awards_list" class="item_flow">
|
|
||||||
<header class="page-header">
|
|
||||||
{% if badge %}
|
|
||||||
<h2>{{ _("Awarded badges for {badge}") | f(badge=badge) }}</h2>
|
|
||||||
{% else: %}
|
|
||||||
<h2>{{ _("Awarded badges") }}</h2>
|
|
||||||
{% endif %}
|
|
||||||
</header>
|
|
||||||
{% include "badger_playdoh/includes/awards_list.html" %}
|
|
||||||
</section>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
|
@ -1,31 +0,0 @@
|
||||||
{% extends "badger_playdoh/base.html" %}
|
|
||||||
|
|
||||||
{% block pageid %}badge_award{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
|
|
||||||
<section class="row-fluid">
|
|
||||||
|
|
||||||
<section class="span4" id="detail">
|
|
||||||
<header class="page-header">
|
|
||||||
<h2>{{ _("Badge: {badge_title}") | f(badge_title=badge.title) }}</h2>
|
|
||||||
</header>
|
|
||||||
{% include "badger_playdoh/includes/badge_full.html" %}
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section class="span8">
|
|
||||||
<header class="page-header">
|
|
||||||
<h2>{{ _("Issue badge awards") }}</h2>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<form id="award_badge" method="POST" action="" enctype="multipart/form-data">
|
|
||||||
{{ csrf() }}
|
|
||||||
<ul>
|
|
||||||
{{ form.as_ul() }}
|
|
||||||
<li><input type="submit" class="btn btn-large btn-primary submit" value="{{ _("Issue badge awards") }}"></li>
|
|
||||||
</ul>
|
|
||||||
</form>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
{% endblock %}
|
|
|
@ -1,80 +0,0 @@
|
||||||
{% extends "badger_playdoh/base.html" %}
|
|
||||||
|
|
||||||
{% block pageid %}badge_create{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
|
|
||||||
<section>
|
|
||||||
<section class="row-fluid">
|
|
||||||
<section class="span6">
|
|
||||||
<header class="page-header">
|
|
||||||
<h2>{{ _("Create a badge") }}</h2>
|
|
||||||
</header>
|
|
||||||
<form id="create_badge" method="POST" action="" enctype="multipart/form-data">
|
|
||||||
{{ csrf() }}
|
|
||||||
<ul>
|
|
||||||
{{ form.as_ul() }}
|
|
||||||
<li><input type="submit" class="btn btn-large btn-primary submit" value="{{ _("Create badge") }}"></li>
|
|
||||||
</ul>
|
|
||||||
</form>
|
|
||||||
</section>
|
|
||||||
<section class="span6 sample-badge">
|
|
||||||
<header class="page-header">
|
|
||||||
<h2>Example badge:</h2>
|
|
||||||
</header>
|
|
||||||
<p>{% trans %}
|
|
||||||
This isn't a real badge, but it shows a few things you can do.
|
|
||||||
{% endtrans %}</p>
|
|
||||||
{# TODO: Put the URL for default badge image in settings #}
|
|
||||||
{% set image_url = "/media/img/default-badge.png" %}
|
|
||||||
<dl class="badge">
|
|
||||||
<dt>{{_("Title:")}}</dt>
|
|
||||||
<dd class="title"><strong>{{ _('Test Badger') }}</strong>
|
|
||||||
<p><i>{% trans %}
|
|
||||||
Try to keep this to 5 words, or less.
|
|
||||||
{% endtrans %}</i></p></dd>
|
|
||||||
<dt>{{_("Image:")}}</dt>
|
|
||||||
<dd class="image"><span class="image"><img src="{{ image_url }}" width="256" height="256" /></span>
|
|
||||||
<p><i>{% trans %}
|
|
||||||
This should be a square image, around 256x256
|
|
||||||
pixels. The system will automatically crop and
|
|
||||||
resize images that fall outside these guidelines.
|
|
||||||
Also, consider using simple artwork that stays
|
|
||||||
distinctive at a variety of sizes and viewing
|
|
||||||
distances. Lots of small details and words are hard
|
|
||||||
to see when the badge image is either small or far
|
|
||||||
away.
|
|
||||||
{% endtrans %}</i></p>
|
|
||||||
</dd>
|
|
||||||
<dt>{{_("Description:")}}</dt>
|
|
||||||
<dd class="description">{{ _("For having qualities like a test pilot, but more badgery.") }}
|
|
||||||
<p><i>{% trans %}
|
|
||||||
Use this to describe why someone would earn this
|
|
||||||
badge. Explain the conditions and criteria a person
|
|
||||||
would need to satisfy to receive this badge as an
|
|
||||||
award.
|
|
||||||
{% endtrans %}</i></p>
|
|
||||||
</dd>
|
|
||||||
<dt>{{ _("Tags:") }}</dt>
|
|
||||||
<dd><ul class="tags">
|
|
||||||
{% set tags = [ 'tests', 'A2makerfaire2012', 'badgers' ] %}
|
|
||||||
{% for tag in tags %}
|
|
||||||
<li><a class="tag" href="{{ url('badger.badges_list', tag_name=tag) }}"><i class="icon-tag icon-white"></i> {{ tag }}</a></li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% set example_tag_url = url('badger.badges_list', tag_name='a2makerfaire2012') %}
|
|
||||||
<p><i>{% trans %}
|
|
||||||
Use tags to group your badge with others. These are
|
|
||||||
like <a href="https://support.twitter.com/articles/49309-what-are-hashtags-symbols" target="_blank">hashtags on Twitter</a>.
|
|
||||||
These <a href="http://twitter.pbworks.com/w/page/1779812/Hashtags" target="_blank">are best used sparingly</a>:
|
|
||||||
Try not to enter more than 2-5 concise topics or keywords. Events
|
|
||||||
often use tags to help gather badges that will be
|
|
||||||
offered (eg. <a href="{{ example_tag_url }}" target="_blank">A2makerfaire2012</a>).
|
|
||||||
{% endtrans %}</i></p>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
|
@ -1,44 +0,0 @@
|
||||||
{% extends "badger_playdoh/base.html" %}
|
|
||||||
|
|
||||||
{% block pageid %}badge_delete{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
|
|
||||||
<section class="row-fluid">
|
|
||||||
|
|
||||||
<section class="span4" id="detail">
|
|
||||||
<header class="page-header">
|
|
||||||
<h2>{{ _("Badge: {badge_title}") | f(badge_title=badge.title) }}</h2>
|
|
||||||
</header>
|
|
||||||
{% include "badger_playdoh/includes/badge_full.html" %}
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section class="span8">
|
|
||||||
<header class="page-header">
|
|
||||||
<h2>{{ _("Delete badge") }}</h2>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<form id="nominate_badge" method="POST" action="" enctype="multipart/form-data">
|
|
||||||
{{ csrf() }}
|
|
||||||
{% if awards_count %}
|
|
||||||
<p>{% trans badge_url=badge.get_absolute_url(), awards_count=awards_count %}
|
|
||||||
<span class="label label-warning">Note:</span>
|
|
||||||
Deleting this badge will also delete
|
|
||||||
<a href="{{ badge_url }}"><span class="awards_count">{{awards_count}}</span> award(s)</a>
|
|
||||||
{% endtrans %}</p>
|
|
||||||
{% else %}
|
|
||||||
<p>{% trans %}
|
|
||||||
<span class="label label-success">Note:</span>
|
|
||||||
No one has been awarded this badge, yet.
|
|
||||||
{% endtrans %}</p>
|
|
||||||
{% endif %}
|
|
||||||
<p>{{ _("Are you sure?") }}</p>
|
|
||||||
<ul>
|
|
||||||
<li><input type="submit" class="btn btn-large btn-danger submit" value="{{ _("Delete badge") }}"></li>
|
|
||||||
</ul>
|
|
||||||
</form>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
|
@ -1,209 +0,0 @@
|
||||||
{% extends "badger_playdoh/base.html" %}
|
|
||||||
|
|
||||||
{% set badge_url = request.build_absolute_uri(badge.get_absolute_url()) %}
|
|
||||||
{% if badge.image %}
|
|
||||||
{% set image_url = badge.image.url %}
|
|
||||||
{% else %}
|
|
||||||
{# TODO: Put the URL for default badge image in settings #}
|
|
||||||
{% set image_url = "/media/img/default-badge.png" %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% block pageid %}badge_detail{% endblock %}
|
|
||||||
|
|
||||||
{% block extrahead %}
|
|
||||||
<link rel="alternate" type="application/atom+xml"
|
|
||||||
title="{{ _('Recent awards') }}"
|
|
||||||
href="{{ url('badger.feeds.awards_by_badge', format='atom', slug=badge.slug) }}" />
|
|
||||||
<link rel="alternate" type="application/json"
|
|
||||||
title="{{ _('{title} (JSON)') | f(title=badge) }}"
|
|
||||||
href="{{ url('badger.detail_json', slug=badge.slug) }}" />
|
|
||||||
|
|
||||||
<meta property="og:type" content="article">
|
|
||||||
<meta property="og:url" content="{{ badge_url }}">
|
|
||||||
<meta property="og:site_name" content="{{ settings.SITE_TITLE }}">
|
|
||||||
<meta property="og:image" content="{{ request.build_absolute_uri(image_url) }}">
|
|
||||||
<meta property="og:title" content="{{ badge.title }}">
|
|
||||||
<meta property="og:description" content="{{ badge.description }}">
|
|
||||||
<meta property="article:published_time" content="{{ badge.modified.isoformat() }}Z">
|
|
||||||
<meta property="article:author" content="{{ request.build_absolute_uri(url('profiles.profile_view', badge.creator.username)) }}">
|
|
||||||
{% for tag in badge.tags.all() %}
|
|
||||||
<meta property="article:tag" content="{{ tag.name }}">
|
|
||||||
{% endfor %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
|
|
||||||
<section class="row-fluid">
|
|
||||||
|
|
||||||
<section class="span4" id="detail">
|
|
||||||
<header class="page-header">
|
|
||||||
<h2 class="badge-title">{{ _("Badge: {badge_title}") | f(badge_title=badge.title) }}</h2>
|
|
||||||
</header>
|
|
||||||
{% include "badger_playdoh/includes/badge_full.html" %}
|
|
||||||
{% if not award %}
|
|
||||||
<dl class="share">
|
|
||||||
<dt>{{ _('Share:') }}</dt>
|
|
||||||
<dd><ul>
|
|
||||||
<li><a href="https://twitter.com/share" class="twitter-share-button"
|
|
||||||
data-text=""{{ badge.title }}" on {{ settings.SITE_TITLE }}!"
|
|
||||||
data-size="large"
|
|
||||||
data-url="{{ badge_url }}" data-hashtags="badgus">...</a></li>
|
|
||||||
|
|
||||||
<li><div class="g-plus" data-href="{{ badge_url }}" data-action="share"
|
|
||||||
data-annotation="bubble" data-height="24"></div></li>
|
|
||||||
|
|
||||||
<li><div class="fb-like" data-href="{{ badge_url }}" data-send="true"
|
|
||||||
data-width="450" data-show-faces="false"></div></li>
|
|
||||||
|
|
||||||
</ul></dd>
|
|
||||||
</dl>
|
|
||||||
{% endif %}
|
|
||||||
</section>
|
|
||||||
|
|
||||||
{% if award_list %}
|
|
||||||
<section class="span4">
|
|
||||||
|
|
||||||
<section id="recent_awardees" class="item_flow">
|
|
||||||
<header class="page-header">
|
|
||||||
<h2>
|
|
||||||
<span>{{ _("Recent badge awards") }}</span>
|
|
||||||
<small>(
|
|
||||||
<a href="{{ url('badger.views.awards_list', badge.slug) }}">{{ _("More...") }}</a>
|
|
||||||
<a href="{{ url('badger.feeds.awards_by_badge', 'atom', badge.slug) }}"><img src="{{MEDIA_URL}}/img/feed-icon-14x14.png" /></a>
|
|
||||||
)</small>
|
|
||||||
</h2>
|
|
||||||
</header>
|
|
||||||
<ul class="awardees clearfix">
|
|
||||||
{% for award in award_list %}
|
|
||||||
<li class="awardee">
|
|
||||||
<a href="{{ award.get_absolute_url() }}" class="avatar_image"><img src="{{ user_avatar(award.user) }}"
|
|
||||||
alt="{{ award.badge.title }}" width="128" height="128" /></a>
|
|
||||||
<a href="{{ award.get_absolute_url() }}" class="label">
|
|
||||||
<span class="user">{{ award.user }}</span></a>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<section class="span4">
|
|
||||||
|
|
||||||
{% if badge.allows_nominate_for(request.user) %}
|
|
||||||
<section>
|
|
||||||
<header class="page-header">
|
|
||||||
<h2>{{ _("Submit nominations by email") }}</h2>
|
|
||||||
</header>
|
|
||||||
<form id="award_badge" method="POST"
|
|
||||||
action="{{ url('badger.views.nominate_for', slug=badge.slug) }}">
|
|
||||||
{{ csrf() }}
|
|
||||||
<ul>
|
|
||||||
{{ sections.nominate.form.as_ul() }}
|
|
||||||
<li><input type="submit" class="btn btn-large btn-primary submit" value="{{ _("Submit nominations") }}"></li>
|
|
||||||
</ul>
|
|
||||||
</form>
|
|
||||||
</section>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if badge.allows_award_to(request.user) %}
|
|
||||||
<section>
|
|
||||||
<header class="page-header">
|
|
||||||
<h2>{{ _("Issue badge awards by email") }}</h2>
|
|
||||||
</header>
|
|
||||||
<form id="award_badge" method="POST"
|
|
||||||
action="{{ url('badger.views.award_badge', slug=badge.slug) }}">
|
|
||||||
{{ csrf() }}
|
|
||||||
<ul>
|
|
||||||
{{ sections.award.form.as_ul() }}
|
|
||||||
<li><input type="submit" class="btn btn-large btn-primary submit" value="{{ _("Issue badge awards") }}"></li>
|
|
||||||
</ul>
|
|
||||||
</form>
|
|
||||||
</section>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if badge.allows_manage_deferred_awards_by(request.user) %}
|
|
||||||
<section class="claims_list">
|
|
||||||
<header class="page-header">
|
|
||||||
<h2>{{ _("Issue badge awards with claim codes") }}</h2>
|
|
||||||
<p>PDF prints sheets of <a href="https://www.google.com/search?q=Avery+22805" target="_blank">Avery 22805 labels</a>, 24 per page</p>
|
|
||||||
</header>
|
|
||||||
<form id="create_claims" method="POST" action="">
|
|
||||||
{{ csrf() }}
|
|
||||||
<input type="hidden" name="is_generate" value="1" />
|
|
||||||
<select name="amount">
|
|
||||||
<option value="1">1 reusable claim code</option>
|
|
||||||
{% for x in (6, 12, 24, 48, 72, 96) %}
|
|
||||||
<option value="{{ x }}">{{ _('{num} single-use claim codes') | f(num=x) }}</option>
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
<input type="submit" class="btn btn-large btn-primary submit" value="{{ _("Generate") }}">
|
|
||||||
</form>
|
|
||||||
<ul class="claim_groups">
|
|
||||||
{% for item in claim_groups %}
|
|
||||||
<li>
|
|
||||||
<form class="delete_claim" method="POST" action="">
|
|
||||||
{{ csrf() }}
|
|
||||||
<input type="hidden" name="is_delete" value="1" />
|
|
||||||
<input type="hidden" name="claim_group" value="{{ item.claim_group }}" />
|
|
||||||
<input type="submit" class="btn btn-danger submit" value="{{ _("Delete") }}">
|
|
||||||
</form>
|
|
||||||
—
|
|
||||||
{% if item.count > 1 %}
|
|
||||||
<a class="btn" target="_blank" href="{{ url('badger.claims_list', badge.slug, item.claim_group) }}">
|
|
||||||
<strong class="modified">{{ item.modified }}</strong>
|
|
||||||
—
|
|
||||||
<span class="count">{{ _('{count} single-use codes') | f(count=item.count) }}</span>
|
|
||||||
</a>
|
|
||||||
—
|
|
||||||
<a class="btn btn-success"
|
|
||||||
title="{{ _("Download claim codes as printable PDF") }}"
|
|
||||||
href="{{ url('badger.claims_list_pdf', slug=badge.slug, claim_group=item.claim_group) }}">{{ _("PDF") }}</a>
|
|
||||||
{% else %}
|
|
||||||
<a class="btn" target="_blank" href="{{ url('badger.claims_list', badge.slug, item.claim_group) }}">
|
|
||||||
<strong class="modified">{{ item.modified }}</strong>
|
|
||||||
—
|
|
||||||
<span class="count">{{ _('1 reusable code') }}</span>
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<div id="fb-root"></div>
|
|
||||||
<script>
|
|
||||||
window.fbAsyncInit = function() {
|
|
||||||
FB.init({
|
|
||||||
appId : '235454449896211', // App ID
|
|
||||||
channelUrl : '{{ request.build_absolute_uri('/media/fb-channel.html') }}', // Channel File
|
|
||||||
status : true, // check login status
|
|
||||||
cookie : true, // enable cookies to allow the server to access the session
|
|
||||||
xfbml : true // parse XFBML
|
|
||||||
});
|
|
||||||
// Additional initialization code here
|
|
||||||
};
|
|
||||||
|
|
||||||
// Load the SDK Asynchronously
|
|
||||||
(function(d){
|
|
||||||
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
|
|
||||||
if (d.getElementById(id)) {return;}
|
|
||||||
js = d.createElement('script'); js.id = id; js.async = true;
|
|
||||||
js.src = "//connect.facebook.net/en_US/all.js";
|
|
||||||
ref.parentNode.insertBefore(js, ref);
|
|
||||||
}(document));
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block js %}
|
|
||||||
<script type="text/javascript"
|
|
||||||
src="//platform.twitter.com/widgets.js"></script>
|
|
||||||
<script type="text/javascript"
|
|
||||||
src="https://apis.google.com/js/plusone.js"></script>
|
|
||||||
{% endblock %}
|
|
|
@ -1,39 +0,0 @@
|
||||||
{% extends "badger_playdoh/base.html" %}
|
|
||||||
|
|
||||||
{% block pageid %}badges{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
|
|
||||||
<section class="badges_list" class="item_flow">
|
|
||||||
<header class="page-header">
|
|
||||||
<h2>
|
|
||||||
{% if tag_name %}
|
|
||||||
<span>{% trans %}Badges tagged <a href="" class="tag"><i class="icon-tag icon-white"></i> {{tag_name}}</a>{% endtrans %}</span>
|
|
||||||
{% if badger_allows_add_by(request.user) %}
|
|
||||||
<small>
|
|
||||||
<a class="action btn btn-large btn-primary" href="{{ url('badger.views.create') | urlparams(tags=tag_name) }}">{{ _('Create new badge') }}</a>
|
|
||||||
</small>
|
|
||||||
{% endif %}
|
|
||||||
{% elif query_string %}
|
|
||||||
<span>{{ _('Badges matching "{query_string}"') | f(query_string=query_string) }}</span>
|
|
||||||
{% else %}
|
|
||||||
<span>{{ _("All badges") }}</span>
|
|
||||||
{% if badger_allows_add_by(request.user) %}
|
|
||||||
<small>
|
|
||||||
<a class="action btn btn-primary" href="{{ url('badger.views.create') }}">{{ _('Create new badge') }}</a>
|
|
||||||
</small>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
</h2>
|
|
||||||
</header>
|
|
||||||
{% include "badger_playdoh/includes/badges_list.html" %}
|
|
||||||
|
|
||||||
{% if award_list %}
|
|
||||||
<h2>{{ _('Recent awards for these badges') }}</h2>
|
|
||||||
{% set award_list = award_list[:12] %}
|
|
||||||
{% set hide_pagination = True %}
|
|
||||||
{% include "badger_playdoh/includes/awards_list.html" %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</section>
|
|
||||||
{% endblock %}
|
|
|
@ -1 +0,0 @@
|
||||||
{% extends "base.html" %}
|
|
|
@ -1,13 +0,0 @@
|
||||||
{% trans domain=current_site.domain,
|
|
||||||
badge_url=badge.get_absolute_url(),
|
|
||||||
badge_title=badge.title,
|
|
||||||
claim_url=deferred_award.get_claim_url(),
|
|
||||||
protocol=(protocol or 'http') %}
|
|
||||||
|
|
||||||
You have received an award for the badge {{ badge_title }}.
|
|
||||||
|
|
||||||
You can claim it, here:
|
|
||||||
|
|
||||||
{{ protocol }}://{{ domain }}{{ claim_url }}
|
|
||||||
|
|
||||||
{% endtrans %}
|
|
|
@ -1 +0,0 @@
|
||||||
{% trans site_name=current_site.name, badge_title=badge.title %}[{{ site_name }}] Claim your award for the badge "{{ badge_title }}"{% endtrans %}
|
|
|
@ -1,125 +0,0 @@
|
||||||
{% extends "badger_playdoh/base.html" %}
|
|
||||||
|
|
||||||
{% block pageid %}home{% endblock %}
|
|
||||||
|
|
||||||
{% block extrahead %}
|
|
||||||
<link rel="alternate" type="application/atom+xml"
|
|
||||||
title="{{ _('Recently awarded badges') }}"
|
|
||||||
href="{{ url('badger.feeds.awards_recent', 'atom') }}" />
|
|
||||||
<link rel="alternate" type="application/atom+xml"
|
|
||||||
title="{{ _('Recently created badges') }}"
|
|
||||||
href="{{ url('badger.feeds.badges_recent', 'atom') }}" />
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
|
|
||||||
<section class="home-intro hero-unit">
|
|
||||||
<h1><span>{{ _("Welcome to {site_title}!") | f(site_title=settings.SITE_TITLE) }}</span></h1>
|
|
||||||
|
|
||||||
<div class="row-fluid">
|
|
||||||
|
|
||||||
<section class="item span4">
|
|
||||||
<section class="blurb">
|
|
||||||
<p>This is an experimental service
|
|
||||||
for <a href="http://decafbad.com/2010/07/badger-article/">badges</a>,
|
|
||||||
powered by <a href="https://github.com/lmorchard/django-badger">Open Source</a>.
|
|
||||||
Check <a href="https://github.com/lmorchard/badg.us/wiki/FAQ">the FAQ</a>!
|
|
||||||
Submit <a href="http://goo.gl/mod/Umab">suggestions</a>!
|
|
||||||
</p>
|
|
||||||
</section>
|
|
||||||
<section class="action">
|
|
||||||
{% if request.user.is_authenticated() %}
|
|
||||||
<p><a class="action btn btn-info btn-large" href="{{ request.user.get_absolute_url() }}">{{ _("☺ View your profile") }}</a></p>
|
|
||||||
{% else %}
|
|
||||||
{% block signin %}
|
|
||||||
<form class="browserid" action="{{url('browserid_verify')}}" method="POST">
|
|
||||||
{{ csrf() }}
|
|
||||||
{% set next = request.GET.get('next', False) %}
|
|
||||||
{% if next %}
|
|
||||||
<input type="hidden" name="next" value="{{ next }}" />
|
|
||||||
{% else %}
|
|
||||||
<input type="hidden" name="next" value="{{ request.build_absolute_uri() }}" />
|
|
||||||
{% endif %}
|
|
||||||
{{ browserid_form.as_p()|safe }}
|
|
||||||
<a href="#" class="browserid-signin" title="{{_('Sign In with BrowserID')}}"><img src="{{MEDIA_URL}}img/sign_in_blue.png" /></a>
|
|
||||||
</form>
|
|
||||||
{% endblock %}
|
|
||||||
{% endif %}
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section class="item span4">
|
|
||||||
<section class="blurb">
|
|
||||||
<h3>{{ _("Have a claim code?") }}</h3>
|
|
||||||
<p>{{ _("Type it here to claim your badge:") }}</p>
|
|
||||||
</section>
|
|
||||||
<section class="action">
|
|
||||||
<form class="claim" method="POST" action="{{ url('badger.views.claim_deferred_award') }}">
|
|
||||||
{{ csrf() }}
|
|
||||||
<input type="text" size="16" class="text-input claim-code"
|
|
||||||
name="code" id="intro_code"
|
|
||||||
placeholder="enter claim code"
|
|
||||||
value="{{ request.GET.get('code','') }}" />
|
|
||||||
<input type="submit" class="action btn btn-success btn-large" value="{{ _('Claim award from code') }}" />
|
|
||||||
</form>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section class="item span4">
|
|
||||||
<section class="blurb">
|
|
||||||
<h3>{{ _("Have an idea for a badge?") }}</h3>
|
|
||||||
<p>{{ _("Click here to start:") }}</p>
|
|
||||||
</section>
|
|
||||||
<section class="action">
|
|
||||||
<p><a class="action btn btn-primary btn-large" href="{{ url('badger.views.create') }}">{{ _("✸ Create a new badge") }}</a></p>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
{% if badge_tags %}
|
|
||||||
<section class="row-fluid">
|
|
||||||
<section class="span12">
|
|
||||||
<ul class="tags top_tags">
|
|
||||||
{% for item in badge_tags %}
|
|
||||||
<li><a class="tag" href="{{ url('badger.badges_list', tag_name=item.tag.name) }}"><i class="icon-tag icon-white"></i> {{ item.tag.name }} <span class="count">{{ item.count }}</span></a></li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<section class="row-fluid">
|
|
||||||
|
|
||||||
<section id="recent_badges" class="span5 item_flow">
|
|
||||||
<header class="page-header">
|
|
||||||
<h2>
|
|
||||||
<span>{{ _("Recently created badges") }}</span>
|
|
||||||
<small>
|
|
||||||
<a href="{{ url('badger.views.badges_list') }}">{{ _("More...") }}</a>
|
|
||||||
<a href="{{ url('badger.feeds.badges_recent', 'atom') }}"><img alt="{{ _("Atom feed") }}" src="{{MEDIA_URL}}/img/feed-icon-14x14.png" /></a>
|
|
||||||
</small>
|
|
||||||
</h2>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
{% set badge_list = badge_list[:12] %}
|
|
||||||
{% include "badger_playdoh/includes/badges_list.html" %}
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section id="recent_awards" class="span7 item_flow">
|
|
||||||
<header class="page-header">
|
|
||||||
<h2>
|
|
||||||
<span>{{ _("Recently awarded badges") }}</span>
|
|
||||||
<small>
|
|
||||||
<a href="{{ url('badger.views.awards_list') }}">{{ _("More...") }}</a>
|
|
||||||
<a href="{{ url('badger.feeds.awards_recent', 'atom') }}"><img alt="{{ _("Atom feed") }}" src="{{MEDIA_URL}}/img/feed-icon-14x14.png" /></a>
|
|
||||||
</small>
|
|
||||||
</h2>
|
|
||||||
</header>
|
|
||||||
{% set award_list = award_list[:9] %}
|
|
||||||
{% include "badger_playdoh/includes/awards_list.html" %}
|
|
||||||
</section>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
{% endblock %}
|
|
|
@ -1,5 +0,0 @@
|
||||||
{% set badge = award.badge %}
|
|
||||||
<div class="award by_badge">
|
|
||||||
{% include "badger_playdoh/includes/badge_full.html" %}
|
|
||||||
<a href="{{award.get_absolute_url()}}">{{ _('Award details') }}</a>
|
|
||||||
</div>
|
|
|
@ -1,4 +0,0 @@
|
||||||
{% set user = award.user %}
|
|
||||||
<div class="award by_user">
|
|
||||||
<a href="{{award.get_absolute_url()}}" class="username">{{ user }}</a>
|
|
||||||
</div>
|
|
|
@ -1,19 +0,0 @@
|
||||||
<dl class="award">
|
|
||||||
<dt>{{_("Awarded to:")}}</dt>
|
|
||||||
<dd class="awarded_to">
|
|
||||||
<a href="{{ award.user.get_absolute_url() }}" class="username"><img src="{{ user_avatar(award.user) }}" class="avatar" alt="{{ award.user }}" width="128" height="128" />{{ award.user }}</a>
|
|
||||||
{% if request.user == award.user %}
|
|
||||||
<strong>{{ _("(That's you!)") }}</strong>
|
|
||||||
{% endif %}
|
|
||||||
</dd>
|
|
||||||
<dt>{{_("Awarded by:")}}</dt>
|
|
||||||
<dd class="awarded_by"><a href="{{ award.creator.get_absolute_url() }}"
|
|
||||||
class="username"><img src="{{ user_avatar(award.creator) }}" class="avatar"
|
|
||||||
alt="{{ award.creator }}" width="128" height="128" />{{ award.creator }}</a></dd>
|
|
||||||
<dt>{{_("Awarded at:")}}</dt>
|
|
||||||
<dd class="issued">{{ award.created }}</dd>
|
|
||||||
{% if award.description %}
|
|
||||||
<dt>{{_("Explanation:")}}</dt>
|
|
||||||
<dd class="description">{{ award.description }}</dd>
|
|
||||||
{% endif %}
|
|
||||||
</dl>
|
|
|
@ -1,16 +0,0 @@
|
||||||
<ul class="badges clearfix">
|
|
||||||
{% for award in award_list %}
|
|
||||||
{% if award.image %}
|
|
||||||
{% set img_url = award.image.url %}
|
|
||||||
{% else %}
|
|
||||||
{% set img_url = "/media/img/default-badge.png" %}
|
|
||||||
{% endif %}
|
|
||||||
<li class="badge">
|
|
||||||
<a href="{{ award.get_absolute_url() }}" class="image"><img src="{{ img_url }}"
|
|
||||||
alt="{{ award.badge.title }}" width="128" height="128" /></a>
|
|
||||||
<a href="{{ award.get_absolute_url() }}" class="label">
|
|
||||||
<span class="title">{{ award.badge.title }}</span></a>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% include "badger_playdoh/includes/pagination.html" %}
|
|
|
@ -1,34 +0,0 @@
|
||||||
<ul class="awards">
|
|
||||||
{% for award in award_list %}
|
|
||||||
|
|
||||||
{% if award.image %}
|
|
||||||
{% set img_url = award.image.url %}
|
|
||||||
{% elif award.badge.image %}
|
|
||||||
{% set img_url = award.badge.image.url %}
|
|
||||||
{% else %}
|
|
||||||
{% set img_url = "/media/img/default-badge.png" %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<li class="award">
|
|
||||||
|
|
||||||
<a href="{{ award.get_absolute_url() }}" class="award_image"><img src="{{ img_url }}"
|
|
||||||
alt="{{ award.badge.title }}" width="128" height="128" /></a>
|
|
||||||
|
|
||||||
<a href="{{ award.get_absolute_url() }}" class="label">
|
|
||||||
{% trans title=award.badge.title, user=award.user %}
|
|
||||||
<span class="badge_title">{{ title }}</span>
|
|
||||||
<span class="relation">awarded to</span>
|
|
||||||
<span class="user">{{ user }}</span>
|
|
||||||
{% endtrans %}
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<a href="{{ award.get_absolute_url() }}" class="avatar_image"><img src="{{ user_avatar(award.user) }}"
|
|
||||||
alt="{{ award.badge.title }}" width="128" height="128" /></a>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% if not hide_pagination %}
|
|
||||||
{% include "badger_playdoh/includes/pagination.html" %}
|
|
||||||
{% endif %}
|
|
|
@ -1,44 +0,0 @@
|
||||||
{% if award and award.image %}
|
|
||||||
{% set image_url = award.image.url %}
|
|
||||||
{% elif badge.image %}
|
|
||||||
{% set image_url = badge.image.url %}
|
|
||||||
{% else %}
|
|
||||||
{# TODO: Put the URL for default badge image in settings #}
|
|
||||||
{% set image_url = "/media/img/default-badge.png" %}
|
|
||||||
{% endif %}
|
|
||||||
{% if not award %}
|
|
||||||
<ul class="btn-list">
|
|
||||||
{% if badge.allows_edit_by(request.user) %}
|
|
||||||
<li><a class="btn btn-large btn-primary edit_badge" href="{{ url('badger.views.edit', badge.slug) }}">{{ _('Edit badge') }}</a></li>
|
|
||||||
{% endif %}
|
|
||||||
{% if badge.allows_delete_by(request.user) %}
|
|
||||||
<li><a class="btn btn-large btn-danger delete_badge" href="{{ url('badger.views.delete', badge.slug) }}">{{ _('Delete badge') }}</a></li>
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
{% endif %}
|
|
||||||
<dl class="badge" data-slug="{{ badge.slug }}">
|
|
||||||
{% if badge_show_title %}
|
|
||||||
<dt>{{_("Title:")}}</dt>
|
|
||||||
<dd class="title"><strong>{{ badge.title }}</strong></dd>
|
|
||||||
{% endif %}
|
|
||||||
<dt>{{_("Image:")}}</dt>
|
|
||||||
<dd class="image"><a href="{{ badge.get_absolute_url() }}" class="image"><img src="{{ image_url }}" width="256" height="256" /></a></dd>
|
|
||||||
{% if badge.description %}
|
|
||||||
<dt>{{_("Description:")}}</dt>
|
|
||||||
<dd class="description">{{ badge.description }}</dd>
|
|
||||||
{% endif %}
|
|
||||||
{% if badge.tags and badge.tags.count() %}
|
|
||||||
<dt>{{ _("Tags:") }}</dt>
|
|
||||||
<dd><ul class="tags">
|
|
||||||
{% for tag in badge.tags.all() %}
|
|
||||||
<li><a class="tag" href="{{ url('badger.badges_list', tag_name=tag.name) }}"><i class="icon-tag icon-white"></i> {{ tag.name }}</a></li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul></dd>
|
|
||||||
{% endif %}
|
|
||||||
<dt>{{_("Creator:")}}</dt>
|
|
||||||
<dd><a href="{{ badge.creator.get_absolute_url() }}"><img src="{{ user_avatar(badge.creator) }}" class="avatar" alt="{{ badge.creator }}" width="28" height="28" />{{ badge.creator }}</a></dd>
|
|
||||||
<dt>{{_("Created:")}}</dt>
|
|
||||||
<dd>{{ badge.created }}</dd>
|
|
||||||
<dt>{{_("Modified:")}}</dt>
|
|
||||||
<dd>{{ badge.modified }}</dd>
|
|
||||||
</dl>
|
|
|
@ -1,15 +0,0 @@
|
||||||
<ul class="badges">
|
|
||||||
{% for badge in badge_list %}
|
|
||||||
{% if badge.image %}
|
|
||||||
{% set img_url = badge.image.url %}
|
|
||||||
{% else %}
|
|
||||||
{% set img_url = "/media/img/default-badge.png" %}
|
|
||||||
{% endif %}
|
|
||||||
<li class="badge">
|
|
||||||
<a href="{{ badge.get_absolute_url() }}" class="image"><img src="{{ img_url }}"
|
|
||||||
alt="{{ badge.title }}" width="128" height="128" /></a>
|
|
||||||
<a href="{{ badge.get_absolute_url() }}" class="label"><span class="title">{{ badge.title }}</span></a>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% include "badger_playdoh/includes/pagination.html" %}
|
|
|
@ -1,21 +0,0 @@
|
||||||
<nav class="pagination">
|
|
||||||
{% if page_obj and page_obj.start_index() != page_obj.end_index() %}
|
|
||||||
<p class="showing">{{_('{start}–{end} of {total}') | f(start=page_obj.start_index(),end=page_obj.end_index(),total=paginator.count) | safe }}</p>
|
|
||||||
{% endif %}
|
|
||||||
{% if is_paginated %}
|
|
||||||
<ul class="paging">
|
|
||||||
{% if page_obj.number != 1 %}
|
|
||||||
<li class="first"><a href="{{ pagination_base_url }}?page=1&sort={{current_sort}}" title="{{_('Go to the first page')}}">First</a></li>
|
|
||||||
{% endif %}
|
|
||||||
{% if page_obj.has_previous() %}
|
|
||||||
<li class="prev"><a href="{{ pagination_base_url }}?page={{ page_obj.previous_page_number() }}&sort={{current_sort}}" title="{{_('Go to the previous page')}}">{{_('Previous')}}</a></li>
|
|
||||||
{% endif %}
|
|
||||||
{% if page_obj.has_next() %}
|
|
||||||
<li class="next"><a href="{{ pagination_base_url }}?page={{ page_obj.next_page_number() }}&sort={{current_sort}}" title="{{_('Go to the next page')}}">{{_('Next')}}</a></li>
|
|
||||||
{% endif %}
|
|
||||||
{% if page_obj.number != paginator.num_pages %}
|
|
||||||
<li class="last"><a href="{{ pagination_base_url }}?page={{ paginator.num_pages }}&sort={{current_sort}}" title="{{_('Go to the last page')}}">{{_('Last')}}</a></li>
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
{% endif %}
|
|
||||||
</nav>
|
|
|
@ -1,10 +0,0 @@
|
||||||
<dl class="award">
|
|
||||||
<dt>Awarded to:</dt>
|
|
||||||
<dd><a href="{{ award.user.get_absolute_url }}"
|
|
||||||
class="username">{{ award.user }}</a></dd>
|
|
||||||
<dt>Awarded by:</dt>
|
|
||||||
<dd><a href="{{ award.creator.get_absolute_url }}"
|
|
||||||
class="username">{{ award.creator }}</a></dd>
|
|
||||||
<dt>Issued on:</dt>
|
|
||||||
<dd>{{ award.created }}</dd>
|
|
||||||
</dl>
|
|
|
@ -16,6 +16,23 @@ from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def permissions_for(obj, user):
|
||||||
|
try:
|
||||||
|
return obj.get_permissions_for(user)
|
||||||
|
except:
|
||||||
|
return {}
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def key(obj, name):
|
||||||
|
try:
|
||||||
|
return obj[name]
|
||||||
|
except:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
@register.simple_tag
|
@register.simple_tag
|
||||||
def user_avatar(user, secure=False, size=256, rating='pg', default=''):
|
def user_avatar(user, secure=False, size=256, rating='pg', default=''):
|
||||||
|
|
||||||
|
|
|
@ -22,15 +22,11 @@ from badger.models import (Badge, Award, Progress, DeferredAward)
|
||||||
|
|
||||||
class BadgerTestCase(test.TestCase):
|
class BadgerTestCase(test.TestCase):
|
||||||
"""Ensure test app and models are set up before tests"""
|
"""Ensure test app and models are set up before tests"""
|
||||||
apps = ('badger.tests.badger_example',)
|
|
||||||
|
|
||||||
def _pre_setup(self):
|
def _pre_setup(self):
|
||||||
# Add the models to the db.
|
|
||||||
self._original_installed_apps = list(settings.INSTALLED_APPS)
|
|
||||||
for app in self.apps:
|
|
||||||
settings.INSTALLED_APPS.append(app)
|
|
||||||
loading.cache.loaded = False
|
loading.cache.loaded = False
|
||||||
call_command('syncdb', interactive=False, verbosity=0)
|
call_command('syncdb', interactive=False, verbosity=0)
|
||||||
|
call_command('migrate', interactive=False, verbosity=0)
|
||||||
call_command('update_badges', verbosity=0)
|
call_command('update_badges', verbosity=0)
|
||||||
badger.autodiscover()
|
badger.autodiscover()
|
||||||
|
|
||||||
|
@ -58,8 +54,6 @@ class BadgerTestCase(test.TestCase):
|
||||||
Award.objects.all().delete()
|
Award.objects.all().delete()
|
||||||
Badge.objects.all().delete()
|
Badge.objects.all().delete()
|
||||||
|
|
||||||
# Restore the settings.
|
|
||||||
settings.INSTALLED_APPS = self._original_installed_apps
|
|
||||||
loading.cache.loaded = False
|
loading.cache.loaded = False
|
||||||
|
|
||||||
if get_url_prefix:
|
if get_url_prefix:
|
||||||
|
|
|
@ -17,7 +17,7 @@ from badger.models import (Badge, Award, Progress,
|
||||||
BadgeAwardNotAllowedException,
|
BadgeAwardNotAllowedException,
|
||||||
BadgeAlreadyAwardedException)
|
BadgeAlreadyAwardedException)
|
||||||
|
|
||||||
from badger.tests.badger_example.models import GuestbookEntry
|
from badger_example.models import GuestbookEntry
|
||||||
|
|
||||||
|
|
||||||
class BadgesPyTest(BadgerTestCase):
|
class BadgesPyTest(BadgerTestCase):
|
||||||
|
|
|
@ -49,7 +49,7 @@ from badger.models import (Badge, Award, Nomination, Progress, DeferredAward,
|
||||||
NominationRejectNotAllowedException,
|
NominationRejectNotAllowedException,
|
||||||
SITE_ISSUER)
|
SITE_ISSUER)
|
||||||
|
|
||||||
from badger.tests.badger_example.models import GuestbookEntry
|
from badger_example.models import GuestbookEntry
|
||||||
|
|
||||||
|
|
||||||
BASE_URL = 'http://example.com'
|
BASE_URL = 'http://example.com'
|
||||||
|
|
|
@ -59,7 +59,7 @@ class BadgerViewsTest(BadgerTestCase):
|
||||||
doc = pq(r.content)
|
doc = pq(r.content)
|
||||||
|
|
||||||
eq_('badge_detail', doc.find('body').attr('id'))
|
eq_('badge_detail', doc.find('body').attr('id'))
|
||||||
eq_(1, doc.find('.badge-title:contains("%s")' % badge.title).length)
|
eq_(1, doc.find('.badge .title:contains("%s")' % badge.title).length)
|
||||||
eq_(badge.description, doc.find('.badge .description').text())
|
eq_(badge.description, doc.find('.badge .description').text())
|
||||||
|
|
||||||
# Now, take a look at the JSON format
|
# Now, take a look at the JSON format
|
||||||
|
@ -87,8 +87,8 @@ class BadgerViewsTest(BadgerTestCase):
|
||||||
doc = pq(r.content)
|
doc = pq(r.content)
|
||||||
|
|
||||||
eq_('award_detail', doc.find('body').attr('id'))
|
eq_('award_detail', doc.find('body').attr('id'))
|
||||||
eq_(1, doc.find('.awarded_to .username:contains("%s")' % user2.username).length)
|
eq_(1, doc.find('.award .awarded_to .username:contains("%s")' % user2.username).length)
|
||||||
eq_(1, doc.find('.badge-title:contains("%s")' % b1.title).length)
|
eq_(1, doc.find('.badge .title:contains("%s")' % b1.title).length)
|
||||||
|
|
||||||
# Now, take a look at the JSON format
|
# Now, take a look at the JSON format
|
||||||
url = reverse('badger.award_detail_json', args=(b1.slug, award.pk,))
|
url = reverse('badger.award_detail_json', args=(b1.slug, award.pk,))
|
||||||
|
@ -398,7 +398,7 @@ class BadgerViewsTest(BadgerTestCase):
|
||||||
doc = pq(r.content)
|
doc = pq(r.content)
|
||||||
|
|
||||||
eq_('badge_detail', doc.find('body').attr('id'))
|
eq_('badge_detail', doc.find('body').attr('id'))
|
||||||
ok_(badge_title in doc.find('.badge-title').text())
|
ok_(badge_title in doc.find('.badge .title').text())
|
||||||
eq_(badge_desc, doc.find('.badge .description').text())
|
eq_(badge_desc, doc.find('.badge .description').text())
|
||||||
|
|
||||||
slug = doc.find('.badge').attr('data-slug')
|
slug = doc.find('.badge').attr('data-slug')
|
||||||
|
@ -438,7 +438,7 @@ class BadgerViewsTest(BadgerTestCase):
|
||||||
doc = pq(r.content)
|
doc = pq(r.content)
|
||||||
|
|
||||||
eq_('badge_detail', doc.find('body').attr('id'))
|
eq_('badge_detail', doc.find('body').attr('id'))
|
||||||
ok_(badge_title in doc.find('.badge-title').text())
|
ok_(badge_title in doc.find('.badge .title').text())
|
||||||
eq_(badge_desc, doc.find('.badge .description').text())
|
eq_(badge_desc, doc.find('.badge .description').text())
|
||||||
|
|
||||||
slug = doc.find('.badge').attr('data-slug')
|
slug = doc.find('.badge').attr('data-slug')
|
||||||
|
|
|
@ -1,15 +1,7 @@
|
||||||
{% extends "badger_playdoh/base.html" %}
|
{% extends "badger/base.html" %}
|
||||||
|
|
||||||
{% set user = award.user %}
|
{% load i18n %}
|
||||||
{% set award_url = request.build_absolute_uri(url('badger.views.award_detail', award.badge.slug, award.id)) %}
|
{% load badger_tags %}
|
||||||
{% if award.image %}
|
|
||||||
{% set image_url = award.image.url %}
|
|
||||||
{% elif badge.image %}
|
|
||||||
{% set image_url = badge.image.url %}
|
|
||||||
{% else %}
|
|
||||||
{# TODO: Put the URL for default badge image in settings #}
|
|
||||||
{% set image_url = "/media/img/default-badge.png" %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% block pageid %}award_delete{% endblock %}
|
{% block pageid %}award_delete{% endblock %}
|
||||||
|
|
||||||
|
@ -20,20 +12,20 @@
|
||||||
<section class="row-fluid">
|
<section class="row-fluid">
|
||||||
|
|
||||||
<section class="badge span4">
|
<section class="badge span4">
|
||||||
{% include "badger_playdoh/includes/badge_full.html" %}
|
{% include "badger/includes/badge_full.html" %}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="award span8">
|
<section class="award span8">
|
||||||
|
|
||||||
<form id="delete_award" method="POST" action="" enctype="multipart/form-data">
|
<form id="delete_award" method="POST" action="" enctype="multipart/form-data">
|
||||||
{{ csrf() }}
|
{{ csrf }}
|
||||||
<p><strong>{{ _("Delete this award, are you sure?") }}</strong></p>
|
<p><strong>{{ _("Delete this award, are you sure?") }}</strong></p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><input type="submit" class="btn btn-large btn-danger submit" value="{{ _("Yes, delete award") }}"></li>
|
<li><input type="submit" class="btn btn-large btn-danger submit" value="{{ _("Yes, delete award") }}"></li>
|
||||||
</ul>
|
</ul>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% include "badger_playdoh/includes/award_full.html" %}
|
{% include "badger/includes/award_full.html" %}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</section>
|
</section>
|
|
@ -3,13 +3,11 @@
|
||||||
{% block pageid %}badge_award{% endblock %}
|
{% block pageid %}badge_award{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<h2>Award a badge</h2>
|
<h2>Award a badge</h2>
|
||||||
|
|
||||||
<form id="award_badge" method="POST" action="" enctype="multipart/form-data">
|
<form id="award_badge" method="POST" action="" enctype="multipart/form-data">
|
||||||
{{ csrf() }}
|
{{ csrf }}
|
||||||
<ul>
|
<ul>
|
||||||
{{ form.as_ul() }}
|
{{ form.as_ul }}
|
||||||
<li><input type="submit" class="submit" value="Award"></li>
|
<li><input type="submit" class="submit" value="Award"></li>
|
||||||
</ul>
|
</ul>
|
||||||
</form>
|
</form>
|
||||||
|
@ -18,5 +16,4 @@
|
||||||
<h3>Badge</h3>
|
<h3>Badge</h3>
|
||||||
{% include "badger/includes/badge_full.html" %}
|
{% include "badger/includes/badge_full.html" %}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -0,0 +1,18 @@
|
||||||
|
{% extends "badger/base.html" %}
|
||||||
|
|
||||||
|
{% block pageid %}badge_create{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<section>
|
||||||
|
<header>
|
||||||
|
<h2>Create a badge</h2>
|
||||||
|
</header>
|
||||||
|
<form id="create_badge" method="POST" action="" enctype="multipart/form-data">
|
||||||
|
{{ csrf }}
|
||||||
|
<ul>
|
||||||
|
{{ form.as_ul }}
|
||||||
|
<li><input type="submit" class="submit" value="Create badge"></li>
|
||||||
|
</ul>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
{% endblock %}
|
|
@ -0,0 +1,43 @@
|
||||||
|
{% extends "badger/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
{% load badger_tags %}
|
||||||
|
|
||||||
|
{% block pageid %}badge_delete{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<section class="span4" id="detail">
|
||||||
|
<header class="page-header">
|
||||||
|
<h2>Badge: {{ badge_title }}</h2>
|
||||||
|
</header>
|
||||||
|
{% include "badger/includes/badge_full.html" %}
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="span8">
|
||||||
|
<header class="page-header">
|
||||||
|
<h2>{{ _("Delete badge") }}</h2>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<form id="nominate_badge" method="POST" action="" enctype="multipart/form-data">
|
||||||
|
{{ csrf }}
|
||||||
|
{% if awards_count %}
|
||||||
|
<p>{% blocktrans with badge_url=badge.get_absolute_url awards_count=awards_count %}
|
||||||
|
<span class="label label-warning">Note:</span>
|
||||||
|
Deleting this badge will also delete
|
||||||
|
<a href="{{ badge_url }}"><span class="awards_count">{{awards_count}}</span> award(s)</a>
|
||||||
|
{% endblocktrans %}</p>
|
||||||
|
{% else %}
|
||||||
|
<p>{% blocktrans %}
|
||||||
|
<span class="label label-success">Note:</span>
|
||||||
|
No one has been awarded this badge, yet.
|
||||||
|
{% endblocktrans %}</p>
|
||||||
|
{% endif %}
|
||||||
|
<p>{{ _("Are you sure?") }}</p>
|
||||||
|
<ul>
|
||||||
|
<li><input type="submit" class="btn btn-large btn-danger submit" value="{{ _("Delete badge") }}"></li>
|
||||||
|
</ul>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
{% endblock %}
|
|
@ -1,4 +1,4 @@
|
||||||
{% extends "badger_playdoh/base.html" %}
|
{% extends "badger/base.html" %}
|
||||||
|
|
||||||
{% block pageid %}badge_edit{% endblock %}
|
{% block pageid %}badge_edit{% endblock %}
|
||||||
|
|
||||||
|
@ -6,14 +6,14 @@
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<header class="page-header">
|
<header class="page-header">
|
||||||
<h2>{{ _("Edit badge: {title}") | f(title=badge.title) }}</h2>
|
<h2>Edit badge: {{ badge.title }}</h2>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<form id="edit_badge" class="form-horizontal"
|
<form id="edit_badge" class="form-horizontal"
|
||||||
method="POST" action="" enctype="multipart/form-data">
|
method="POST" action="" enctype="multipart/form-data">
|
||||||
{{ csrf() }}
|
{{ csrf }}
|
||||||
<ul>
|
<ul>
|
||||||
{{ form.as_ul() }}
|
{{ form.as_ul }}
|
||||||
<li><input type="submit" class="btn btn-large btn-primary submit" value="{{ _("Save badge") }}"></li>
|
<li><input type="submit" class="btn btn-large btn-primary submit" value="{{ _("Save badge") }}"></li>
|
||||||
</ul>
|
</ul>
|
||||||
</form>
|
</form>
|
|
@ -1,4 +1,4 @@
|
||||||
{% extends "badger_playdoh/base.html" %}
|
{% extends "badger/base.html" %}
|
||||||
|
|
||||||
{% block pageid %}badge_nominate{% endblock %}
|
{% block pageid %}badge_nominate{% endblock %}
|
||||||
|
|
||||||
|
@ -8,9 +8,9 @@
|
||||||
|
|
||||||
<section class="span4" id="detail">
|
<section class="span4" id="detail">
|
||||||
<header class="page-header">
|
<header class="page-header">
|
||||||
<h2>{{ _("Badge: {badge_title}") | f(badge_title=badge.title) }}</h2>
|
<h2>Badge: {{ badge_title }}</h2>
|
||||||
</header>
|
</header>
|
||||||
{% include "badger_playdoh/includes/badge_full.html" %}
|
{% include "badger/includes/badge_full.html" %}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="span8">
|
<section class="span8">
|
||||||
|
@ -19,9 +19,9 @@
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<form id="nominate_badge" method="POST" action="" enctype="multipart/form-data">
|
<form id="nominate_badge" method="POST" action="" enctype="multipart/form-data">
|
||||||
{{ csrf() }}
|
{{ csrf }}
|
||||||
<ul>
|
<ul>
|
||||||
{{ form.as_ul() }}
|
{{ form.as_ul }}
|
||||||
<li><input type="submit" class="btn btn-large btn-primary submit" value="{{ _("Submit nominations") }}"></li>
|
<li><input type="submit" class="btn btn-large btn-primary submit" value="{{ _("Submit nominations") }}"></li>
|
||||||
</ul>
|
</ul>
|
||||||
</form>
|
</form>
|
|
@ -1,4 +1,4 @@
|
||||||
{% extends "badger_playdoh/base.html" %}
|
{% extends "badger/base.html" %}
|
||||||
|
|
||||||
{% block pageid %}badges_by_user{% endblock %}
|
{% block pageid %}badges_by_user{% endblock %}
|
||||||
|
|
||||||
|
@ -11,6 +11,6 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<section class="badge_list">
|
<section class="badge_list">
|
||||||
<h2>{{ _("Badges created by {user}") | f(user=user) }}</h2>
|
<h2>{{ _("Badges created by {user}") | f(user=user) }}</h2>
|
||||||
{% include "badger_playdoh/includes/badges_list.html" %}
|
{% include "badger/includes/badges_list.html" %}
|
||||||
</section>
|
</section>
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -1,16 +1,17 @@
|
||||||
{% extends "badger_playdoh/base.html" %}
|
{% extends "badger/base.html" %}
|
||||||
|
|
||||||
|
{% load badger_tags %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
{% block pageid %}claim_badge{% endblock %}
|
{% block pageid %}claim_badge{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<section class="row-fluid">
|
|
||||||
|
|
||||||
<section class="span4" id="detail">
|
<section class="span4" id="detail">
|
||||||
<header class="page-header">
|
<header class="page-header">
|
||||||
<h2>{{ _("Badge: {badge_title}") | f(badge_title=badge.title) }}</h2>
|
<h2>Badge: {{badge.title}}</h2>
|
||||||
</header>
|
</header>
|
||||||
{% include "badger_playdoh/includes/badge_full.html" %}
|
{% include "badger/includes/badge_full.html" %}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="span8">
|
<section class="span8">
|
||||||
|
@ -28,43 +29,36 @@
|
||||||
<dd><code>{{ deferred_award.claim_code }}</code></dd>
|
<dd><code>{{ deferred_award.claim_code }}</code></dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
{% if user.is_anonymous() %}
|
{% if user.is_anonymous %}
|
||||||
<div>
|
<div>
|
||||||
<h3>{{ _("Claim") }}</h3>
|
<h3>{{ _("Claim") }}</h3>
|
||||||
<p>{{ _("Sign in to claim this badge award") }}</p>
|
<p>{{ _("Sign in to claim this badge award") }}</p>
|
||||||
<form class="browserid" action="{{url('browserid_verify')}}" method="POST">
|
|
||||||
{{ csrf() }}
|
|
||||||
<input type="hidden" name="next" value="{{ request.build_absolute_uri() }}" />
|
|
||||||
{{ browserid_form.as_p()|safe }}
|
|
||||||
<a href="#" class="browserid-signin" title="{{_('Sign In with BrowserID')}}"><img src="{{MEDIA_URL}}img/sign_in_blue.png" /></a>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if deferred_award.allows_grant_by(request.user) %}
|
{% if deferred_award|permissions_for:request.user|key:'grant_by' %}
|
||||||
<form id="grant_award" method="POST" action="">
|
<form id="grant_award" method="POST" action="">
|
||||||
<input type="hidden" name="is_grant" value="1" />
|
<input type="hidden" name="is_grant" value="1" />
|
||||||
{{ csrf() }}
|
{{ csrf }}
|
||||||
<h3>{{ _("Grant") }}</h3>
|
<h3>{{ _("Grant") }}</h3>
|
||||||
<p>{{ _("You can grant this award to someone else") }}
|
<p>{{ _("You can grant this award to someone else") }}
|
||||||
{{ grant_form.as_p() }}
|
{{ grant_form.as_p }}
|
||||||
<input type="submit" class="btn btn-large btn-primary submit" value="{{ _("Grant this award") }}">
|
<input type="submit" class="btn btn-large btn-primary submit" value="{{ _("Grant this award") }}">
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if deferred_award.allows_claim_by(request.user) %}
|
{% if deferred_award|permissions_for:request.user|key:'claim_by' %}
|
||||||
{% set email_mismatch = (deferred_award.email and request.user.email != deferred_award.email) %}
|
<form id="claim_award" method="POST" action="" class="{% if deferred_award.email and request.user.email != deferred_award.email %}email-mismatch{% endif %}">
|
||||||
<form id="claim_award" method="POST" action="" class="{{ email_mismatch and 'email-mismatch ' or '' }}">
|
{{ csrf }}
|
||||||
{{ csrf() }}
|
|
||||||
<h3>{{ _("Claim") }}</h3>
|
<h3>{{ _("Claim") }}</h3>
|
||||||
{% if email_mismatch %}
|
{% if deferred_award.email and request.user.email != deferred_award.email %}
|
||||||
{# This isn't enforced, since an awardee might have multiple email addresses #}
|
{# This isn't enforced, since an awardee might have multiple email addresses #}
|
||||||
{% trans %}
|
{% blocktrans %}
|
||||||
<p><span class="label label-warning">Note:</span>
|
<p><span class="label label-warning">Note:</span>
|
||||||
<em>This award may not be intended for you.</em>
|
<em>This award may not be intended for you.</em>
|
||||||
Your email address does not match this award claim.
|
Your email address does not match this award claim.
|
||||||
</p>
|
</p>
|
||||||
{% endtrans %}
|
{% endblocktrans %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>{{ _("You can claim this award for yourself") }}</p>
|
<p>{{ _("You can claim this award for yourself") }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -74,6 +68,4 @@
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -1,4 +1,4 @@
|
||||||
{% extends "badger_playdoh/base.html" %}
|
{% extends "badger/base.html" %}
|
||||||
|
|
||||||
{% block pageid %}claims_list{% endblock %}
|
{% block pageid %}claims_list{% endblock %}
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
{% load i18n %}
|
||||||
|
{% blocktrans with domain=current_site.domain badge_url=badge.get_absolute_url badge_title=badge.title claim_url=deferred_award.get_claim_url protocol=protocol|default:"http" %}
|
||||||
|
|
||||||
|
You have received an award for the badge {{ badge_title }}.
|
||||||
|
|
||||||
|
You can claim it, here:
|
||||||
|
|
||||||
|
{{ protocol }}://{{ domain }}{{ claim_url }}
|
||||||
|
|
||||||
|
{% endblocktrans %}
|
|
@ -0,0 +1,2 @@
|
||||||
|
{% load i18n %}
|
||||||
|
{% blocktrans with site_name=current_site.name badge_title=badge.title %}[{{ site_name }}] Claim your award for the badge "{{ badge_title }}"{% endblocktrans %}
|
|
@ -0,0 +1,24 @@
|
||||||
|
{% load badger_tags %}
|
||||||
|
|
||||||
|
<dl class="award">
|
||||||
|
<dt>Awarded to:</dt>
|
||||||
|
<dd class="awarded_to"><a href="{{ award.user.get_absolute_url }}"
|
||||||
|
class="username">{{ award.user }}</a></dd>
|
||||||
|
{% if award.description %}
|
||||||
|
<dt>Explanation:</dt>
|
||||||
|
<dd class="description">{{ award.description }}</dd>
|
||||||
|
{% endif %}
|
||||||
|
<dt>Awarded by:</dt>
|
||||||
|
<dd><a href="{{ award.creator.get_absolute_url }}"
|
||||||
|
class="username">{{ award.creator }}</a></dd>
|
||||||
|
<dt>Issued on:</dt>
|
||||||
|
<dd>{{ award.created }}</dd>
|
||||||
|
</dl>
|
||||||
|
{% if award|permissions_for:request.user|key:'delete_by' %}
|
||||||
|
<dl class="actions">
|
||||||
|
<dt>Actions:</dt>
|
||||||
|
<dd><ul class="btn-list">
|
||||||
|
<li><a class="btn btn-large btn-danger delete_award" href="{% url badger.views.award_delete badge.slug award.id %}">{{ _('Delete award') }}</a></li>
|
||||||
|
</ul></dd>
|
||||||
|
</dl>
|
||||||
|
{% endif %}
|
|
@ -1,5 +1,18 @@
|
||||||
{% load badger_tags %}
|
{% load badger_tags %}
|
||||||
|
|
||||||
|
{% if not award %}
|
||||||
|
<ul class="btn-list">
|
||||||
|
{% if badge|permissions_for:request.user|key:'edit_by' %}
|
||||||
|
<li><a class="btn btn-large btn-primary edit_badge" href="{% url badger.views.edit badge.slug %}">{{ _('Edit badge') }}</a></li>
|
||||||
|
{% endif %}
|
||||||
|
{% if badge|permissions_for:request.user|key:'delete_by' %}
|
||||||
|
<li><a class="btn btn-large btn-danger delete_badge" href="{% url badger.views.delete badge.slug %}">{{ _('Delete badge') }}</a></li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<dl class="badge" data-slug="{{ badge.slug }}">
|
||||||
|
|
||||||
<dl class="badge" data-slug="{{ badge.slug }}">
|
<dl class="badge" data-slug="{{ badge.slug }}">
|
||||||
<dt>Title:</dt>
|
<dt>Title:</dt>
|
||||||
<dd class="title">{{ badge.title }}</dd>
|
<dd class="title">{{ badge.title }}</dd>
|
|
@ -1,4 +1,4 @@
|
||||||
{% extends "badger_playdoh/base.html" %}
|
{% extends "badger/base.html" %}
|
||||||
|
|
||||||
{% block pageid %}manage_claims{% endblock %}
|
{% block pageid %}manage_claims{% endblock %}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
<header class="page-header">
|
<header class="page-header">
|
||||||
<h2 class="badge-title">{{ _("Badge: {badge_title}") | f(badge_title=badge.title) }}</h2>
|
<h2 class="badge-title">{{ _("Badge: {badge_title}") | f(badge_title=badge.title) }}</h2>
|
||||||
</header>
|
</header>
|
||||||
{% include "badger_playdoh/includes/badge_full.html" %}
|
{% include "badger/includes/badge_full.html" %}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="claims_list span8">
|
<section class="claims_list span8">
|
|
@ -1,4 +1,4 @@
|
||||||
{% extends "badger_playdoh/base.html" %}
|
{% extends "badger/base.html" %}
|
||||||
|
|
||||||
{% block pageid %}nomination_detail{% endblock %}
|
{% block pageid %}nomination_detail{% endblock %}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
<header class="page-header">
|
<header class="page-header">
|
||||||
<h2>{{ _("Badge: {badge_title}") | f(badge_title=badge.title) }}</h2>
|
<h2>{{ _("Badge: {badge_title}") | f(badge_title=badge.title) }}</h2>
|
||||||
</header>
|
</header>
|
||||||
{% include "badger_playdoh/includes/badge_full.html" %}
|
{% include "badger/includes/badge_full.html" %}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="nomination span8">
|
<section class="nomination span8">
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче