+{% endmacro -%}
diff --git a/amt/site/templates/macros/cards.html.j2 b/amt/site/templates/macros/cards.html.j2
index 8a0b332d..4304df3d 100644
--- a/amt/site/templates/macros/cards.html.j2
+++ b/amt/site/templates/macros/cards.html.j2
@@ -1,71 +1,71 @@
{% from "macros/editable_macros.html.j2" import editable with context %}
{% macro render_include_path(path) -%}
- {{ path.urlpath.split("/")[-1] .split(".")[0] }}
+ {{ path.urlpath.split("/")[-1] .split(".")[0] }}
{%- endmacro %}
{% macro render_attribute(attribute) -%}
- {{ attribute.capitalize().replace("_", " ") }}
+ {{ attribute.capitalize().replace("_", " ") }}
{%- endmacro %}
{% macro render_value(key, value, depth, base_resource_path, path) -%}
- {% set has_permission = permission(permission_path, 'Update', permissions) %}
- {% if key is defined and key != "" %}
- {% set relative_resource_path = path + "/" + key %}
+ {% set has_permission = permission(permission_path, 'Update', permissions) %}
+ {% if key is defined and key != "" %}
+ {% set relative_resource_path = path + "/" + key %}
+ {% else %}
+ {% set relative_resource_path = path %}
+ {% endif %}
+ {% set full_resource_path = base_resource_path + relative_resource_path %}
+ {% if isinstance(value, 'IterMixin') or isinstance(value, 'dict') %}
+
+ {% if is_editable_resource(full_resource_path, editables) %}
+ {{ editable(algorithm, relative_resource_path, full_resource_path, None, has_permission) }}
+ {% else %}
+ {% if value.__class__.__name__ == 'dict' %}
+ {% set value = value.items() %}
+ {% endif %}
+ {% for subkey, subvalue in value %}
+ {{ render_attribute(subkey) }} :
+ {% if is_editable_resource(full_resource_path + "/" + subkey, editables) %}
+ {{ editable(algorithm, relative_resource_path + "/" + subkey, full_resource_path + "/" + subkey, None, has_permission) }}
+ {% else %}
+ {{ render_value(subkey, subvalue, depth+1, base_resource_path, path) }}
+ {% endif %}
+ {% if not loop.last %} {% endif %}
+ {% endfor %}
+ {% endif %}
+
+ {% elif isinstance(value, 'list') %}
+ {% if key == "assessments" %}
+
+ {% elif key == "models" %}
+ {% for model in value %}{{ model["name"] }}{% endfor %}
{% else %}
- {% set relative_resource_path = path %}
- {% endif %}
- {% set full_resource_path = base_resource_path + relative_resource_path %}
- {% if isinstance(value, 'IterMixin') or isinstance(value, 'dict') %}
-
- {% if is_editable_resource(full_resource_path, editables) %}
- {{ editable(algorithm, relative_resource_path, full_resource_path, None, has_permission) }}
- {% else %}
- {% if value.__class__.__name__ == 'dict' %}
- {% set value = value.items() %}
- {% endif %}
- {% for subkey, subvalue in value %}
-
{{ render_attribute(subkey) }} :
- {% if is_editable_resource(full_resource_path + "/" + subkey, editables) %}
- {{ editable(algorithm, relative_resource_path + "/" + subkey, full_resource_path + "/" + subkey, None, has_permission) }}
- {% else %}
- {{ render_value(subkey, subvalue, depth+1, base_resource_path, path) }}
- {% endif %}
- {% if not loop.last %}
{% endif %}
- {% endfor %}
- {% endif %}
+ {% if is_editable_resource(full_resource_path + "[*]", editables) %}
+
+ {% for item in value %}
+ {{ editable(algorithm, relative_resource_path + "[" + (loop.index-1) | string + "]", full_resource_path + "[" + (loop.index-1) | string + "]", None, has_permission) }}
+ {% endfor %}
- {% elif isinstance(value, 'list') %}
- {% if key == "assessments" %}
-
- {% elif key == "models" %}
- {% for model in value %}{{ model["name"] }}{% endfor %}
- {% else %}
- {% if is_editable_resource(full_resource_path + "[*]", editables) %}
-
- {% for item in value %}
- {{ editable(algorithm, relative_resource_path + "[" + (loop.index-1) | string + "]", full_resource_path + "[" + (loop.index-1) | string + "]", None, has_permission) }}
- {% endfor %}
-
- {% else %}
-
- {% for item in value %}
- {{ render_value("", item, depth+1, base_resource_path, path + "/" + key + "[" + (loop.index-1) |string + "]") }}
- {% endfor %}
-
- {% endif %}
- {% endif %}
+ {% else %}
+
+ {% for item in value %}
+ {{ render_value("", item, depth+1, base_resource_path, path + "/" + key + "[" + (loop.index-1) |string + "]") }}
+ {% endfor %}
+
+ {% endif %}
+ {% endif %}
+ {% else %}
+ {% if is_editable_resource(full_resource_path, editables) %}
+ {{ editable(algorithm, relative_resource_path, full_resource_path, None, has_permission) }}
{% else %}
- {% if is_editable_resource(full_resource_path, editables) %}
- {{ editable(algorithm, relative_resource_path, full_resource_path, None, has_permission) }}
- {% else %}
- {{ value }}
- {% endif %}
+ {{ value }}
{% endif %}
+ {% endif %}
{%- endmacro %}
diff --git a/amt/site/templates/macros/editable_macros.html.j2 b/amt/site/templates/macros/editable_macros.html.j2
index acf24d70..aca0cac3 100644
--- a/amt/site/templates/macros/editable_macros.html.j2
+++ b/amt/site/templates/macros/editable_macros.html.j2
@@ -1,259 +1,259 @@
{% macro render_attribute(attribute) -%}
- {{ attribute.capitalize().replace("_", " ") }}
+ {{ attribute.capitalize().replace("_", " ") }}
{%- endmacro %}
{% macro show_ai_act_button() %}
-
{% trans %}Find your AI Act profile{% endtrans %}
+
{% trans %}Find your AI Act profile{% endtrans %}
{% endmacro %}
{% macro editable_from_path(full_resource_path, context_variables, has_permission) %}
- {% set editable_object = resolve_editable_from_path(full_resource_path, context_variables, request) %}
- {{ editable(none, editable_object.relative_resource_path, editable_object.full_resource_path, editable_object, has_permission) }}
+ {% set editable_object = resolve_editable_from_path(full_resource_path, context_variables, request) %}
+ {{ editable(none, editable_object.relative_resource_path, editable_object.full_resource_path, editable_object, has_permission) }}
{% endmacro %}
{% macro editable(obj, relative_resource_path, full_resource_path, editable_object, has_permission) %}
- {% if is_parent_editable(editables, full_resource_path) %}
- {% if editable_object is none %}
- {% set editable_object = editables[replace_digits_in_brackets(full_resource_path)] %}
- {% endif %}
- {% if has_permission %}
-
- {% else %}
-
- {% endif %}
- {% if editable_object.children is not none and editable_object.children | length > 0 %}
- {% for child_editable in editable_object.children %}
- {{ render_attribute(child_editable.last_path_item() ) }} :
- {{ display_value(child_editable.last_path_item() , nested_value(obj, resolve_resource_list_path(full_resource_path, child_editable.relative_resource_path))) }}
- {% if not loop.last %} {% endif %}
- {% endfor %}
- {% else %}
- {{ nested_value(obj, relative_resource_path) | safe }}
- {% endif %}
- {% if has_permission %}{{ edit_link(base_href, full_resource_path) }}{% endif %}
-
- {% else %}
- {% if has_permission %}
-
- {% else %}
-
- {% endif %}
- {% if editable_object is not none %}
- {% set value = editable_object.value %}
- {% else %}
- {% set value = nested_value(obj, relative_resource_path) %}
- {% endif %}
- {% set key = relative_resource_path.split("/")[-1] %}
- {% if is_nested_enum(obj, relative_resource_path) %}
-
-
- {{ nested_enum_value(obj, relative_resource_path, language).display_value | safe }}
-
- {% if has_permission %}{{ edit_link(base_href, full_resource_path) }}{% endif %}
- {% else %}
- {{ display_value(key, value) }}
- {% if has_permission %}{{ edit_link(base_href, full_resource_path) }}{% endif %}
- {% endif %}
-
- {% endif %}
- {% endmacro %}
- {% macro display_value(key, value) %}
- {% if isinstance(value, 'WebFormOption') %}
- {% set value = value.display_value %}
- {% endif %}
- {% if key == "uri" or key == "link" or key == "upl" %}
-
{{ value }}
- {% elif key == "oin" %}
-
{{ value }}
- {% elif key == "email" %}
-
{{ value }}
- {% elif key == "urn" %}
-
{{ value }}
- {% elif value is string and value.startswith('http') %}
-
{{ value }}
- {% elif value is iterable and value is not string %}
- {{ value|join(", ") }}
- {% else %}
- {{ value }}
- {% endif %}
- {% endmacro %}
- {% macro edit_link(base_href, full_resource_path) %}
-
-
- {% trans %}Edit{% endtrans %}
-
+ {% if is_parent_editable(editables, full_resource_path) %}
+ {% if editable_object is none %}
+ {% set editable_object = editables[replace_digits_in_brackets(full_resource_path)] %}
+ {% endif %}
+ {% if has_permission %}
+
+ {% else %}
+
+ {% endif %}
+ {% if editable_object.children is not none and editable_object.children | length > 0 %}
+ {% for child_editable in editable_object.children %}
+ {{ render_attribute(child_editable.last_path_item()) }} :
+ {{ display_value(child_editable.last_path_item() , nested_value(obj, resolve_resource_list_path(full_resource_path, child_editable.relative_resource_path))) }}
+ {% if not loop.last %} {% endif %}
+ {% endfor %}
+ {% else %}
+ {{ nested_value(obj, relative_resource_path) | safe }}
+ {% endif %}
+ {% if has_permission %}{{ edit_link(base_href, full_resource_path) }}{% endif %}
+
+ {% else %}
+ {% if has_permission %}
+
+ {% else %}
+
+ {% endif %}
+ {% if editable_object is not none %}
+ {% set value = editable_object.value %}
+ {% else %}
+ {% set value = nested_value(obj, relative_resource_path) %}
+ {% endif %}
+ {% set key = relative_resource_path.split("/")[-1] %}
+ {% if is_nested_enum(obj, relative_resource_path) %}
+
+
+ {{ nested_enum_value(obj, relative_resource_path, language).display_value | safe }}
+
+ {% if has_permission %}{{ edit_link(base_href, full_resource_path) }}{% endif %}
+ {% else %}
+ {{ display_value(key, value) }}
+ {% if has_permission %}{{ edit_link(base_href, full_resource_path) }}{% endif %}
+ {% endif %}
+
+ {% endif %}
+{% endmacro %}
+{% macro display_value(key, value) %}
+ {% if isinstance(value, 'WebFormOption') %}
+ {% set value = value.display_value %}
+ {% endif %}
+ {% if key == "uri" or key == "link" or key == "upl" %}
+
{{ value }}
+ {% elif key == "oin" %}
+
{{ value }}
+ {% elif key == "email" %}
+
{{ value }}
+ {% elif key == "urn" %}
+
{{ value }}
+ {% elif value is string and value.startswith('http') %}
+
{{ value }}
+ {% elif value is iterable and value is not string %}
+ {{ value|join(", ") }}
+ {% else %}
+ {{ value }}
+ {% endif %}
+{% endmacro %}
+{% macro edit_link(base_href, full_resource_path) %}
+
+
+ {% trans %}Edit{% endtrans %}
+
{% endmacro %}
{% macro edit(editable_object) %}
-
-