Skip to content

Commit

Permalink
Adjust layout to utilize full width for content display. Show seconda…
Browse files Browse the repository at this point in the history
…ry panel only for dataset and filtering purposes.
  • Loading branch information
NTaherifar committed May 29, 2024
1 parent f6dc722 commit 1d27946
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ckan/src/ckanext-igsn-theme/ckanext/igsn_theme/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ def is_creating_or_editing_dataset():
return True
return False

def is_creating_or_editing_org():
"""Determine if the user is creating or editing an organization."""
current_path = toolkit.request.path
if (
current_path.startswith('/organization/request_join_collection') or
current_path.startswith('/organization/request_new_collection') or
current_path.startswith('/organization/new') or
current_path.startswith('/organization/edit') or
current_path.startswith('/organization/members') or
current_path.startswith('/organization/bulk_process') or
current_path == '/organization/'
):
return True
return False

def get_search_facets():
context = {'user': toolkit.c.user or toolkit.c.author}
data_dict = {
Expand Down Expand Up @@ -64,6 +79,7 @@ def get_helpers():
return {
"igsn_theme_hello": igsn_theme_hello,
"is_creating_or_editing_dataset" :is_creating_or_editing_dataset,
"is_creating_or_editing_org" : is_creating_or_editing_org,
'get_org_list': get_org_list,
'users_role_in_org': users_role_in_org,
"get_search_facets" : get_search_facets,
Expand Down
64 changes: 64 additions & 0 deletions ckan/src/ckanext-igsn-theme/ckanext/igsn_theme/templates/page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{% ckan_extends %}

{% set display_secondary = not (h.is_creating_or_editing_dataset() or h.is_creating_or_editing_org())%}

{% block secondary %}
{% if display_secondary %}
<aside class="secondary col-md-3">
{#
The secondary_content block can be used to add content to the
sidebar of the page. This is the main block that is likely to be
used within a template.

Example:

{% block secondary_content %}
<h2>A sidebar item</h2>
<p>Some content for the item</p>
{% endblock %}
#}
{% block secondary_content %}{% endblock %}
</aside>
{% endif %}
{% endblock %}

{% block primary %}
<div class="primary {% if not display_secondary %}col-md-12{% else %}col-md-9{% endif %} col-xs-12" role="main">
{#
The primary_content block can be used to add content to the page.
This is the main block that is likely to be used within a template.

Example:

{% block primary_content %}
<h1>My page content</h1>
<p>Some content for the page</p>
{% endblock %}
#}
{% block primary_content %}
<article class="module">
{% block page_header %}
<header class="module-content page-header">
{% if self.content_action() | trim %}
<div class="content_action">
{% block content_action %}{% endblock %}
</div>
{% endif %}
<ul class="nav nav-tabs">
{% block content_primary_nav %}{% endblock %}
</ul>
</header>
{% endblock %}
<div class="module-content">
{% if self.page_primary_action() | trim %}
<div class="page_primary_action">
{% block page_primary_action %}{% endblock %}
</div>
{% endif %}
{% block primary_content_inner %}
{% endblock %}
</div>
</article>
{% endblock %}
</div>
{% endblock %}

0 comments on commit 1d27946

Please sign in to comment.