Skip to content

Commit

Permalink
Merge branch 'develop' into feature/iiif-annotation-leaflet
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardKoschicek committed Dec 4, 2023
2 parents f04e193 + 8044818 commit d22d67d
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 28 deletions.
3 changes: 2 additions & 1 deletion openatlas/api/endpoints/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ class ClassMapping(Resource):
def get() -> Union[tuple[Resource, int], Response]:
return marshal([{
"systemClass": class_.name,
"crmClass": class_.cidoc_class.code if class_.cidoc_class else None,
"crmClass":
class_.cidoc_class.code if class_.cidoc_class else None,
"view": class_.view,
"standardTypeId": class_.standard_type_id,
"icon": class_.icon,
Expand Down
6 changes: 3 additions & 3 deletions openatlas/models/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import subprocess
from datetime import datetime
from pathlib import Path
from typing import Optional
from typing import Any, Optional

from openatlas import app

Expand All @@ -18,8 +18,8 @@ def current_date_for_filename() -> str:
def sql_export(format_: str, postfix: Optional[str] = '') -> bool:
file = app.config['EXPORT_PATH'] \
/ f'{current_date_for_filename()}_export{postfix}.{format_}'
command = ["pg_dump" if os.name == 'posix'
else Path(shutil.which("pg_dump.exe"))]
command: Any = [
"pg_dump" if os.name == 'posix' else Path(shutil.which("pg_dump.exe"))]
if format_ == 'dump':
command.append('-Fc')
command.extend([
Expand Down
20 changes: 0 additions & 20 deletions openatlas/templates/import/project_view.html

This file was deleted.

File renamed without changes.
34 changes: 30 additions & 4 deletions openatlas/views/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
from openatlas.display.table import Table
from openatlas.display.util import (
button, datetime64_to_timestamp, display_form, format_date,
get_backup_file_data, is_authorized, link, manual, required_group)
get_backup_file_data, is_authorized, link, manual, required_group,
button_bar, uc_first, description)
from openatlas.forms.field import SubmitField
from openatlas.models.entity import Entity
from openatlas.models.imports import Import, is_float
Expand Down Expand Up @@ -88,10 +89,35 @@ def import_project_insert() -> Union[str, Response]:
@required_group('contributor')
def import_project_view(id_: int) -> str:
project = Import.get_project_by_id(id_)
content = ''
if is_authorized('manager'):
content = button_bar([
manual('admin/import'),
button(
_('edit'),
url_for('import_project_update', id_=project.id)),
button(
_('delete'),
url_for('import_project_delete', id_=project.id),
onclick="return confirm('" +
_('delete %(name)s?', name=project.name.replace("'", "")) +
"')")])
content += '<p>' + uc_first(_('new import')) + ':</p>'
buttons = []
for class_ in \
['source'] \
+ g.view_class_mapping['event'] \
+ g.view_class_mapping['actor'] \
+ ['place', 'bibliography', 'edition']:
buttons.append(button(
_(class_),
url_for('import_data', project_id=project.id, class_=class_)))
content += button_bar(buttons)
content += description(project.description)
tabs = {
'info': Tab(
'info',
render_template('import/project_view.html', project=project)),
content=content),
'entities': Tab(
'entities',
table=Table(
Expand Down Expand Up @@ -282,7 +308,7 @@ def import_data(project_id: int, class_: str) -> str:
g.logger.log('error', 'import', 'import check failed', e)
flash(_('error at import'), 'error')
return render_template(
'import/import_data.html',
'import_data.html',
form=form,
messages=messages,
file_data=file_data,
Expand All @@ -307,7 +333,7 @@ def import_data(project_id: int, class_: str) -> str:
g.logger.log('error', 'import', 'import failed', e)
flash(_('error transaction'), 'error')
return render_template(
'import/import_data.html',
'import_data.html',
form=form,
file_data=file_data,
table=table,
Expand Down

0 comments on commit d22d67d

Please sign in to comment.