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
591eee85
Commit
591eee85
authored
4 years ago
by
jan.bednarik
Browse files
Options
Downloads
Patches
Plain Diff
uniweb: Gallery section
parent
6d579e90
No related branches found
No related tags found
2 merge requests
!95
sync test
,
!89
Uniweb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
uniweb/models.py
+19
-4
19 additions, 4 deletions
uniweb/models.py
uniweb/templates/uniweb/base.html
+7
-0
7 additions, 0 deletions
uniweb/templates/uniweb/base.html
uniweb/templates/uniweb/snippet_sections.html
+20
-4
20 additions, 4 deletions
uniweb/templates/uniweb/snippet_sections.html
with
46 additions
and
8 deletions
uniweb/models.py
+
19
−
4
View file @
591eee85
...
@@ -9,6 +9,7 @@ from wagtail.admin.edit_handlers import (
...
@@ -9,6 +9,7 @@ from wagtail.admin.edit_handlers import (
from
wagtail.core
import
blocks
from
wagtail.core
import
blocks
from
wagtail.core.fields
import
StreamField
from
wagtail.core.fields
import
StreamField
from
wagtail.core.models
import
Page
from
wagtail.core.models
import
Page
from
wagtail.images.blocks
import
ImageChooserBlock
from
wagtail.images.edit_handlers
import
ImageChooserPanel
from
wagtail.images.edit_handlers
import
ImageChooserPanel
from
wagtailmetadata.models
import
MetadataPageMixin
from
wagtailmetadata.models
import
MetadataPageMixin
...
@@ -41,6 +42,14 @@ class TextSectionBlock(blocks.StructBlock):
...
@@ -41,6 +42,14 @@ class TextSectionBlock(blocks.StructBlock):
label
=
"
textová sekce
"
label
=
"
textová sekce
"
class
GallerySectionBlock
(
blocks
.
StructBlock
):
title
=
blocks
.
CharBlock
(
label
=
"
nadpis
"
,
required
=
False
)
images
=
blocks
.
ListBlock
(
ImageChooserBlock
(
label
=
"
obrázek
"
))
class
Meta
:
label
=
"
galerie obrázků
"
class
MenuItemBlock
(
blocks
.
StructBlock
):
class
MenuItemBlock
(
blocks
.
StructBlock
):
name
=
blocks
.
CharBlock
(
label
=
"
název
"
)
name
=
blocks
.
CharBlock
(
label
=
"
název
"
)
page
=
blocks
.
PageChooserBlock
(
label
=
"
stránka
"
)
page
=
blocks
.
PageChooserBlock
(
label
=
"
stránka
"
)
...
@@ -66,8 +75,11 @@ class UniwebHomePage(MetadataPageMixin, Page):
...
@@ -66,8 +75,11 @@ class UniwebHomePage(MetadataPageMixin, Page):
### FIELDS
### FIELDS
content
=
StreamField
(
content
=
StreamField
(
[(
"
text_section
"
,
TextSectionBlock
()),],
[
verbose_name
=
"
Obsah stránky
"
,
(
"
text_section
"
,
TextSectionBlock
()),
(
"
gallery_section
"
,
GallerySectionBlock
()),
],
verbose_name
=
"
obsah stránky
"
,
blank
=
True
,
blank
=
True
,
)
)
# settings
# settings
...
@@ -121,8 +133,11 @@ class UniwebFlexiblePage(Page, SubpageMixin, MetadataPageMixin):
...
@@ -121,8 +133,11 @@ class UniwebFlexiblePage(Page, SubpageMixin, MetadataPageMixin):
### FIELDS
### FIELDS
content
=
StreamField
(
content
=
StreamField
(
[(
"
text_section
"
,
TextSectionBlock
()),],
[
verbose_name
=
"
Obsah stránky
"
,
(
"
text_section
"
,
TextSectionBlock
()),
(
"
gallery_section
"
,
GallerySectionBlock
()),
],
verbose_name
=
"
obsah stránky
"
,
blank
=
True
,
blank
=
True
,
)
)
...
...
This diff is collapsed.
Click to expand it.
uniweb/templates/uniweb/base.html
+
7
−
0
View file @
591eee85
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
<!-- Bootstrap CSS -->
<!-- Bootstrap CSS -->
<link
rel=
"stylesheet"
href=
"{% static "
shared
/
vendor
/
bootstrap-4.4.1
/
css
/
bootstrap.min.css
"
%}"
>
<link
rel=
"stylesheet"
href=
"{% static "
shared
/
vendor
/
bootstrap-4.4.1
/
css
/
bootstrap.min.css
"
%}"
>
<link
rel=
"stylesheet"
href=
"{% static "
shared
/
vendor
/
fancybox
/
jquery.fancybox.min.css
"
%}"
>
<!-- Styles -->
<!-- Styles -->
<link
href=
"{% static "
uniweb
/
assets
/
css
/
style.css
"
%}"
rel=
"stylesheet"
>
<link
href=
"{% static "
uniweb
/
assets
/
css
/
style.css
"
%}"
rel=
"stylesheet"
>
...
@@ -103,5 +104,11 @@
...
@@ -103,5 +104,11 @@
</footer>
</footer>
<!-- /FOOTER -->
<!-- /FOOTER -->
<!-- JavaScript libraries -->
<script
src=
"{% static "
shared
/
vendor
/
jquery
/
jquery-3.4.1.min.js
"
%}"
></script>
<script
src=
"{% static "
shared
/
vendor
/
bootstrap-4.4.1
/
js
/
bootstrap.min.js
"
%}"
></script>
<script
src=
"{% static "
shared
/
vendor
/
lazysizes
/
lazysizes.min.js
"
%}"
></script>
<script
src=
"{% static "
shared
/
vendor
/
fancybox
/
jquery.fancybox.min.js
"
%}"
></script>
</body>
</body>
</html>
</html>
This diff is collapsed.
Click to expand it.
uniweb/templates/uniweb/snippet_sections.html
+
20
−
4
View file @
591eee85
{% load wagtailcore_tags %}
{% load wagtailcore_tags wagtailimages_tags %}
{% for section in page.content %}
{% for section in page.content %}
<section
class=
"section--{% cycle "
alternate
"
"
primary
"
%}"
>
<section
class=
"section--{% cycle "
alternate
"
"
primary
"
%}"
>
<div
class=
"container"
>
<div
class=
"container"
>
{% if section.value.title %}
{% if section.value.title %}
<h2
class=
"lead page-subheading mb-4"
>
{{ section.value.title }}
</h2>
<h2
class=
"lead page-subheading mb-4"
>
{{ section.value.title }}
</h2>
{% endif %}
{% endif %}
{% if section.block_type == "text_section" %}
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-12 richtext"
>
<div
class=
"col-12 richtext"
>
{{ section.value.text|richtext }}
{{ section.value.text|richtext }}
</div>
<!-- /column -->
</div>
</div>
<!-- /row -->
</div>
{% endif %}
{% if section.block_type == "gallery_section" %}
<div
class=
"row about-images"
>
{% for picture in section.value.images %}
{% image picture width-2000 as img %}
{% image picture fill-300x200 as thumb %}
<div
class=
"col-6 col-md-3 mb-4"
>
<a
data-fancybox=
"gallery"
href=
"{{ img.url }}"
><img
data-src=
"{{ thumb.url }}"
class=
"lazyload img-fluid"
alt=
"{{ thumb.alt }}"
></a>
</div>
{% endfor %}
</div>
{% endif %}
</div>
<!-- /container -->
</div>
</section>
</section>
{% endfor %}
{% endfor %}
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