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
b4fdc7ea
Commit
b4fdc7ea
authored
11 months ago
by
Tomi Valentová
Browse files
Options
Downloads
Patches
Plain Diff
fix meta titles
parent
cf54c60a
No related branches found
No related tags found
2 merge requests
!1061
Fix meta titles
,
!1060
Fix meta titles
Pipeline
#19073
passed
11 months ago
Stage: build
Changes
2
Pipelines
3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
district/models.py
+0
-11
0 additions, 11 deletions
district/models.py
shared/models/main.py
+13
-28
13 additions, 28 deletions
shared/models/main.py
with
13 additions
and
39 deletions
district/models.py
+
0
−
11
View file @
b4fdc7ea
...
@@ -538,17 +538,6 @@ class DistrictCenterPage(
...
@@ -538,17 +538,6 @@ class DistrictCenterPage(
class
Meta
:
class
Meta
:
verbose_name
=
"
Stránka pirátského centra
"
verbose_name
=
"
Stránka pirátského centra
"
def
get_background_photo
(
self
):
"""
Vrací background_photo pro pozadí na stránce, pokud není nastaveno,
vezme falbback z homepage
"""
return
(
self
.
background_photo
if
self
.
background_photo
else
self
.
root_page
.
fallback_image
)
@property
@property
def
has_calendar
(
self
):
def
has_calendar
(
self
):
return
self
.
calendar_id
is
not
None
return
self
.
calendar_id
is
not
None
...
...
This diff is collapsed.
Click to expand it.
shared/models/main.py
+
13
−
28
View file @
b4fdc7ea
...
@@ -93,8 +93,8 @@ class ExtendedMetadataHomePageMixin(models.Model):
...
@@ -93,8 +93,8 @@ class ExtendedMetadataHomePageMixin(models.Model):
abstract
=
True
abstract
=
True
def
get_meta_title_suffix
(
self
):
def
get_meta_title_suffix
(
self
):
if
self
.
meta_title_suffix
:
if
self
.
root_page
.
meta_title_suffix
:
return
self
.
meta_title_suffix
return
self
.
root_page
.
meta_title_suffix
if
hasattr
(
super
(),
"
get_meta_title
"
):
if
hasattr
(
super
(),
"
get_meta_title
"
):
return
super
().
get_meta_title
()
return
super
().
get_meta_title
()
...
@@ -102,15 +102,11 @@ class ExtendedMetadataHomePageMixin(models.Model):
...
@@ -102,15 +102,11 @@ class ExtendedMetadataHomePageMixin(models.Model):
return
self
.
get_site
().
site_name
return
self
.
get_site
().
site_name
def
get_meta_title
(
self
):
def
get_meta_title
(
self
):
title
=
super
().
get_meta_title
()
"""
suffix
=
self
.
get_meta_title_suffix
()
Return only the meta suffix on homepages.
"""
# Covers scenario when title_suffix is not set and evaluates to super().get_meta_title() value.
# Rather than having MS Pardubice | MS Pardubice, just use MS Pardubice alone.
if
title
!=
suffix
:
return
f
"
{
super
().
get_meta_title
()
}
|
{
self
.
get_meta_title_suffix
()
}
"
return
title
return
self
.
get_meta_title_suffix
()
class
ExtendedMetadataPageMixin
(
models
.
Model
):
class
ExtendedMetadataPageMixin
(
models
.
Model
):
...
@@ -127,35 +123,24 @@ class ExtendedMetadataPageMixin(models.Model):
...
@@ -127,35 +123,24 @@ class ExtendedMetadataPageMixin(models.Model):
abstract
=
True
abstract
=
True
def
get_meta_title_suffix
(
self
):
def
get_meta_title_suffix
(
self
):
if
not
hasattr
(
self
,
"
root_page
"
):
if
self
.
root_page
.
meta_title_suffix
:
logger
.
warning
(
return
self
.
root_page
.
meta_title_suffix
"
Using `ExtendedMetadataPageMixin` without `SubpageMixin` for %s
"
,
repr
(
self
),
)
return
None
if
not
hasattr
(
self
.
root_page
,
"
get_meta_title_suffix
"
):
if
hasattr
(
super
(),
"
get_meta_title
"
):
logger
.
warning
(
return
super
().
get_meta_title
()
"
Using `ExtendedMetadataPageMixin` without `ExtendedMetadataHomePageMixin` on the root page for %s
"
,
repr
(
self
),
)
return
None
return
self
.
root_page
.
get_meta_t
it
l
e_
suffix
()
return
self
.
get_site
().
s
ite_
name
def
get_meta_title
(
self
):
def
get_meta_title
(
self
):
title
=
super
().
get_meta_title
()
title
=
super
().
get_meta_title
()
suffix
=
self
.
get_meta_title_suffix
()
suffix
=
self
.
get_meta_title_suffix
()
if
hasattr
(
self
,
"
root_page
"
)
and
title
==
self
.
root_page
.
title
:
return
f
"
Domů | Piráti
{
suffix
}
"
# Covers scenario when title_suffix is not set and evaluates to super().get_meta_title() value.
# Covers scenario when title_suffix is not set and evaluates to super().get_meta_title() value.
# Rather than having MS Pardubice | MS Pardubice, just use MS Pardubice alone.
# Rather than having MS Pardubice | MS Pardubice, just use MS Pardubice alone.
if
title
!=
suffix
:
if
title
!=
suffix
:
return
f
"
{
super
().
get_meta_title
()
}
|
Piráti
{
self
.
get_meta_title_suffix
()
}
"
return
f
"
{
super
().
get_meta_title
()
}
|
{
self
.
get_meta_title_suffix
()
}
"
return
f
"
Piráti
{
title
}
"
return
title
class
SubpageMixin
:
class
SubpageMixin
:
...
...
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