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 core_user/edit_profile_fields

    UI for editing profile fields

    Example context (json):
    {
        "baseurl": "index.php",
        "sesskey": "12345",
        "categories": [
            {
                "id": 1,
                "name": "Cat1",
                "fields": [
                    {"id": 1, "name": "Field1", "isfirst": true, "islast": false},
                    {"id": 2, "name": "Field2", "isfirst": false, "islast": false},
                    {"id": 3, "name": "Field3", "isfirst": false, "islast": true}
                ],
                "hasfields": true,
                "isfirst": true,
                "candelete": true
            },
            {
                "id": 2,
                "name": "Cat2",
                "candelete": true
            },
            {
                "id": 3,
                "name": "Cat3",
                "islast": true,
                "candelete": true
            }
        ]
    }
}}

<div class="profileeditor mt-3">
    <a tabindex="0" role="button" class="btn btn-sm btn-secondary" data-action="editcategory">
        <svg class="mr-2" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path d="M4.75 6.75V8.25C4.75 9.35457 5.64543 10.25 6.75 10.25H8.25C9.35457 10.25 10.25 9.35457 10.25 8.25V6.75C10.25 5.64543 9.35457 4.75 8.25 4.75H6.75C5.64543 4.75 4.75 5.64543 4.75 6.75Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
            <path d="M14.75 7H19.25" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
            <path d="M17 4.75L17 9.25" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
            <path d="M4.75 15.75V17.25C4.75 18.3546 5.64543 19.25 6.75 19.25H8.25C9.35457 19.25 10.25 18.3546 10.25 17.25V15.75C10.25 14.6454 9.35457 13.75 8.25 13.75H6.75C5.64543 13.75 4.75 14.6454 4.75 15.75Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
            <path d="M13.75 15.75V17.25C13.75 18.3546 14.6454 19.25 15.75 19.25H17.25C18.3546 19.25 19.25 18.3546 19.25 17.25V15.75C19.25 14.6454 18.3546 13.75 17.25 13.75H15.75C14.6454 13.75 13.75 14.6454 13.75 15.75Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
        </svg>
        {{#str}}profilecreatecategory, admin{{/str}}
    </a>
</div>

<div class="categorieslist">
{{#categories}}
<div data-category-id="{{id}}" id="category-{{id}}" class="mt-2">
    <div>
        <div class="categoryinstance w-100 mt-3 d-inline-flex align-items-center justify-content-between">
            <h4 class="mb-0">
                {{{name}}}
            </h4>

            <div class="ml-auto">
                <a class="ml-3 btn btn-sm btn-icon btn-info" href="#" data-action="editcategory" data-id="{{id}}" data-name="{{name}}">
                    <svg width="24" height="24" fill="none" viewBox="0 0 24 24">
                        <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M4.75 19.25L9 18.25L18.2929 8.95711C18.6834 8.56658 18.6834 7.93342 18.2929 7.54289L16.4571 5.70711C16.0666 5.31658 15.4334 5.31658 15.0429 5.70711L5.75 15L4.75 19.25Z"></path>
                        <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M19.25 19.25H13.75"></path>
                    </svg>
                </a>
                {{#candelete}}
                    <a class="btn btn-sm btn-icon btn-danger" href="{{baseurl}}?action=deletecategory&id={{id}}&sesskey={{sesskey}}">
                        <svg width="24" height="24" fill="none" viewBox="0 0 24 24">
                            <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M6.75 7.75L7.59115 17.4233C7.68102 18.4568 8.54622 19.25 9.58363 19.25H14.4164C15.4538 19.25 16.319 18.4568 16.4088 17.4233L17.25 7.75"></path>
                            <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9.75 7.5V6.75C9.75 5.64543 10.6454 4.75 11.75 4.75H12.25C13.3546 4.75 14.25 5.64543 14.25 6.75V7.5"></path>
                            <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M5 7.75H19"></path>
                        </svg>
                    </a>
                {{/candelete}}
                {{^isfirst}}
                    <a class="btn btn-sm btn-icon btn-secondary" href="{{baseurl}}?id={{id}}&action=movecategory&dir=up&amp;sesskey={{sesskey}}">
                        <svg width="24" height="24" fill="none" viewBox="0 0 24 24">
                            <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M17.25 10.25L12 4.75L6.75 10.25"></path>
                            <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M12 19.25V5.75"></path>
                        </svg>
                    </a>
                {{/isfirst}}
                {{^islast}}
                    <a class="btn btn-sm btn-icon btn-secondary" href="{{baseurl}}?id={{id}}&action=movecategory&dir=down&amp;sesskey={{sesskey}}">
                        <svg width="24" height="24" fill="none" viewBox="0 0 24 24">
                            <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M17.25 13.75L12 19.25L6.75 13.75"></path>
                            <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M12 18.25V4.75"></path>
                        </svg>
                    </a>
                {{/islast}}
            </div>

            <div class="ml-2">
                {{#addfieldmenu}}{{> core/action_menu}}{{/addfieldmenu}}
            </div>
        </div>

    </div>

    <div class="profilefield">
        {{#hasfields}}
            <ul class="rui-profilefield list-group mt-2 mx-0">
                {{#fields}}
                    <li class="list-group-item d-inline-flex justidy-content-between align-items-center">
                        <h5 class="mb-0">{{{name}}}</h5>
                        <div class="ml-auto">
                            <a class="btn btn-sm btn-icon btn-info" href="#" data-action="editfield" data-id="{{id}}" data-name="{{name}}">
                                <svg width="20" height="20" fill="none" viewBox="0 0 24 24">
                                    <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M4.75 19.25L9 18.25L18.2929 8.95711C18.6834 8.56658 18.6834 7.93342 18.2929 7.54289L16.4571 5.70711C16.0666 5.31658 15.4334 5.31658 15.0429 5.70711L5.75 15L4.75 19.25Z"></path>
                                    <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M19.25 19.25H13.75"></path>
                                </svg>
                            </a>
                            <a class="btn btn-sm btn-icon btn-danger" href="{{baseurl}}?action=deletefield&id={{id}}&sesskey={{sesskey}}">
                                <svg width="20" height="20" fill="none" viewBox="0 0 24 24">
                                    <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M6.75 7.75L7.59115 17.4233C7.68102 18.4568 8.54622 19.25 9.58363 19.25H14.4164C15.4538 19.25 16.319 18.4568 16.4088 17.4233L17.25 7.75"></path>
                                    <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9.75 7.5V6.75C9.75 5.64543 10.6454 4.75 11.75 4.75H12.25C13.3546 4.75 14.25 5.64543 14.25 6.75V7.5"></path>
                                    <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M5 7.75H19"></path>
                                </svg>
                            </a>
                            {{^isfirst}}
                                <a class="btn btn-sm btn-icon btn-secondary" href="{{baseurl}}?id={{id}}&action=movefield&dir=up&amp;sesskey={{sesskey}}">
                                    <svg width="20" height="20" fill="none" viewBox="0 0 24 24">
                                        <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M17.25 10.25L12 4.75L6.75 10.25"></path>
                                        <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M12 19.25V5.75"></path>
                                    </svg>
                                </a>
                            {{/isfirst}}
                            {{^islast}}
                                <a class="btn btn-sm btn-icon btn-secondary" href="{{baseurl}}?id={{id}}&action=movefield&dir=down&amp;sesskey={{sesskey}}">
                                    <svg width="20" height="20" fill="none" viewBox="0 0 24 24">
                                        <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M17.25 13.75L12 19.25L6.75 13.75"></path>
                                        <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M12 18.25V4.75"></path>
                                    </svg>
                                </a>
                            {{/islast}}
                        </div>
                    </li>
                {{/fields}}
            </ul>
        {{/hasfields}}
        {{^hasfields}}
        <div class="alert alert-warning mt-2">{{#str}}profilenofieldsdefined, admin{{/str}}</div>
        {{/hasfields}}
    </div>
</div>
{{/categories}}
</div>

{{#js}}
    require(['core_user/edit_profile_fields'], function(s) {
        s.init();
    });
{{/js}}