Skip to content

Commit

Permalink
ui: do not show view record button and set link and active item
Browse files Browse the repository at this point in the history
  • Loading branch information
rekt-hard committed Jul 17, 2024
1 parent 4085842 commit 533ed0d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{#
Copyright (C) 2020 CERN.
Copyright (C) 2020 Northwestern University.
Copyright (C) 2024 Graz University of Technology.

Invenio App RDM is free software; you can redistribute it and/or modify it
Invenio-Curations is free software; you can redistribute it and/or modify it
under the terms of the MIT License; see LICENSE file for more details.
#}
{%- set title = _("Requests") %}
Expand All @@ -16,15 +15,9 @@
{%- endblock javascript %}

{%- block user_dashboard_body %}
{% if has_permission %}

<div id="invenio-search-config"
data-invenio-search-config='{{ search_app_curations_requests_config(app_id="InvenioAppRdm.DashboardRequests") | tojson }}'>
</div>
{% else %}
<div>
403
</div>
{% endif %}

{%- endblock user_dashboard_body %}
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{# -*- coding: utf-8 -*-

This file is part of Invenio.
Copyright (C) 2016-2023 CERN.
Copyright (C) 2024 Graz University of Technology.

Invenio is free software; you can redistribute it and/or modify it
Invenio-Curations is free software; you can redistribute it and/or modify it
under the terms of the MIT License; see LICENSE file for more details.
#}

{#
Renders the request details page when publishing a draft and including it in a community.
Renders the rdm-curation request details page.
#}

{% extends "invenio_requests/details/index.html" %}

{% set active_dashboard_menu_item = 'curation-overview' %}
{% set is_curator = current_user.has_role(config["CURATIONS_MODERATION_ROLE"]) %}
{% set active_dashboard_menu_item = "curation-overview" if is_curator else "requests" %}

{%- block request_header %}
{% set back_button_url = url_for("invenio_curations.curation_requests_overview") %}

{% set back_button_url = url_for("invenio_curations.curation_requests_overview" if is_curator else "invenio_app_rdm_users.requests") %}
{% from "invenio_requests/macros/request_header.html" import inclusion_request_header %}
{{ inclusion_request_header(
request=invenio_request,
record=record,
accepted=request_is_accepted,
accepted=False,
back_button_url=back_button_url,
back_button_text=_("Back to requests")
) }}
Expand Down
6 changes: 4 additions & 2 deletions invenio_curations/views/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

"""Curations ui views module."""

from flask import Blueprint, g, render_template
from flask import Blueprint, abort, g, render_template
from flask_login import current_user
from invenio_users_resources.proxies import current_user_resources

Expand All @@ -26,6 +26,9 @@ def user_has_curations_management_role(identity):

def curation_requests_overview():
"""Display user dashboard page."""
if not user_has_curations_management_role(g.identity):
abort(403)

url = current_user_resources.users_service.links_item_tpl.expand(
g.identity, current_user
)["avatar"]
Expand All @@ -34,7 +37,6 @@ def curation_requests_overview():
"invenio_curations/overview.html",
searchbar_config=dict(searchUrl="/"),
user_avatar=url,
has_permission=user_has_curations_management_role(g.identity),
)


Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ packages = find:
python_requires = >=3.9
zip_safe = False
install_requires =
invenio-requests>=4.1.0,<5.0.0
invenio-drafts-resources>=3.0.0,<4.0.0
invenio-requests>=4.1.0,<5.0.0
[options.extras_require]
tests =
pytest-black-ng>=0.4.0
Expand Down

0 comments on commit 533ed0d

Please sign in to comment.