{{=<% %>=}}
<%!
    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/mobile_comments

    This template renders the view for comments

    Example context (json):
    {
        "name": "Discuss",
        "blockid": 12,
        "rawcomments": [
            {
                "fullname": "Rodney Dangerfield",
                "content": "I get no respect",
                "time": "Tuesday, April 1"
            }
        ],
        "task": 13
    }
}}
%>
<ion-list>
    <ion-item>
        <ion-textarea
            expand="block" title="label"
            showError="true"
            autoGrow="true"
            rows="1"
            [(ngModel)]="CONTENT_OTHERDATA.content"
        >
        </ion-textarea>
        <ion-button
            core-site-plugins-call-ws
            name="core_comment_add_comments"
            [params]="{comments: [{
                contextlevel: 'block',
                instanceid: <% blockid %>,
                content: CONTENT_OTHERDATA.content,
                itemid: <% task %>,
                component: 'block_deft',
                area: 'task'
            }]}"
        >
           {{ 'plugin.block_deft.post' | translate }}
        </ion-button>
    </ion-item>
    <%# rawcomments %>
        <%# date %>
            <ion-item><% date %></ion-item>
        <%/ date %>
    <ion-item-sliding>
    <%# delete %>
        <ion-item-options side="end">
            <ion-item-option color="danger"
                core-site-plugins-call-ws
                name="core_comment_delete_comments"
                [params]="{comments: [<% id %>]}"
            >
                {{ 'plugin.block_deft.delete' | translate }}
            </ion-item-option>
        </ion-item-options>
    <%/ delete %>
    <ion-item-options side="start">
        <ion-item-option color="info" expandable>
            <div><% time %></div>
        </ion-item-option>
    </ion-item-options>
        <ion-item>
            <ion-label>
                <div><%{ avatar }%> <% fullname %></div>
                <div><%{ content }%></div>
            </ion-label>
        </ion-item>
    </ion-item-sliding>
    <%/ rawcomments %>
</ion-list>
