Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Discuss Data Project
Discuss Data
Commits
f9f0f14f
Commit
f9f0f14f
authored
Sep 04, 2020
by
felix.herrmann
Browse files
fix(helpnav): add toc to help; restructure manual index pages and manual pages
parent
20f69886
Changes
7
Hide whitespace changes
Inline
Side-by-side
discuss_data/core/templatetags/core_tags.py
View file @
f9f0f14f
...
...
@@ -6,6 +6,8 @@ from discuss_data.ddcomments.models import Notification
from
discuss_data.dddatasets.models
import
DataSet
from
discuss_data.ddusers.models
import
User
from
wagtail.core.models
import
Page
register
=
template
.
Library
()
DEFAULT_USER_IMAGE
=
"/static/images/user_default.png"
...
...
@@ -181,3 +183,13 @@ def replace_vars(string, vars_dict):
for
key
,
value
in
vars_dict
.
items
():
string
=
str
(
string
).
replace
(
key
,
value
)
return
string
@
register
.
simple_tag
(
takes_context
=
True
)
def
get_all_pages
(
context
):
return
Page
.
objects
.
live
()
@
register
.
simple_tag
(
takes_context
=
True
)
def
get_root_help_page
(
context
):
return
Page
.
objects
.
live
().
get
(
slug
=
"discuss-data-help"
)
discuss_data/static/sass/project.scss
View file @
f9f0f14f
...
...
@@ -1234,6 +1234,22 @@ $red: #b94a48;
height
:
9rem
;
}
.toc
ul
{
list-style-type
:
none
;
}
ul
.level-1
{
padding-left
:
0
;
}
ul
.level-2
{
padding-left
:
1
.5rem
;
}
ul
.level-3
{
padding-left
:
2
.5rem
;
}
/*
* The MIT License
* Copyright (c) 2012 Matias Meno <m@tias.me>
...
...
discuss_data/templates/nav-sidebar.html
View file @
f9f0f14f
...
...
@@ -36,7 +36,7 @@
</a>
</li>
<li
class=
"nav-item {% nav_active request.path "
/
documentation
"
%}"
>
<a
class=
"nav-link i i-ds-upload"
href=
"{% slugurl 'discuss-data-
documentation
' %}"
>
<a
class=
"nav-link i i-ds-upload"
href=
"{% slugurl 'discuss-data-
help
' %}"
>
{% trans "Help" %}
</a>
</li>
...
...
discuss_data/templates/nav-top.html
View file @
f9f0f14f
...
...
@@ -17,7 +17,7 @@
<ul
class=
"navbar-nav ml-auto"
>
<li
class=
"nav-item"
>
<a
class=
"nav-link"
href=
"{% slugurl 'discuss-data-
documentation
' %}"
>
{% trans "Help" %}
</a>
<a
class=
"nav-link"
href=
"{% slugurl 'discuss-data-
help
' %}"
>
{% trans "Help" %}
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link"
href=
"{% url 'core.about_page' %}"
>
{% trans "About" %}
</a>
...
...
discuss_data/templates/pages/_toc.html
0 → 100644
View file @
f9f0f14f
{% load static i18n core_tags wagtailcore_tags%}
{% get_root_help_page as root_help_page %}
<h2><a
href=
"{% slugurl 'discuss-data-help' %}"
>
{% trans 'Help' %}
</h2></a>
<div
class=
"toc"
>
<ul
class=
"level-1"
>
{% for hpage in root_help_page.get_children %}
<li>
{% if hpage.url == request.path %}
<b>
{{ hpage.title }}
</b>
{% else %}
<a
href=
"{% pageurl hpage %}"
>
{{ hpage.title }}
</a>
{% endif %}
<ul
class=
"level-2"
>
{% for subpage in hpage.get_children %}
<li>
{% if subpage.url == request.path %}
<b>
{{ subpage.title }}
</b>
{% else %}
<a
href=
"{% pageurl subpage %}"
>
{{ subpage.title }}
</a>
{% endif %}
<ul
class=
"level-3"
>
{% for subsubpage in subpage.get_children %}
<li>
{% if subsubpage.url == request.path %}
<b>
{{ subsubpage.title }}
</b>
{% else %}
<a
href=
"{% pageurl subsubpage %}"
>
{{ subsubpage.title }}
</a>
{% endif %}
</li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
</div>
discuss_data/templates/pages/manual_index_page.html
View file @
f9f0f14f
...
...
@@ -3,52 +3,24 @@
{% load wagtailcore_tags core_tags %}
{% block ic-content %}
<div
class=
"row"
>
{% if self.get_ancestors|length > 1 %}
<nav
aria-label=
"breadcrumb"
>
<ol
class=
"breadcrumb"
>
{% for page in self.get_ancestors %}
{% if page.is_root == False %}
<li
class=
"breadcrumb-item"
><a
href=
"{% pageurl page %}"
>
{{ page.title }}
</a></li>
{% endif %}
{% endfor %}
<li
class=
"breadcrumb-item active"
>
{{ self.title }}
</li>
</ol>
</nav>
{% endif %}
{% if callfromchild %}
<h1
class=
"docupage-title"
id=
"{{ page.specific.slug }}"
>
{{ page.specific.title }}
</h1>
{% if page.specific.intro %}
<p
class=
"docupage-intro"
>
{{ page.specific.intro }}
</p>
{% endif %}
<div>
{{ page.specific.text|richtext }}
</div>
{% else %}
<h1
class=
"docupage-title"
id=
"{{ page.slug }}"
>
{{ page.title }}
</h1>
<div
class=
"col-md-8"
>
<h2
class=
"docupage-title"
id=
"{{ page.slug }}"
>
{{ page.title }}
</h2>
{% if page.intro %}
<p
class=
"docupage-intro"
>
{{ page.intro }}
</p>
{% endif %}
<div>
{{ page.text|richtext }}
</div>
{% endif %}
<div
class=
"accordion smallskip"
id=
"accordion-docu"
>
{% for subpage in page.get_children %}
<div
class=
"card content-bg"
>
<div
class=
"card-header docucard-header {% if subpage.slug == subpagemain %}docucard-header-active{% endif %}"
id=
"{{ subpage.slug }}"
>
{% if subpage.specific.class_name == 'ManualPage' %}
<button
class=
"btn btn-link docucard-button no-padding"
data-toggle=
"collapse"
data-target=
"#subpage-{{ subpage.id }}"
aria-expanded=
"{% if subpage.slug == subpagemain %}true{% else %}false{% endif %}"
aria-controls=
"subpage-{{ subpage.id }}"
onclick=
"docucardActive(this)"
ic-get-from=
"{% pageurl subpage %}"
ic-push-url=
"true"
ic-target=
"#subpage-{{ subpage.id }}-card-body"
{%
if
subpage.slug =
=
subpagemain
%}
ic-trigger-on=
"load"
{%
endif
%}
>
{{ subpage.title }}
<i
class=
"fa fa-spinner fa-spin ic-indicator"
style=
"display:none"
></i></button>
{% elif subpage.specific.class_name == 'ManualIndexPage' %}
<button
class=
"btn btn-link docucard-button no-padding"
ic-get-from=
"{% pageurl subpage %}"
ic-push-url=
"true"
ic-target=
"#content"
{%
if
subpage.slug =
=
subpagemain
%}
ic-trigger-on=
"load"
{%
endif
%}
>
{{ subpage.title }}
<i
class=
"fa fa-spinner fa-spin ic-indicator"
style=
"display:none"
></i></button>
{% endif %}
</div>
<div
id=
"subpage-{{ subpage.id }}"
class=
"collapse {% if subpage.slug == subpagemain %}show{% endif %}"
aria-labelledby=
"{{ subpage.slug }}"
data-parent=
"#accordion-docu"
>
<div
id=
"subpage-{{ subpage.id }}-card-body"
class=
"card-body"
></div>
</div>
</div>
{% endfor %}
{% for subpage in page.get_children %}
<p><a
href=
"{% pageurl subpage %}"
>
{{ subpage.title }}
</a></p>
{% endfor %}
</div>
<div
class=
"col-md-4"
>
{% include 'pages/_toc.html' %}
</div>
</div>
...
...
discuss_data/templates/pages/manual_page.html
View file @
f9f0f14f
...
...
@@ -2,27 +2,34 @@
{% load wagtailcore_tags wagtailimages_tags %}
{% if request.is_intercooler %}
{% block ic-content %}
<
h2
class=
"
docupage-title"
>
{{ page.title }}
</h2
>
{% if page.intro %}
<p
class=
"docupage-intro"
>
{{ page.intro }}
</p>
{% endif %}
{{ page.text|richtext }
}
<
div
class=
"
row"
>
<div
class=
"col-md-8"
>
<h2
class=
"docupage-title"
>
{{ page.title }}
</h2>
{% if page.intro %}
<p
class=
"docupage-intro"
>
{{ page.intro }}
</p>
{% endif %
}
{% for block in page.body %}
<section>
{% include_block block %}
</section>
{% endfor %}
{{ page.text|richtext }}
{% for subpage in page.get_children %}
<h2><a
href=
"{% pageurl subpage %}"
>
{{ subpage.title }}
</a></h2>
{% if subpage.specific.intro %}{{ subpage.specific.intro }}{% endif %}
{% if subpage.specific.text %}{{ subpage.specific.text|richtext }}{% endif %}
{% endfor %}
<div
class=
"accordion smallskip"
id=
"accordion-docu"
>
{% for block in page.body %}
<div
class=
"card content-bg"
>
<div
class=
"card-header docucard-header"
id=
"{{ block.slug }}"
>
<button
class=
"btn btn-link docucard-button no-padding"
data-toggle=
"collapse"
data-target=
"#block-{{ block.id }}"
aria-expanded=
"false"
aria-controls=
"block-{{ block.id }}"
onclick=
"docucardActive(this)"
>
{{ block.value.heading }}
</button>
</div>
<div
id=
"block-{{ block.id }}"
class=
"collapse"
aria-labelledby=
"{{ block.slug }}"
data-parent=
"#accordion-docu"
>
<div
class=
"card-body"
>
<section>
{% include_block block %}
</section>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
<div
class=
"col-md-4"
>
{% include 'pages/_toc.html' %}
</div>
</div>
{% endblock ic-content %}
{% else %}
{% block content %}
{% include 'pages/manual_index_page.html' with page=page.get_parent subpagemain=page.slug callfromchild=True %}
{% endblock content %}
{% endif %}
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