Merge branch 'MDL-68975-master' of git://github.com/sarjona/moodle

This commit is contained in:
Andrew Nicols 2020-08-20 08:40:37 +08:00
commit f8e916d705
12 changed files with 89 additions and 37 deletions

View File

@ -1,2 +1,2 @@
define ("core_contentbank/selectors",["exports"],function(a){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;var b=function(a,b){return"[data-".concat(a,"=\"").concat(b,"\"]")},c={regions:{cbcontentname:b("region","cb-content-name"),contentbank:b("region","contentbank"),filearea:b("region","filearea")},actions:{search:b("action","searchcontent"),clearSearch:b("action","clearsearchcontent"),viewgrid:b("action","viewgrid"),viewlist:b("action","viewlist"),sortname:b("action","sortname"),sortdate:b("action","sortdate"),sortsize:b("action","sortsize"),sorttype:b("action","sorttype")},elements:{listitem:".cb-listitem",cbnavbarbreadcrumb:".cb-navbar-breadbrumb",cbnavbartotalsearch:".cb-navbar-totalsearch",clearsearch:".input-group-append .clear-icon",searchicon:".input-group-append .search-icon",searchinput:"#searchinput",sortbutton:".cb-btnsort"}};a.default=c;return a.default});
define ("core_contentbank/selectors",["exports"],function(a){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;var b=function(a,b){return"[data-".concat(a,"=\"").concat(b,"\"]")},c={regions:{cbcontentname:b("region","cb-content-name"),contentbank:b("region","contentbank"),filearea:b("region","filearea")},actions:{search:b("action","searchcontent"),clearSearch:b("action","clearsearchcontent"),viewgrid:b("action","viewgrid"),viewlist:b("action","viewlist"),sortname:b("action","sortname"),sortdate:b("action","sortdate"),sortsize:b("action","sortsize"),sorttype:b("action","sorttype"),sortauthor:b("action","sortauthor")},elements:{listitem:".cb-listitem",cbnavbarbreadcrumb:".cb-navbar-breadbrumb",cbnavbartotalsearch:".cb-navbar-totalsearch",clearsearch:".input-group-append .clear-icon",searchicon:".input-group-append .search-icon",searchinput:"#searchinput",sortbutton:".cb-btnsort"}};a.default=c;return a.default});
//# sourceMappingURL=selectors.min.js.map

View File

