Skip to content
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

Accessibility fixes for manage IDs page #814

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
7 changes: 3 additions & 4 deletions templates/includes/search_help.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<div class="fcontrol__help-wrapper">
<div class="fcontrol__help">EZID search uses AND logic which means ALL terms entered into a search box must be present in order to show up in the results.
<br/><a class="read-more-show hide" href="#">Read more &dArr;</a></div>
<div class="read-more-content">
</div>
<div>
<div class="fcontrol__help">&nbsp;&nbsp;&nbsp;&nbsp;&#8226; Example AND search: "trees fruit" will return any search results with both keywords trees and fruit.</div>
<div class="fcontrol__help">If you would like to use OR logic which means ANY terms entered in the search box can be present in the results, please add an "OR" to the search query.</div>
<div class="fcontrol__help">&nbsp;&nbsp;&nbsp;&nbsp;&#8226; Example OR search: "trees OR fruit" will return any search results with the keywords trees or fruit.
<br/><a class="read-more-hide hide" href="#">&uArr; Read less</a></div>
<div class="fcontrol__help">&nbsp;&nbsp;&nbsp;&nbsp;&#8226; Example OR search: "trees OR fruit" will return any search results with the keywords trees or fruit.</div>
</div>
</div>
21 changes: 12 additions & 9 deletions ui_tags/templatetags/manage_form_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,23 +183,27 @@ def data_row(


FUNCTIONS_FOR_FORMATTING = {
'datetime': lambda x, tp, href: datetime_disp(x, href),
'datetime': lambda x, tp: datetime_disp(x),
'identifier': lambda x, tp, href: identifier_disp(x, tp),
'string': lambda x, tp, href: string_value(x, href),
'string': lambda x, tp: string_value(x),
}


def formatted_field(record, field_name, field_display_types, testPrefixes, href):
value = record[field_name]
formatting = field_display_types[field_name]
return FUNCTIONS_FOR_FORMATTING[formatting](value, testPrefixes, href)
# only the identifier gets linked now
if formatting == 'identifier':
return FUNCTIONS_FOR_FORMATTING[formatting](value, testPrefixes, href)
else:
return FUNCTIONS_FOR_FORMATTING[formatting](value, testPrefixes)


def string_value(x, href):
def string_value(x):
if x is None or x.strip() == '':
return '&nbsp;'
else:
return href + django.utils.html.escape(x) + "</a>"
return django.utils.html.escape(x)


@register.simple_tag
Expand All @@ -222,15 +226,14 @@ def identifier_disp(x, testPrefixes):
)


def datetime_disp(x, href):
def datetime_disp(x):
return (
href
+ django.utils.html.escape(
django.utils.html.escape(
datetime.datetime.utcfromtimestamp(x).strftime(
django.conf.settings.TIME_FORMAT_UI_METADATA
)
)
+ " UTC</a>"
+ " UTC"
)


Expand Down
Loading