oshipka/vm_gen/templates/html/_get.html

56 lines
3.0 KiB
HTML
Raw Permalink Normal View History

2020-06-07 13:13:14 +02:00
[%- for column in columns %]
2023-07-22 12:05:11 +02:00
{% if has_permission("[[ name|camel_to_snake ]]", "[[ column.name ]].read", instance, object_prefix="columns", action_prefix="column") %}
{% if "[[ column.name ]]" not in skip_list %}
2021-05-08 14:14:54 +02:00
<li id="display-[[ name|camel_to_snake ]]-[[ column.name ]]"><strong>[%- if column.type in ['relationship'] and column.multiple %]{{ _("[[ column.name|pluralize ]]") }}[%- else %]{{ _("[[ column.name ]]") }}[%- endif %]</strong>:
[%- if not column.type in ['bool', 'boolean', ] %]
[%- if column.type in ['relationship'] and column.multiple %]
{% if not instance.[[ column.name|pluralize ]] %}{% else %}
[%- else %]
{% if not instance.[[ column.name ]] %}{% else %}
[%- endif %]
[%- endif %]
2021-05-08 12:24:13 +02:00
[%- if column.type in ['picture', 'image', 'img'] %]
2021-05-09 21:34:11 +02:00
<img src="{{ url_for('oshipka_bp.get_media', model_name='[[ name|camel_to_snake ]]', instance_id=instance.id, column='[[ column.name ]]', filepath=instance.[[ column.name ]]) }}" id="display-[[ name|camel_to_snake ]]-[[ column.name ]]" />
2021-05-08 12:24:13 +02:00
[%- elif column.type in ['video'] %]
2021-05-09 21:34:11 +02:00
<video src="{{ url_for('oshipka_bp.get_media', model_name='[[ name|camel_to_snake ]]', instance_id=instance.id, column='[[ column.name ]]', filepath=instance.[[ column.name ]]) }}" controls class="video-inline" id="display-[[ name|camel_to_snake ]]-[[ column.name ]]">
<source src="{{ url_for('oshipka_bp.get_media', model_name='[[ name|camel_to_snake ]]', instance_id=instance.id, column='[[ column.name ]]', filepath=instance.[[ column.name ]]) }}" type="video/mp4">
<source src="{{ url_for('oshipka_bp.get_media', model_name='[[ name|camel_to_snake ]]', instance_id=instance.id, column='[[ column.name ]]', filepath=instance.[[ column.name ]]) }}" type="video/webm">
</video>
2021-05-01 16:21:39 +02:00
[%- elif column.type in ['audio'] %]
2021-05-09 21:34:11 +02:00
<audio src="{{ url_for('oshipka_bp.get_media', model_name='[[ name|camel_to_snake ]]', instance_id=instance.id, column='[[ column.name ]]', filepath=instance.[[ column.name ]]) }}" controls id="display-[[ name|camel_to_snake ]]-[[ column.name ]]"></audio>
[%- elif column.type in ['relationship'] %]
[%- if column.multiple %]
2021-05-08 14:14:54 +02:00
<ul>
{% for instance in instance.[[ column.name|pluralize ]] %}
{% include "[[ column.name|camel_to_snake ]]/_list_item.html" %}
{% endfor %}
</ul>
[%- else %]
2021-05-08 12:24:13 +02:00
{{ instance.[[ column.name ]] }}
[%- endif %]
2020-06-08 16:32:39 +02:00
[%- elif column.type in ['bool', 'boolean', ] %]
2021-05-08 12:24:13 +02:00
{{ instance.[[ column.name ]]|bool }}
2020-06-07 13:13:14 +02:00
[%- else %]
2021-05-08 12:24:13 +02:00
{{ instance.[[ column.name ]] }}
2020-06-07 13:13:14 +02:00
[%- endif %]
2021-05-08 12:24:13 +02:00
</li>
{% endif %}
2021-05-08 14:14:54 +02:00
[%- if not column.type in ['bool', 'boolean', ] %]
{% endif %}
[%- endif %]
2021-05-08 20:53:50 +02:00
{% endif %}
2021-05-08 14:14:54 +02:00
[%- endfor %]
[%- for backref in backrefs %]
<li id="display-[[ backref.name ]]"><strong>{{ _("[[ backref.name ]]") }}</strong>:
<ul>
{% set ex_instance = instance %}
{% for tmp_instance in ex_instance.[[ backref.name ]] %}
[%- if backref.resolve %]
{% set instance = tmp_instance[[ backref.resolve ]] %}
[%- else %]
{% set instance = tmp_instance %}
[%- endif %]
{% include "[[ backref.model ]]/_list_item.html" %}
{% endfor %}
</ul>
2020-06-07 13:13:14 +02:00
[%- endfor %]