@ -1 +1 @@
{"version":3,"sources":["../src/selectors.js"],"names":["getDataSelector","name","value","regions","cbcontentname","contentbank","filearea","actions","search","clearSearch","viewgrid","viewlist","sortname","sortdate","sortsize","sorttype","elements","listitem","cbnavbarbreadcrumb","cbnavbartotalsearch","clearsearch","searchicon","searchinput","sortbutton"],"mappings":"+IAgCMA,CAAAA,CAAe,CAAG,SAACC,CAAD,CAAOC,CAAP,CAAiB,CACrC,sBAAgBD,CAAhB,eAAyBC,CAAzB,OACH,C,GAEc,CACXC,OAAO,CAAE,CACLC,aAAa,CAAEJ,CAAe,CAAC,QAAD,CAAW,iBAAX,CADzB,CAELK,WAAW,CAAEL,CAAe,CAAC,QAAD,CAAW,aAAX,CAFvB,CAGLM,QAAQ,CAAEN,CAAe,CAAC,QAAD,CAAW,UAAX,CAHpB,CADE,CAMXO,OAAO,CAAE,CACLC,MAAM,CAAER,CAAe,CAAC,QAAD,CAAW,eAAX,CADlB,CAELS,WAAW,CAAET,CAAe,CAAC,QAAD,CAAW,oBAAX,CAFvB,CAGLU,QAAQ,CAAEV,CAAe,CAAC,QAAD,CAAW,UAAX,CAHpB,CAILW,QAAQ,CAAEX,CAAe,CAAC,QAAD,CAAW,UAAX,CAJpB,CAKLY,QAAQ,CAAEZ,CAAe,CAAC,QAAD,CAAW,UAAX,CALpB,CAMLa,QAAQ,CAAEb,CAAe,CAAC,QAAD,CAAW,UAAX,CANpB,CAOLc,QAAQ,CAAEd,CAAe,CAAC,QAAD,CAAW,UAAX,CAPpB,CAQLe,QAAQ,CAAEf,CAAe,CAAC,QAAD,CAAW,UAAX,CARpB,CANE,CAgBXgB,QAAQ,CAAE,CACNC,QAAQ,CAAE,cADJ,CAENC,kBAAkB,CAAE,uBAFd,CAGNC,mBAAmB,CAAE,wBAHf,CAINC,WAAW,CAAE,iCAJP,CAKNC,UAAU,CAAE,kCALN,CAMNC,WAAW,CAAE,cANP,CAONC,UAAU,CAAE,aAPN,CAhBC,C","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Define all of the selectors we will be using on the contentbank interface.\n *\n * @module core_contentbank/selectors\n * @package core_contentbank\n * @copyright 2020 Sara Arjona <sara@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * A small helper function to build queryable data selectors.\n *\n * @method getDataSelector\n * @param {String} name\n * @param {String} value\n * @return {string}\n */\nconst getDataSelector = (name, value) => {\n return `[data-${name}=\"${value}\"]`;\n};\n\nexport default {\n regions: {\n cbcontentname: getDataSelector('region', 'cb-content-name'),\n contentbank: getDataSelector('region', 'contentbank'),\n filearea: getDataSelector('region', 'filearea')\n },\n actions: {\n search: getDataSelector('action', 'searchcontent'),\n clearSearch: getDataSelector('action', 'clearsearchcontent'),\n viewgrid: getDataSelector('action', 'viewgrid'),\n viewlist: getDataSelector('action', 'viewlist'),\n sortname: getDataSelector('action', 'sortname'),\n sortdate: getDataSelector('action', 'sortdate'),\n sortsize: getDataSelector('action', 'sortsize'),\n sorttype: getDataSelector('action', 'sorttype')\n },\n elements: {\n listitem: '.cb-listitem',\n cbnavbarbreadcrumb: '.cb-navbar-breadbrumb',\n cbnavbartotalsearch: '.cb-navbar-totalsearch',\n clearsearch: '.input-group-append .clear-icon',\n searchicon: '.input-group-append .search-icon',\n searchinput: '#searchinput',\n sortbutton: '.cb-btnsort'\n },\n};\n"],"file":"selectors.min.js"}
{"version":3,"sources":["../src/selectors.js"],"names":["getDataSelector","name","value","regions","cbcontentname","contentbank","filearea","actions","search","clearSearch","viewgrid","viewlist","sortname","sortdate","sortsize","sorttype","sortauthor","elements","listitem","cbnavbarbreadcrumb","cbnavbartotalsearch","clearsearch","searchicon","searchinput","sortbutton"],"mappings":"+IAgCMA,CAAAA,CAAe,CAAG,SAACC,CAAD,CAAOC,CAAP,CAAiB,CACrC,sBAAgBD,CAAhB,eAAyBC,CAAzB,OACH,C,GAEc,CACXC,OAAO,CAAE,CACLC,aAAa,CAAEJ,CAAe,CAAC,QAAD,CAAW,iBAAX,CADzB,CAELK,WAAW,CAAEL,CAAe,CAAC,QAAD,CAAW,aAAX,CAFvB,CAGLM,QAAQ,CAAEN,CAAe,CAAC,QAAD,CAAW,UAAX,CAHpB,CADE,CAMXO,OAAO,CAAE,CACLC,MAAM,CAAER,CAAe,CAAC,QAAD,CAAW,eAAX,CADlB,CAELS,WAAW,CAAET,CAAe,CAAC,QAAD,CAAW,oBAAX,CAFvB,CAGLU,QAAQ,CAAEV,CAAe,CAAC,QAAD,CAAW,UAAX,CAHpB,CAILW,QAAQ,CAAEX,CAAe,CAAC,QAAD,CAAW,UAAX,CAJpB,CAKLY,QAAQ,CAAEZ,CAAe,CAAC,QAAD,CAAW,UAAX,CALpB,CAMLa,QAAQ,CAAEb,CAAe,CAAC,QAAD,CAAW,UAAX,CANpB,CAOLc,QAAQ,CAAEd,CAAe,CAAC,QAAD,CAAW,UAAX,CAPpB,CAQLe,QAAQ,CAAEf,CAAe,CAAC,QAAD,CAAW,UAAX,CARpB,CASLgB,UAAU,CAAEhB,CAAe,CAAC,QAAD,CAAW,YAAX,CATtB,CANE,CAiBXiB,QAAQ,CAAE,CACNC,QAAQ,CAAE,cADJ,CAENC,kBAAkB,CAAE,uBAFd,CAGNC,mBAAmB,CAAE,wBAHf,CAINC,WAAW,CAAE,iCAJP,CAKNC,UAAU,CAAE,kCALN,CAMNC,WAAW,CAAE,cANP,CAONC,UAAU,CAAE,aAPN,CAjBC,C","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Define all of the selectors we will be using on the contentbank interface.\n *\n * @module core_contentbank/selectors\n * @package core_contentbank\n * @copyright 2020 Sara Arjona <sara@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * A small helper function to build queryable data selectors.\n *\n * @method getDataSelector\n * @param {String} name\n * @param {String} value\n * @return {string}\n */\nconst getDataSelector = (name, value) => {\n return `[data-${name}=\"${value}\"]`;\n};\n\nexport default {\n regions: {\n cbcontentname: getDataSelector('region', 'cb-content-name'),\n contentbank: getDataSelector('region', 'contentbank'),\n filearea: getDataSelector('region', 'filearea')\n },\n actions: {\n search: getDataSelector('action', 'searchcontent'),\n clearSearch: getDataSelector('action', 'clearsearchcontent'),\n viewgrid: getDataSelector('action', 'viewgrid'),\n viewlist: getDataSelector('action', 'viewlist'),\n sortname: getDataSelector('action', 'sortname'),\n sortdate: getDataSelector('action', 'sortdate'),\n sortsize: getDataSelector('action', 'sortsize'),\n sorttype: getDataSelector('action', 'sorttype'),\n sortauthor: getDataSelector('action', 'sortauthor'),\n },\n elements: {\n listitem: '.cb-listitem',\n cbnavbarbreadcrumb: '.cb-navbar-breadbrumb',\n cbnavbartotalsearch: '.cb-navbar-totalsearch',\n clearsearch: '.input-group-append .clear-icon',\n searchicon: '.input-group-append .search-icon',\n searchinput: '#searchinput',\n sortbutton: '.cb-btnsort'\n },\n};\n"],"file":"selectors.min.js"}

