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

add title to truncated links #1505

Merged
merged 12 commits into from
Sep 13, 2024
3 changes: 3 additions & 0 deletions changes/1505.changes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- show title with truncated link text
- show title in breadcrumbs
- increase title length from ckan's default 80 to 150 before truncating
1 change: 1 addition & 0 deletions ckanext/canada/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,7 @@ def ckan_to_cdts_breadcrumbs(breadcrumb_content):
anchor = breadcrumb.find('a')
cdts_breadcrumbs.append({
'title': breadcrumb.text if not anchor else anchor.text,
'acronym': '' if not anchor else anchor.get('title'),
RabiaSajjad marked this conversation as resolved.
Show resolved Hide resolved
'href': '' if not anchor else anchor['href'],
})
return cdts_breadcrumbs
Expand Down
2 changes: 1 addition & 1 deletion ckanext/canada/templates/admin/trash.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<ul class="user-list list-group">
{% for pkg in g.deleted_packages %}
{% set title = pkg.title or pkg.name %}
<li class="list-group-item">{{ h.link_to(h.truncate(title, truncate_title), h.url_for(pkg.type + '.read', id=pkg.name)) }}</li>
<li class="list-group-item">{{ h.link_to(h.truncate(title, truncate_title), h.url_for(pkg.type + '.read', id=pkg.name), title=title) }}</li>
RabiaSajjad marked this conversation as resolved.
Show resolved Hide resolved
{% endfor %}
</ul>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{% set html_title = h.truncate(organization.description, length=80, whole_word=True) %}
{% endif %}
<dt style="width:auto;"><a href="{{ url }}" title="{{ html_title }}">
{{ h.truncate(h.split_piped_bilingual_field(organization.display_name, h.lang()), length=70, whole_word=True) }}</a>
{{ h.truncate(h.split_piped_bilingual_field(organization.display_name, h.lang()), length=80, whole_word=True) }}</a>
</dt>
<dd class="text-right">
{%- if organization.package_count -%}
Expand Down
3 changes: 1 addition & 2 deletions ckanext/canada/templates/package/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
{% set pkg_url = h.url_for(pkg.type ~ '.read', id=pkg.id if is_activity_archive else pkg.name, **({'activity_id': request.args['activity_id']} if 'activity_id' in request.args else {})) %}
{% if g.action != 'new' and pkg %}
{% set dataset = h.get_translated(pkg, 'title') %}
<li><a href="{{ pkg_url }}">{{ dataset|truncate(30) }}</a></li>
<li><a href="{{ pkg_url }}" title="{{ dataset }}">{{ dataset|truncate(30) }}</a></li>
RabiaSajjad marked this conversation as resolved.
Show resolved Hide resolved
{% endif %}
{% endblock %}

5 changes: 5 additions & 0 deletions ckanext/canada/templates/package/resource_read.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
{% endif %}
{% endblock %}

{% block breadcrumb_content %}
{{ super.super() }}
<li class="active"><a href="" title="{{ h.resource_display_name(res) }}">{{ h.resource_display_name(res)|truncate(30) }}</a></li>
RabiaSajjad marked this conversation as resolved.
Show resolved Hide resolved
{% endblock %}

{% block resource_actions %}
<div class="resource-actions-toolbar">{{ super() }}</div>
{% endblock %}
Expand Down
2 changes: 1 addition & 1 deletion ckanext/canada/templates/recombinant/resource_edit.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% ckan_extends %}

{% block organization_display %}
{{- h.split_piped_bilingual_field(org.title, h.lang()) | truncate(60) -}}
{{- h.split_piped_bilingual_field(org.title, h.lang()) | truncate(80) -}}
{% endblock %}

{%- block subtitle_2 -%}
Expand Down
2 changes: 1 addition & 1 deletion ckanext/canada/templates/snippets/package_item.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h3 class="panel-title">
{% block heading_private %}
{{ super() }}
{% endblock %}
{{ h.link_to(h.truncate(my_title, truncate_title), h.url_for(package.type ~ '.read', id=package.name)) }}
{{ h.link_to(h.truncate(my_title, 150), h.url_for(package.type ~ '.read', id=package.name), title=my_title) }}
{% block heading_meta %}
{{ super() }}
{% endblock %}
Expand Down
Loading