Skip to content

Commit

Permalink
SQL for new bone class
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderWatzinger committed Jan 21, 2025
1 parent 6653282 commit efaead6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions install/upgrade/bones.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ BEGIN;

-- Feature: Bone inventory (#1473)

INSERT INTO model.openatlas_class (name, cidoc_class_code, alias_allowed, reference_system_allowed, new_types_allowed, write_access_group_name, layout_color, layout_icon, standard_type_id) VALUES
('bone', 'E20', false, true, true, 'contributor', NULL, 'mdi-map-marker', NULL);


INSERT INTO model.entity (cidoc_class_code, openatlas_class_name, name) VALUES
('E55', 'type_tools', 'Bone preservation'),
('E55', 'type_tools', '0%'),
Expand Down
9 changes: 5 additions & 4 deletions openatlas/views/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def bones(id_: int) -> str | Response:
_('bone inventory')])


@app.route('/tools/bones_update/<int:id_>/<category>')
@app.route('/tools/bones_update/<int:id_>/<category>', methods=['GET', 'POST'])
@required_group('contributor')
def bones_update(id_: int, category) -> str | Response:
entity = Entity.get_by_id(id_, types=True)
Expand All @@ -308,10 +308,11 @@ def bones_update(id_: int, category) -> str | Response:
'bones',
content=
Markup(f'<form method="post">{form.csrf_token}') +
bone_row(
bone_rows(
form,
category,
structure[category.replace('_', ' ')]) +
form.save +
Markup('</form>'),
buttons=[manual('tools/anthropological_analyses')])},
crumbs=tools_start_crumbs(entity) + [
Expand Down Expand Up @@ -360,7 +361,7 @@ def bone_fields_recursive(form, label, item, choices):
bone_fields_recursive(form, label, sub, choices)


def bone_row(
def bone_rows(
form: Any,
label: str,
item: dict[str, Any],
Expand All @@ -373,5 +374,5 @@ def bone_row(
html += Markup('</div>')
if 'subs' in item:
for label, sub in item['subs'].items():
html += bone_row(form, label, sub, offset + 0.5)
html += bone_rows(form, label, sub, offset + 0.5)
return html

0 comments on commit efaead6

Please sign in to comment.