View File

@ -1,2 +1,2 @@
define ("core_contentbank/sort",["exports","./selectors","core/str","core/prefetch","core/ajax","core/notification"],function(a,b,c,d,e,f){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.init=void 0;b=g(b);d=g(d);e=g(e);f=g(f);function g(a){return a&&a.__esModule?a:{default:a}}var h=function(){var a=document.querySelector(b.default.regions.contentbank);d.default.prefetchStrings("contentbank",["contentname","lastmodified","size","type"]);d.default.prefetchStrings("moodle",["sortbyx","sortbyxreverse"]);i(a)};a.init=h;var i=function(a){var c=document.querySelector(b.default.regions.filearea),d=c.querySelectorAll(b.default.elements.listitem),e=a.querySelector(b.default.actions.viewgrid),f=a.querySelector(b.default.actions.viewlist);e.addEventListener("click",function(){a.classList.remove("view-list");a.classList.add("view-grid");e.classList.add("active");f.classList.remove("active");j(!1)});f.addEventListener("click",function(){a.classList.remove("view-grid");a.classList.add("view-list");f.classList.add("active");e.classList.remove("active");j(!0)});var g=a.querySelector(b.default.actions.sortname);g.addEventListener("click",function(){var b=k(a,g);m(c,d,"data-file",b)});var h=a.querySelector(b.default.actions.sortdate);h.addEventListener("click",function(){var b=k(a,h);m(c,d,"data-timemodified",b)});var i=a.querySelector(b.default.actions.sortsize);i.addEventListener("click",function(){var b=k(a,i);m(c,d,"data-bytes",b)});var l=a.querySelector(b.default.actions.sorttype);l.addEventListener("click",function(){var b=k(a,l);m(c,d,"data-type",b)})},j=function(a){if(!1===a){a=null}var b={methodname:"core_user_update_user_preferences",args:{preferences:[{type:"core_contentbank_view_list",value:a}]}};return e.default.call([b])[0].catch(f.default.exception)},k=function(a,c){var d=a.querySelectorAll(b.default.elements.sortbutton);d.forEach(function(a){if(a!==c){a.classList.remove("dir-asc");a.classList.remove("dir-desc");a.classList.add("dir-none");l(a,!1)}});var e=!0;if(c.classList.contains("dir-none")){c.classList.remove("dir-none");c.classList.add("dir-asc")}else if(c.classList.contains("dir-asc")){c.classList.remove("dir-asc");c.classList.add("dir-desc");e=!1}else if(c.classList.contains("dir-desc")){c.classList.remove("dir-desc");c.classList.add("dir-asc")}l(c,e);return e},l=function(a,b){var d=b?"sortbyxreverse":"sortbyx";return(0,c.get_string)(a.dataset.string,"contentbank").then(function(a){return(0,c.get_string)(d,"core",a)}).then(function(b){a.setAttribute("title",b);return b}).catch()},m=function(a,b,c,d){var e=[].slice.call(b).sort(function(e,a){var b=e.getAttribute(c),f=a.getAttribute(c);if(!isNaN(b)){b=parseInt(b);f=parseInt(f)}if(d){return b>f?1:-1}else{return b<f?1:-1}});e.forEach(function(b){return a.appendChild(b)})}});
define ("core_contentbank/sort",["exports","./selectors","core/str","core/prefetch","core/ajax","core/notification"],function(a,b,c,d,e,f){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.init=void 0;b=g(b);d=g(d);e=g(e);f=g(f);function g(a){return a&&a.__esModule?a:{default:a}}var h=function(){var a=document.querySelector(b.default.regions.contentbank);d.default.prefetchStrings("contentbank",["contentname","lastmodified","size","type","author"]);d.default.prefetchStrings("moodle",["sortbyx","sortbyxreverse"]);i(a)};a.init=h;var i=function(a){var c=document.querySelector(b.default.regions.filearea),d=c.querySelectorAll(b.default.elements.listitem),e=a.querySelector(b.default.actions.viewgrid),f=a.querySelector(b.default.actions.viewlist);e.addEventListener("click",function(){a.classList.remove("view-list");a.classList.add("view-grid");e.classList.add("active");f.classList.remove("active");j(!1)});f.addEventListener("click",function(){a.classList.remove("view-grid");a.classList.add("view-list");f.classList.add("active");e.classList.remove("active");j(!0)});var g=a.querySelector(b.default.actions.sortname);g.addEventListener("click",function(){var b=k(a,g);m(c,d,"data-file",b)});var h=a.querySelector(b.default.actions.sortdate);h.addEventListener("click",function(){var b=k(a,h);m(c,d,"data-timemodified",b)});var i=a.querySelector(b.default.actions.sortsize);i.addEventListener("click",function(){var b=k(a,i);m(c,d,"data-bytes",b)});var l=a.querySelector(b.default.actions.sorttype);l.addEventListener("click",function(){var b=k(a,l);m(c,d,"data-type",b)});var n=a.querySelector(b.default.actions.sortauthor);n.addEventListener("click",function(){var b=k(a,n);m(c,d,"data-author",b)})},j=function(a){if(!1===a){a=null}var b={methodname:"core_user_update_user_preferences",args:{preferences:[{type:"core_contentbank_view_list",value:a}]}};return e.default.call([b])[0].catch(f.default.exception)},k=function(a,c){var d=a.querySelectorAll(b.default.elements.sortbutton);d.forEach(function(a){if(a!==c){a.classList.remove("dir-asc");a.classList.remove("dir-desc");a.classList.add("dir-none");l(a,!1)}});var e=!0;if(c.classList.contains("dir-none")){c.classList.remove("dir-none");c.classList.add("dir-asc")}else if(c.classList.contains("dir-asc")){c.classList.remove("dir-asc");c.classList.add("dir-desc");e=!1}else if(c.classList.contains("dir-desc")){c.classList.remove("dir-desc");c.classList.add("dir-asc")}l(c,e);return e},l=function(a,b){var d=b?"sortbyxreverse":"sortbyx";return(0,c.get_string)(a.dataset.string,"contentbank").then(function(a){return(0,c.get_string)(d,"core",a)}).then(function(b){a.setAttribute("title",b);return b}).catch()},m=function(a,b,c,d){var e=[].slice.call(b).sort(function(e,a){var b=e.getAttribute(c),f=a.getAttribute(c);if(!isNaN(b)){b=parseInt(b);f=parseInt(f)}if(d){return b>f?1:-1}else{return b<f?1:-1}});e.forEach(function(b){return a.appendChild(b)})}});
//# sourceMappingURL=sort.min.js.map

