view MoinMoin/templates/blog_layout.html @ 1711:6ba24e1114d5

Fix blog's layout (fixate the sidebar).
author Pavel Sviderski <pavel@psviderski.name>
date Sat, 18 Aug 2012 17:43:19 +0200
parents 2bd2dad3cc74
children 1df0320ae4c4
line wrap: on
line source
{% extends theme("layout.html") %}
{% import "forms.html" as forms %}
{% import "utils.html" as utils %}
{% import "itemviews.html" as itemviews with context %}

{% macro show_blog_entry(entry_item) %}
    {% if entry_item.meta['summary'] %}
        {% set title = entry_item.meta['summary'] %}
    {% else %}
        {% set title = entry_item.name %}
    {% endif %}
    <h1><a href="{{ url_for('frontend.show_item', item_name=entry_item.name) }}"
        title="{{ title }}" class="moin-blog-entry-link">{{ title }}</a></h1>
    {% if user.may.write(entry_item.name) %}
        <div class="moin-blog-entry-modify">
            <span class="moin-blog-icon">&#x2710;</span>
            <a href="{{ url_for('frontend.modify_item', item_name=entry_item.name) }}">{{ _("Modify entry") }}</a>
        </div>
    {% endif %}
    <div class="moin-blog-entry-info">
        {% set publish_time = entry_item.meta['ptime'] %}
        {% if publish_time %}
            {{ _("Published on") }} {{ entry_item.meta['ptime']|datetimeformat }}
            {{ _("by") }} {{ utils.editor_info(entry_item.meta) }}
        {% else %}
            {{ _("Not published yet.") }}
        {% endif %}
    </div>
    <div class="moin-blog-entry-content">
        {{ entry_item.content._render_data()|safe }} {# rendered blog entry content #}
    </div>
    <div class="moin-blog-entry-bottominfo">
        {% set tags = entry_item.meta['tags']|sort %}
        {% if tags %} {# display blog entry's tags as a list if it is not empty #}
            <div class="moin-blog-entry-tags">
                {{ _("Tags:") }}
                <ul class="moin-blog-entry-tags">
                    {% for tag in tags %}
                        <li><a href="{{ url_for('frontend.tagged_items', tag=tag) }}">{{ tag }}</a></li>
                    {% endfor %}
                </ul>
            </div>
        {% endif %}
        <div class="moin-blog-entry-comments">
            {% set discussion_item_name = '{0}/{1}'.format(entry_item.name, cfg.supplementation_item_names[0]) %}
            <a href="{{ url_for('frontend.show_item', item_name=discussion_item_name) }}">{{ _("Discussion page") }}</a>
        </div>
    </div>
{% endmacro %}

{% macro widget_supertags(blog_name, supertags) %}
    <div id="moin-blog-categories">
        <h2>{{ _("Categories") }}</h2>
        <ul>
            {% for supertag in supertags %}
                <li><a href="{{ url_for('frontend.show_item', item_name=blog_name, tag=supertag) }}">{{ supertag }}</a></li>
            {% endfor %}
        </ul>
    </div>
{% endmacro %}

{% if blog_item %}
    {% set blog_header = blog_item.content._render_data()|safe %}
    {% set blog_name = blog_item.name %}
    {% set supertags = blog_item.meta['supertags'] %}
{% endif %}

{% if blog_name %}
    {% macro header_search(form) %}
        {{ gen.form.open(form, id='moin-searchform', method='get', action=url_for('frontend.search')) }}
            <div>
                {{ forms.render(form['q']) }}
                {{ gen.button(form['submit'], type='submit', id='moin-search-submit') }}
                {{ forms.render_errors(form) }}
                <br />
                <input type="checkbox" id="moin-blog-search-this"
                onclick="$('#moin-searchform').attr('action', this.checked ? '{{ url_for('frontend.search', item_name=blog_name) }}' : '{{ url_for('frontend.search') }}' );" />
                {{ _("only this blog") }}
            </div>
        {{ gen.form.close() }}
    {% endmacro %}
{% endif %}

{% block header_itemviews %}
    {{ itemviews }}
{% endblock %}

{% block content %}
    {% block content_data %}
        <div id="moin-content-data">
            <div id="moin-blog-header">
                {% if blog_header %}
                    {{ blog_header }}
                {% endif %}
            </div>
            <div id="moin-blog-body">
                <div id="moin-blog-content">
                {% block blog_content %}<br />{% endblock %}
                </div>
                {% if blog_name and supertags %}
                    <div id="moin-blog-sidebar">
                        {{ widget_supertags(blog_name, supertags) }}
                    </div>
                {% endif %}
            </div>
        </div>
    {% endblock %}
{% endblock %}

{% block footer_itemviews %}
    {{ itemviews }}
{% endblock %}