Skip to content

Commit

Permalink
refactor: improve specificity of variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
carlinmack committed Sep 26, 2024
1 parent 38d5a61 commit ff88956
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
{% extends "invenio_communities/details/base.html" %}

{% set active_community_header_menu_item= 'browse' %}
{% set api_endpoint = community["links"]["subcommunities"] %}
{% set pid_value = community["slug"] %}
{% set subcommunities_endpoint = community["links"]["subcommunities"] %}
{% set community_slug = community["slug"] %}

{%- block javascript %}
{{ super() }}
Expand All @@ -20,15 +20,15 @@

{%- block page_body %}
{{ super() }}
<div id='invenio-browse-config' data-api-endpoint='{{ api_endpoint }}'
<div id='invenio-browse-config' data-api-endpoint='{{ subcommunities_endpoint }}'
class="ui container communities-frontpage rel-mt-3 rel-mb-2">
<div class="flex">
<h2 class="ui header mb-0 align-self-center">{{ _('Subcommunities') }}</h2>
<a class="align-self-center rel-ml-1" href="{{url_for('invenio_communities.communities_subcommunities', pid_value=pid_value)}}">
<a class="align-self-center rel-ml-1" href="{{url_for('invenio_communities.communities_subcommunities', pid_value=community_slug)}}">
{{ _('See all')}}
</a>
</div>
<div class="ui divider hidden"></div>
<div id="subcommunities"></div>
<div id="subcommunities-container"></div>
</div>
{%- endblock page_body %}
6 changes: 2 additions & 4 deletions invenio_app_rdm/communities_ui/views/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,9 @@ def record_permission_denied_error(error):

def _show_browse_page():
"""Whether the browse page should be visible in the menu."""
community = request.community # will also be conditioned on collections, etc
conf = current_app.config
return (
conf.get("COMMUNITIES_SHOW_BROWSE_MENU_ENTRY", False)
and community["children"]["allow"]
current_app.config.get("COMMUNITIES_SHOW_BROWSE_MENU_ENTRY", False)
and request.community["children"]["allow"]
)


Expand Down
2 changes: 1 addition & 1 deletion invenio_app_rdm/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ def github_link_render(record):
"""Community requests search configuration (i.e list of community requests)"""

COMMUNITIES_SHOW_BROWSE_MENU_ENTRY = False
"""Whether the browse menu item is enabled for communities"""
"""Toggle to show or hide the 'Browse' menu entry for communities."""

# Invenio-RDM-Records
# ===================
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
* This file is part of Invenio.
* Copyright (C) 2016-2021 CERN.
* Copyright (C) 2023 Northwestern University.
* Copyright (C) 2024 CERN.
*
* Invenio is free software; you can redistribute it and/or modify it
* under the terms of the MIT License; see LICENSE file for more details.
Expand All @@ -13,7 +12,7 @@ import _get from "lodash/get";

import { CommunitiesCardGroup } from "@js/invenio_communities/community";

const subCommunitiesContainer = document.getElementById("subcommunities");
const subCommunitiesContainer = document.getElementById("subcommunities-container");
const domContainer = document.getElementById("invenio-browse-config");
const apiEndpoint = _get(domContainer.dataset, "apiEndpoint");

Expand Down

0 comments on commit ff88956

Please sign in to comment.