{{!
    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/>.
}}
{{!
    @copyright Copyright (c) 2017 Open LMS

    @template theme_snap/course_cards

    Course cards template

    Context variables required for this template:
    * published - visible to students
    * courseid - id of the course
    * categoryid - id of the category that contains the course 
    * model - 
    * archived - course close date has passed
    * toggletitle - hover text on favorite toggle
    * favorited - is the course pinned to the top of the list
    * url - course url
    * fullname - course fullname
    * feedback - is the course pinned to the top of the list

    Example context (json):
    {
        "published": true,
        "courseid": "160",
        "categoryid": "2",
        "settings": "RAW HTML",
        "archived": false,
        "toggletitle": "Favorite",
        "favorited": true,
        "url": "/",
        "fullname": "Course 101"
    }
}}
<div data-hidden="{{^published}}true{{/published}}{{#published}}false{{/published}}" data-courseid="{{courseid}}" data-category="{{category}}" data-model="{{model}}" data-href="{{{url}}}" data-shortname="{{shortname}}" class="coursecard{{#favorited}} favorited{{/favorited}}" style="{{imagecss}}" tabindex="-1"{{#lazyloadimageurl}} data-image-url="{{.}}"{{/lazyloadimageurl}}>
    {{^archived}}
    <button class="snap-icon-toggle favoritetoggle" title="{{toggletitle}}" aria-pressed="{{#favorited}}true{{/favorited}}{{^favorited}}false{{/favorited}}"></button>
    {{/archived}}
    <div class="coursecard-body">
        <h3><a class="coursecard-coursename" href="{{{url}}}">{{{fullname}}}</a></h3>
        <div class="coursecard-dynamicinfo">
            {{#feedback.coursegrade.value}}
                    <div class="coursegrade">{{#str}}coursegrade, theme_snap{{/str}} <a href="{{feedbackurl}}">{{feedback.coursegrade.value}}</a></div>
            {{/feedback.coursegrade.value}}
            {{#completion.render}}
            <div class="completionstatus outoftotal">{{#str}}progresstotal, completion, {"complete":{{completion.complete}},"total":{{completion.total}} }{{/str}}<span class="float-right">{{completion.progress}}%</span></div>
            <div class="completion-line" style="width:{{completion.progress}}%"></div>
            {{/completion.render}}
        </div>
        {{^published}}
        <small class="published-status text-warning">
            {{# str }} notpublished, theme_snap {{/ str }}
        </small>
        {{/published}}
        <div class="coursecard-contacts">
            <h4 class="sr-only">{{#str}}coursecontacts, theme_snap{{/str}}</h4>
            {{#visibleavatars}}
                {{{.}}}
            {{/visibleavatars}}
            {{#showextralink}}
                <a data-toggle="collapse" class="coursecard-contacts-more" aria-expanded="false" href="#coursecard-contacts-{{courseid}}"  aria-controls="coursecard-contacts-{{courseid}}" href="#">{{hiddenavatarcount}}<span class="sr-only"> {{#str}}more, theme_snap{{/str}}</span></a>
                    <div class="collapse" id="coursecard-contacts-{{courseid}}">
                        {{#hiddenavatars}}
                            {{{.}}}
                        {{/hiddenavatars}}
                    </div>
            {{/showextralink}}
        </div>
    </div>
</div>
