templates_donate_messagesdir = $(templates_donatedir)/messages
+templates_docs_DATA = \
+ src/templates/docs/base.html \
+ src/templates/docs/page.html
+
+templates_docsdir = $(templatesdir)/docs
+
+templates_docs_modules_DATA = \
+ src/templates/docs/modules/header.html
+
+templates_docs_modulesdir = $(templates_docsdir)/modules
+
templates_downloads_DATA = \
src/templates/downloads/mirrors.html \
src/templates/downloads/release.html \
templates_wiki_DATA = \
src/templates/wiki/404.html \
- src/templates/wiki/base.html \
src/templates/wiki/confirm-delete.html \
src/templates/wiki/confirm-restore.html \
src/templates/wiki/diff.html \
src/templates/wiki/edit.html \
- src/templates/wiki/page.html \
src/templates/wiki/recent-changes.html \
src/templates/wiki/revisions.html \
src/templates/wiki/search-results.html \
templates_wiki_modules_DATA = \
src/templates/wiki/modules/diff.html \
- src/templates/wiki/modules/list.html \
- src/templates/wiki/modules/navbar.html
+ src/templates/wiki/modules/list.html
templates_wiki_modulesdir = $(templates_wikidir)/modules
{% extends "../base.html" %}
-{% block content %}
- {% module WikiNavbar() %}
+{% block container %}
+ {% module DocsHeader() %}
{% block main %}{% end block %}
{% end block %}
-{% if len(breadcrumbs) >= 1 %}
- <ol class="breadcrumb">
- {% for p, title in breadcrumbs %}
- <li class="breadcrumb-item">
- <a href="{{ p }}">{{ title }}</a>
- </li>
- {% end %}
+<section class="hero is-light">
+ <div class="hero-body">
+ <div class="container">
+ <nav class="breadcrumb is-medium" aria-label="breadcrumbs">
+ <ul>
+ <li>
+ <a href="/">
+ {{ _("Home") }}
+ </a>
+ </li>
- <li class="breadcrumb-item {% if not suffix %}active{% end %}">
- <a href="{{ page }}">{{ page_title }}</a>
- </li>
+ <li>
+ <a href="/docs">
+ {{ _("Docs") }}
+ </a>
+ </li>
- {% if suffix %}
- <li class="breadcrumb-item active">{{ suffix }}</li>
- {% end %}
- </ol>
-{% end %}
+ {% for p, title in breadcrumbs %}
+ <li>
+ <a href="/docs{{ p }}">{{ title }}</a>
+ </li>
+ {% end %}
+
+ {% if page_title %}
+ <li {% if not suffix %}class="is-active"{% end %}>
+ <a href="/docs{{ page }}" {% if not suffix %}aria-current="page"{% end %}>
+ {{ page_title }}
+ </a>
+ </li>
+ {% end %}
+
+ {% if suffix %}
+ <li class="is-active">
+ <a href="#" aria-current="page">{{ suffix }}</a>
+ </li>
+ {% end %}
+ </ul>
+ </nav>
+
+ <h1 class="title is-1">{{ page_title or _("IPFire Docs") }}</h1>
+ </div>
+ </div>
+</section>
{% block main %}
{% import os.path %}
- <div class="card mb-3">
- <div class="card-body wiki-content">
- {% raw page.html %}
+ <section class="section">
+ <div class="container">
+ <div class="content">
+ {% raw page.html %}
+ </div>
</div>
- </div>
+ </section>
- <div class="d-grid">
- <a class="btn btn-primary mb-3" href="{{ os.path.join(request.path, "_edit") }}">
- <span class="fas fa-edit mr-2"></span> {{ _("Edit Page") }}
- {% if not current_user %}‐ {{ _("Yes, you can edit!") }}{% end %}
- </a>
- </div>
+ <section class="section">
+ <div class="container">
+ <div class="block">
+ <a class="button is-primary is-fullwidth" href="{{ os.path.join(request.path, "_edit") }}">
+ <span class="icon-text">
+ <span class="icon">
+ <i class="fas fa-edit"></i>
+ </span>
+ <span>
+ {{ _("Edit Page") }}
+ {% if not current_user %}‐ {{ _("Yes, you can edit!") }}{% end %}
+ </span>
+ </span>
+ </a>
+ </div>
- <p class="small text-muted">
- {% if current_user %}
- {% if page.is_watched_by(current_user) %}
- <a href="{{ os.path.join(page.url, "_unwatch") }}"><span class="fas fa-star" title="{{ _("Stop watching this page") }}"></span></a>
- {% else %}
- <a href="{{ os.path.join(page.url, "_watch") }}"><span class="far fa-star" title="{{ _("Watch this page") }}"></span></a>
- {% end %} •
- {% end %}
+ <div class="block">
+ <div class="level">
+ <div class="level-left">
+ {% if current_user %}
+ {% if page.is_watched_by(current_user) %}
+ <a class="level-item" href="{{ os.path.join(page.url, "_unwatch") }}">
+ <i class="fas fa-star" title="{{ _("Stop watching this page") }}"></i>
+ </a>
+ {% else %}
+ <a class="level-item" href="{{ os.path.join(page.url, "_watch") }}">
+ <i class="far fa-star" title="{{ _("Watch this page") }}"></i>
+ </a>
+ {% end %}
+ {% end %}
- <a href="{{ request.path }}?action=revisions">
- {{ _("Older Revisions") }}
- </a>
+ <a class="level-item" href="{{ request.path }}?action=revisions">
+ {{ _("Older Revisions") }}
+ </a>
- •
+ <div class="level-item">
+ {{ locale.format_date(page.timestamp) }}
+ </div>
- {{ locale.format_date(page.timestamp) }}
-
- {% if page.author %}
- •
-
- <a href="/users/{{ page.author.uid }}">
- {{ page.author }}
- </a>
- {% end %}
- </p>
+ {% if page.author %}
+ <a class="level-item" href="/users/{{ page.author.uid }}">
+ {{ page.author }}
+ </a>
+ {% end %}
+ </div>
+ </div>
+ </div>
+ </div>
+ </section>
{% end block %}
"BootMenuHeader" : boot.MenuHeaderModule,
"BootMenuSeparator" : boot.MenuSeparatorModule,
+ # Docs
+ "DocsHeader" : docs.HeaderModule,
+
# People
"Agent" : people.AgentModule,
"CDR" : people.CDRModule,
# Wiki
"WikiDiff" : wiki.WikiDiffModule,
- "WikiNavbar" : wiki.WikiNavbarModule,
"WikiList" : wiki.WikiListModule,
# Misc
import tornado.web
from . import base
+from . import ui_modules
class PageHandler(base.BaseHandler):
@property
latest_revision = page.get_latest_revision()
# Render page
- self.render("wiki/page.html", page=page, latest_revision=latest_revision)
+ self.render("docs/page.html", page=page, latest_revision=latest_revision)
+
+
+class HeaderModule(ui_modules.UIModule):
+ @property
+ def page(self):
+ """
+ Returns the path of the page (without any actions)
+ """
+ path = self.request.path.removeprefix("/docs")
+
+ return "/".join((p for p in path.split("/") if not p.startswith("_")))
+
+ def render(self, suffix=None):
+ _ = self.locale.translate
+
+ breadcrumbs = self.backend.wiki.make_breadcrumbs(self.page)
+ title = self.backend.wiki.get_page_title(self.page)
+
+ if self.request.path.endswith("/_edit"):
+ suffix = _("Edit")
+ elif self.request.path.endswith("/_files"):
+ suffix = _("Files")
+
+ return self.render_string("docs/modules/header.html",
+ breadcrumbs=breadcrumbs, page=self.page, page_title=title, suffix=suffix)
return self.render_string("wiki/modules/list.html", link_revision=link_revision,
pages=pages, show_breadcrumbs=show_breadcrumbs,
show_author=show_author, show_changes=show_changes)
-
-
-class WikiNavbarModule(ui_modules.UIModule):
- @property
- def path(self):
- """
- Returns the path of the page (without any actions)
- """
- path = self.request.path.split("/")
-
- if path and path[-1].startswith("_"):
- path.pop()
-
- return "/".join(path)
-
- def render(self, suffix=None):
- _ = self.locale.translate
-
- # Make the path
- page = self.request.path.split("/")
-
- # Drop the action bit
- if page and page[-1].startswith("_"):
- page.pop()
-
- page = "/".join(page)
-
- breadcrumbs = self.backend.wiki.make_breadcrumbs(page)
- title = self.backend.wiki.get_page_title(page)
-
- if self.request.path.endswith("/_edit"):
- suffix = _("Edit")
- elif self.request.path.endswith("/_files"):
- suffix = _("Files")
-
- return self.render_string("wiki/modules/navbar.html",
- breadcrumbs=breadcrumbs, page=page, page_title=title, suffix=suffix)