-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: create browse communities page
- Loading branch information
1 parent
285ebaa
commit f35ba2a
Showing
7 changed files
with
115 additions
and
2 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
...pp_rdm/communities_ui/templates/semantic-ui/invenio_communities/details/browse/index.html
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,34 @@ | ||
{# -*- coding: utf-8 -*- | ||
|
||
This file is part of Invenio. | ||
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. | ||
#} | ||
|
||
{% extends "invenio_communities/details/base.html" %} | ||
|
||
{% set active_community_header_menu_item= 'browse' %} | ||
{% set api_endpoint = community["links"]["subcommunities"] %} | ||
{% set pid_value = community["slug"] %} | ||
|
||
{%- block javascript %} | ||
{{ super() }} | ||
{{ webpack['invenio-communities-browse.js'] }} | ||
{%- endblock %} | ||
|
||
{%- block page_body %} | ||
{{ super() }} | ||
<div id='invenio-browse-config' data-api-endpoint='{{ api_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)}}"> | ||
{{ _('See all')}} | ||
</a> | ||
</div> | ||
<div class="ui divider hidden"></div> | ||
<div id="subcommunities"></div> | ||
</div> | ||
{%- endblock page_body %} |
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
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
29 changes: 29 additions & 0 deletions
29
invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/subcommunity/browse.js
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,29 @@ | ||
/* | ||
* This file is part of Invenio. | ||
* Copyright (C) 2016-2021 CERN. | ||
* Copyright (C) 2023 Northwestern University. | ||
* | ||
* 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. | ||
*/ | ||
|
||
import React from "react"; | ||
import ReactDOM from "react-dom"; | ||
import _get from "lodash/get"; | ||
|
||
import { CommunitiesCardGroup } from "@js/invenio_communities/community"; | ||
|
||
const subCommunitiesContainer = document.getElementById("subcommunities"); | ||
const domContainer = document.getElementById("invenio-browse-config"); | ||
const apiEndpoint = _get(domContainer.dataset, "apiEndpoint"); | ||
|
||
if (subCommunitiesContainer) { | ||
ReactDOM.render( | ||
<CommunitiesCardGroup | ||
fetchDataUrl={apiEndpoint} | ||
emptyMessage="There are no child communities." | ||
defaultLogo="/static/images/square-placeholder.png" | ||
/>, | ||
subCommunitiesContainer | ||
); | ||
} |
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