Skip to content

Commit

Permalink
Merge branch 'develop' into feature/text_annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderWatzinger committed Dec 6, 2024
2 parents 99fbfd6 + 2fca01c commit b7fdbe0
Show file tree
Hide file tree
Showing 12 changed files with 1,209 additions and 1,129 deletions.
13 changes: 9 additions & 4 deletions openatlas/display/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,15 @@ def add_data(self) -> None:
def add_tabs(self) -> None:
super().add_tabs()
entity = self.entity
for name in [
'actor', 'artifact', 'event', 'place', 'text', 'reference',
'file']:
self.tabs[name] = Tab(name, entity=entity)
for name, tooltip in {
'actor': _('mentioned in the source'),
'artifact': _('mentioned in the source'),
'event': _('mentioned in the source'),
'place': _('mentioned in the source'),
'text': _('mentioned in the source'),
'reference': '',
'file': ''}.items():
self.tabs[name] = Tab(name, entity=entity, tooltip=tooltip)
for text in entity.get_linked_entities('P73', types=True):
self.tabs['text'].table.rows.append([
link(text),
Expand Down
6 changes: 4 additions & 2 deletions openatlas/display/tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from openatlas.display.table import Table
from openatlas.display.util import (
button, check_iiif_activation, check_iiif_file_exist)
from openatlas.display.util2 import is_authorized, manual
from openatlas.display.util2 import is_authorized, manual, uc_first

if TYPE_CHECKING: # pragma: no cover
from openatlas.models.entity import Entity
Expand Down Expand Up @@ -44,7 +44,8 @@ def __init__(
table: Optional[Table] = None,
buttons: Optional[list[str]] = None,
entity: Optional[Entity] = None,
form: Optional[FlaskForm] = None) -> None:
form: Optional[FlaskForm] = None,
tooltip: Optional[str] = None) -> None:

self.name = name
self.content = content
Expand All @@ -53,6 +54,7 @@ def __init__(
self.table = table or Table()
self.set_table_headers(name, entity)
self.buttons: list[str] = buttons or [manual(f'entity/{name}')]
self.tooltip = uc_first(tooltip) if tooltip else ''
if is_authorized('contributor'):
self.set_buttons(name, entity)

Expand Down
4 changes: 3 additions & 1 deletion openatlas/templates/tabs.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
<li class="nav-item" role="presentation">
<a
class="fw-normal py-1 nav-link {% if loop.first %}active{% endif %}"
data-bs-toggle="tab"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="{{ tab.tooltip }}"
role="tab"
type="button"
aria-selected="{% if active %}true{% else %}false{% endif %}"
Expand Down
Loading

0 comments on commit b7fdbe0

Please sign in to comment.