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
a164985c
Commit
a164985c
authored
4 years ago
by
jarmil
Committed by
jan.bednarik
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Pridano strankovani aktualit. Solves
#10
parent
bc77e9d0
No related branches found
No related tags found
2 merge requests
!68
sync test
,
!64
Pridano strankovani aktualit. Solves #10
Pipeline
#977
passed
4 years ago
Stage: build
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+2
-0
2 additions, 0 deletions
.gitignore
senat_campaign/models.py
+13
-0
13 additions, 0 deletions
senat_campaign/models.py
senat_campaign/templates/senat_campaign/senat_campaign_news_index_page.html
+24
-10
24 additions, 10 deletions
...plates/senat_campaign/senat_campaign_news_index_page.html
with
39 additions
and
10 deletions
.gitignore
+
2
−
0
View file @
a164985c
...
@@ -145,3 +145,5 @@ cython_debug/
...
@@ -145,3 +145,5 @@ cython_debug/
media_files/
media_files/
static_files/
static_files/
.python-version
.idea/
This diff is collapsed.
Click to expand it.
senat_campaign/models.py
+
13
−
0
View file @
a164985c
from
django.core.paginator
import
EmptyPage
,
PageNotAnInteger
,
Paginator
from
django.db
import
models
from
django.db
import
models
from
django.utils.translation
import
gettext_lazy
from
django.utils.translation
import
gettext_lazy
from
wagtail.admin.edit_handlers
import
(
from
wagtail.admin.edit_handlers
import
(
...
@@ -319,6 +320,18 @@ class SenatCampaignNewsIndexPage(Page, SubpageMixin, MetadataPageMixin):
...
@@ -319,6 +320,18 @@ class SenatCampaignNewsIndexPage(Page, SubpageMixin, MetadataPageMixin):
def
get_context
(
self
,
request
):
def
get_context
(
self
,
request
):
context
=
super
().
get_context
(
request
)
context
=
super
().
get_context
(
request
)
articles
=
self
.
get_children
().
live
().
order_by
(
"
-senatcampaignnewspage__date
"
)
articles
=
self
.
get_children
().
live
().
order_by
(
"
-senatcampaignnewspage__date
"
)
paginator
=
Paginator
(
articles
,
4
)
page
=
request
.
GET
.
get
(
"
page
"
)
try
:
articles
=
paginator
.
page
(
page
)
except
PageNotAnInteger
:
# If page is not an integer, deliver first page.
articles
=
paginator
.
page
(
1
)
except
EmptyPage
:
# If page is out of range (e.g. 9999), deliver last page of results.
articles
=
paginator
.
page
(
paginator
.
num_pages
)
context
[
"
articles
"
]
=
articles
context
[
"
articles
"
]
=
articles
return
context
return
context
...
...
This diff is collapsed.
Click to expand it.
senat_campaign/templates/senat_campaign/senat_campaign_news_index_page.html
+
24
−
10
View file @
a164985c
...
@@ -34,30 +34,44 @@
...
@@ -34,30 +34,44 @@
</div>
<!-- /row -->
</div>
<!-- /row -->
{%
comment %}{# TODO #
}
{%
if articles.paginator.num_pages > 1 %
}
<nav
aria-label=
"Stránkování aktualit"
>
<nav
aria-label=
"Stránkování aktualit"
>
<ul
class=
"pagination justify-content-center"
>
<ul
class=
"pagination justify-content-center"
>
<li
class=
"page-item active"
>
<a
class=
"page-link"
href=
"#"
>
1
<span
class=
"sr-only"
>
(current)
</span></a>
{% if articles.has_previous %}
</li>
<li
class=
"page-item"
><a
class=
"page-link"
href=
"?page={{ articles.previous_page_number }}"
>
Předchozí
</a></li>
<li
class=
"page-item"
><a
class=
"page-link"
href=
"#"
>
2
</a></li>
{% endif %}
<li
class=
"page-item"
><a
class=
"page-link"
href=
"#"
>
3
</a></li>
<li
class=
"page-item"
>
{% for page_num in articles.paginator.page_range %}
<a
class=
"page-link"
href=
"#"
>
Další
</a>
{% if page_num == articles.number %}
</li>
<li
class=
"page-item active"
>
<a
class=
"page-link"
href=
"#"
>
{{ page_num }}
<span
class=
"sr-only"
>
(current)
</span></a>
</li>
{% else %}
<li
class=
"page-item"
><a
class=
"page-link"
href=
"?page={{ page_num }}"
>
{{ page_num }}
</a></li>
{% endif %}
{% endfor %}
{% if articles.has_next %}
<li
class=
"page-item"
><a
class=
"page-link"
href=
"?page={{ articles.next_page_number }}"
>
Další
</a></li>
{% endif %}
</ul>
</ul>
</nav>
</nav>
{% endcomment %}
{% endif %}
</div>
<!-- /column -->
</div>
<!-- /column -->
{% if page.root_page.facebook %}
{% if page.root_page.facebook %}
{% if articles.number == 1 %}
<div
class=
"col-12 col-lg-4 offset-xl-1 text-center"
>
<div
class=
"col-12 col-lg-4 offset-xl-1 text-center"
>
<h3
class=
"lead mb-3"
>
Z mého facebooku
</h3>
<h3
class=
"lead mb-3"
>
Z mého facebooku
</h3>
<iframe
src=
"https://www.facebook.com/plugins/page.php?href={{ page.root_page.facebook }}&tabs=timeline&width=290&height=500&small_header=true&adapt_container_width=true&hide_cover=true&show_facepile=false&appId=410144066050191"
width=
"290"
height=
"500"
style=
"border:none;overflow:hidden"
scrolling=
"no"
frameborder=
"0"
allowTransparency=
"true"
allow=
"encrypted-media"
></iframe>
<iframe
src=
"https://www.facebook.com/plugins/page.php?href={{ page.root_page.facebook }}&tabs=timeline&width=290&height=500&small_header=true&adapt_container_width=true&hide_cover=true&show_facepile=false&appId=410144066050191"
width=
"290"
height=
"500"
style=
"border:none;overflow:hidden"
scrolling=
"no"
frameborder=
"0"
allowTransparency=
"true"
allow=
"encrypted-media"
></iframe>
</div>
<!-- /column -->
</div>
<!-- /column -->
{% endif %}
{% endif %}
{% endif %}
</div>
<!-- /row -->
</div>
<!-- /row -->
...
...
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