Skip to content

Commit

Permalink
Merge branch 'development' into development-keyword-selector
Browse files Browse the repository at this point in the history
  • Loading branch information
lwesterhof committed Jan 4, 2024
2 parents 1d6a3b2 + 3edfcc9 commit c6d5beb
Show file tree
Hide file tree
Showing 126 changed files with 14,768 additions and 4,171 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-push-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:

jobs:
push-image:
if: github.repository == 'utrechtuniversity/yoda-portal'
runs-on: ubuntu-22.04
permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/javascript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 17
node-version: 18

- name: Install standard
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8==6.0.0 flake8-import-order==0.18.2 darglint==1.8.1 codespell mypy types-requests
python -m pip install flake8==6.0.0 flake8-import-order==0.18.2 darglint==1.8.1 codespell mypy types-requests werkzeug
- name: Lint with flake8
run: |
Expand Down
34 changes: 10 additions & 24 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from search.search import search_bp
from stats.stats import stats_bp
from user.user import user_bp
from util import get_validated_static_path
from vault.vault import vault_bp


Expand Down Expand Up @@ -105,7 +106,7 @@


@app.before_request
def static_loader() -> Response:
def static_loader() -> Optional[Response]:
"""
Static files handling - recognisable through '/assets/'
Override requested static file if present in user_static_area
Expand All @@ -122,29 +123,14 @@ def static_loader() -> Response:
:returns: Static file
"""
if '/assets/' in request.full_path:
user_static_area = path.join(app.config.get('YODA_THEME_PATH'), app.config.get('YODA_THEME'))
asset_dir, asset_name = path.split(request.path)
parts = request.full_path.split('/')

if parts[1] == 'assets':
# Main assets
static_dir = asset_dir.replace('/assets', user_static_area + '/static')
user_static_filename = path.join(static_dir, asset_name)
if not path.exists(user_static_filename):
static_dir = asset_dir.replace('/assets', '/var/www/yoda/static')
else:
# Module specific assets
module = parts[1]
specific_file_location = asset_dir.replace('/' + module + '/assets/', '')
module_static_area = path.join(module, 'static', module)
user_static_filename = path.join(user_static_area, module_static_area, specific_file_location, asset_name)

if path.exists(user_static_filename):
static_dir = path.join(user_static_area, module_static_area, specific_file_location)
else:
static_dir = asset_dir.replace('/' + module + '/assets', '/var/www/yoda/' + module_static_area)

result = get_validated_static_path(
request.full_path,
request.path,
app.config.get('YODA_THEME_PATH'),
app.config.get('YODA_THEME')
)
if result is not None:
static_dir, asset_name = result
return send_from_directory(static_dir, asset_name)


Expand Down
6 changes: 3 additions & 3 deletions deposit/metadata-form/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion deposit/metadata-form/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ let schema = {};
let uiSchema = {};
let yodaFormData = {};

let validator;
let formProperties;

let saving = false;
let back = false;

let form = document.getElementById('form');

const validator = customizeValidator({ AjvClass: Ajv2019, ajvOptionsOverrides: {verbose: true, addUsedSchema: false } });
const validatorAjvDraft7 = customizeValidator({ ajvOptionsOverrides: {verbose: true, addUsedSchema: false } });
const validatorAjv2019 = customizeValidator({ AjvClass: Ajv2019, ajvOptionsOverrides: {verbose: true, addUsedSchema: false } });

const enumWidget = (props) => {
let enumArray = props['schema']['enum'];
Expand Down Expand Up @@ -685,6 +687,13 @@ function loadForm() {
}

} else {
// Select validator based on schema.
if (schema.$schema == "http://json-schema.org/draft-07/schema") {
validator = validatorAjvDraft7
} else {
validator = validatorAjv2019
}

// Metadata present or user has write access, load the form.
if (!formProperties.data.can_edit)
uiSchema['ui:readonly'] = true;
Expand Down
2 changes: 1 addition & 1 deletion deposit/static/deposit/js/metadata-form.js

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions general/templates/general/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@
</head>

<body class="d-flex flex-column min-vh-100">
{% if config.get('YODA_ENVIRONMENT') != "production" %}{% include 'environment.html' %}{% endif %}
<header class="py-3">
<div class="container">
<div class="row">
<div class="col-md-2">
<a href="{{ url_for('general_bp.index') }}" class="logo mb-lg-0 me-lg-auto text-dark text-decoration-none"></a>
</div>
<div class="col-md-4 offset-md-4">
<div class="col"></div>
<div class="col-md-5">
{% if g.user and request.path != "/open_search/" and request.path != "/search/" %}
{% if config.get('OPEN_SEARCH_ENABLED') %}
<form class="mt-2 mb-lg-0 me-3" action="{{ url_for('open_search_bp.index') }}" method="get">
Expand Down Expand Up @@ -91,7 +93,7 @@
{% endif %}
{% endif %}
</div>
<div class="col-2 mt-2 text-end">
<div class="col-md-auto mt-2 text-end">
{% include 'user.html' %}
</div>
</div>
Expand Down
7 changes: 7 additions & 0 deletions general/templates/general/environment.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% if config.get('YODA_ENVIRONMENT') == "development" %}
<div class="non-production sticky-top text-bg-danger text-center fw-bold lh-1 p-1">This is a development environment!</div>
{% elif config.get('YODA_ENVIRONMENT') == "testing" %}
<div class="non-production sticky-top text-bg-warning text-center fw-bold lh-1 p-1">This is a testing environment!</div>
{% elif config.get('YODA_ENVIRONMENT') == "acceptance" %}
<div class="non-production sticky-top text-bg-success text-center fw-bold lh-1 p-1">This is an acceptance environment!</div>
{% endif %}
2 changes: 1 addition & 1 deletion group_manager/static/group_manager/css/group_manager.css
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
}

.table-striped tbody tr.active td {
background-color: #ffcd00;
background-color: var(--bs-primary);
}

.placeholder-text {
Expand Down
Loading

0 comments on commit c6d5beb

Please sign in to comment.