{% macro column_input(column, value) %}
{% if column.isNotNull %}{% set req = 'required' %}{% endif %}
{% if column.isForeign %}
{% elseif column.type in ['text'] %}
{% elseif column.type in ['boolean'] %}
{% elseif column.type in ['date'] %}
{% elseif column.type in ['blob'] %}
{% else %}
{% endif %}
{% endmacro %}
{% macro linked_options(link) %}
{% for row in link.all %}
{% endfor %}
{% endmacro %}
{% macro column_show_plain(column, value) %}
{% if column.type in ['boolean'] %}
{% if value %}2713{% else %}2717{% endif %};
{% elseif column.type in ['datetime', 'datetimez'] %}
{{ value|date("M jS Y \\a\\t g:ia") }}
{% elseif column.type in ['date'] %}
{{ value|date("M jS Y") }}
{% elseif column.type in ['decimal', 'float', 'integer', 'smallint', 'bigint'] %}
{{ value|number_format }}
{% elseif column.type in ['time'] %}
{{ value|date("g:ia") }}
{% elseif column.type in ['text', 'string'] %}
{% set stripped_value = value|striptags %}
{% if stripped_value %}
{% if stripped_value|length > 32 %}
{{ stripped_value[:32] }}...
{% else %}
{{ stripped_value }}
{% endif %}
{% else %}
{% if value|length > 32 %}
{{ value[:32] }}...
{% else %}
{{ value }}
{% endif %}
{% endif %}
{% endif %}
{% endmacro %}
{% macro column_show(path, column, row, all_columns) %}
{% set value = row[column.name] %}
{% if column.isPrimary %}
Edit | Delete
{% elseif column.isForeign %}
{% if value %}
View
{% else %}
None
{% endif %}
{% else %}
{% if value == '' %}
Empty
{% else %}
{% if column.type in ['boolean'] %}
{{ _self.column_show_plain(column, value) }}
{% elseif column.type in ['blob'] %}
{% for c in all_columns if c.isPrimary %}
View
{% endfor %}
{% else %}
{{ _self.column_show_plain(column, value) }}
{% endif %}
{% endif %}
{% endif %}
{% endmacro %}
{% macro bytes_to_string(bytes) %}
{% set sizes = ['bytes', 'kilobytes', 'megabytes', 'gigabytes', 'terrabytes', 'petabytes'] %}
{% set factor = ((bytes|length - 1) / 3)|round(0, 'floor') %}
{{ (bytes / (1024 ** factor))|round }} {{ sizes[factor] }}
{% endmacro %}