Skip to content

Commit

Permalink
Merge pull request #256 from oarepo/hiding-admin-from-user-menu
Browse files Browse the repository at this point in the history
hidden admin from user menu
  • Loading branch information
mirekys authored Nov 18, 2024
2 parents 6c573ca + bf84237 commit 2d97372
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.ui.header {
word-break: break-word;
}
7 changes: 7 additions & 0 deletions oarepo_ui/views.py
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 2d97372

Please sign in to comment.