Skip to content

Commit

Permalink
Undo changes for alt text. That was a bit too soon.
Browse files Browse the repository at this point in the history
  • Loading branch information
mauritsvanrees committed Oct 21, 2024
1 parent 6230bd4 commit e37ec9a
Show file tree
Hide file tree
Showing 19 changed files with 7 additions and 232 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ local.cfg
/venv/
.installed.txt

/test_*
robot_*

##
# Add extra configuration options in .meta.toml:
Expand Down
6 changes: 0 additions & 6 deletions .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,3 @@ dependencies_ignores = "['ZServer', 'plone.app.event', 'Products.CMFPlone',]"

[tox]
constraints_file = "https://dist.plone.org/release/6.1-dev/constraints.txt"

[gitignore]
extra_lines = """
/test_*
robot_*
"""
6 changes: 0 additions & 6 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,3 @@ global-exclude *.pyc

recursive-exclude news *
exclude news

include requirements.txt
include constraints.txt
include *.yaml
include Makefile
exclude *-mxdev.txt
123 changes: 0 additions & 123 deletions Makefile

This file was deleted.

1 change: 0 additions & 1 deletion constraints.txt

This file was deleted.

7 changes: 0 additions & 7 deletions instance.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions mx.ini

This file was deleted.

2 changes: 0 additions & 2 deletions news/+setup.internal

This file was deleted.

2 changes: 0 additions & 2 deletions news/700.feature

This file was deleted.

7 changes: 2 additions & 5 deletions plone/app/contenttypes/browser/templates/image.pt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
<figure class="figure">
<a tal:define="
scale context/@@images;
alt_text context/alt_text|nothing;
img_tag python:scale.tag('image', scale='large', css_class='figure-img img-fluid', alt=alt_text);
img_tag python:scale.tag('image', scale='large', css_class='figure-img img-fluid');
"
tal:attributes="
href string:${context/@@plone_context_state/object_url}/image_view_fullscreen;
Expand Down Expand Up @@ -86,9 +85,7 @@
>Download</a>
<a class="btn btn-primary fullscreen"
href="${context/@@plone_context_state/object_url}/image_view_fullscreen"
>
<span i18n:translate="label_click_to_view_full_image">View full-size image</span>
</a>
><span i18n:translate="label_click_to_view_full_image">View full-size image</span></a>
</section>


Expand Down
3 changes: 1 addition & 2 deletions plone/app/contenttypes/browser/templates/listing.pt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
item_link python:item_type in view.use_view_action and item_url+'/view' or item_url;
item_is_event python:view.is_event(obj);
item_has_image python:item.getIcon;
item_alt_text python:getattr(item, 'alt_text', '') if item_has_image else '';
item_type_class python:('contenttype-' + view.normalizeString(item_type)) if showicons else '';
">
<metal:block define-slot="entry">
Expand Down Expand Up @@ -162,7 +161,7 @@
<a tal:attributes="
href python:item_link;
">
<img tal:replace="structure python:image_scale.tag(item, 'image', scale=thumb_scale_list, css_class=img_class, loading='lazy', alt=item_alt_text)" />
<img tal:replace="structure python:image_scale.tag(item, 'image', scale=thumb_scale_list, css_class=img_class, loading='lazy')" />
</a>
</div>
</article>
Expand Down
8 changes: 2 additions & 6 deletions plone/app/contenttypes/browser/templates/listing_album.pt
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@
<div class="card-image d-flex justify-content-center align-items-center"
style="height: 14rem;"
tal:define="
item_has_image python:image.getIcon;
item_alt_text python:getattr(image, 'alt_text', '') if item_has_image else '';
scale python:image_scale.tag(image, 'image', scale='mini', loading='lazy', alt=item_alt_text);
scale python:image_scale.tag(image, 'image', scale='mini', loading='lazy');
"
tal:condition="scale"
>
Expand Down Expand Up @@ -81,9 +79,7 @@
<div class="card-image d-flex justify-content-center align-items-center"
style="height: 14rem;"
tal:define="
item_has_image python:album.getIcon;
item_alt_text python:getattr(album, 'alt_text', '') if item_has_image else '';
scale python:image_scale.tag(album, 'image', scale='mini', loading='lazy', alt=item_alt_text) if getattr(album, 'image', None) else None;
scale python:image_scale.tag(album, 'image', scale='mini', loading='lazy') if getattr(album, 'image', None) else None;
"
tal:condition="scale"
>
Expand Down
4 changes: 1 addition & 3 deletions plone/app/contenttypes/browser/templates/listing_summary.pt
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
tal:attributes="
href item_link;
title item_type;
item_has_image python:item.getIcon;
item_alt_text python:getattr(item, 'alt_text', '') if item_has_image else '';
"
>
Item Title
Expand Down Expand Up @@ -74,7 +72,7 @@
<a tal:attributes="
href item_link;
">
<img tal:replace="structure python:image_scale.tag(item, 'image', scale=thumb_scale_summary, css_class='image-responsive thumb-' + thumb_scale_summary, loading='lazy', alt=item_alt_text)" />
<img tal:replace="structure python:image_scale.tag(item, 'image', scale=thumb_scale_summary, css_class='image-responsive thumb-' + thumb_scale_summary, loading='lazy')" />
</a>
</div>

