diff --git a/cohort/tests/behat/reportbuilder.feature b/cohort/tests/behat/reportbuilder.feature
index 27c198ecba0..4b89d613b84 100644
--- a/cohort/tests/behat/reportbuilder.feature
+++ b/cohort/tests/behat/reportbuilder.feature
@@ -43,8 +43,7 @@ Feature: Manage custom reports for cohorts
Scenario: Add condition to cohorts report
Given I am on the "My report" "reportbuilder > Editor" page logged in as "admin"
And I change window size to "large"
- When I click on "Show/hide settings sidebar" "button"
- And I click on "Show/hide 'Conditions'" "button"
+ When I click on "Show/hide 'Conditions'" "button"
Then I should see "There are no conditions selected" in the "[data-region='settings-conditions']" "css_element"
And I set the field "Select a condition" to "Category"
And I should see "Added condition 'Category'"
@@ -60,8 +59,7 @@ Feature: Manage custom reports for cohorts
Scenario: Use filters in cohorts report
Given I am on the "My report" "reportbuilder > Editor" page logged in as "admin"
And I change window size to "large"
- When I click on "Show/hide settings sidebar" "button"
- And I click on "Show/hide 'Filters'" "button"
+ When I click on "Show/hide 'Filters'" "button"
Then I should see "There are no filters selected" in the "[data-region='settings-filters']" "css_element"
And I set the field "Select a filter" to "Name"
And I should see "Other cohort" in the ".reportbuilder-table" "css_element"
@@ -87,7 +85,6 @@ Feature: Manage custom reports for cohorts
And I am on the "My report" "reportbuilder > Editor" page logged in as "admin"
And I set the field "Rename column 'Surname'" to "Member count"
And I set the "Surname" column aggregation to "Count"
- And I click on "Show/hide settings sidebar" "button"
And I click on "Show/hide 'Sorting'" "button"
And I click on "Move sorting for column 'Surname'" "button"
And I click on "To the top of the list" "link" in the "Move sorting for column 'Surname'" "dialogue"
diff --git a/lang/en/reportbuilder.php b/lang/en/reportbuilder.php
index ee06da11c6c..2c3626a23e4 100644
--- a/lang/en/reportbuilder.php
+++ b/lang/en/reportbuilder.php
@@ -53,6 +53,8 @@ $string['cardview_help'] = 'Card view allows you to define the layout of your re
$string['cardviewfirstcolumntitle'] = 'First column title';
$string['cardviewsettingssaved'] = 'Card view settings saved';
$string['cardviewvisiblecolumns'] = 'Columns visible';
+$string['close'] = 'Close';
+$string['closeeditor'] = 'Close \'{$a}\' editor';
$string['columnadded'] = 'Added column \'{$a}\'';
$string['columnaggregated'] = 'Aggregated column \'{$a}\'';
$string['columndeleted'] = 'Deleted column \'{$a}\'';
@@ -171,7 +173,6 @@ $string['renamefilter'] = 'Rename filter \'{$a}\'';
$string['reportbuilder'] = 'Report builder';
$string['reportcreated'] = 'Report created';
$string['reportdeleted'] = 'Report deleted';
-$string['reportsettingstoggle'] = 'Show/hide settings sidebar';
$string['reportsource'] = 'Report source';
$string['reportsource_help'] = 'The report source defines where the data for the report will come from.';
$string['reportupdated'] = 'Report updated';
diff --git a/reportbuilder/amd/build/editor.min.js b/reportbuilder/amd/build/editor.min.js
index 4dde824c2ec..6b0bc1549c0 100644
--- a/reportbuilder/amd/build/editor.min.js
+++ b/reportbuilder/amd/build/editor.min.js
@@ -1,2 +1,2 @@
-function _typeof(a){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){_typeof=function(a){return typeof a}}else{_typeof=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return _typeof(a)}define ("core_reportbuilder/editor",["exports","core/inplace_editable","core/notification","core/pending","core/templates","core_reportbuilder/local/selectors","core_reportbuilder/local/editor/columns","core_reportbuilder/local/editor/conditions","core_reportbuilder/local/editor/filters","core_reportbuilder/local/editor/sorting","core_reportbuilder/local/editor/card_view","core_reportbuilder/local/repository/reports"],function(a,b,c,d,e,f,g,h,i,j,k,l){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.init=void 0;c=o(c);d=o(d);e=o(e);f=n(f);function m(){if("function"!=typeof WeakMap)return null;var a=new WeakMap;m=function(){return a};return a}function n(a){if(a&&a.__esModule){return a}if(null===a||"object"!==_typeof(a)&&"function"!=typeof a){return{default:a}}var b=m();if(b&&b.has(a)){return b.get(a)}var c={},d=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var e in a){if(Object.prototype.hasOwnProperty.call(a,e)){var f=d?Object.getOwnPropertyDescriptor(a,e):null;if(f&&(f.get||f.set)){Object.defineProperty(c,e,f)}else{c[e]=a[e]}}}c.default=a;if(b){b.set(a,c)}return c}function o(a){return a&&a.__esModule?a:{default:a}}var p=!1,q=function(){(0,g.init)(p);(0,h.init)(p);(0,i.init)(p);(0,j.init)(p);(0,k.init)(p);if(p){return}document.addEventListener("click",function(a){var b=a.target.closest(f.actions.toggleEditPreview);if(b){a.preventDefault();var g=a.target.closest(f.regions.report),h=new d.default("core_reportbuilder/reports:get"),i="1"!==b.dataset.editMode,j="";(0,l.getReport)(g.dataset.reportId,i).then(function(a){j=a.javascript;return e.default.render("core_reportbuilder/local/dynamictabs/editor",a)}).then(function(a,b){return e.default.replaceNode(g,a,b+j)}).then(function(){return h.resolve()}).catch(c.default.exception)}});p=!0};a.init=q});
+function _typeof(a){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){_typeof=function(a){return typeof a}}else{_typeof=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return _typeof(a)}define ("core_reportbuilder/editor",["exports","core/inplace_editable","core/notification","core/pending","core/templates","core/str","core/toast","core_reportbuilder/local/selectors","core_reportbuilder/local/editor/columns","core_reportbuilder/local/editor/conditions","core_reportbuilder/local/editor/filters","core_reportbuilder/local/editor/sorting","core_reportbuilder/local/editor/card_view","core_reportbuilder/local/repository/reports","core_reportbuilder/local/repository/modals"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.init=void 0;c=r(c);d=r(d);e=r(e);h=q(h);function p(){if("function"!=typeof WeakMap)return null;var a=new WeakMap;p=function(){return a};return a}function q(a){if(a&&a.__esModule){return a}if(null===a||"object"!==_typeof(a)&&"function"!=typeof a){return{default:a}}var b=p();if(b&&b.has(a)){return b.get(a)}var c={},d=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var e in a){if(Object.prototype.hasOwnProperty.call(a,e)){var f=d?Object.getOwnPropertyDescriptor(a,e):null;if(f&&(f.get||f.set)){Object.defineProperty(c,e,f)}else{c[e]=a[e]}}}c.default=a;if(b){b.set(a,c)}return c}function r(a){return a&&a.__esModule?a:{default:a}}var s=!1,t=function(){(0,i.init)(s);(0,j.init)(s);(0,k.init)(s);(0,l.init)(s);(0,m.init)(s);if(s){return}document.addEventListener("click",function(a){var b=a.target.closest(h.actions.toggleEditPreview);if(b){a.preventDefault();var i=a.target.closest(h.regions.report),j=new d.default("core_reportbuilder/reports:get"),k="1"!==b.dataset.editMode,l="";(0,n.getReport)(i.dataset.reportId,k).then(function(a){l=a.javascript;return e.default.render("core_reportbuilder/local/dynamictabs/editor",a)}).then(function(a,b){return e.default.replaceNode(i,a,b+l)}).then(function(){return j.resolve()}).catch(c.default.exception)}var m=a.target.closest(h.actions.reportEdit);if(m){a.preventDefault();var p=(0,o.createReportModal)(a.target,(0,f.get_string)("editreportdetails","core_reportbuilder"),m.dataset.reportId);p.addEventListener(p.events.FORM_SUBMITTED,function(){(0,f.get_string)("reportupdated","core_reportbuilder").then(g.add).then(function(){return window.location.reload()}).catch(c.default.exception)});p.show()}});s=!0};a.init=t});
//# sourceMappingURL=editor.min.js.map
diff --git a/reportbuilder/amd/build/editor.min.js.map b/reportbuilder/amd/build/editor.min.js.map
index 0f0f1fd9a22..1efd371d667 100644
--- a/reportbuilder/amd/build/editor.min.js.map
+++ b/reportbuilder/amd/build/editor.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/editor.js"],"names":["initialized","init","document","addEventListener","event","toggleEditViewMode","target","closest","reportSelectors","actions","toggleEditPreview","preventDefault","reportElement","regions","report","pendingPromise","Pending","toggledEditMode","dataset","editMode","customjs","reportId","then","response","javascript","Templates","render","html","js","replaceNode","resolve","catch","Notification","exception"],"mappings":"2uBAuBA,a,+DAGA,OACA,OACA,OACA,O,4lBAQIA,CAAAA,CAAW,G,CAKFC,CAAI,CAAG,UAAM,CACtB,WAAkBD,CAAlB,EACA,WAAqBA,CAArB,EACA,WAAkBA,CAAlB,EACA,WAAkBA,CAAlB,EACA,WAAmBA,CAAnB,EAGA,GAAIA,CAAJ,CAAiB,CACb,MACH,CAGDE,QAAQ,CAACC,gBAAT,CAA0B,OAA1B,CAAmC,SAAAC,CAAK,CAAI,CAGxC,GAAMC,CAAAA,CAAkB,CAAGD,CAAK,CAACE,MAAN,CAAaC,OAAb,CAAqBC,CAAe,CAACC,OAAhB,CAAwBC,iBAA7C,CAA3B,CACA,GAAIL,CAAJ,CAAwB,CACpBD,CAAK,CAACO,cAAN,GADoB,GAGdC,CAAAA,CAAa,CAAGR,CAAK,CAACE,MAAN,CAAaC,OAAb,CAAqBC,CAAe,CAACK,OAAhB,CAAwBC,MAA7C,CAHF,CAIdC,CAAc,CAAG,GAAIC,UAAJ,CAAY,gCAAZ,CAJH,CAKdC,CAAe,CAA2C,GAAxC,GAAAZ,CAAkB,CAACa,OAAnB,CAA2BC,QAL/B,CAOhBC,CAAQ,CAAG,EAPK,CASpB,gBAAUR,CAAa,CAACM,OAAd,CAAsBG,QAAhC,CAA0CJ,CAA1C,EACKK,IADL,CACU,SAAAC,CAAQ,CAAI,CACdH,CAAQ,CAAGG,CAAQ,CAACC,UAApB,CACA,MAAOC,WAAUC,MAAV,CAAiB,6CAAjB,CAAgEH,CAAhE,CACV,CAJL,EAKKD,IALL,CAKU,SAACK,CAAD,CAAOC,CAAP,CAAc,CAChB,MAAOH,WAAUI,WAAV,CAAsBjB,CAAtB,CAAqCe,CAArC,CAA2CC,CAAE,CAAGR,CAAhD,CACV,CAPL,EAQKE,IARL,CAQU,iBAAMP,CAAAA,CAAc,CAACe,OAAf,EAAN,CARV,EASKC,KATL,CASWC,UAAaC,SATxB,CAUH,CACJ,CAxBD,EA0BAjC,CAAW,GACd,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 .\n\n/**\n * Report builder editor\n *\n * @module core_reportbuilder/editor\n * @copyright 2021 David Matamoros \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n\"use strict\";\n\nimport 'core/inplace_editable';\nimport Notification from 'core/notification';\nimport Pending from 'core/pending';\nimport Templates from 'core/templates';\nimport * as reportSelectors from 'core_reportbuilder/local/selectors';\nimport {init as columnsEditorInit} from 'core_reportbuilder/local/editor/columns';\nimport {init as conditionsEditorInit} from 'core_reportbuilder/local/editor/conditions';\nimport {init as filtersEditorInit} from 'core_reportbuilder/local/editor/filters';\nimport {init as sortingEditorInit} from 'core_reportbuilder/local/editor/sorting';\nimport {init as cardviewEditorInit} from 'core_reportbuilder/local/editor/card_view';\nimport {getReport} from 'core_reportbuilder/local/repository/reports';\n\nlet initialized = false;\n\n/**\n * Initialise editor and all it's modules\n */\nexport const init = () => {\n columnsEditorInit(initialized);\n conditionsEditorInit(initialized);\n filtersEditorInit(initialized);\n sortingEditorInit(initialized);\n cardviewEditorInit(initialized);\n\n // Ensure we only add our listeners once (can be called multiple times by mustache template).\n if (initialized) {\n return;\n }\n\n // Add event handlers to generic report editor elements.\n document.addEventListener('click', event => {\n\n // Toggle between edit and preview mode.\n const toggleEditViewMode = event.target.closest(reportSelectors.actions.toggleEditPreview);\n if (toggleEditViewMode) {\n event.preventDefault();\n\n const reportElement = event.target.closest(reportSelectors.regions.report);\n const pendingPromise = new Pending('core_reportbuilder/reports:get');\n const toggledEditMode = toggleEditViewMode.dataset.editMode !== \"1\";\n\n let customjs = '';\n\n getReport(reportElement.dataset.reportId, toggledEditMode)\n .then(response => {\n customjs = response.javascript;\n return Templates.render('core_reportbuilder/local/dynamictabs/editor', response);\n })\n .then((html, js) => {\n return Templates.replaceNode(reportElement, html, js + customjs);\n })\n .then(() => pendingPromise.resolve())\n .catch(Notification.exception);\n }\n });\n\n initialized = true;\n};\n"],"file":"editor.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/editor.js"],"names":["initialized","init","document","addEventListener","event","toggleEditViewMode","target","closest","reportSelectors","actions","toggleEditPreview","preventDefault","reportElement","regions","report","pendingPromise","Pending","toggledEditMode","dataset","editMode","customjs","reportId","then","response","javascript","Templates","render","html","js","replaceNode","resolve","catch","Notification","exception","reportEdit","reportModal","events","FORM_SUBMITTED","addToast","window","location","reload","show"],"mappings":"szBAuBA,a,+DAGA,OACA,OACA,OAGA,O,4lBASIA,CAAAA,CAAW,G,CAKFC,CAAI,CAAG,UAAM,CACtB,WAAkBD,CAAlB,EACA,WAAqBA,CAArB,EACA,WAAkBA,CAAlB,EACA,WAAkBA,CAAlB,EACA,WAAmBA,CAAnB,EAGA,GAAIA,CAAJ,CAAiB,CACb,MACH,CAGDE,QAAQ,CAACC,gBAAT,CAA0B,OAA1B,CAAmC,SAAAC,CAAK,CAAI,CAGxC,GAAMC,CAAAA,CAAkB,CAAGD,CAAK,CAACE,MAAN,CAAaC,OAAb,CAAqBC,CAAe,CAACC,OAAhB,CAAwBC,iBAA7C,CAA3B,CACA,GAAIL,CAAJ,CAAwB,CACpBD,CAAK,CAACO,cAAN,GADoB,GAGdC,CAAAA,CAAa,CAAGR,CAAK,CAACE,MAAN,CAAaC,OAAb,CAAqBC,CAAe,CAACK,OAAhB,CAAwBC,MAA7C,CAHF,CAIdC,CAAc,CAAG,GAAIC,UAAJ,CAAY,gCAAZ,CAJH,CAKdC,CAAe,CAA2C,GAAxC,GAAAZ,CAAkB,CAACa,OAAnB,CAA2BC,QAL/B,CAOhBC,CAAQ,CAAG,EAPK,CASpB,gBAAUR,CAAa,CAACM,OAAd,CAAsBG,QAAhC,CAA0CJ,CAA1C,EACKK,IADL,CACU,SAAAC,CAAQ,CAAI,CACdH,CAAQ,CAAGG,CAAQ,CAACC,UAApB,CACA,MAAOC,WAAUC,MAAV,CAAiB,6CAAjB,CAAgEH,CAAhE,CACV,CAJL,EAKKD,IALL,CAKU,SAACK,CAAD,CAAOC,CAAP,CAAc,CAChB,MAAOH,WAAUI,WAAV,CAAsBjB,CAAtB,CAAqCe,CAArC,CAA2CC,CAAE,CAAGR,CAAhD,CACV,CAPL,EAQKE,IARL,CAQU,iBAAMP,CAAAA,CAAc,CAACe,OAAf,EAAN,CARV,EASKC,KATL,CASWC,UAAaC,SATxB,CAUH,CAGD,GAAMC,CAAAA,CAAU,CAAG9B,CAAK,CAACE,MAAN,CAAaC,OAAb,CAAqBC,CAAe,CAACC,OAAhB,CAAwByB,UAA7C,CAAnB,CACA,GAAIA,CAAJ,CAAgB,CACZ9B,CAAK,CAACO,cAAN,GAEA,GAAMwB,CAAAA,CAAW,CAAG,wBAAkB/B,CAAK,CAACE,MAAxB,CAAgC,iBAAU,mBAAV,CAA+B,oBAA/B,CAAhC,CAChB4B,CAAU,CAAChB,OAAX,CAAmBG,QADH,CAApB,CAEAc,CAAW,CAAChC,gBAAZ,CAA6BgC,CAAW,CAACC,MAAZ,CAAmBC,cAAhD,CAAgE,UAAM,CAClE,iBAAU,eAAV,CAA2B,oBAA3B,EACKf,IADL,CACUgB,KADV,EAEKhB,IAFL,CAEU,UAAM,CACR,MAAOiB,CAAAA,MAAM,CAACC,QAAP,CAAgBC,MAAhB,EACV,CAJL,EAKKV,KALL,CAKWC,UAAaC,SALxB,CAMH,CAPD,EAQAE,CAAW,CAACO,IAAZ,EACH,CACJ,CA1CD,EA4CA1C,CAAW,GACd,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 .\n\n/**\n * Report builder editor\n *\n * @module core_reportbuilder/editor\n * @copyright 2021 David Matamoros \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n\"use strict\";\n\nimport 'core/inplace_editable';\nimport Notification from 'core/notification';\nimport Pending from 'core/pending';\nimport Templates from 'core/templates';\nimport {get_string as getString} from 'core/str';\nimport {add as addToast} from 'core/toast';\nimport * as reportSelectors from 'core_reportbuilder/local/selectors';\nimport {init as columnsEditorInit} from 'core_reportbuilder/local/editor/columns';\nimport {init as conditionsEditorInit} from 'core_reportbuilder/local/editor/conditions';\nimport {init as filtersEditorInit} from 'core_reportbuilder/local/editor/filters';\nimport {init as sortingEditorInit} from 'core_reportbuilder/local/editor/sorting';\nimport {init as cardviewEditorInit} from 'core_reportbuilder/local/editor/card_view';\nimport {getReport} from 'core_reportbuilder/local/repository/reports';\nimport {createReportModal} from 'core_reportbuilder/local/repository/modals';\n\nlet initialized = false;\n\n/**\n * Initialise editor and all it's modules\n */\nexport const init = () => {\n columnsEditorInit(initialized);\n conditionsEditorInit(initialized);\n filtersEditorInit(initialized);\n sortingEditorInit(initialized);\n cardviewEditorInit(initialized);\n\n // Ensure we only add our listeners once (can be called multiple times by mustache template).\n if (initialized) {\n return;\n }\n\n // Add event handlers to generic report editor elements.\n document.addEventListener('click', event => {\n\n // Toggle between edit and preview mode.\n const toggleEditViewMode = event.target.closest(reportSelectors.actions.toggleEditPreview);\n if (toggleEditViewMode) {\n event.preventDefault();\n\n const reportElement = event.target.closest(reportSelectors.regions.report);\n const pendingPromise = new Pending('core_reportbuilder/reports:get');\n const toggledEditMode = toggleEditViewMode.dataset.editMode !== \"1\";\n\n let customjs = '';\n\n getReport(reportElement.dataset.reportId, toggledEditMode)\n .then(response => {\n customjs = response.javascript;\n return Templates.render('core_reportbuilder/local/dynamictabs/editor', response);\n })\n .then((html, js) => {\n return Templates.replaceNode(reportElement, html, js + customjs);\n })\n .then(() => pendingPromise.resolve())\n .catch(Notification.exception);\n }\n\n // Edit report details modal.\n const reportEdit = event.target.closest(reportSelectors.actions.reportEdit);\n if (reportEdit) {\n event.preventDefault();\n\n const reportModal = createReportModal(event.target, getString('editreportdetails', 'core_reportbuilder'),\n reportEdit.dataset.reportId);\n reportModal.addEventListener(reportModal.events.FORM_SUBMITTED, () => {\n getString('reportupdated', 'core_reportbuilder')\n .then(addToast)\n .then(() => {\n return window.location.reload();\n })\n .catch(Notification.exception);\n });\n reportModal.show();\n }\n });\n\n initialized = true;\n};\n"],"file":"editor.min.js"}
\ No newline at end of file
diff --git a/reportbuilder/amd/src/editor.js b/reportbuilder/amd/src/editor.js
index 80262f8a4b8..c4c126d6379 100644
--- a/reportbuilder/amd/src/editor.js
+++ b/reportbuilder/amd/src/editor.js
@@ -27,6 +27,8 @@ import 'core/inplace_editable';
import Notification from 'core/notification';
import Pending from 'core/pending';
import Templates from 'core/templates';
+import {get_string as getString} from 'core/str';
+import {add as addToast} from 'core/toast';
import * as reportSelectors from 'core_reportbuilder/local/selectors';
import {init as columnsEditorInit} from 'core_reportbuilder/local/editor/columns';
import {init as conditionsEditorInit} from 'core_reportbuilder/local/editor/conditions';
@@ -34,6 +36,7 @@ import {init as filtersEditorInit} from 'core_reportbuilder/local/editor/filters
import {init as sortingEditorInit} from 'core_reportbuilder/local/editor/sorting';
import {init as cardviewEditorInit} from 'core_reportbuilder/local/editor/card_view';
import {getReport} from 'core_reportbuilder/local/repository/reports';
+import {createReportModal} from 'core_reportbuilder/local/repository/modals';
let initialized = false;
@@ -77,6 +80,24 @@ export const init = () => {
.then(() => pendingPromise.resolve())
.catch(Notification.exception);
}
+
+ // Edit report details modal.
+ const reportEdit = event.target.closest(reportSelectors.actions.reportEdit);
+ if (reportEdit) {
+ event.preventDefault();
+
+ const reportModal = createReportModal(event.target, getString('editreportdetails', 'core_reportbuilder'),
+ reportEdit.dataset.reportId);
+ reportModal.addEventListener(reportModal.events.FORM_SUBMITTED, () => {
+ getString('reportupdated', 'core_reportbuilder')
+ .then(addToast)
+ .then(() => {
+ return window.location.reload();
+ })
+ .catch(Notification.exception);
+ });
+ reportModal.show();
+ }
});
initialized = true;
diff --git a/reportbuilder/classes/output/renderer.php b/reportbuilder/classes/output/renderer.php
index b76f5bc486e..2450c359000 100644
--- a/reportbuilder/classes/output/renderer.php
+++ b/reportbuilder/classes/output/renderer.php
@@ -19,10 +19,12 @@ declare(strict_types=1);
namespace core_reportbuilder\output;
use html_writer;
+use moodle_url;
use plugin_renderer_base;
use core_reportbuilder\table\custom_report_table;
use core_reportbuilder\table\custom_report_table_view;
use core_reportbuilder\table\system_report_table;
+use core_reportbuilder\local\models\report;
/**
* Report renderer class
@@ -113,4 +115,30 @@ class renderer extends plugin_renderer_base {
'data-action' => 'report-create',
]);
}
+
+ /**
+ * Renders full page editor header
+ *
+ * @param report $report
+ * @return string
+ */
+ public function render_fullpage_editor_header(report $report): string {
+ $reportname = $report->get_formatted_name();
+ $editdetailsbutton = html_writer::tag('button', get_string('editdetails', 'core_reportbuilder'), [
+ 'class' => 'btn btn-outline-secondary mr-2',
+ 'data-action' => 'report-edit',
+ 'data-report-id' => $report->get('id')
+ ]);
+ $closebutton = html_writer::link(new moodle_url('/reportbuilder/index.php'), get_string('close', 'core_reportbuilder'), [
+ 'class' => 'btn btn-secondary',
+ 'title' => get_string('closeeditor', 'core_reportbuilder', $reportname),
+ 'role' => 'button'
+ ]);
+ $context = [
+ 'title' => $reportname,
+ 'buttons' => $editdetailsbutton . $closebutton,
+ ];
+
+ return $this->render_from_template('core_reportbuilder/editor_navbar', $context);
+ }
}
diff --git a/reportbuilder/edit.php b/reportbuilder/edit.php
index ae1bfe975c3..d67f04d425e 100644
--- a/reportbuilder/edit.php
+++ b/reportbuilder/edit.php
@@ -44,13 +44,18 @@ permission::require_can_edit_report($report->get_report_persistent());
$PAGE->set_context($report->get_context());
$PAGE->navbar->add(get_string('editreportcontent', 'core_reportbuilder'), $PAGE->url);
+$PAGE->set_pagelayout('popup');
+
+/** @var \core_reportbuilder\output\renderer $renderer */
+$renderer = $PAGE->get_renderer('core_reportbuilder');
$reportname = $report->get_report_persistent()->get_formatted_name();
$PAGE->set_title($reportname);
-$PAGE->set_heading($reportname);
echo $OUTPUT->header();
+echo $renderer->render_fullpage_editor_header($report->get_report_persistent());
+
// Add dynamic tabs.
$tabdata = ['reportid' => $reportid];
$tabs = [
diff --git a/reportbuilder/templates/editor_navbar.mustache b/reportbuilder/templates/editor_navbar.mustache
new file mode 100644
index 00000000000..d1aecf9d2ad
--- /dev/null
+++ b/reportbuilder/templates/editor_navbar.mustache
@@ -0,0 +1,33 @@
+{{!
+ 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 .
+}}
+{{!
+ @template core_reportbuilder/editor_navbar
+
+ This template renders the reportbuilder editor navbar
+
+ Example context (json):
+ {
+ "title": "Report title",
+ "buttons": ""
+ }
+}}
+
diff --git a/reportbuilder/templates/local/dynamictabs/audience.mustache b/reportbuilder/templates/local/dynamictabs/audience.mustache
index 62c74b48562..a8642219e03 100644
--- a/reportbuilder/templates/local/dynamictabs/audience.mustache
+++ b/reportbuilder/templates/local/dynamictabs/audience.mustache
@@ -46,7 +46,7 @@
}
}}