diff --git a/boards/config/default_settings.ini b/boards/config/default_settings.ini --- a/boards/config/default_settings.ini +++ b/boards/config/default_settings.ini @@ -35,6 +35,7 @@ ThreadsPerPage = 3 PostsPerPage = 10 ImagesPerPageGallery = 20 MaxLandingThreads = 20 +MaxLandingPosts = 10 Themes=md:Mystic Dark,md_centered:Mystic Dark (centered),sw:Snow White,pg:Photon Grey,ad:Amanita Dark,iw:Inocibe White ImageViewers=simple:Simple,popup:Popup diff --git a/boards/static/css/md/base_page.css b/boards/static/css/md/base_page.css --- a/boards/static/css/md/base_page.css +++ b/boards/static/css/md/base_page.css @@ -588,6 +588,10 @@ ul { border-right: solid 1px #777; } +.landing-threads { + margin-bottom: 1em; +} + .post[data-opening=True] > .post-info { background: black; padding: 4px; diff --git a/boards/templates/boards/feed.html b/boards/templates/boards/feed.html --- a/boards/templates/boards/feed.html +++ b/boards/templates/boards/feed.html @@ -36,7 +36,7 @@ {% endif %} {% for post in posts %} - {% post_view post moderator=moderator truncated=True need_op_data=True %} + {% post_view post truncated=True need_op_data=True %} {% endfor %} {% if next_page_link %} diff --git a/boards/templates/boards/landing.html b/boards/templates/boards/landing.html --- a/boards/templates/boards/landing.html +++ b/boards/templates/boards/landing.html @@ -34,6 +34,9 @@ {% endfor %} {% endif %} + {% for post in latest_posts %} + {% post_view post truncated=True need_op_data=True %} + {% endfor %} {% endautoescape %} {% endblock %} diff --git a/boards/views/landing.py b/boards/views/landing.py --- a/boards/views/landing.py +++ b/boards/views/landing.py @@ -13,6 +13,7 @@ from boards.views.base import BaseBoardV PARAM_SECTION_STR = 'section_str' PARAM_LATEST_THREADS = 'latest_threads' +PARAM_LATEST_POSTS = 'latest_posts' TEMPLATE = 'boards/landing.html' @@ -37,5 +38,9 @@ class LandingView(BaseBoardView): params[PARAM_LATEST_THREADS] = ops + max_landing_posts = settings.get_int(SECTION_VIEW, 'MaxLandingPosts') + params[PARAM_LATEST_POSTS] = Post.objects.filter(pub_time__gt=today)\ + .order_by('-pub_time')[:max_landing_posts] + return render(request, TEMPLATE, params)