Skip to content

Managing content/navigation in a more elegant way #2391

Open
@karlcow

Description

@karlcow

This issue was triggered by #2337 and exists only as a brainstorming place. It might be closed without any resolution (What we have currently is working).

Two things which are feeling itchy

  • The tight coupling in between the views and the templates for navigation
  • The number of views necessary for content which are basically doing nothing except doing the same thing. :) returning the templates.

There might be solution for both of them separately. And ways to thing about it.

for example, we can imagine that we have a dictionary with all the contents. OR a JSON.
The dictionary can be dynamically built from static files when we start the project. Or anything.
The dictionary will have the notion of

  • hierarchy the content is part of
  • the prose reference or the prose itself.
  • titles, etc.
  • anything…

Just prototyping something. We need to find better ways.

contents = {
    'reproduce-bug': {'part_of': 'contributors', 'prose': 'reproduce.html'},
    'report-bug': {'part_of': 'contributors', 'prose': 'report.html'},
    # etc
    }

# in views.py we can have the content passed to the template and its position in the hierarchy.
# This would reduce greatly the number of files in templates.
def contributors('/contributors/<content_id>'):
    """Handles all routes for contributors section."""
    if content_id in contents['content_id']:
        page = contents['content_id']
        # the upper section it is part of
        part_of = page['part_of']
        # The text of this page, so not part anymore of the templates
        prose = get_content_file(page['prose'])
        # etc.
        return render_template('contributors', part_of=part_of, prose=prose)
    abort(404)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions