home ยป zplus/freepost.git
ID: 5d2a3c6a5360f47931772b791dbd848f03d12078
94 lines โ€” 3K โ€” View raw


{% from 'vote.html' import vote %}

{% extends 'layout.html' %}

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

{% block content %}
    <div class="posts">
        
        {# include 'banner.html' #}
        
        {% for post in posts %}
            {% set topics = split_topics (post.topics) %}
            
            <div class="post">
                {# Print the item position number #}
                <div class="position">
                    {{ page_number * settings ('defaults', 'items_per_page') + loop.index }}.
                </div>
                
                <div class="info">
                    <div class="title">
                        <a href="{{ post.link if post.link and post.link|length > 0 else url ('post', hash_id=post.hashId) }}">
                            {{ post.title }}
                            
                            {# Post content preview #}
                            {% if post.text %}
                                <img
                                    alt=""
                                    title="{{ post.text|md2txt }}"
                                    src="{{ url ('static', filename='images/text.svg') }}"
                                    class="text_preview" />
                            {% endif %}
                        </a>
                        
                        {# URL hostname #}
                        {% if post.link %}
                            <span class="netloc">
                                {{ post.link|netloc }}
                            </span>
                        {% endif %}
                    </div>
                    
                    <div class="topics">
                        {% for topic in topics %}
                            <a href="" class="topic">{{ topic }}</a>
                        {% endfor %}
                    </div>
                    
                    <div class="about">
                        {{ vote ('post', post, user) }}
                        
                        <em class="username">
                            <a href="post/{{ 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="post/{{ post.hashId }}#comments">
                            {% if post.commentsCount > 0 %}
                                {{ post.commentsCount }} comments
                            {% else %}
                                discuss
                            {% endif %}
                        </a>
                    </div>
                </div>
            </div>
            
        {% endfor %}
        
        <div class="more">
            {% if page_number > 0 %}
                <a href="{{ url ('homepage') if page_number == 1 else '?page=' ~ (page_number - 1) }}" class="button button_default1">
                    Previous
                </a>
            {% endif %}
            
            <a href="?page={{ page_number + 1 }}" class="button button_default1">
                Next
            </a>
        </div>
    </div>


{% endblock %}