File diff suppressed because one or more lines are too long

View File

@ -48,7 +48,8 @@ export default {
sortname: getDataSelector('action', 'sortname'),
sortdate: getDataSelector('action', 'sortdate'),
sortsize: getDataSelector('action', 'sortsize'),
sorttype: getDataSelector('action', 'sorttype')
sorttype: getDataSelector('action', 'sorttype'),
sortauthor: getDataSelector('action', 'sortauthor'),
},
elements: {
listitem: '.cb-listitem',

View File

@ -35,7 +35,7 @@ import Notification from 'core/notification';
*/
export const init = () => {
const contentBank = document.querySelector(selectors.regions.contentbank);
Prefetch.prefetchStrings('contentbank', ['contentname', 'lastmodified', 'size', 'type']);
Prefetch.prefetchStrings('contentbank', ['contentname', 'lastmodified', 'size', 'type', 'author']);
Prefetch.prefetchStrings('moodle', ['sortbyx', 'sortbyxreverse']);
registerListenerEvents(contentBank);
};
@ -93,12 +93,19 @@ const registerListenerEvents = (contentBank) => {
updateSortOrder(fileArea, shownItems, 'data-bytes', ascending);
});
// Sort by type
// Sort by type.
const sortByType = contentBank.querySelector(selectors.actions.sorttype);
sortByType.addEventListener('click', () => {
const ascending = updateSortButtons(contentBank, sortByType);
updateSortOrder(fileArea, shownItems, 'data-type', ascending);
});
// Sort by author.
const sortByAuthor = contentBank.querySelector(selectors.actions.sortauthor);
sortByAuthor.addEventListener('click', () => {
const ascending = updateSortButtons(contentBank, sortByAuthor);
updateSortOrder(fileArea, shownItems, 'data-author', ascending);
});
};

