Mercurial > agora-palash
view templates/code.djhtml @ 139:b8e0bdc37e32
Hide snippets created by anonymous users
Created a custom manager for Snippet, with a public() method for easily
retrieving all the snippets that were created by registered users.
This change makes the code a bit neater, as it's no longer to necessary
to have to do the {% if snippet.author %} check every time.
author | dellsystem <ilostwaldo@gmail.com> |
---|---|
date | Sat, 29 Sep 2012 21:31:17 -0400 |
parents | 2bca07be6e51 |
children | c7be7def8b57 |
line wrap: on
line source
{% extends "base.djhtml" %} {% block content %} <h1>Browse code submissions</h1> {% if not user.is_authenticated %} <p class="hint"> Welcome to Agora. </p> {% endif %} <div class="row"> <div class="span3"> <h2 class="center-align">Snippets</h2> <a class="pill" href="{% url snippet_new %}"> Post a snippet </a> {% if snippets %} <ul> {% for snippet in snippets %} <li> <a href="{{ snippet.get_absolute_url }}"> <strong>{{ snippet.get_title }}</strong> </a> by <a href="{{ snippet.author.get_absolute_url }}"> {{ snippet.author }} </a> <br /> {{ snippet.published }} </li> {% endfor %} </ul> <p class="right-float"> <a href="{% url snippet_explore %}">View more »</a> </p> {% else %} <p>No one has yet created a snippet. <a href="{% url new_snippet %}">Be the first!</a> </p> {% endif %} </div><div class="span3"> <h2 class="center-align">Modules</h2> {% if user.is_authenticated %} <a class="pill" href="">Upload a modules</a> {% else %} <a class="pill login-link" href="{% url login %}"> Login to upload modules </a> {% endif %} {% if modules %} <ul> {% for module in modules %} <li>{{ module }}</li> {% endfor %} </ul> {% else %} <p>This feature is not yet available.</p> {% endif %} </div><div class="span3"> <h2 class="center-align">Forge</h2> {% if user.is_authenticated %} <a class="pill" href="">Add a module to the forge</a> {% else %} <a class="pill login-link" href="{% url login %}"> Login to add a module to the forge </a> {% endif %} {% if forge %} <ul> {% for forge_module in forge %} <li>{{ forge_module }}</li> {% endfor %} </ul> {% else %} <p>This feature is not yet available.</p> {% endif %} </div> </div> {% endblock %}