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

hidden admin from user menu #256

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
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
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