Skip to content
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
14 changes: 2 additions & 12 deletions ckanext/montreal_theme/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@

g = tk.g

def get_all_organizations(include_dataset_count=True):
'''Return a list of organizations that the current user has the specified
permission for.
'''
def get_all_organizations(include_dataset_count=False):
context = {'user': g.user}
data_dict = {
'include_dataset_count': include_dataset_count,
Expand All @@ -21,20 +18,13 @@ def get_all_organizations(include_dataset_count=True):


def get_latest_datasets():
'''Return a list of the latest datasets that the current user has the specified
permission for.
'''
context = {'user': g.user}
data_dict = {'sort': 'metadata_modified desc', 'rows': 4, 'include_private': True}

datasets = tk.get_action('package_search')(context, data_dict)
return datasets.get('results', [])


def get_all_groups(include_dataset_count=True):
'''Return a list of organizations that the current user has the specified
permission for.
'''
def get_all_groups(include_dataset_count=False):
context = {'user': g.user}
data_dict = {
'include_dataset_count': include_dataset_count,
Expand Down
15 changes: 8 additions & 7 deletions ckanext/montreal_theme/templates/home/layout4.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ <h1 class="text-center text-black font-normal text-4xl mb-8 px-8">{{_('Search fo
<div data-title="our-data">
<h2 class="text-4xl text-zambezi font-semibold"> {{ _('Our data') }}</h2>
</div>
{% set groups = h.all_groups() %}
<div data-title="collection-grid" class="flex w-full">
{% block featured_groups%}
{% snippet 'home/snippets/all_groups.html' %}
{% snippet 'home/snippets/all_groups.html', groups=groups %}
{% endblock %}
</div>

{% set groups = h.all_groups() %}
{% if groups|length > 0 %}
<div class="flex flex-col pt-6 pb-3 items-center">
<a class="view_all text-center bg-transparent mb-4 hover:bg-primary text-primary font-semibold hover:text-white py-2 px-4 border-1 border-gray-500 hover:border-transparent rounded-full" href="{{ h.url_for('group.index') }}"> {{_('View all')}}</a>
Expand Down Expand Up @@ -73,8 +73,9 @@ <h2 class="text-4xl text-zambezi font-semibold w-full">{{_('News')}}</h2>
<h2 class="text-4xl text-zambezi font-semibold w-full">{{_('Applications')}}</h2>
<div class="slick-showcase block flex w-full flex-row">
{% block applications %}
{% if h.get_showcases() %}
{% snippet 'home/snippets/showcase_list.html', showcases=h.get_showcases() %}
{% set showcases = h.get_showcases() %}
{% if showcases %}
{% snippet 'home/snippets/showcase_list.html', showcases=showcases %}
{% endif %}
</div>
<a href="{{ h.url_for('showcase_blueprint.index') }}" class="view_all text-center bg-transparent mb-4 hover:bg-primary text-primary font-semibold hover:text-white mt-4 py-2 px-4 border-1 border-gray-500 hover:border-transparent rounded-full">
Expand All @@ -87,13 +88,13 @@ <h2 class="text-4xl text-zambezi font-semibold w-full">{{_('Applications')}}</h2
{# <------------------ Organizations section ---------------> #}
<div class="flex flex-col items-center pt-16 pb-16">
<h2 class="text-4xl text-zambezi font-semibold w-full">{{_('Organizations')}}</h2>
{% set org = h.all_organizations() %}
<div data-title="collection-grid" class="flex w-full">
{% block featured_organization %}
{% snippet 'home/snippets/all_organizations.html' %}
{% snippet 'home/snippets/all_organizations.html', organizations=org %}
{% endblock %}
</div>

{% set org = h.all_organizations() %}

{% if org|length > 0 %}
<a class="view_all text-center bg-transparent mb-4 hover:bg-primary text-primary font-semibold hover:text-white mt-2 py-2 px-4 border-1 border-gray-500 hover:border-transparent rounded-full" href="{{ h.url_for('organization.index') }}"> {{_('View all')}}</a>
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

<ul class="flex-grow sm:flex flex-wrap sm:-mx-2 mt-gutter">
{% set all_groups = h.all_groups() %}
{% set all_groups = groups if groups is defined else h.all_groups() %}
{% for group in all_groups %}
<li class="sm:w-1/3 lg:w-1/3 p-2">
<a href="{{ h.url_for('group.read', id=group.id) }}" class="p-4 block bg-white rounded hover:border-1 hover:border-solid hover:border-transparent hover:bg-white hover:shadow-xl hover:text-primary" style="border:1px solid #CED4DA">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<ul class="flex-grow sm:flex flex-wrap sm:-mx-2 mt-gutter">
{% set organizations = h.all_organizations() %}
{% set organizations = organizations if organizations is defined else h.all_organizations() %}
{% for org in organizations[:3] %}
<li class="sm:w-1/3 lg:w-1/3 p-2">
<a href="{{ h.url_for('organization.read', id=org.id) }}" class="p-4 block bg-white rounded hover:border-1 hover:border-solid hover:border-transparent hover:bg-white hover:shadow-xl hover:text-primary" style="border:1px solid #CED4DA">
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion ckanext/montreal_theme/templates/snippets/facet_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h3 class="pb-4 font-semibold text-2xl text-gray-900">{{ title }}</h3>
{% for item in items %}
{% set href = h.remove_url_param(name, item.name, extras=extras, alternative_url=alternative_url) if item.active else h.add_url_param(new_params={name: item.name}, extras=extras, alternative_url=alternative_url) %}
{% set label = label_function(item) if label_function else item.display_name %}
{% set label_truncated = h.truncate(label, 22) if not label_function else label %}
{% set label_truncated = (label | truncate(22, killwords=True, end='...')) if not label_function else label %}
{% set count = count_label(item['count']) if count_label else ('%d' % item['count']) %}

<li class="search-facet flex justify-between items-center text-gray-900 group hover:bg-sarcelle-lightest cursor-pointer">
Expand Down
4 changes: 2 additions & 2 deletions ckanext/montreal_theme/templates/snippets/package_item.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ <h3 class="text-lg font-bold">
{% endblock %}
{% block heading_title %}
<a href="{{ h.url_for('%s.read' % package.type, id=package.name) }}" class="text-gray-900 hover:text-primary">
{{ h.truncate(title, truncate_title) }}
{{ title | truncate(truncate_title, killwords=True, end='...') }}
</a>
{% endblock %}
{% block heading_meta %}
Expand All @@ -66,7 +66,7 @@ <h3 class="text-lg font-bold">
<div class="w-full">
<div class="markdown-content leading-relaxed">
<p class="block"></p>
<p>{{ notes|urlize }}</p>
<p>{{ notes }}</p>
<p></p>
</div>
</div>
Expand Down
Loading