]> git.ipfire.org Git - people/shoehn/ipfire.org.git/commitdiff
Add the release announcement to the download page
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 22 Feb 2015 22:52:52 +0000 (23:52 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 22 Feb 2015 22:53:48 +0000 (23:53 +0100)
templates/modules/news-item.html
templates/modules/release-item.html
templates/news-author.html [deleted file]
webapp/__init__.py
webapp/backend/releases.py
webapp/handlers_news.py
webapp/ui_modules.py

index 7fbd41be20b7679295427e021796898c768b8bf8..be4c37377c8144098a2829f999666acd33a48c9b 100644 (file)
@@ -5,18 +5,16 @@
                                {% if announcement %}
                                        {{ _("Announcement") }}:
                                {% end %}
-                               <a href="/news/{{ item.slug }}">{{ item.title }}</a>
+                               <a href="http://www.ipfire.org/news/{{ item.slug }}">{{ item.title }}</a>
                        </h2>
                {% end %}
 
                {% raw item.text %}
-       </div>
-</div>
-<div class="row">
-       <div class="col-lg-12 col-md-12">
-               <p class="pull-right">
-                       <a href="/author/{{ item.author_id }}">{{ item.author }}</a> -
-                       {{ locale.format_date(item.published, full_format=True) }}
-               </p>
+
+               <hr>
+
+               <small class="pull-right">
+                       {{ _("Published by %(author)s, %(time)s") % { "author" : item.author, "time" : locale.format_date(item.published, full_format=True) } }}
+               </small>
        </div>
 </div>
index 6aa0d4d5fba97ff52052086826c1878763b3c8a5..64792b14ff85b78328661eb538f32ef699e84907 100644 (file)
                <i class="glyphicon glyphicon-magnet"></i> {{ _("Magnet link") }},
                <i class="glyphicon glyphicon-download-alt"></i> {{ _("Torrent download") }}
        </p>
+
+       {% if release.news %}
+               <hr>
+
+               {% module NewsItem(release.news, show_heading=True, announcement=True) %}
+       {% end %}
 {% else %}
        <div class="alert alert-warning">
                {{ _("There are no downloads available for this release.") }}
diff --git a/templates/news-author.html b/templates/news-author.html
deleted file mode 100644 (file)
index de38035..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-{% extends "planet-user.html" %}
-
-{% block title %}{{ author.cn }}{% end block %}
-
-{% block bodyA %}
-       <div class="page-header">
-               <h1>{{ _("%s's announcements") % author.cn }}</h1>
-       </div>
-
-       <div class="row">
-               <div class="col-lg-9 col-md-9">
-                       {% if lang == "de" %}
-                               XXX GERMAN TEXT MISSING
-                       {% else %}
-                               <p>
-                                       This is a list of all announcements made by {{ author.cn }}
-                                       in reverse chronological order.
-                               </p>
-                       {% end %}
-
-                       <table class="table table-striped table-bordered">
-                               <tbody>
-                                       {% for news in latest_news %}
-                                               <tr>
-                                                       <td>
-                                                               <a href="/news/{{ news.slug }}">{{ news.title }}</a>
-                                                       </td>
-                                                       <td>
-                                                               {{ locale.format_date(news.date, full_format=True) }}
-                                                       </td>
-                                               </tr>
-                                       {% end %}
-                               </tbody>
-                       </table>
-               </div>
-       </div>
-{% end block %}
index 752b3b4d5812b0d2b8a678ef790b3bb42b5b1f25..87cebb2ad7fcb937000764b3265750c1d2772e0d 100644 (file)
@@ -92,7 +92,6 @@ class Application(tornado.web.Application):
                        (r"/news", NewsIndexHandler),
                        (r"/news/year/([0-9]*)", NewsYearHandler),
                        (r"/news/(.*)", NewsItemHandler),
-                       (r"/author/(.*)", NewsAuthorHandler),
 
                        # Download sites
                        (r"/download", tornado.web.RedirectHandler, { "url" : "http://downloads.ipfire.org/latest" }),
index ff482c0221fe4e347ba660ec41834d2fb9d52a9e..d7f5433f2b92de68889b7b0171c7e9085e4e1512 100644 (file)
@@ -376,6 +376,17 @@ class Release(Object):
        def netboot_initrd(self):
                return "http://downloads.ipfire.org/%s/images/instroot" % self.path
 
+       @property
+       def news_id(self):
+               return self.__data.news_id
+
+       @property
+       def news(self):
+               if not hasattr(self, "_news"):
+                       self._news = self.backend.news.get(self.news_id)
+
+               return self._news
+
 
 class Releases(Object):
        def get_by_id(self, id):
index 51194fc4d38a2f1e6373b9dee88614c6f6652b5d..18fd7f70f134a17dad8f3e48938127ae9bc47dc3 100644 (file)
@@ -37,25 +37,9 @@ class NewsItemHandler(BaseHandler):
                # Find the name of the author
                author = self.get_account(news.author_id)
                if author:
-                       news.author = author.cn
+                       news.author = author.name
                else:
                        _ = self.locale.translate
                        news.author = _("Unknown author")
 
                return self.render("news-item.html", item=news)
-
-
-class NewsAuthorHandler(BaseHandler):
-       """
-               This page displays information about the news author.
-       """
-       def get(self, author):
-               author = self.get_account(author)
-               if not author:
-                       raise tornado.web.HTTPError(404)
-
-               latest_news = self.news.get_latest(author=author.uid,
-                       locale=self.locale, limit=10)
-
-               self.render("news-author.html",
-                       author=author, latest_news=latest_news)
index 1a0eb769d9204260896ac0c010694371460c97ca..c1de1d0cd765c31f7aa8e9bfe167e05e42f55144 100644 (file)
@@ -201,7 +201,7 @@ class NewsItemModule(UIModule):
                # Get name of author
                author = self.accounts.find(author)
                if author:
-                       return author.cn
+                       return author.name
                else:
                        _ = self.locale.translate
                        return _("Unknown author")