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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
Maják
Commits
214a1385
Verified
Commit
214a1385
authored
Jul 15, 2023
by
jindra12
Browse files
Options
Downloads
Patches
Plain Diff
Displays correct url and can lookup fake pages
#210
parent
ce5bdf7d
Branches
Branches containing commit
No related tags found
2 merge requests
!816
Release
,
!801
Prepare basic shared tags
Pipeline
#13766
passed
Jul 15, 2023
Stage: build
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
shared/models.py
+28
-30
28 additions, 30 deletions
shared/models.py
shared/templates/shared/article_preview.html
+15
-3
15 additions, 3 deletions
shared/templates/shared/article_preview.html
with
43 additions
and
33 deletions
shared/models.py
+
28
−
30
View file @
214a1385
...
@@ -271,7 +271,9 @@ class ArticlesMixin(models.Model):
...
@@ -271,7 +271,9 @@ class ArticlesMixin(models.Model):
content_panels
=
Page
.
content_panels
+
[
FieldPanel
(
"
shared_tags
"
)]
content_panels
=
Page
.
content_panels
+
[
FieldPanel
(
"
shared_tags
"
)]
def
append_all_shared_articles
(
self
,
previous_query
:
models
.
QuerySet
|
None
):
def
append_all_shared_articles
(
self
,
previous_query
:
models
.
QuerySet
|
None
=
None
,
filter
=
None
):
"""
"""
To prevent circular deps, we get class models during runtime
To prevent circular deps, we get class models during runtime
"""
"""
...
@@ -335,35 +337,17 @@ class ArticlesMixin(models.Model):
...
@@ -335,35 +337,17 @@ class ArticlesMixin(models.Model):
},
},
)
)
district
A
rticle
Q
uery
:
models
.
QuerySet
=
DistrictArticlePage
.
objects
district
_a
rticle
_q
uery
:
models
.
QuerySet
=
DistrictArticlePage
.
objects
uniweb
A
rticle
PageQ
uery
:
models
.
QuerySet
=
UniwebArticlePage
.
objects
uniweb
_a
rticle
_q
uery
:
models
.
QuerySet
=
UniwebArticlePage
.
objects
main
A
rticle
PageQ
uery
:
models
.
QuerySet
=
MainArticlePage
.
objects
main
_a
rticle
_q
uery
:
models
.
QuerySet
=
MainArticlePage
.
objects
district_by_slug
=
(
apply_additional_filter
=
(
(
lambda
query
:
filter
(
query
)
if
filter
is
not
None
else
query
districtArticleQuery
.
filter
(
shared_tags__slug__in
=
self
.
shared_tags
.
values_list
(
"
slug
"
,
flat
=
True
)
)
)
.
live
()
.
specific
()
)
uniweb_by_slug
=
(
(
uniwebArticlePageQuery
.
filter
(
shared_tags__slug__in
=
self
.
shared_tags
.
values_list
(
"
slug
"
,
flat
=
True
)
)
)
.
live
()
.
specific
()
)
)
main_by_slug
=
(
create_query_by_slug
=
lambda
query
:
apply_additional_filter
(
(
(
mainArticlePageQ
uery
.
filter
(
q
uery
.
filter
(
shared_tags__slug__in
=
self
.
shared_tags
.
values_list
(
shared_tags__slug__in
=
self
.
shared_tags
.
values_list
(
"
slug
"
,
flat
=
True
"
slug
"
,
flat
=
True
)
)
...
@@ -373,6 +357,18 @@ class ArticlesMixin(models.Model):
...
@@ -373,6 +357,18 @@ class ArticlesMixin(models.Model):
.
specific
()
.
specific
()
)
)
district_by_slug
=
create_query_by_slug
(
district_article_query
)
if
filter
is
not
None
:
district_by_slug
=
filter
(
district_by_slug
)
uniweb_by_slug
=
create_query_by_slug
(
uniweb_article_query
)
if
filter
is
not
None
:
uniweb_by_slug
=
filter
(
uniweb_by_slug
)
main_by_slug
=
create_query_by_slug
(
main_article_query
)
if
filter
is
not
None
:
main_by_slug
=
filter
(
main_by_slug
)
results
=
(
results
=
(
main_by_slug
.
values
(
main_by_slug
.
values
(
**
main_fields
,
**
main_fields
,
...
@@ -454,11 +450,13 @@ class ArticlesMixin(models.Model):
...
@@ -454,11 +450,13 @@ class ArticlesMixin(models.Model):
)
)
def
get_article_page_by_slug
(
self
,
slug
:
str
):
def
get_article_page_by_slug
(
self
,
slug
:
str
):
articles
=
self
.
append_all_shared_articles
()
articles
=
self
.
append_all_shared_articles
(
return
articles
.
filter
(
page_ptr__path
=
slug
).
first
()
filter
=
lambda
query
:
query
.
filter
(
slug
=
slug
)
)
return
articles
[
0
]
def
setup_article_page_context
(
self
,
request
):
def
setup_article_page_context
(
self
,
request
):
slug
=
request
.
GET
.
get
(
"
s
lug
"
,
""
)
slug
=
request
.
GET
.
get
(
"
s
dilene
"
,
""
)
return
self
.
get_article_page_by_slug
(
slug
).
serve
(
request
)
return
self
.
get_article_page_by_slug
(
slug
).
serve
(
request
)
def
get_search_tags_params
(
self
,
site_article_ids
:
list
):
def
get_search_tags_params
(
self
,
site_article_ids
:
list
):
...
...
This diff is collapsed.
Click to expand it.
shared/templates/shared/article_preview.html
+
15
−
3
View file @
214a1385
...
@@ -7,10 +7,18 @@
...
@@ -7,10 +7,18 @@
itemscope=
""
itemscope=
""
>
>
{% if article.shared %}
<link
itemprop=
"mainEntityOfPage"
href=
"{{ page.url }}sdilene?sdilene={{ article.slug|urlencode }}"
>
{% else %}
<link
itemprop=
"mainEntityOfPage"
href=
"{{ article.url }}"
>
<link
itemprop=
"mainEntityOfPage"
href=
"{{ article.url }}"
>
{% endif %}
<div
class=
"article-card-cover"
>
<div
class=
"article-card-cover"
>
{% if article.shared %}
<a
href=
"{{ page.url }}sdilene?sdilene={{ article.slug|urlencode }}"
rel=
"noindex"
itemprop=
"image"
itemtype=
"http://schema.org/ImageObject"
itemscope=
""
>
{% else %}
<a
href=
"{{ article.url }}"
itemprop=
"image"
itemtype=
"http://schema.org/ImageObject"
itemscope=
""
>
<a
href=
"{{ article.url }}"
itemprop=
"image"
itemtype=
"http://schema.org/ImageObject"
itemscope=
""
>
{% endif %}
{% if article.thumb_image %}
{% if article.thumb_image %}
{% image article.thumb_image fill-356x192 as img %}
{% image article.thumb_image fill-356x192 as img %}
{% image article.thumb_image fill-714x384 as img_2x %}
{% image article.thumb_image fill-714x384 as img_2x %}
...
@@ -64,7 +72,11 @@
...
@@ -64,7 +72,11 @@
</div>
</div>
<div
class=
"card__body article-card__body{% if article.is_black %} text-white{% endif %}"
>
<div
class=
"card__body article-card__body{% if article.is_black %} text-white{% endif %}"
>
{% if article.shared %}
<a
href=
"{{ page.url }}sdilene?sdilene={{ article.slug|urlencode }}"
rel=
"noindex"
>
{% else %}
<a
href=
"{{ article.url }}"
>
<a
href=
"{{ article.url }}"
>
{% endif %}
<h1
class=
"card-headline mb-4"
>
<h1
class=
"card-headline mb-4"
>
{{ article.title }}
{{ article.title }}
</h1>
</h1>
...
...
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