From 70fedc230cfc566e4849c64f19f958d89877492e Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Tue, 18 Jul 2017 10:36:19 +0400 Subject: [PATCH] webpyapp: support de bootstrapcss --- lib/pyulib/src/ulib/web/pages.py | 49 +++++++++++++--- .../bootstrap/{template.html => T.html} | 1 + .../static/bootstrap/{template.php => T.php} | 1 + .../webpyapp/static/bootstrap/bslocal.css | 54 ++++++++++++++++++ .../webpyapp/static/bootstrap/icons/done.png | Bin 0 -> 724 bytes .../webpyapp/static/bootstrap/icons/error.png | Bin 0 -> 625 bytes .../webpyapp/static/bootstrap/icons/help.png | Bin 0 -> 717 bytes .../webpyapp/static/bootstrap/icons/info.png | Bin 0 -> 744 bytes .../webpyapp/static/bootstrap/icons/ldone.png | Bin 0 -> 2346 bytes .../static/bootstrap/icons/lerror.png | Bin 0 -> 2398 bytes .../webpyapp/static/bootstrap/icons/linfo.png | Bin 0 -> 2259 bytes .../static/bootstrap/icons/lneutral.png | Bin 0 -> 1970 bytes .../static/bootstrap/icons/lwarning.png | Bin 0 -> 1847 bytes .../webpyapp/static/bootstrap/icons/minus.png | Bin 0 -> 655 bytes .../webpyapp/static/bootstrap/icons/plus.png | Bin 0 -> 711 bytes .../static/bootstrap/icons/question.png | Bin 0 -> 766 bytes .../static/bootstrap/icons/warning.png | Bin 0 -> 654 bytes lib/ulib/templates/webpyapp/templates/T.html | 13 +++++ .../templates/webpyapp/templates/index.html | 13 +---- 19 files changed, 110 insertions(+), 21 deletions(-) rename lib/ulib/templates/webpyapp/static/bootstrap/{template.html => T.html} (94%) rename lib/ulib/templates/webpyapp/static/bootstrap/{template.php => T.php} (94%) create mode 100644 lib/ulib/templates/webpyapp/static/bootstrap/bslocal.css create mode 100644 lib/ulib/templates/webpyapp/static/bootstrap/icons/done.png create mode 100644 lib/ulib/templates/webpyapp/static/bootstrap/icons/error.png create mode 100644 lib/ulib/templates/webpyapp/static/bootstrap/icons/help.png create mode 100644 lib/ulib/templates/webpyapp/static/bootstrap/icons/info.png create mode 100644 lib/ulib/templates/webpyapp/static/bootstrap/icons/ldone.png create mode 100644 lib/ulib/templates/webpyapp/static/bootstrap/icons/lerror.png create mode 100644 lib/ulib/templates/webpyapp/static/bootstrap/icons/linfo.png create mode 100644 lib/ulib/templates/webpyapp/static/bootstrap/icons/lneutral.png create mode 100644 lib/ulib/templates/webpyapp/static/bootstrap/icons/lwarning.png create mode 100644 lib/ulib/templates/webpyapp/static/bootstrap/icons/minus.png create mode 100644 lib/ulib/templates/webpyapp/static/bootstrap/icons/plus.png create mode 100644 lib/ulib/templates/webpyapp/static/bootstrap/icons/question.png create mode 100644 lib/ulib/templates/webpyapp/static/bootstrap/icons/warning.png create mode 100644 lib/ulib/templates/webpyapp/templates/T.html diff --git a/lib/pyulib/src/ulib/web/pages.py b/lib/pyulib/src/ulib/web/pages.py index 2ad6dab..0c93c09 100644 --- a/lib/pyulib/src/ulib/web/pages.py +++ b/lib/pyulib/src/ulib/web/pages.py @@ -44,20 +44,50 @@ def jscss(href, min=False): BPSUPPL_CSS = "bpsuppl.css" def blueprintcss(prefix=None, suppl=True): if prefix is None: - prefix = "" - bpsuppl = BPSUPPL_CSS + prefix = "/static/blueprint/" + bpsuppl = "/static/%s" % BPSUPPL_CSS else: pprefix = path.split(prefix)[0] bpsuppl = path.join(pprefix, BPSUPPL_CSS) if not prefix.endswith("/"): prefix = prefix + "/" + lines = [ + css("%sscreen.css" % prefix, "screen, projection"), + css("%sprint.css" % prefix, "print"), + u"", + ] + if suppl: + lines.extend([ + css(bpsuppl), + ]) + return u"\n".join(lines) + +def bootstrapcss(prefix=None, icons=True, charset="utf-8"): + if prefix is None: prefix = "/static/bootstrap/" + elif not prefix.endswith("/"): prefix = prefix + "/" + lines = [ + '' % charset, + '', + '', + ] + if icons: + lines.extend([ + '' % prefix, + '' % prefix, + ]) + lines.extend([ + css("%sbootstrap/css/bootstrap.min.css" % prefix), + css("%sbslocal.css" % prefix), + js("%sjquery.min.js" % prefix), + js("%sbootstrap/js/bootstrap.min.js" % prefix), + u"", + ]) + return u"\n".join(lines) - return u"\n".join([css("%sscreen.css" % prefix, "screen, projection"), - css("%sprint.css" % prefix, "print"), - u"", - css(bpsuppl), - ]) DEFAULT_TEMPLATE_GLOBALS = {'_u': _u, 'checked': checked, 'selected': selected, @@ -66,6 +96,7 @@ DEFAULT_TEMPLATE_GLOBALS = {'_u': _u, 'js': js, 'jscss': jscss, 'blueprintcss': blueprintcss, + 'bootstrapcss': bootstrapcss, 'plural': plural, } diff --git a/lib/ulib/templates/webpyapp/static/bootstrap/template.html b/lib/ulib/templates/webpyapp/static/bootstrap/T.html similarity index 94% rename from lib/ulib/templates/webpyapp/static/bootstrap/template.html rename to lib/ulib/templates/webpyapp/static/bootstrap/T.html index b189d21..ea6f71b 100644 --- a/lib/ulib/templates/webpyapp/static/bootstrap/template.html +++ b/lib/ulib/templates/webpyapp/static/bootstrap/T.html @@ -8,6 +8,7 @@ + + +$:bootstrapcss() +Template + + +
+

Template

+
+ + diff --git a/lib/ulib/templates/webpyapp/templates/index.html b/lib/ulib/templates/webpyapp/templates/index.html index bb1ea7c..97ce608 100644 --- a/lib/ulib/templates/webpyapp/templates/index.html +++ b/lib/ulib/templates/webpyapp/templates/index.html @@ -2,18 +2,7 @@ $def with () - - - - - - - - - +$:bootstrapcss() index