seitime-frappe/frappe/templates/includes/macros.html
Faris Ansari 6b282db8a0 fix: Web View Rendering
- Extract title from h1 if it doesn't contain jinja
- Add _context_dict to context to be able to inspect it in templates
- Add inspect macro to inspect any variable
- Better defaults for controller_row template

Co-Authored-By: Suraj Shetty <surajshetty3416@gmail.com>
2020-03-24 15:12:24 +05:30

25 lines
535 B
HTML

{% macro square_image_with_fallback(src=None, size=None, alt=None, class="") %}
{% if src %}
<img
{% if size %}
width="{{size}}"
height="{{size}}"
{% endif %}
{% if src %}
src="{{ src }}"
{% endif %}
class="{{ class }} "
alt="{{ alt or '' }}"
>
{% else %}
<div class="no-image bg-light {{ class }} " {% if size %}style="width: {{size}}; height: {{size}};"{% endif %}></div>
{% endif %}
{% endmacro %}
{%- macro inspect(var, render=True) -%}
{%- if render -%}
<pre>{{ var | pprint | e }}</pre>
{%- endif -%}
{%- endmacro %}