{{!
    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 format_onetopic/courseformat/content/cm/activityinline

    Display the activity content of a cm.

    Example context (json):
    {
        "cmname": {
            "displayvalue" : "<a class=\"aalink\" href=\"#\"><span class=\"instancename\">Activity example</span></a>"
        },
        "hasname": "true",
        "afterlink": "<span class=\"badge badge-primary\">30 unread messages</span>",
        "hasextras": true,
        "extras": ["<span class=\"badge badge-secondary\">[extras]</span>"],
        "activityinfo": {
            "hasmodavailability": true,
            "activityname": "Activity example",
            "hascompletion": true,
            "uservisible": true,
            "hasdates": true,
            "isautomatic": true,
            "istrackeduser": true,
            "activitydates": [
                {
                    "label": "Opens:",
                    "datestring": "6 April 2021, 6:46 PM"
                }
            ],
            "completiondetails": [
                {
                    "statuscomplete": 1,
                    "description": "Viewed"
                },
                {
                    "statusincomplete": 1,
                    "description": "Receive a grade"
                }
            ]
        },
        "modstealth": true
    }
}}
<span class="activity-basis">
    {{#cmname}}
        {{$ format_onetopic/courseformat/content/cm/cmnameinline }}
            {{> format_onetopic/courseformat/content/cm/cmnameinline }}
        {{/ format_onetopic/courseformat/content/cm/cmnameinline }}
    {{/cmname}}
    {{#afterlink}}
        <span class="afterlink">
            {{{afterlink}}}
        </span>
    {{/afterlink}}

    {{#showinlinehelp}}
        {{#activityinfo}}
            {{! Only show the icon if there is a name to display. }}
            {{#hasname}}
                <span class="iconwithhelp">
                    {{#pix}} e/help, core, {{#str}} info {{/str}} {{/pix}}
                    <span class="hidden iconwithhelp-content" {{#singlename}}data-title="{{singlename}}"{{/singlename}}>

                        {{$ format_onetopic/courseformat/content/cm/badgesinline }}
                            {{> format_onetopic/courseformat/content/cm/badgesinline }}
                        {{/ format_onetopic/courseformat/content/cm/badgesinline }}

                        {{#hascompletion}}
                            {{#showcompletionconditions}}
                                <span class="activity-info mt-1 mt-md-0">
                                    {{> format_onetopic/courseformat/content/cm/activity_infoinline}}
                                </span>
                            {{/showcompletionconditions}}
                        {{/hascompletion}}

                        <span class="description">
                            {{#hasdates}}
                            <span data-region="activity-dates" class="activity-dates-inline small course-description-item">
                                <span class="description-inner">
                                    {{#activitydates}}
                                        {{$format_onetopic/local/activity_dateinline}}
                                            {{>format_onetopic/local/activity_dateinline}}
                                        {{/format_onetopic/local/activity_dateinline}}
                                    {{/activitydates}}
                                </span>
                            </span>
                            {{/hasdates}}

                            {{#altcontent}}
                                <span class="activity-altcontent {{#hasname}}course-description-item small{{/hasname}}{{^hasname}}contentwithoutlink{{/hasname}} d-flex">
                                    <span class="flex-fill description-inner">
                                        <!--{{{altcontent}}}-->
                                    </span>
                                </span>
                            {{/altcontent}}
                            {{#modavailability}}
                                {{$ format_onetopic/courseformat/content/cm/availabilityinline }}
                                    {{> format_onetopic/courseformat/content/cm/availabilityinline }}
                                {{/ format_onetopic/courseformat/content/cm/availabilityinline }}
                            {{/modavailability}}
                        </span>

                    </span>
                </span>
            {{/hasname}}
        {{/activityinfo}}
    {{/showinlinehelp}}
</span>
