Skip to content
This repository has been archived by the owner on Sep 5, 2019. It is now read-only.

Commit

Permalink
Make sure that the alt text in manage images is never stale
Browse files Browse the repository at this point in the history
Resolves #221
  • Loading branch information
Denis Krienbühl committed Aug 18, 2016
1 parent cbeb8c3 commit ece27b0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Changelog
---------

- Make sure that the alt text in manage images is never stale.
[href]

- Makes the location of an event mandatory.
[href]

Expand Down
4 changes: 2 additions & 2 deletions onegov/town/assets/js/lazyalttext.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var onLazyLoadAltText = function(element) {
return; // we already have an alt text
}

if (target.hasClass('.missing-alt')) {
if (target.hasClass('.static-alt')) {
return; // this alt text is not dynamic
}

Expand All @@ -64,7 +64,7 @@ var onLazyLoadAltText = function(element) {
});
};

$('.page-text img[alt][alt!=""], .missing-alt').each(function() {
$('.page-text img[alt][alt!=""], .static-alt').each(function() {
appendAltText(this, $(this).attr('alt'));
});

Expand Down
4 changes: 2 additions & 2 deletions onegov/town/templates/images.pt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
<ul class="small-block-grid-1 medium-block-grid-2 large-block-grid-4">
<li tal:repeat="image group['images']" id="image-${repeat.image.index}" class="image-box">
<a href="${image.url}" tal:condition="image" class="editable-alt" data-note-update-url="${image.extra}">
<img tal:condition="image.alt" data-src="${image.src}" class="lazyload" alt="${image.alt}" />
<img tal:condition="not:image.alt" data-src="${image.src}" class="lazyload missing-alt" alt="Click to add a description" i18n:attributes="alt" />
<img tal:condition="image.alt" data-src="${image.src}" class="lazyload static-alt" alt="${image.alt}" />
<img tal:condition="not:image.alt" data-src="${image.src}" class="lazyload missing-alt static-alt" alt="Click to add a description" i18n:attributes="alt" />
</a>
<a class="delete confirm"
ic-delete-from="${image.url}?csrf-token=${layout.csrf_token}"
Expand Down

0 comments on commit ece27b0

Please sign in to comment.