westferry_ui_PYTHON = \
src/westferry/ui/__init__.py \
src/westferry/ui/base.py \
+ src/westferry/ui/boxes.py \
src/westferry/ui/forms.py \
src/westferry/ui/graphs.py \
src/westferry/ui/menu.py \
templates_modulesdir = $(templatesdir)/modules
-dist_templates_modules_DATA =
+dist_templates_modules_DATA = \
+ src/templates/modules/box.html
templates_modules_formsdir = $(templates_modulesdir)/forms
<h{{ i }}>{{ _("Heading %s") % i }}</h{{ i }}>
{% end %}
+ <h3>{{ _("Boxes") }}</h3>
+
+ {% module PrimaryBox(_("Primary"), _("This is a box in our primary color.")) %}
+
+ {% module SecondaryBox(_("Secondary"), _("This is a box in our secondary color.")) %}
+
+ {% module SuccessBox(_("Success"), _("This is a box to show a successful operation.")) %}
+
+ {% module WarningBox(_("Warning"), _("This box shows a warning.")) %}
+
+ {% module AlertBox(_("Alert"), _("This is an alert!")) %}
+
<h3>{{ _("Controls") }}</h3>
<h4>{{ _("Buttons") }}</h4>
--- /dev/null
+#!/usr/bin/python3
+###############################################################################
+# #
+# Westferry - The IPFire web user interface #
+# Copyright (C) 2021 IPFire development team #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+###############################################################################
+
+from . import base
+
+class _BoxModule(base.BaseUIModule):
+ level = None
+
+ def render(self, title, text):
+ return self.render_string(
+ "modules/box.html", level=self.level, title=title, text=text)
+
+
+class PrimaryBoxModule(_BoxModule):
+ level = "primary"
+
+
+class SecondaryBoxModule(_BoxModule):
+ level = "secondary"
+
+
+class SuccessBoxModule(_BoxModule):
+ level = "success"
+
+
+class WarningBoxModule(_BoxModule):
+ level = "warning"
+
+
+class AlertBoxModule(_BoxModule):
+ level = "alert"