Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Maják
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
Maják
Commits
e1e7af58
Commit
e1e7af58
authored
4 years ago
by
jarmil
Committed by
jan.bednarik
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Stranka MS - aktuality: strankovani
parent
a233d2f0
No related branches found
No related tags found
2 merge requests
!173
Release
,
!134
Weby pro MS
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
district/models.py
+5
-6
5 additions, 6 deletions
district/models.py
district/templates/district/district_articles.html
+34
-0
34 additions, 0 deletions
district/templates/district/district_articles.html
with
39 additions
and
6 deletions
district/models.py
+
5
−
6
View file @
e1e7af58
from
django.core.paginator
import
Paginator
from
django.db
import
models
from
django.utils.translation
import
gettext_lazy
from
wagtail.admin.edit_handlers
import
FieldPanel
,
MultiFieldPanel
,
StreamFieldPanel
...
...
@@ -89,10 +90,8 @@ class DistrictArticles(MetadataPageMixin, Page):
def
get_context
(
self
,
request
):
context
=
super
().
get_context
(
request
)
context
[
"
articles
"
]
=
(
self
.
get_siblings
(
inclusive
=
False
)
.
type
(
Article
)
.
live
()
.
specific
()[:
self
.
max_items
]
)
context
[
"
articles
"
]
=
Paginator
(
self
.
get_siblings
(
inclusive
=
False
).
type
(
Article
).
live
().
specific
(),
self
.
max_items
or
5
,
).
get_page
(
request
.
GET
.
get
(
"
page
"
))
return
context
This diff is collapsed.
Click to expand it.
district/templates/district/district_articles.html
+
34
−
0
View file @
e1e7af58
...
...
@@ -11,5 +11,39 @@
{% endfor %}
</div>
<div
class=
"pagination-container"
role=
"navigation"
aria-label=
"Pagination"
>
<nav>
{% if articles.has_previous %}
<a
href=
"/aktuality/?page={{ articles.previous_page_number }}"
class=
"btn btn--icon btn--grey-125 btn--hoveractive btn--to-black btn--condensed btn--inverted-icon px-0"
aria-label=
"Předchozí stránka"
>
<div
class=
"btn__body-wrap"
>
<div
class=
"btn__body "
>
Předchozí
</div>
<div
class=
"btn__icon "
>
<i
class=
"ico--chevron-left"
></i>
</div>
</div>
</a>
{% endif %}
{% for i in articles.paginator.page_range %}
<a
href=
"/aktuality/?page={{ i }}"
class=
"btn {% if i == articles.number %} btn--grey-500 {% else %} btn--grey-125 {% endif %} btn--hoveractive btn--to-black btn--condensed hidden md:inline-block px-0"
aria-label=
"Stránka {{ i }}"
>
<div
class=
"btn__body "
>
{{ i }}
</div>
</a>
{% endfor %}
{% if articles.has_next %}
<a
href=
"/aktuality/?page={{ articles.next_page_number }}"
class=
"btn btn--icon btn--grey-125 btn--hoveractive btn--to-black btn--condensed px-0"
aria-label=
"Další stránka"
>
<div
class=
"btn__body-wrap"
>
<div
class=
"btn__body "
>
Další
</div>
<div
class=
"btn__icon "
>
<i
class=
"ico--chevron-right"
></i>
</div>
</div>
</a>
{% endif %}
</nav>
</div>
</main>
{% endblock %}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment