Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#472] Unify the dataset searches to give consistent results text
Conflicts: ckan/templates/package/snippets/search_form.html trivial
- Loading branch information
Showing
3 changed files
with
35 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{# | ||
|
||
Displays a test for results of a search. | ||
|
||
query - The text that was searched for | ||
count - The number of results for the search | ||
type - Search result type (dataset, group, organization) | ||
|
||
Example: | ||
|
||
{% snippet 'snippets/search_result_text.html', query=query, count=count, type='dataset' %} | ||
|
||
#} | ||
{% if type == 'dataset' %} | ||
{% set text_query = ungettext('{number} dataset found for "{query}"', '{number} datasets found for "{query}"', count) %} | ||
{% set text_query_none = _('Sorry no datasets found for "{query}"') %} | ||
{% set text_no_query = ungettext('{number} dataset found', '{number} datasets found', count) %} | ||
{% set text_no_query_none = _('Sorry no datasets found') %} | ||
{%- endif -%} | ||
|
||
{% if query %} | ||
{%- if count -%} | ||
{{ text_query.format(number=count, query=query) }} | ||
{%- else -%} | ||
{{ text_query_none.format(query=query) }} | ||
{%- endif -%} | ||
{%- else -%} | ||
{%- if count -%} | ||
{{ text_no_query.format(number=count) }} | ||
{%- else -%} | ||
{{ text_no_query_none }} | ||
{%- endif -%} | ||
{%- endif -%} |