{{!
    This file is part of Moodle - http://moodle.org/

    Moodle is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Moodle is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
}}
{{!
    @template contenttype_repurpose/media

    This template renders the link for question preview and adds listener

    Example context (json):
    {
        "path": "/contenttype_repurpose/content/530/content/image/image-238972974911.png",
        "title": "Cows"
    }
}}
<div class="row">
{{# path }}
<div class="col col-md-3">
    <div class="card">
        <img class="card-img-top" src="@@PLUGINFILE@@/content/{{ path }}" alt="{{ title }}">
        <div class="card-body">
            <h5 class="card-title">{{ title }}</h5>
            <a href="#" data-action="edit"><i class="icon fa fa-cog"></i></a>
            <a href="#" data-action="delete"><i class="icon fa fa-trash"></i></a>
        </div>
    </div>
</div>
{{/ path }}
{{# media }}
<div class="col col-md-3">
    <div class="card">
        {{# image }}
            <img class="card-img-top" src="@@PLUGINFILE@@/content/{{ params.file.path }}" alt="{{ metadata.title }}">
        {{/ image }}
        {{# audio }}
            <audio controls class="card-img-top">
                 {{# params.files }}
                 <source src="@@PLUGINFILE@@/content/{{ path }}" type="{{ mime }}" alt="{{ metadata.title }}">
                 {{/ params.files }}
            </audio>
        {{/ audio }}
        {{# video }}
            <video controls class="card-img-top">
                 {{# params.sources }}
                 <source src="@@PLUGINFILE@@/content/{{ path }}" type="{{ mime }}" alt="{{ metadata.title }}">
                 {{/ params.sources }}
            </video>
        {{/ video }}
        <div class="card-body">
            <h5 class="card-title">{{ metadata.title }}</h5>
            <a href="#" data-action="edit"><i class="icon fa fa-cog"></i></a>
            <a href="#" data-action="delete"><i class="icon fa fa-trash"></i></a>
            {{^ first }}<a href="#" data-action="left"><i class="icon fa fa-arrow-left"></i></a>{{/ first }}
            {{^ last }}<a href="#" data-action="right"><i class="icon fa fa-arrow-right"></i></a>{{/ last }}
        </div>
    </div>
</div>
{{/ media }}
</div>
