Proyectos de Subversion Moodle

Rev

Autoría | Ultima modificación | Ver Log |

{{!
    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 unilabeltype_courseteaser/carousel
    Template to show a bootstrap modal dialog.

    Example context (json):
    {
        "showintro": false,
        "intro": "",
        "interval": "5",
        "height": 300,
        "fontawesomeprev": "fa-solid fa-forward",
        "fontawesomenext": "fa-solid fa-forward",
        "items": [
            {
                "courseid": "3",
                "courseurl": "url-to-course",
                "title": "TEST copy 1",
                "nr": 0,
                "first": true
            },
            {
                "courseid": "2",
                "courseurl": "url-to-course",
                "title": "TEST",
                "nr": 1
            }
        ],
        "hasitems": true,
        "custombuttons": true,
        "cssjsonstring": "'css-selector {overflow: hidden;}'",
        "cmid": "55"
    }
}}

{{#showintro}}
    {{{intro}}}
{{/showintro}}
{{#hasitems}}
    <div id="{{plugin}}-{{uniqid}}" class="{{plugin}} carousel slide my-2" data-ride="carousel" data-interval="{{#interval}}{{.}}000{{/interval}}{{^interval}}false{{/interval}}">

        <!-- Indicators -->
        <ul class="carousel-indicators">
            {{#items}}
                <li data-target="#{{plugin}}-{{uniqid}}" data-slide-to="{{nr}}"{{#first}} class="active"{{/first}}></li>
            {{/items}}
        </ul>

        <!-- The slideshow -->
        <div class="carousel-inner">
            {{#items}}
                <div class="carousel-item text-center py-4{{#first}} active{{/first}}">
                    <a href="{{{courseurl}}}" class="d-block py-3">
                        {{#imageurl}}
                        <div style="width:100%;">
                            <img class="img-fluid" src="{{{imageurl}}}" style="height:100%;object-fit:contain;"/>
                        </div>
                        {{/imageurl}}
                    </a>

                    {{> unilabeltype_courseteaser/carousel_caption }}

                </div>
            {{/items}}
        </div>

        <!-- Left and right controls -->
        {{< unilabeltype_courseteaser/carousel_control}}{{!
            }} {{$direction}}next{{/direction}}{{!
            }} {{$icon}}{{#fontawesomenext}}{{.}}{{/fontawesomenext}}{{^fontawesomenext}}d-none{{/fontawesomenext}}{{/icon}}{{!
            }} {{/ unilabeltype_courseteaser/carousel_control}}
        {{< unilabeltype_courseteaser/carousel_control}}{{!
            }} {{$direction}}prev{{/direction}}{{!
            }} {{$icon}}{{#fontawesomeprev}}{{.}}{{/fontawesomeprev}}{{^fontawesomeprev}}d-none{{/fontawesomeprev}}{{/icon}}{{!
            }} {{/ unilabeltype_courseteaser/carousel_control}}
    </div>
{{/hasitems}}
{{^hasitems}}
    <span>{{#str}} nocontent , unilabeltype_courseteaser {{/str}}</span>
{{/hasitems}}
{{#js}}
    require(['theme_boost/loader']);
    require(['theme_boost/bootstrap/carousel']);
    {{#interval}}
    require(['mod_unilabel/carouselstart'], function(mod) {
        mod.init('{{plugin}}-{{uniqid}}');
    });
    {{/interval}}

    {{#hasitems}}
        {{#custombuttons}}
            require(['mod_unilabel/add_css'], function(mod) {
                // To make sure we have clean html we have to put the css into the <head> by using javascript.
                mod.init({{{cssjsonstring}}});
            });
        {{/custombuttons}}
    {{/hasitems}}

{{/js}}