{% set isVideo = post.quickVideo and post.quickShowVideo and post.quickVideoHeight and post.quickVideoWidth %}
{% set image = post.quickImage ? post.quickImage : (post.image ? asset(post.image) : null) %}
{% set url = post.quickUrl %}
{% set title = post.title %}
{% set content = post.content|murph_url %}

{%- set content -%}
    {% if post.contentFormat == 'html' %}
        {{- post.content|murph_url|file_attributes|post -}}
    {% elseif post.contentFormat == 'markdown' %}
        {{- post.content|murph_url|file_attributes|markdown('post') -}}
    {% elseif post.contentFormat == 'editorjs' %}
        {{- post.content|murph_url|file_attributes|editorjs_to_html -}}
    {% endif %}
{%- endset -%}

{%- set more -%}
    {% if not full %}
        <p class="quick-more">
            <a href="{{ safe_path('blog_menu_post', {post: post.id, slug: post.slug, _domain: _domain}) }}">
                {{- 'Lien permanent' -}}
            </a>
        </p>
    {% endif %}
{%- endset -%}

{% if isVideo %}
    <div class="quick card shadow-md m-3 md:ml-0 md:mr-0 bg-box">
        <div class="card">
            <figure class="quick-video m-0">
                <div class="video-ratio" data-ratio="{{ post.quickVideoHeight * 100 / post.quickVideoWidth }}%">
                    <iframe src="{{ post.quickVideo }}" allowfullscreen></iframe>
                </div>
            </figure>

            <div class="quick-body card-body">
                <h2 class="h4 no-margin card-title">
                    <a href="{{ url }}" target="_blank">
                        {{- title -}}
                    </a>
                </h2>

                <p class="no-margin">
                    <a href="{{ url }}" target="_blank">{{ url }}</a>
                </p>

                {{- content|raw -}}
                {{- more|raw -}}
            </div>
        </div>
    </div>
{% elseif not image %}
    <div class="quick-body">
        <h2 class="h4 no-margin">
            <a href="{{ url }}" target="_blank">
                {{- title -}}
            </a>
        </h2>

        <p class="no-margin">
            <a href="{{ url }}" target="_blank">{{ url }}</a>
        </p>

        {{- content|raw -}}
        {{- more|raw -}}
    </div>
{% elseif image %}
    <div class="col-12">
        <div class="quick">
            <div class="ejs-link rounded-2xl shadow-md p-2 md:p-8 bg-box">
                <div class="ejs-link--anchor ejs-link--anchor--with-image">
                    <div class="ejs-link-content">
                        <div class="ejs-link-content--title">
                            <p class="no-margin"><a href="{{ url }}">{{- title -}}</a></p>
                        </div>
                        <div class="ejs-link-content--description">
                            {{- content|raw -}}
                        </div>
                    </div>
                    <div class="ejs-link--image rounded-full" style="background-image: url('{{ image }}'), url('{{ asset('build/images/quick-post-load2.png') }}')"></div>
                </div>
                {{- more|raw -}}
            </div>
        </div>
    </div>
{% endif %}
