Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
},
"homepage": "https://github.com/TACC/Core-CMS",
"devDependencies": {
"@tacc/core-styles": "^2.40.2"
"@tacc/core-styles": "^2.41.0"
}
}
3 changes: 3 additions & 0 deletions taccsite_cms/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,9 @@ def get_subdirs_as_module_names(path):
('right', _('Align right')),
('center', _('Align center')),
]
DJANGOCMS_PICTURE_TEMPLATES = [
('no_link_to_ext_image', _('Do not link to external image')),
]

# FILE UPLOAD VALUES MUST BE SET!
# Set in correlation with the `client_max_body_size 20m;` value in /etc/nginx/proxy.conf.
Expand Down
22 changes: 22 additions & 0 deletions taccsite_cms/templates/djangocms_picture/default/picture.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,26 @@
{# /TACC #}
{# /TACC #}

{# TACC (allow link to be conditional): #}
{% block picture_link_start %}
{# /TACC #}
{% if picture_link %}
{# TACC (allow link to be conditional): #}
{% block picture_link %}
{# /TACC #}
<a href="{{ picture_link }}"
{% if instance.link_target %} target="{{ instance.link_target }}"{% endif %}
{# TACC (assign attributes to parent): #}
{{ instance.attributes_str }}
{# /TACC #}
{{ instance.link_attributes_str }}>
{# TACC (allow link to be conditional): #}
{% endblock %}
{# /TACC #}
{% endif %}
{# TACC (allow link to be conditional): #}
{% endblock %}
{# /TACC #}

{# start render figure/figcaption #}
{# TACC (support children as caption content): #}
Expand Down Expand Up @@ -49,11 +61,15 @@
{{ picture_size.size.0 }}px
"
{% endif %}
{# TACC (allow link to be conditional): #}
{% block picture_attributes %}
{# TACC (assign attributes to parent): #}
{% if not instance.caption_text and not picture_link and not instance.child_plugin_instances %}
{{ instance.attributes_str }}
{% endif %}
{# /TACC #}
{% endblock %}
{# /TACC #}
>
{# TACC (mimic v3.0.0 to v4.0.0 changes): #}
{% endlocalize %}
Expand All @@ -75,9 +91,15 @@
{% endif %}
{# end render figure/figcaption #}

{# TACC (allow link to be conditional): #}
{% block picture_link_end %}
{# /TACC #}
{% if picture_link %}
</a>
{% endif %}
{# TACC (allow link to be conditional): #}
{% endblock %}
{# /TACC #}

{% comment %}
# https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{% extends "djangocms_picture/default/picture.html" %}
{# Do not let instance.external_picture trigger picture_link templating #}
{% comment %}
App djangocms_picture assumes external image must be linked to,
but we want to allow external image to be displayed without link.
{% endcomment %}
{# FAQ: picture_link is instance link_url or link_page_id or external_picture #}
{# https://github.com/django-cms/djangocms-picture/blob/3.0.0/djangocms_picture/models.py#L269-L276 #}

{# So picture with external image is not wrapped in a link #}
{% block picture_link_start %}
{% if instance.link_url or instance.link_page_id %}
{% block picture_link %}
{{ block.super }}
{% endblock %}
{% endif %}
{% endblock %}

{# So picture attributes can be added to picture with external image #}
{% block picture_attributes %}
{% if not instance.caption_text and not instance.link_url and not instance.link_page_id and not instance.child_plugin_instances %}
{{ instance.attributes_str }}
{% endif %}
{% endblock %}

{# So picture with external image is not wrapped in a link #}
{% block picture_link_end %}
{% endblock %}