ubyssey.ca icon indicating copy to clipboard operation
ubyssey.ca copied to clipboard

Bring Back The Previous Season Magazines

Open FireBoyAJ24 opened this issue 1 year ago • 0 comments

Past Magazines

In the past, we used to have previous magazines in a dropdown menu in the nav bar. We had magazines from 2017-2021. image From Jan 2022.#1217

We have the images, SCSS, HTML and JS from the previous magazines (if some are missing, then within the releases and pull requests there are changes and pull requests we can use). In the past, previous developers would use Dispatch to collect the magazine articles and format the articles in each of the magazine landing pages and articles pages. However, we have recently completely phased out Dispatch (#1157).

2017: https://web.archive.org/web/20211203231106/https://ubyssey.ca/magazine/2017/ 2018: https://web.archive.org/web/20211203221617/https://ubyssey.ca/magazine/2018/ 2019: https://web.archive.org/web/20220130200916/https://www.ubyssey.ca/magazine/2019/ 2020: https://web.archive.org/web/20220122091101/https://ubyssey.ca/magazine/2020/ 2021: https://web.archive.org/web/20220117042830/https://www.ubyssey.ca/magazine/2021/ 2022: https://web.archive.org/web/20220813154729/https://www.goingviralubyssey.ca/ (This was a separate website)

A Possible Solution

Using routable pages (Wagtail feature) we can use the magazine model and route all the pages to the depending years. An example of routable pages can be seen in the archive page. All the magazine articles are grouped up in category snippets (see the example code below). We can use this to allow us to gather all the articles and easily display them for each year. We just need to render each of the magazine year templates. Considering the period between now and these magazines, there will be a few missing, broken pieces of code known as code decay. This issue will tie in with #956. The magazine templates will need to be systemized by looking at common fields between magazines.

At the end of the day this is just a possible solution to one part of this issue.

From archive/models.py:

@route(r'^magazines/(?P<magazine_slug>[-\w]+)/$', name="magazines_view")
    def get_magazine_articles(self, request, magazine_slug):
        video_section = False
        context = self.get_context(request, video_section)
        context['magazine_slug'] = magazine_slug
        search_query = context["q"]
        
        if len(SpecialLandingPage.objects.filter(category__slug=magazine_slug)) > 0:
            articles = ArticlePage.objects.from_magazine_special_section(section_slug=magazine_slug)
        else:
            articles = ArticlePage.objects.live().public().filter(category__slug=magazine_slug)
        
        if context["order"]:
            articles = self.get_order_objects(context["order"], articles, video_section)           
        
        if self.year:
            articles = self.get_year_objects(articles, video_section)
        
        if search_query:
            articles = self.get_search_objects(search_query, articles, video_section)

        context = self.get_paginated_articles(context, articles, video_section, request)
        
        return render(request, "archive/archive_page.html", context) 

FireBoyAJ24 avatar Aug 21 '23 12:08 FireBoyAJ24