{{!
    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 block_deft/comments

    This template renders the view for the text task

    Example context (json):
    {
        "name": "Welcome",
        "comments": ""
    }
}}
{{# visible }}
    <h6>{{ name }}</h6>
    {{# expandcomments }}
        <div>
            {{ label }}
            {{# collapsible }}
            <a href="#" class="card-link float-right" data-action="collapse" title="{{# str }} collapse {{/ str }}"><i class="icon fa fa-chevron-down"></i></a>
            {{/ collapsible }}
            <a href="#" class="card-link float-right" data-action="addcomment" title="{{# str }} addcomment {{/ str }}"><i class="icon fa fa-plus"></i></a>
        </div>
        <div class="block_deft_comments p-2 expanded">
            {{# rawcomments }}
                {{# date }}
                    <div class="block_deft_comment_date card bg-light mt-3 text-muted text-center">{{date}}</div>
                {{/ date }}
                <div class="block_deft_comment card position-relative border border-secondary m-2 p-1" data-comment="{{ id }}">
                    <div class="card-content">
                        <span class="picture float-left">{{{ avatar }}}</span>
                        <div class="card-title">
                            <span class="name">{{ fullname }}</span>
                            <span class="time">{{ time }}</span>
                            {{# delete }}
                                <a href="#" class="card-link float-right" data-action="delete" title="{{# str }} delete {{/ str }}"><i class="icon fa fa-trash"></i></a>
                            {{/ delete }}
                        </div>
                        <div class="card-text">
                             {{{ content }}}
                        </div>
                    </div>
                </div>
            {{/ rawcomments }}
        </div>
    {{/ expandcomments }}
    {{^ expandcomments }}
        <div class="block_deft_comments p-2">
            {{ label }} ({{count }})
            <a href="#" class="card-link float-right" data-action="expand" title="{{# str }} expand {{/ str }}"><i class="icon fa fa-chevron-right"></i></a>
        </div>
    {{/ expandcomments }}
{{/ visible }}
