home ยป zplus/freepost.git
ID: 4c972fd2cec4df1046de28388bf173511ffad40d
76 lines โ€” 2K โ€” View raw


{% extends 'layout.html' %}

{# Set variables for base layour #}
{% set active_page = 'search' %}
{% set title = 'Search' %}

{% block content %}

<div class="search">
    <form action="/search">
        <p>
            <input type="text" name="q" value="{{ query if query else '' }}" placeholder="Search..." required="required" />
            <input type="submit" value="Search" />
        </p>
        <p>
            Order by
            <label>
                <input type="radio" name="order" value="newest" {{ 'checked' if order == 'newest' }}>
                Most recent
            </label>
            <label>
                <input type="radio" name="order" value="points" {{ 'checked' if order == 'points' }}>
                Points
            </label>
        </p>
    </form>
</div>

<div class="posts">
    
    {% for post in results %}
    
        <div class="post">
            <div class="title">
                {% if post.link and post.link|length > 0 %}
                    <a href="{{ post.link }}">
                        {{ post.title }}
                    </a>
                {% else %}
                    <a href="{{ url ('post', hash_id=post.hashId) }}">
                        {{ post.title }}
                    </a>
                {% endif %}
            </div>
            
            <div class="info">
                <em>
                    <a href="{{ url ('post', hash_id=post.hashId) }}">
                        <time title="{{ post.created|title }}" datetime="{{ post.created|datetime }}">
                            {{ post.created|ago }}
                        </time>
                    </a>
                </em>
                by
                <a href="{{ url ('user_public', username=post.username) }}">
                    {{ post.username }}
                </a>
                โ€”
                <a href="{{ url ('post', hash_id=post.hashId) }}#comments">
                    {{ post.commentsCount if post.commentsCount else '' }} comments
                </a>
            </div>
        </div>
        
    {% endfor %}
    
    {# Add once I'll have fulltext search
    <div class="more">
        <a href="?page={{ page + 1 }}" class="button button_default1">
            More
        </a>
    </div>
    #}
</div>

{% endblock %}