Expand Down
3 changes: 1 addition & 2 deletions plone/app/contenttypes/browser/templates/listing_tabular.pt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
item_wf_state_class python:'state-' + view.normalizeString(item_wf_state);
item_creator python:item.Creator();
item_has_image python:item.getIcon;
item_alt_text python:getattr(item, 'alt_text', '') if item_has_image else '';
item_link python:item_type in view.use_view_action and item_url+'/view' or item_url;
item_mime_type python:item.mime_type;
item_mime_type_icon python: 'mimetype-' + item_mime_type;
Expand Down Expand Up @@ -139,7 +138,7 @@

<td>
<a tal:condition="python:item_has_image and thumb_scale_table">
<img tal:replace="structure python:image_scale.tag(item, 'image', scale=thumb_scale_table, css_class=img_class, loading='lazy', alt=item_alt_text)"
<img tal:replace="structure python:image_scale.tag(item, 'image', scale=thumb_scale_table, css_class=img_class, loading='lazy')"
tal:attributes="
href python: item_link;
"
Expand Down
5 changes: 0 additions & 5 deletions plone/app/contenttypes/indexers.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,3 @@ def getIcon(obj):
if obj.aq_base.image:
return True
return False


@indexer(IDexterityContent)
def getAltTag(obj):
return obj.alt_text
4 changes: 0 additions & 4 deletions plone/app/contenttypes/indexers.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,5 @@
factory=".indexers.mime_type"
name="mime_type"
/>
<adapter
factory=".indexers.getAltTag"
name="alt_text"
/>

</configure>
14 changes: 0 additions & 14 deletions plone/app/contenttypes/schema/image.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,5 @@
<description />
<title i18n:translate="label_image">Image</title>
</field>
<field name="alt_text"
type="zope.schema.TextLine"
>
<description i18n:translate="label_alt_text_help">
Briefly describe the meaning of the image for people using assistive technology like screen readers.
This will be used when the image is viewed by itself or in automated contexts like listings.
Do not duplicate the Title or Description fields, since those might also be read by screen readers.
Alt text should describe what a sighted user sees when looking at the image.
This might include text the image contains, or even a description of an abstract pattern.
In case your description already sufficiently describes your image, leave this field blank.
</description>
<required>False</required>
<title i18n:translate="label_alt_text">Alt Text</title>
</field>
</schema>
</model>
32 changes: 0 additions & 32 deletions plone/app/contenttypes/tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,7 @@ def setUp(self):
image.title = "My Image"
image.description = "This is my image."
image.image = dummy_image()

self.portal.invokeFactory("Image", "image-with-alt")
image_alt = self.portal["image-with-alt"]
image_alt.title = "My Image 2"
image_alt.description = "This is my second image."
image_alt.alt_text = "An alt text"
image_alt.image = dummy_image()

self.image = image
self.image_alt = image_alt
self.request.set("URL", image.absolute_url())
self.request.set("ACTUAL_URL", image.absolute_url())
alsoProvides(self.request, IPloneFormLayer)
Expand All @@ -94,29 +85,6 @@ def test_image_view(self):
self.assertTrue("My Image" in view())
self.assertTrue("This is my image." in view())

def test_image_view_alt(self):
view = self.image_alt.restrictedTraverse("@@image_view")
self.assertTrue(view())
self.assertEqual(view.request.response.status, 200)
self.assertTrue("My Image 2" in view())
self.assertTrue("This is my second image." in view())
self.assertTrue("An alt text" in view())

def test_image_alt_in_listing_view(self):
self.image_alt.image = dummy_image("image.svg")
view = self.portal.restrictedTraverse("@@listing_view")
self.assertTrue("An alt text" in view())

def test_image_alt_in_summary_view(self):
self.image_alt.image = dummy_image("image.svg")
view = self.portal.restrictedTraverse("@@summary_view")
self.assertTrue("An alt text" in view())

def test_image_alt_in_album_view(self):
self.image_alt.image = dummy_image("image.svg")
view = self.portal.restrictedTraverse("@@album_view")
self.assertTrue("An alt text" in view())

# XXX: Not working. See ImageFunctionalTest test_image_view_fullscreen
# Problem seems to be that the image is not properly uploaded.
# def test_image_view_fullscreen(self):
Expand Down
1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

0 comments on commit e37ec9a

Please sign in to comment.