From b2e5117789e16eee6dacd060c892d9a0eadc76ca Mon Sep 17 00:00:00 2001 From: ducica Date: Sat, 16 Nov 2024 22:48:14 +0100 Subject: [PATCH 1/2] hidden admin from user menu --- .../forms/components/EDTFDatePickerField/utils.js | 10 +++++++--- .../oarepo_ui/themes/default/elements/header.overrides | 3 +++ oarepo_ui/views.py | 7 +++++++ 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 oarepo_ui/theme/assets/semantic-ui/less/oarepo_ui/themes/default/elements/header.overrides diff --git a/oarepo_ui/theme/assets/semantic-ui/js/oarepo_ui/forms/components/EDTFDatePickerField/utils.js b/oarepo_ui/theme/assets/semantic-ui/js/oarepo_ui/forms/components/EDTFDatePickerField/utils.js index 25044682..7f909295 100644 --- a/oarepo_ui/theme/assets/semantic-ui/js/oarepo_ui/forms/components/EDTFDatePickerField/utils.js +++ b/oarepo_ui/theme/assets/semantic-ui/js/oarepo_ui/forms/components/EDTFDatePickerField/utils.js @@ -9,20 +9,24 @@ export const edtfDateFormatOptions = [ { value: "yyyy-mm-dd", text: i18next.t("Year, month and date") }, ]; +const getPaddedYearString = (dateObj) => { + const year = dateObj.getFullYear(); + return _padStart(`${year}`, 4, "0"); +}; export const allEmptyStrings = (arr) => arr.every((element) => element === ""); export const serializeDate = (dateObj, dateEdtfFormat) => { if (dateObj === null) return ""; - if (dateEdtfFormat === "yyyy") return `${dateObj.getFullYear()}`; + if (dateEdtfFormat === "yyyy") return getPaddedYearString(dateObj); if (dateEdtfFormat === "yyyy-mm") - return `${dateObj.getFullYear()}-${_padStart( + return `${getPaddedYearString(dateObj)}-${_padStart( dateObj.getMonth() + 1, 2, "0" )}`; if (dateEdtfFormat === "yyyy-mm-dd") - return `${dateObj.getFullYear()}-${_padStart( + return `${getPaddedYearString(dateObj)}-${_padStart( dateObj.getMonth() + 1, 2, "0" diff --git a/oarepo_ui/theme/assets/semantic-ui/less/oarepo_ui/themes/default/elements/header.overrides b/oarepo_ui/theme/assets/semantic-ui/less/oarepo_ui/themes/default/elements/header.overrides new file mode 100644 index 00000000..35edbc7c --- /dev/null +++ b/oarepo_ui/theme/assets/semantic-ui/less/oarepo_ui/themes/default/elements/header.overrides @@ -0,0 +1,3 @@ +.ui.header { + word-break: break-word; +} diff --git a/oarepo_ui/views.py b/oarepo_ui/views.py index ddf43f85..2354aa30 100644 --- a/oarepo_ui/views.py +++ b/oarepo_ui/views.py @@ -1,11 +1,18 @@ from flask import Blueprint from invenio_base.utils import obj_or_import_string +from flask_menu import current_menu def create_blueprint(app): blueprint = Blueprint("oarepo_ui", __name__, template_folder="templates") blueprint.app_context_processor(lambda: ({"current_app": app})) + # hide the /admin (maximum recursion depth exceeded menu) + @blueprint.before_app_first_request + def init_menu(): + admin_menu = current_menu.submenu("settings.admin") + admin_menu.hide() + def add_jinja_filters(state): app = state.app ext = app.extensions["oarepo_ui"] From bf84237f37588b0172df07150d7c4dbd95dfd9e6 Mon Sep 17 00:00:00 2001 From: Miroslav Bauer Date: Mon, 18 Nov 2024 11:42:58 +0100 Subject: [PATCH 2/2] chore(release): release version 5.2.26 --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 3ff57a1e..06abe68e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = oarepo-ui -version = 5.2.25 +version = 5.2.26 description = UI module for invenio 3.5+ long_description = file: README.md long_description_content_type = text/markdown