view templates/snippet/snippet_new.djhtml @ 87:e0348cfbdf48

Update styling of snippets page Some other CSS changes too. Work-in-progress.
author dellsystem <ilostwaldo@gmail.com>
date Fri, 24 Aug 2012 23:45:48 -0400
parents a9703864b18f
children f872c643b056
line wrap: on
line source

{% extends "snippet/base.djhtml" %}
{% load i18n %}

{% block title %}{% trans "New snippet" %}{% endblock %}

{% block content %}
    <div id="non-sidebar">
        <h1>{% trans "Paste a new snippet" %}</h1>
        <p class="hint">Snippets are a lorem ipsum</p>
        {% include "snippet/snippet_form.djhtml" %}
    </div><div id="sidebar">
        <h2>Recent snippets</h2>
        {% for snippet in recent_snippets %}
        <hr />
        <p><a href="{% url snippet_details snippet %}">
        {% if snippet.title %}
        {{ snippet.title }}
        {% else %}
        Snippet #{{ snippet.id }}
        {% endif %}
        </a>
        <br />
        by
        {% if snippet.author %}
            <a href="{% url show_profile snippet.author %}">{{ snippet.author }}</a>
        {% else %}
            anonymous
        {% endif %}
        </p>
        {% endfor %}
    </div>
{% endblock %}


{% block content-related %}
    <h2>Recent snippets</h2>
    <div class="whitebox">
      <ul>
        {% for r in recent %}
        <li>
          <a href="{% url snippet_details r %}">
            {% if r.title %}
            {{r.title}}
            {% else %}
            Snippet #{{r.pk}}
            {% endif %}
          </a>
        by
          {% if r.author %}
          <a href="{% url agora.apps.profile.views.showprofile r.author %}">
            {{r.author}}
          </a>
          {% else %}
          anonymous
          {% endif %}
          {% endfor %}
        </li>
      </ul>
    </div>
{% endblock %}


{% block script_footer %}
<script src="/static/jquery.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
    {% if request.session.userprefs.display_all_lexer %}
    $('#guess_lexer_btn').click(function(){
        $.getJSON('{% url snippet_guess_lexer %}',
            {'codestring': $('#id_content').val()},
            function(data){
                if(data.lexer == "unknown"){
                    $('#guess_lexer_btn').css('color', 'red');
                }else{
                    $('#id_lexer').val(data.lexer);
                    $('#guess_lexer_btn').css('color', 'inherit');
                }
            });
    });
    {% endif %}
});
</script>
{% endblock %}