Skip to content

Commit

Permalink
overridableRegistry: add global mapping for overriden components
Browse files Browse the repository at this point in the history
  • Loading branch information
jrcastro2 committed Jan 20, 2023
1 parent 73acb68 commit 60d2752
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 12 deletions.
2 changes: 1 addition & 1 deletion invenio_app_rdm/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def _(x):
APP_THEME = ["semantic-ui"]
"""Application theme."""

BASE_TEMPLATE = "invenio_theme/page.html"
BASE_TEMPLATE = "invenio_app_rdm/page.html"
"""Global base template."""

COVER_TEMPLATE = "invenio_theme/page_cover.html"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import ReactDOM from "react-dom";
import { getInputFromDOM } from "react-invenio-deposit";
import { RDMDepositForm } from "./RDMDepositForm";
import { OverridableContext } from "react-overridable";
import { overriddenComponents } from "./override";

import { overridableRegistry } from "react-invenio-forms";

const overriddenComponents = overridableRegistry.getComponents();

ReactDOM.render(
<OverridableContext.Provider value={overriddenComponents}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import React from "react";
import ReactDOM from "react-dom";
import RecordsList from "./RecordsList";
import { OverridableContext } from "react-overridable";
import { overriddenComponents } from "./override";

import { overridableRegistry } from "react-invenio-forms";

const overriddenComponents = overridableRegistry.getComponents();
const recordsListContainer = document.getElementById("records-list");
const title = recordsListContainer.dataset.title;
const fetchUrl = recordsListContainer.dataset.fetchUrl;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This file is part of InvenioRDM
// Copyright (C) 2023 CERN.
//
// Invenio App RDM 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 { overridenComponents } from "./mapping";

import { overridableRegistry } from "react-invenio-forms";

overridableRegistry.addComponents(overridenComponents);
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file is part of InvenioRDM
// Copyright (C) 2022 CERN.
// Copyright (C) 2023 CERN.
//
// Invenio App RDM is free software; you can redistribute it and/or modify it
// under the terms of the MIT License; see LICENSE file for more details.

export const overriddenComponents = {};
export const overridenComponents = {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{#
Copyright (C) 2023 CERN.

Invenio App RDM 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_theme/page.html" %}

{%- block body %}
{{ super() }}

{%- block javascript %}
{{ super() }}
{{ webpack['overridable-registry.js'] }}
{%- endblock javascript %}

{%- endblock body %}
1 change: 1 addition & 0 deletions invenio_app_rdm/theme/webpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"base-theme-rdm": "./js/invenio_app_rdm/theme.js",
"iiif-simple-previewer": "./less/invenio_app_rdm/previewer/iiif_simple.less",
"invenio-app-rdm-frontpage": "./js/invenio_app_rdm/frontpage/index.js",
"overridable-registry": "./js/invenio_app_rdm/overridableRegistry/index.js",
},
dependencies={
"@babel/runtime": "^7.9.0",
Expand Down

0 comments on commit 60d2752

Please sign in to comment.