Skip to content

Commit

Permalink
Show titles of the last 5 articles on the frontpage, reordered imports.
Browse files Browse the repository at this point in the history
  • Loading branch information
soerface committed Feb 24, 2011
1 parent fb6baff commit 4e9fbe2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
12 changes: 8 additions & 4 deletions inyoka/portal/controllers.py
Expand Up @@ -9,22 +9,24 @@
:license: GNU GPL, see LICENSE for more details.
"""
from xappy.highlight import Highlighter

from inyoka.context import ctx
from inyoka.core.api import IController, Rule, view, Response, \
templated, href, redirect, _, login_required, redirect_to
from inyoka.core import search
from inyoka.core.auth import get_auth_system
from inyoka.core.auth.models import User, UserProfile, Group
from inyoka.core.http import allow_next_redirects
from inyoka.core.models import Tag
from inyoka.context import ctx
from inyoka.core.database import db
from inyoka.news.models import Article
from inyoka.portal.api import ITaggableContentProvider
from inyoka.portal.forms import ProfileForm, SearchForm, DeactivateProfileForm,\
get_change_password_form
from inyoka.utils.confirm import call_confirm, Expired
from inyoka.utils.pagination import URLPagination, SearchPagination
from inyoka.utils.sortable import Sortable
from inyoka.utils.text import get_search_words
from inyoka.portal.forms import ProfileForm, SearchForm, DeactivateProfileForm,\
get_change_password_form
from inyoka.portal.api import ITaggableContentProvider


hl = Highlighter(ctx.cfg['language'])
Expand Down Expand Up @@ -59,9 +61,11 @@ class PortalController(IController):
@templated('portal/index.html', modifier=context_modifier)
def index(self, request):
cloud, more = Tag.query.public().get_cloud()
articles = Article.query.order_by(Article.updated.desc()).limit(5).all()
return {
'tag_cloud': cloud,
'more_tags': more,
'articles': articles,
}

@view
Expand Down
10 changes: 10 additions & 0 deletions inyoka/portal/templates/index.html
Expand Up @@ -7,6 +7,16 @@ <h1>{{ _('Welcome to Inyoka') }}</h1>

{% block content %}
<div id="portal" class="clear">
{% if articles %}
<div class="column">
<h2>{{ _('News') }}</h2>
<ul>
{%- for article in articles %}
<li><a href="{{ href('news/detail', slug=article.slug) }}">{{ article.title }}</a></li>
{%- endfor %}
</ul>
</div>
{%- endif %}
{% if tag_cloud %}
<div class="column tagcloud">
<h2>{{ _('Tags') }}</h2>
Expand Down

0 comments on commit 4e9fbe2

Please sign in to comment.