Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pass config to deposit_create and deposit_edit #2889

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
10 changes: 8 additions & 2 deletions invenio_app_rdm/records_ui/views/deposits.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,14 @@ def deposit_create(community=None):
community_theme = community.get("theme", {})

community_use_jinja_header = bool(community_theme)

dashboard_uploads_route = current_app.config["APP_RDM_USER_DASHBOARD_ROUTES"][
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, thinking out loud, can we maybe pass down the dashboard routes object and just use the uploads subkey on the places that needed it? I am thinking e.g. you might need in some point to connect to /me/communities so it would be more flexible to have the information available. What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
dashboard_uploads_route = current_app.config["APP_RDM_USER_DASHBOARD_ROUTES"][
dashboard_routes = current_app.config["APP_RDM_USER_DASHBOARD_ROUTES"]

"uploads"
]
return render_community_theme_template(
current_app.config["APP_RDM_DEPOSIT_FORM_TEMPLATE"],
theme=community_theme,
forms_config=get_form_config(
dashboard_uploads_route=dashboard_uploads_route,
createUrl="/api/records",
quota=get_files_quota(),
hide_community_selection=community_use_jinja_header,
Expand Down Expand Up @@ -450,12 +453,15 @@ def deposit_edit(pid_value, draft=None, draft_files=None, files_locked=True):
# for unpublished records we fallback to the react component so users can change
# communities
community_use_jinja_header = bool(community_theme)

dashboard_uploads_route = current_app.config["APP_RDM_USER_DASHBOARD_ROUTES"][
"uploads"
]
return render_community_theme_template(
current_app.config["APP_RDM_DEPOSIT_FORM_TEMPLATE"],
theme=community_theme,
forms_config=get_form_config(
apiUrl=f"/api/records/{pid_value}/draft",
dashboard_uploads_route=dashboard_uploads_route,
# maybe quota should be serialized into the record e.g for admins
quota=get_files_quota(draft._record),
# hide react community component
Expand Down