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
eecd0e50
Commit
eecd0e50
authored
4 years ago
by
jan.bednarik
Browse files
Options
Downloads
Patches
Plain Diff
shared: ArticleMixin upgrades
parent
f89e0b30
No related branches found
No related tags found
2 merge requests
!187
Release
,
!186
Uniweb články
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
shared/models.py
+17
-1
17 additions, 1 deletion
shared/models.py
shared/templates/styleguide/2.3.x/article_card.html
+9
-14
9 additions, 14 deletions
shared/templates/styleguide/2.3.x/article_card.html
with
26 additions
and
15 deletions
shared/models.py
+
17
−
1
View file @
eecd0e50
...
...
@@ -25,7 +25,11 @@ class SubpageMixin:
class
ArticleMixin
(
models
.
Model
):
"""
Common fields for articles
"""
"""
Common fields for articles
If you want to tag articles, add tags as `tags` field in article page model.
"""
RICH_TEXT_FEATURES
=
[
"
h2
"
,
...
...
@@ -66,6 +70,18 @@ class ArticleMixin(models.Model):
class
Meta
:
abstract
=
True
@classmethod
def
has_tags
(
cls
):
try
:
cls
.
_meta
.
get_field
(
"
tags
"
)
except
models
.
FieldDoesNotExist
:
return
False
return
True
def
tag_filter_page
(
self
):
"""
Page used for filtering by tags in url like `?tag=foo`.
"""
return
self
.
get_parent
()
class
Person
(
models
.
Model
):
"""
Informace o Piratovi. Slouzi prevazne jako cache informaci o osobe pro
...
...
This diff is collapsed.
Click to expand it.
shared/templates/styleguide/2.3.x/article_card.html
+
9
−
14
View file @
eecd0e50
...
...
@@ -41,20 +41,15 @@
</a>
<p
class=
"card-body-text flex-grow"
>
{{ article.perex }}
</p>
{# TODO tags #}
{% comment %}
<div
class=
"inline-block-nogap mt-4"
>
<button
class=
"btn article-card__category-button btn--grey-125 btn--condensed text-sm font-light"
>
<div
class=
"btn__body "
>
Kategorie 1
</div>
</button>
<button
class=
"btn article-card__category-button btn--grey-125 btn--condensed text-sm font-light"
>
<div
class=
"btn__body "
>
Kategorie 2
</div>
</button>
<button
class=
"btn article-card__category-button btn--grey-125 btn--condensed text-sm font-light"
>
<div
class=
"btn__body "
>
Dlouhá kategorie 3
</div>
</button>
</div>
{% endcomment %}
{% if article.has_tags %}
<div
class=
"inline-block-nogap mt-4"
>
{% for tag in article.tags.all %}
<a
href=
"{% pageurl article.tag_filter_page %}?tag={{ tag }}"
class=
"btn article-card__category-button btn--grey-125 btn--condensed text-sm font-light"
>
<div
class=
"btn__body "
>
{{ tag }}
</div>
</a>
{% endfor %}
</div>
{% endif %}
</div>
</article>
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