View File

@ -86,6 +86,7 @@ class bankcontent implements renderable, templatable {
$contenttypeclass = $content->get_content_type().'\\contenttype';
$contenttype = new $contenttypeclass($this->context);
$name = $content->get_name();
$author = \core_user::get_user($content->get_content()->usercreated);
$contentdata[] = array(
'name' => $name,
'title' => strtolower($name),
@ -94,7 +95,8 @@ class bankcontent implements renderable, templatable {
'timemodified' => $content->get_timemodified(),
'bytes' => $filesize,
'size' => display_size($filesize),
'type' => $mimetype
'type' => $mimetype,
'author' => fullname($author),
);
}
$data->viewlist = get_user_preferences('core_contentbank_view_list');

View File

@ -27,6 +27,7 @@
"size": "699.3KB",
"bytes": 716126,
"type": "Archive (H5P)",
"author": "Admin user",
"link": "http://something/contentbank/contenttype/h5p/view.php?url=http://something/pluginfile.php/1/contentbank/public/accordion.h5p",
"icon" : "http://something/theme/image.php/boost/core/1581597850/f/h5p-64"
},
@ -37,6 +38,7 @@
"size": "699.3KB",
"bytes": 716126,
"type": "Archive (PDF)",
"author": "Admin user",
"icon": "http://something/theme/image.php/boost/core/1584597850/f/pdf-64"
}
],
@ -122,7 +124,7 @@ data-region="contentbank">
<span class="asc">{{#pix}} t/sort_asc, core, {{#str}}asc, core{{/str}} {{/pix}}</span>
</button>
</div>
<div class="cb-type cb-column d-flex last">
<div class="cb-type cb-column d-flex">
<div class="title">{{#str}} type, contentbank {{/str}}</div>
<button class="btn btn-sm cb-btnsort dir-none ml-auto" data-string="type" data-action="sorttype"
title="{{#str}} sortbyx, core, {{#str}} type, contentbank {{/str}} {{/str}}">
@ -131,6 +133,15 @@ data-region="contentbank">
<span class="asc">{{#pix}} t/sort_asc, core, {{#str}}asc, core{{/str}} {{/pix}}</span>
</button>
</div>
<div class="cb-author cb-column d-flex last">
<div class="title">{{#str}} author, contentbank {{/str}}</div>
<button class="btn btn-sm cb-btnsort dir-none ml-auto" data-string="author" data-action="sortauthor"
title="{{#str}} sortbyx, core, {{#str}} author, contentbank {{/str}} {{/str}}">
<span class="default">{{#pix}} t/sort, core, {{#str}}sort, core {{/str}} {{/pix}}</span>
<span class="desc">{{#pix}} t/sort_desc, core, {{#str}}desc, core{{/str}} {{/pix}}</span>
<span class="asc">{{#pix}} t/sort_asc, core, {{#str}}asc, core{{/str}} {{/pix}}</span>
</button>
</div>
</div>
{{#contents}}
<div class="cb-listitem"
@ -138,7 +149,8 @@ data-region="contentbank">
data-name="{{{ name }}}"
data-bytes="{{ bytes }}"
data-timemodified="{{ timemodified }}"
data-type="{{{ type }}}">
data-type="{{{ type }}}"
data-author="{{{ author }}}">
<div class="cb-file cb-column position-relative">
<div class="cb-thumbnail" role="img" aria-label="{{{ name }}}"
style="background-image: url('{{{ icon }}}');">
@ -155,9 +167,12 @@ data-region="contentbank">
<div class="cb-size cb-column small">
{{ size }}
</div>
<div class="cb-type cb-column last small">
<div class="cb-type cb-column small">
{{{ type }}}
</div>
<div class="cb-type cb-column last small">
{{{ author }}}
</div>
</div>
{{/contents}}
</div>

View File

@ -5,14 +5,20 @@ Feature: Sort content in the content bank
I need to be able to sort the content bank in various ways
Background:
Given the following "contentbank content" exist:
| contextlevel | reference | contenttype | user | contentname |
| System | | contenttype_h5p | admin | Dragon_santjordi.h5p |
| System | | contenttype_h5p | admin | mathsbook.h5p |
| System | | contenttype_h5p | admin | historybook.h5p |
| System | | contenttype_h5p | admin | santjordi.h5p |
| System | | contenttype_h5p | admin | santjordi_rose.h5p |
| System | | contenttype_h5p | admin | SantJordi_book |
Given the following "users" exist:
| username | firstname | lastname | email |
| manager | Max | Manager | man@example.com |
And the following "role assigns" exist:
| user | role | contextlevel | reference |
| manager | manager | System | |
And the following "contentbank content" exist:
| contextlevel | reference | contenttype | user | contentname |
| System | | contenttype_h5p | admin | Dragon_santjordi.h5p |
| System | | contenttype_h5p | admin | mathsbook.h5p |
| System | | contenttype_h5p | manager | historybook.h5p |
| System | | contenttype_h5p | admin | santjordi.h5p |
| System | | contenttype_h5p | admin | santjordi_rose.h5p |
| System | | contenttype_h5p | admin | SantJordi_book |
Scenario: Admins can order content in the content bank
Given I log in as "admin"
@ -30,3 +36,18 @@ Feature: Sort content in the content bank
And "historybook.h5p" "text" should appear before "Dragon_santjordi.h5p" "text"
And "mathsbook.h5p" "text" should appear before "historybook.h5p" "text"
Then "santjordi_rose.h5p" "text" should appear before "SantJordi_book" "text"
Scenario: Admins can order content depending on the author
Given I log in as "admin"
And I am on site homepage
And I turn editing mode on
And I add the "Navigation" block if not present
And I expand "Site pages" node
And I click on "Content bank" "link"
When I click on "Display content bank with file details" "button"
Then I click on "Sort by Author ascending" "button"
And "Dragon_santjordi.h5p" "text" should appear before "historybook.h5p" "text"
And "santjordi_rose.h5p" "text" should appear before "historybook" "text"
And I click on "Sort by Author descending" "button"
And "historybook.h5p" "text" should appear before "Dragon_santjordi.h5p" "text"
And "historybook.h5p" "text" should appear before "santjordi_rose" "text"

View File

@ -47,7 +47,8 @@
.cb-heading,
.cb-date,
.cb-size,
.cb-type {
.cb-type,
.cb-author {
display: none;
}
}
@ -94,13 +95,14 @@
z-index: 1;
}
.cb-file,
.cb-date {
flex: 0 0 35%;
max-width: 35%;
.cb-file {
flex: 0 0 40%;
max-width: 40%;
}
.cb-date,
.cb-size,
.cb-type {
.cb-type,
.cb-author {
flex: 0 0 15%;
max-width: 15%;
}

View File

@ -13048,7 +13048,8 @@ table.calendartable caption {
.content-bank-container.view-grid .cb-heading,
.content-bank-container.view-grid .cb-date,
.content-bank-container.view-grid .cb-size,
.content-bank-container.view-grid .cb-type {
.content-bank-container.view-grid .cb-type,
.content-bank-container.view-grid .cb-author {
display: none; }
.content-bank-container.view-list .cb-content-wrapper {
@ -13083,12 +13084,13 @@ table.calendartable caption {
position: sticky;
top: 0;
z-index: 1; }
.content-bank-container.view-list .cb-file,
.content-bank-container.view-list .cb-date {
flex: 0 0 35%;
max-width: 35%; }
.content-bank-container.view-list .cb-file {
flex: 0 0 40%;
max-width: 40%; }
.content-bank-container.view-list .cb-date,
.content-bank-container.view-list .cb-size,
.content-bank-container.view-list .cb-type {
.content-bank-container.view-list .cb-type,
.content-bank-container.view-list .cb-author {
flex: 0 0 15%;
max-width: 15%; }
.content-bank-container.view-list .cb-column.last {

View File

@ -13262,7 +13262,8 @@ table.calendartable caption {
.content-bank-container.view-grid .cb-heading,
.content-bank-container.view-grid .cb-date,
.content-bank-container.view-grid .cb-size,
.content-bank-container.view-grid .cb-type {
.content-bank-container.view-grid .cb-type,
.content-bank-container.view-grid .cb-author {
display: none; }
.content-bank-container.view-list .cb-content-wrapper {
@ -13297,12 +13298,13 @@ table.calendartable caption {
position: sticky;
top: 0;
z-index: 1; }
.content-bank-container.view-list .cb-file,
.content-bank-container.view-list .cb-date {
flex: 0 0 35%;
max-width: 35%; }
.content-bank-container.view-list .cb-file {
flex: 0 0 40%;
max-width: 40%; }
.content-bank-container.view-list .cb-date,
.content-bank-container.view-list .cb-size,
.content-bank-container.view-list .cb-type {
.content-bank-container.view-list .cb-type,
.content-bank-container.view-list .cb-author {
flex: 0 0 15%;
max-width: 15%; }
.content-bank-container.view-list .cb-column.last {