mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00
MDL-67810 core_contentbank: added dropdown menu to create content
This commit is contained in:
parent
68fd8d8bdf
commit
75f58cbfa2
16 changed files with 437 additions and 14 deletions
|
@ -15,7 +15,7 @@
|
|||
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
}}
|
||||
{{!
|
||||
@template core_contentbank/list
|
||||
@template core_contentbank/bankcontent
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
|
@ -32,10 +32,36 @@
|
|||
},
|
||||
{
|
||||
"name": "resume.pdf",
|
||||
"title": "resume",
|
||||
"timemodified": 1589792039,
|
||||
"size": "699.3KB",
|
||||
"bytes": 716126,
|
||||
"type": "Archive (PDF)",
|
||||
"icon": "http://something/theme/image.php/boost/core/1584597850/f/pdf-64"
|
||||
}
|
||||
],
|
||||
"tools": [
|
||||
{
|
||||
"name": "Add",
|
||||
"dropdown": true,
|
||||
"link": "http://something/contentbank/edit.php?contextid=1",
|
||||
"contenttypes": [
|
||||
{
|
||||
"name": "H5P Interactive Content",
|
||||
"baseurl": "http://something/contentbank/edit.php?contextid=1&plugin=h5p",
|
||||
"types": [
|
||||
{
|
||||
"typename": "H5P Interactive Content"
|
||||
},
|
||||
{
|
||||
"typename": "Accordion",
|
||||
"typeeditorparams": "library=Accordion-1.4",
|
||||
"typeicon": "http://something/pluginfile.php/1/core_h5p/libraries/13/H5P.Accordion-1.4/icon.svg"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Upload",
|
||||
"link": "http://something/contentbank/contenttype/h5p/view.php?url=http://something/pluginfile.php/1/contentbank/public/accordion.h5p",
|
||||
|
|
|
@ -20,6 +20,27 @@
|
|||
Example context (json):
|
||||
{
|
||||
"tools": [
|
||||
{
|
||||
"name": "Add",
|
||||
"dropdown": true,
|
||||
"link": "http://something/contentbank/edit.php?contextid=1",
|
||||
"contenttypes": [
|
||||
{
|
||||
"name": "h5p",
|
||||
"baseurl": "http://something/contentbank/edit.php?contextid=1&plugin=h5p",
|
||||
"types": [
|
||||
{
|
||||
"typename": "H5P Interactive Content"
|
||||
},
|
||||
{
|
||||
"typename": "Accordion",
|
||||
"typeeditorparams": "library=Accordion-1.4",
|
||||
"typeicon": "http://something/pluginfile.php/1/core_h5p/libraries/13/H5P.Accordion-1.4/icon.svg"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Upload",
|
||||
"link": "http://something/contentbank/contenttype/h5p/view.php?url=http://something/pluginfile.php/1/contentbank/public/accordion.h5p",
|
||||
|
@ -34,9 +55,14 @@
|
|||
}}
|
||||
|
||||
{{#tools}}
|
||||
<a href="{{{ link }}}" class="icon-no-margin btn btn-secondary" title="{{{ name }}}">
|
||||
{{#pix}} {{{ icon }}} {{/pix}} {{{ name }}}
|
||||
</a>
|
||||
{{#dropdown}}
|
||||
{{>core_contentbank/bankcontent/toolbar_dropdown}}
|
||||
{{/dropdown}}
|
||||
{{^dropdown}}
|
||||
<a href="{{{ link }}}" class="icon-no-margin btn btn-secondary" title="{{{ name }}}">
|
||||
{{#pix}} {{{ icon }}} {{/pix}} {{{ name }}}
|
||||
</a>
|
||||
{{/dropdown}}
|
||||
{{/tools}}
|
||||
<button class="icon-no-margin btn btn-secondary active ml-2"
|
||||
title="{{#str}} displayicons, contentbank {{/str}}"
|
||||
|
@ -47,4 +73,4 @@ data-action="viewgrid">
|
|||
title="{{#str}} displaydetails, contentbank {{/str}}"
|
||||
data-action="viewlist">
|
||||
{{#pix}}t/viewdetails, core, {{#str}} displaydetails, contentbank {{/str}} {{/pix}}
|
||||
</button>
|
||||
</button>
|
||||
|
|
64
contentbank/templates/bankcontent/toolbar_dropdown.mustache
Normal file
64
contentbank/templates/bankcontent/toolbar_dropdown.mustache
Normal file
|
@ -0,0 +1,64 @@
|
|||
{{!
|
||||
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_contentbank/bankcontent/toolbar_dropdown
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
"name": "Add",
|
||||
"dropdown": true,
|
||||
"link": "http://something/contentbank/edit.php?contextid=1",
|
||||
"contenttypes": [
|
||||
{
|
||||
"name": "h5p",
|
||||
"baseurl": "http://something/contentbank/edit.php?contextid=1&plugin=h5p",
|
||||
"types": [
|
||||
{
|
||||
"typename": "H5P Interactive Content"
|
||||
},
|
||||
{
|
||||
"typename": "Accordion",
|
||||
"typeeditorparams": "library=Accordion-1.4",
|
||||
"typeicon": "http://something/pluginfile.php/1/core_h5p/libraries/13/H5P.Accordion-1.4/icon.svg"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
}}
|
||||
<div class="btn-group mr-1" role="group">
|
||||
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" data-action="{{name}}-content"
|
||||
aria-haspopup="true" aria-expanded="false" {{^contenttypes}}title="{{#str}}nocontenttypes, core_contentbank{{/str}}"
|
||||
disabled{{/contenttypes}}>
|
||||
{{#name}} {{name}} {{/name}}
|
||||
</button>
|
||||
<div class="dropdown-menu dropdown-scrollable dropdown-menu-right">
|
||||
{{#contenttypes}}
|
||||
{{#types}}
|
||||
{{^typeeditorparams}}
|
||||
<h6 class="dropdown-header">{{ typename }}</h6>
|
||||
{{/typeeditorparams}}
|
||||
{{#typeeditorparams}}
|
||||
<a class="dropdown-item icon-size-4" href="{{{ baseurl }}}&{{{ typeeditorparams }}}">
|
||||
<img alt="" class="icon" src="{{{ typeicon }}}"> {{ typename }}
|
||||
</a>
|
||||
{{/typeeditorparams}}
|
||||
{{/types}}
|
||||
{{/contenttypes}}
|
||||
</div>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue