Skip to content

Commit

Permalink
Merge branch 'develop' into feature/api/remodel_gis_queries
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardKoschicek committed Feb 18, 2025
2 parents 8de0daf + 79a957e commit dbe24d0
Show file tree
Hide file tree
Showing 30 changed files with 2,041 additions and 2,075 deletions.
28 changes: 17 additions & 11 deletions openatlas/api/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@
},
"/entity_presentation_view/{entityId}": {
"get": {
"tags": ["Proposal"],
"tags": [
"Proposal"
],
"description": "Retrieves an Entity with its linked data for presentation sites",
"parameters": [
{
Expand Down Expand Up @@ -2341,10 +2343,7 @@
"type",
"crmClass",
"systemClass",
"viewClass",
"properties",
"descriptions",
"geometry"
"viewClass"
],
"properties": {
"@id": {
Expand Down Expand Up @@ -4669,12 +4668,7 @@
"systemClass",
"title",
"description",
"geometries",
"when",
"types",
"externalReferenceSystems",
"files",
"relations"
"aliases"
],
"properties": {
"id": {
Expand All @@ -4696,6 +4690,7 @@
}
},
"geometries": {
"nullable": true,
"type": "object",
"required": [
"type",
Expand Down Expand Up @@ -4726,21 +4721,25 @@
}
},
"when": {
"nullable": true,
"$ref": "#/components/schemas/TimeRangeModel"
},
"types": {
"nullable": true,
"type": "array",
"items": {
"$ref": "#/components/schemas/EntityTypeModel"
}
},
"externalReferenceSystems": {
"nullable": true,
"type": "array",
"items": {
"$ref": "#/components/schemas/ExternalReferenceModel"
}
},
"files": {
"nullable": true,
"type": "array",
"items": {
"type": "object",
Expand All @@ -4759,6 +4758,7 @@
"type": "string"
},
"license": {
"nullable": true,
"type": "string"
},
"creator": {
Expand All @@ -4770,6 +4770,7 @@
"nullable": true
},
"publicShareable": {
"nullable": true,
"type": "boolean"
},
"mimetype": {
Expand Down Expand Up @@ -4987,6 +4988,7 @@
},
"EntityTypeModel": {
"type": "object",
"nullable": true,
"required": [
"id",
"title",
Expand All @@ -5007,6 +5009,7 @@
"type": "boolean"
},
"typeHierarchy": {
"nullable": true,
"type": "array",
"items": {
"$ref": "#/components/schemas/TypeHierarchyEntryModel"
Expand Down Expand Up @@ -5034,6 +5037,7 @@
}
},
"ExternalReferenceModel": {
"nullable": true,
"type": "object",
"required": [
"type",
Expand Down Expand Up @@ -5065,6 +5069,7 @@
}
},
"RelatedEntityModel": {
"nullable": true,
"type": "object",
"required": [
"id",
Expand Down Expand Up @@ -5120,6 +5125,7 @@
}
},
"RelationTypeModel": {
"nullable": true,
"type": "object",
"required": [
"property",
Expand Down
1 change: 1 addition & 0 deletions openatlas/display/classes_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ def add_tabs(self) -> None:
'artifact', 'reference', 'file']:
if entity.class_.name == 'group' or name != 'member':
self.tabs[name] = Tab(name, entity=entity)
self.tabs['member_of'].label = _('member of')
self.add_reference_tables_data()
self.event_links = \
entity.get_links(['P11', 'P14', 'P22', 'P23', 'P25'], True)
Expand Down
22 changes: 2 additions & 20 deletions openatlas/display/tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,13 @@
if TYPE_CHECKING: # pragma: no cover
from openatlas.models.entity import Entity

# Needed for translations of tab titles
_('bookmarks')
_('circular dependencies')
_('export')
_('invalid dates')
_('invalid link dates')
_('invalid involvement dates')
_('invalid preceding dates')
_('invalid sub dates')
_('member of')
_('missing files')
_('modules')
_('notes')
_('orphaned files')
_('orphaned iiif files')
_('orphaned subunits')
_('presentation site')
_('texts')
_('unlinked')


class Tab:

def __init__(
self,
name: str,
label: Optional[str] = None,
content: Optional[str] = None,
table: Optional[Table] = None,
buttons: Optional[list[str]] = None,
Expand All @@ -48,6 +29,7 @@ def __init__(
tooltip: Optional[str] = None) -> None:

self.name = name
self.label = uc_first(label or _(name))
self.content = content
self.entity = entity
self.form = form
Expand Down
16 changes: 11 additions & 5 deletions openatlas/display/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,22 @@ def bookmark_toggle(entity_id: int, for_table: bool = False) -> str:


@app.template_filter()
def display_menu(entity: Optional[Entity], origin: Optional[Entity]) -> str:
def menu(entity: Optional[Entity], origin: Optional[Entity]) -> str:
view_name = ''
if entity:
view_name = entity.class_.view
if origin:
view_name = origin.class_.view
html = ''
for item in [
'source', 'event', 'actor', 'place', 'artifact', 'reference',
'type', 'file']:
for item, label in {
'source': _('source'),
'event': _('event'),
'actor': _('actor'),
'place': _('place'),
'artifact': _('artifact'),
'reference': _('reference'),
'type': _('type'),
'file': _('file')}.items():
active = ''
request_parts = request.path.split('/')
if view_name == item \
Expand All @@ -225,7 +231,7 @@ def display_menu(entity: Optional[Entity], origin: Optional[Entity]) -> str:
and g.class_view_mapping[name] == item:
active = 'active'
html += link(
_(item),
label,
url_for(f'{item}_index') if item in ['file', 'type']
else url_for("index", view=item),
f'nav-item nav-link fw-bold uc-first {active}')
Expand Down
2 changes: 1 addition & 1 deletion openatlas/templates/admin/data.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ <h1 class="mb-1">{{ 'API'|uc_first }}</h1>
<div class="col-auto">{{ _('edit')|button(url_for('settings', category='api'))|safe }}</div>
{% endif %}
{% if 'admin'|is_authorized %}
<div class="col-auto">{{ _('api token')|button(url_for('api_token'))|safe }}</div>
<div class="col-auto">{{ _('token')|button(url_for('api_token'))|safe }}</div>
{% endif %}
</div>
{{ info|display_info|safe }}
Expand Down
2 changes: 1 addition & 1 deletion openatlas/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav me-auto mb-4 mb-md-0">
{% if current_user.is_authenticated %}
{{ entity|display_menu(origin=origin)|safe }}
{{ entity|menu(origin=origin)|safe }}
{% endif %}
</div>
<div class="navbar">
Expand Down
6 changes: 3 additions & 3 deletions openatlas/templates/tabs.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
title="{{ tab.tooltip }}"
data-bs-placement="top"
class="d-flex gap-1">
{{ _(tab.name|replace('_', ' '))|uc_first }}
{{ tab.label }}
{% if tab.table.rows|length %}
<span class="tab-counter badge align-self-center">{{
<span class="tab-counter badge align-self-center">{{
'{0:,}'.format(tab.table.rows|length) }}</span>
{% endif %}
</span>
Expand All @@ -39,7 +39,7 @@
{{ tab.content|safe }}
{% endif %}
{% if tab.form %}
{{ tab.form|display_form |safe }}
{{ tab.form|display_form|safe }}
{% endif %}
{% if tab.table.rows %}
{{ tab.table.display(tab.name)|safe }}
Expand Down
Loading

0 comments on commit dbe24d0

Please sign in to comment.