Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
w2pext
plugin_dbui
Commits
4162c12f
Commit
4162c12f
authored
Dec 06, 2019
by
LE GAC Renaud
Browse files
Update view/plugin_dbui/documentation list to use Path.
parent
aa43f37f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
59 deletions
+75
-59
views/plugin_dbui/documentations_list.html
views/plugin_dbui/documentations_list.html
+75
-59
No files found.
views/plugin_dbui/documentations_list.html
View file @
4162c12f
{{
import os
from plugin_dbui import get_reference_paths
# alias
apath, lpath = get_reference_paths()
myapp = request.application
path_exists = lambda x: x and os.path.exists(os.path.join(apath, x))
f = lambda x: x.replace("static/", "")
rwrite = response.write
}}
<h2
class=
"dbui-h2 dbui-small-cap"
>
{{=T("Documentations")}}
</h2>
<p
class=
"dbui-p dbui-small-cap"
style=
"margin-top: 5ex"
>
...
...
@@ -19,6 +5,14 @@
</p>
<ul>
{{
from pathlib import Path
myapp = request.application
apath = Path("applications", myapp)
static = apath / "static"
rwrite = response.write
#.....................................................................
#
# user guide
...
...
@@ -26,19 +20,21 @@
a1, a2 = None, None
path_html_user = plugin.app_html_user
if path_exists(path_html_user):
a1 = A("html",
callback=URL("static", f(path_html_user)),
_target="_blank")
if path_html_user is not None:
path_html_user = apath / path_html_user
if path_html_user.exists():
fpath = str(path_html_user.relative_to(static))
a1 = A("html", callback=URL("static", fpath), _target="_blank")
pass
pass
path_pdf_user = plugin.app_pdf_user
if path_exists(path_pdf_user):
a2 = A("pdf",
callback=URL("static", f(path_pdf_user)),
_target="_blank")
if path_pdf_user is not None:
path_pdf_user = apath / path_pdf_user
if path_pdf_user.exists():
fpath = str(path_pdf_user.relative_to(static))
a2 = A("pdf", callback=URL("static", fpath), _target="_blank")
pass
pass
if a1 is not None and a2 is not None:
...
...
@@ -53,13 +49,17 @@
# database schema
#
path_db_schema = plugin.app_db_schema
if path_exists(path_db_schema):
if path_db_schema is not None:
path_db_schema = apath / path_db_chema
if path_db_schema.exists():
a = A(T("Database schema"),
callback=URL("static", f(path_db_schema)),
_target="_blank")
fpath = str(path_db_schema.relative_to(static))
a = A(T("Database schema"),
callback=URL("static", fpath),
_target="_blank")
rwrite(LI(a, _class="dbui-p"))
rwrite(LI(a, _class="dbui-p"))
pass
pass
#.....................................................................
...
...
@@ -67,13 +67,17 @@
# changelog
#
path_changelog = plugin.app_changelog
if path_exists(path_changelog):
if path_changelog is not None:
path_changelog = apath / path_changelog
if path_changelog.exists():
a = A("CHANGELOG",
callback=URL("static", f(path_changelog)),
_target="_blank")
fpath = str(path_changelog.relative_to(static))
a = A("CHANGELOG",
callback=URL("static", fpath),
_target="_blank")
rwrite(LI(a, _class="dbui-p"))
rwrite(LI(a, _class="dbui-p"))
pass
pass
}}
...
...
@@ -89,13 +93,17 @@
# Python API
#
path_html_api = plugin.app_html_api
if path_exists(path_html_api):
if path_html_api is not None:
path_html_api = apath / path_html_api
if path_html_api.exists():
a = A("%s Python API" % myapp,
callback=URL("static", f(path_html_api)),
_target="_blank")
fpath = str(path_html_api.relative_to(static))
a = A("%s Python API" % myapp,
callback=URL("static", fpath),
_target="_blank")
rwrite(LI(a, _class="dbui-p"))
rwrite(LI(a, _class="dbui-p"))
pass
pass
#.....................................................................
...
...
@@ -103,16 +111,20 @@
# JavaScript API
#
path_html_jsduck = plugin.app_html_jsduck
if path_exists(path_html_jsduck):
if path_html_jsduck is not None:
path_html_jsduck = apath / path_html_jsduck
if path_html_jsduck.exists():
a = A("%s JavaScript API" % myapp,
callback=URL("static", f(path_html_jsduck)),
_target="_blank")
fpath = str(path_html_jsduck.relative_to(static))
a = A("%s JavaScript API" % myapp,
callback=URL("static", fpath),
_target="_blank")
rwrite(LI(a, _class="dbui-p"))
rwrite(LI(a, _class="dbui-p"))
pass
pass
if path_
exists(path_html_api) or path_
exists(path_html_jsduck):
if path_
html_api.
exists(
) or
path_html_jsduck
.exists(
):
rwrite(BR())
pass
...
...
@@ -122,17 +134,19 @@
#
stdplgs = ["plugin_ace", "plugin_extjs", "plugin_mathjax"]
for el in os.listdir(os.path.join(apath, "static")):
if el.startswith("plugin") and el not in stdplgs:
for el in static.iterdir():
name = el.name
if name.startswith("plugin") and name not in stdplgs:
#
# reference manual
#
path =
"
static
/%s/
docs/reference/index.html"
% el
if path
_
exists(
path
):
path = static
/ name / "
docs/reference/index.html"
if path
.
exists():
a = A("%s Reference Manual" % el,
callback=URL("static", f(path)),
fpath = str(path.relative_to(static))
a = A(f"{name} Reference Manual",
callback=URL("static", fpath),
_target="_blank")
rwrite(LI(a, _class="dbui-p"))
...
...
@@ -141,11 +155,12 @@
#
# python api
#
path =
"
static
/%s/
docs/api/index.html"
% el
if path
_
exists(
path
):
path = static
/ name / "
docs/api/index.html"
if path
.
exists():
a = A("%s Python API" % el,
callback=URL("static", f(path)),
fpath = str(path.relative_to(static))
a = A(f"{name} Python API",
callback=URL("static", fpath),
_target="_blank")
rwrite(LI(a, _class="dbui-p"))
...
...
@@ -154,11 +169,12 @@
#
# javaScript api
#
path =
"
static
/%s/
docs/jsduck/index.html"
% el
if path
_
exists(
path
):
path = static
/ name / "
docs/jsduck/index.html"
if path
.
exists():
a = A("%s JavaScript API" % el,
callback=URL("static", f(path)),
fpath = str(path.relative_to(static))
a = A(f"{name} JavaScript API",
callback=URL("static", fpath),
_target="_blank")
rwrite(LI(a, _class="dbui-p"))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment