-
Notifications
You must be signed in to change notification settings - Fork 2
feat: GH-999 let CMS admin change header logo #1083
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
e2f7c53
f52b8b2
ead8569
53cfef6
e1d19d9
9fef1c3
7459528
d156af6
d5b2a36
c7f4454
15a1c2d
053fdd7
79f14b3
c42f211
15fc05c
07c0c2a
27fa19d
96ed5cd
7070552
3ee0438
fc6bb82
1937592
fc7eb38
0d4fd91
42a801a
c85cc71
2cabc1c
e56e434
b737a87
34988a7
440ceba
606a0eb
559dbf7
9beaf61
a4f1a43
1d01d08
9ff3bc2
958e340
74241ec
56931f1
f878b60
97d3382
d8d6114
7450f3f
a6b9209
4c79ddf
cead748
950ed99
d361e90
1d96a54
39a8386
b41b1a6
791d412
0d31361
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -558,7 +558,14 @@ def get_subdirs_as_module_names(path): | |
| } | ||
|
|
||
| CMS_PERMISSION = True | ||
| CMS_PLACEHOLDER_CONF = {} | ||
| CMS_PLACEHOLDER_CONF = { | ||
| 'header-logo': { | ||
| 'plugins': ['PicturePlugin'], | ||
| 'limits': { | ||
| 'global': 1 | ||
| }, | ||
| }, | ||
|
Comment on lines
+571
to
+581
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Name the placeholder and limit its content to a header logo. |
||
| } | ||
|
|
||
| THUMBNAIL_HIGH_RESOLUTION = True | ||
| THUMBNAIL_PROCESSORS = ( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| {# Header logo from Picture plugin: pass plugin_logo and use shared header_logo.html. #} | ||
| {% load header_logo_tags %} | ||
| {% header_logo_from_picture instance picture_link as plugin_logo %} | ||
| {% include "header_logo.html" with plugin_logo=plugin_logo %} |
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The keystone code is in this file. |
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not as big a change a it looks. I basically moved it to what file looks like, sans diff |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| """Template tags for header logo (e.g. building plugin_logo from Picture plugin).""" | ||
| from django import template | ||
|
|
||
| register = template.Library() | ||
|
|
||
|
|
||
| @register.simple_tag | ||
| def header_logo_from_picture(instance, picture_link): | ||
| """ | ||
| Build a plugin_logo dict from a djangocms_picture instance for use in header_logo.html. | ||
|
|
||
| Usage: {% header_logo_from_picture instance picture_link as plugin_logo %} | ||
| Then: {% include "header_logo.html" with plugin_logo=plugin_logo %} | ||
| """ | ||
| attributes = getattr(instance, 'attributes', None) or {} | ||
| picture = getattr(instance, 'picture', None) | ||
| alt = attributes.get('alt') or (getattr(picture, 'default_alt_text', None) if picture else None) or '' | ||
| img_src = getattr(instance, 'img_src', None) or '' | ||
| return { | ||
| 'link_href': picture_link or '#', | ||
| 'link_target': getattr(instance, 'link_target', None) or '', | ||
| 'img_class': '', | ||
| 'img_file_src': img_src, | ||
| 'is_remote': True, | ||
| 'img_crossorigin': '', | ||
| 'img_alt_text': alt, | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To no longer let basic CMS editor edit placeholders.1
Footnotes
I auto-added this permission before I realized I should not. ↩