Reworked Vue templates in mustache for readability.

This commit is contained in:
PMKuipers 2024-12-31 09:59:33 +01:00
parent 7d70e9167b
commit 299eb0e881
26 changed files with 118 additions and 89 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,3 +1,3 @@
define("local_treestudyplan/page-myreport",["exports","./vue/vue","./report-viewer-components","./portal-vue/portal-vue.esm","./bootstrap-vue/bootstrap-vue"],(function(_exports,_vue,_reportViewerComponents,_portalVue,_bootstrapVue){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=function(){let type=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"own",arg1=arguments.length>1?arguments[1]:void 0;new _vue.default({el:"#root",data:{studyplans:[],type:type,invitekey:"invited"==type?arg1:null,userid:"other"==type?arg1:null},methods:{}})},_vue=_interopRequireDefault(_vue),_reportViewerComponents=_interopRequireDefault(_reportViewerComponents),_portalVue=_interopRequireDefault(_portalVue),_bootstrapVue=_interopRequireDefault(_bootstrapVue),_vue.default.use(_reportViewerComponents.default),_vue.default.use(_portalVue.default),_vue.default.use(_bootstrapVue.default)}));
define("local_treestudyplan/page-myreport",["exports","./vue/vue","./util/string-helper","./report-viewer-components","./portal-vue/portal-vue.esm","./bootstrap-vue/bootstrap-vue","./util/settings"],(function(_exports,_vue,_stringHelper,_reportViewerComponents,_portalVue,_bootstrapVue,_settings){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=function(){let type=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"own",key=arguments.length>1?arguments[1]:void 0,enableplansharing=arguments.length>2?arguments[2]:void 0;new _vue.default({el:"#root",data:{studyplans:[],type:type,invitekey:"invited"==type?key:null,userid:"other"==type?key:null,text:strings.myreport,enableplansharing:enableplansharing},methods:{}})},_vue=_interopRequireDefault(_vue),_reportViewerComponents=_interopRequireDefault(_reportViewerComponents),_portalVue=_interopRequireDefault(_portalVue),_bootstrapVue=_interopRequireDefault(_bootstrapVue),_vue.default.use(_reportViewerComponents.default),_vue.default.use(_portalVue.default),_vue.default.use(_bootstrapVue.default);let strings=(0,_stringHelper.loadStrings)({myreport:{manageInvites:"manage_invites"}})}));
//# sourceMappingURL=page-myreport.min.js.map

View file

@ -1 +1 @@
{"version":3,"file":"page-myreport.min.js","sources":["../src/page-myreport.js"],"sourcesContent":["/* eslint no-unused-vars: \"off\" */\n/* eslint-env es6*/\n// Put this file in path/to/plugin/amd/src\n// You can call it anything you like\n\nimport Vue from './vue/vue';\n\nimport RVComponents from './report-viewer-components';\nVue.use(RVComponents);\n\nimport PortalVue from './portal-vue/portal-vue.esm';\nVue.use(PortalVue);\nimport BootstrapVue from './bootstrap-vue/bootstrap-vue';\nVue.use(BootstrapVue);\n\n/**\n * Initialize the Page\n * @param {string} type Type of page to show\n * @param {Object} arg1 Argument1 as passed\n */\n export function init(type = \"own\", arg1) {\n let app = new Vue({\n el: '#root',\n data: {\n \"studyplans\": [],\n \"type\": type,\n \"invitekey\": (type == \"invited\") ? arg1 : null,\n \"userid\": (type == \"other\") ? arg1 : null,\n },\n methods: {\n\n },\n });\n\n}\n\n"],"names":["type","arg1","Vue","el","data","methods","use","RVComponents","PortalVue","BootstrapVue"],"mappings":"+YAoBsBA,4DAAO,MAAOC,4CACtB,IAAIC,aAAI,CACdC,GAAI,QACJC,KAAM,YACY,QACNJ,eACc,WAARA,KAAqBC,KAAO,YACvB,SAARD,KAAmBC,KAAO,MAEzCI,QAAS,+NArBbC,IAAIC,8CAGJD,IAAIE,iCAEJF,IAAIG"}
{"version":3,"file":"page-myreport.min.js","sources":["../src/page-myreport.js"],"sourcesContent":["/* eslint no-unused-vars: \"off\" */\n/* eslint-env es6*/\n// Put this file in path/to/plugin/amd/src\n// You can call it anything you like\n\nimport Vue from './vue/vue';\n\nimport {loadStrings} from './util/string-helper';\n\nimport RVComponents from './report-viewer-components';\nVue.use(RVComponents);\nimport PortalVue from './portal-vue/portal-vue.esm';\nVue.use(PortalVue);\nimport BootstrapVue from './bootstrap-vue/bootstrap-vue';\nimport { settings } from './util/settings';\nVue.use(BootstrapVue);\n\nlet strings = loadStrings({\n myreport: {\n manageInvites: \"manage_invites\",\n },\n});\n\n/**\n * Initialize the Page\n * @param {string} type Type of page to show\n * @param {Object} key Invitekey or userid of another user\n * @param {boolean} enableplansharing True if studyplan sharing is enabled\n */\n export function init(type = \"own\", key, enableplansharing) {\n let app = new Vue({\n el: '#root',\n data: {\n studyplans: [],\n type: type,\n invitekey: (type == \"invited\") ? key : null,\n userid: (type == \"other\") ? key : null,\n text: strings.myreport,\n enableplansharing: enableplansharing,\n },\n methods: {\n },\n });\n\n}\n\n"],"names":["type","key","enableplansharing","Vue","el","data","studyplans","invitekey","userid","text","strings","myreport","methods","use","RVComponents","PortalVue","BootstrapVue","manageInvites"],"mappings":"gdA6BsBA,4DAAO,MAAOC,2CAAKC,yDAC3B,IAAIC,aAAI,CACdC,GAAI,QACJC,KAAM,CACFC,WAAY,GACZN,KAAMA,KACNO,UAAoB,WAARP,KAAqBC,IAAM,KACvCO,OAAiB,SAARR,KAAmBC,IAAM,KAClCQ,KAAMC,QAAQC,SACdT,kBAAmBA,mBAEvBU,QAAS,+NA9BbC,IAAIC,8CAEJD,IAAIE,iCAGJF,IAAIG,2BAEJN,SAAU,6BAAY,CACtBC,SAAU,CACNM,cAAe"}

View file

@ -1,3 +1,3 @@
define("local_treestudyplan/page-result-overview",["exports","core/ajax","core/notification","./vue/vue","./util/debugger","./util/string-helper","./studyplan-report-components","./report-viewer-components","./modedit-modal","./portal-vue/portal-vue.esm","./bootstrap-vue/bootstrap-vue"],(function(_exports,_ajax,_notification,_vue,_debugger,_stringHelper,_studyplanReportComponents,_reportViewerComponents,_modeditModal,_portalVue,_bootstrapVue){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=function(studyplanid,pageid,firstperiod,lastperiod){if(void 0===pageid||!Number.isInteger(Number(pageid))||void 0===studyplanid||!Number.isInteger(Number(studyplanid)))return void debug.error("Error: studyplan id and page id not provided as integer numbers to script.",studyplanid,pageid,firstperiod,lastperiod);studyplanid=Number(studyplanid),pageid=Number(pageid);new _vue.default({el:"#root",data:{structure:null,studyplan:null,page:null,text:strings.studyplanReport},created(){this.loadStructure(pageid,firstperiod,lastperiod)},computed:{},methods:{loadStructure(pageid,firstperiod,lastperiod){const self=this;this.structure=null,(0,_ajax.call)([{methodname:"local_treestudyplan_get_report_structure",args:{pageid:pageid,firstperiod:firstperiod,lastperiod:lastperiod}}])[0].then((response=>{self.structure=response,self.studyplan=response.studyplan,self.page=response.page})).catch(_notification.default.exception)},selectedPage(e){debug.info("SelectedPage",e);const pageid=e.target.value;this.loadStructure(pageid)},selectedFirstPeriod(e){debug.info("selectedFirstPeriod",e);let f=e.target.value,l=this.structure.lastperiod;l<f&&(l=f),this.loadStructure(this.page.id,f,l)},selectedLastPeriod(e){debug.info("selectedLastPeriod",e);let f=this.structure.firstperiod,l=e.target.value;l<f&&(l=f),this.loadStructure(this.page.id,f,l)}}})},_notification=_interopRequireDefault(_notification),_vue=_interopRequireDefault(_vue),_debugger=_interopRequireDefault(_debugger),_studyplanReportComponents=_interopRequireDefault(_studyplanReportComponents),_reportViewerComponents=_interopRequireDefault(_reportViewerComponents),_modeditModal=_interopRequireDefault(_modeditModal),_portalVue=_interopRequireDefault(_portalVue),_bootstrapVue=_interopRequireDefault(_bootstrapVue),_vue.default.use(_studyplanReportComponents.default),_vue.default.use(_reportViewerComponents.default),_vue.default.use(_modeditModal.default),_vue.default.use(_portalVue.default),_vue.default.use(_bootstrapVue.default);let debug=new _debugger.default("treestudyplanviewer"),strings=(0,_stringHelper.loadStrings)({studyplanReport:{studyplan:"studyplan",page:"studyplanpage",periods:"periods",period:"period",loading:"loading@core",all:"all@core",from:"from@core",to:"to@core"}})}));
define("local_treestudyplan/page-result-overview",["exports","core/ajax","core/notification","./vue/vue","./util/debugger","./util/string-helper","./studyplan-report-components","./report-viewer-components","./modedit-modal","./portal-vue/portal-vue.esm","./bootstrap-vue/bootstrap-vue"],(function(_exports,_ajax,_notification,_vue,_debugger,_stringHelper,_studyplanReportComponents,_reportViewerComponents,_modeditModal,_portalVue,_bootstrapVue){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=function(studyplanid,pageid,contextname,studyplanname,pagename,firstperiod,lastperiod){if(void 0===pageid||!Number.isInteger(Number(pageid))||void 0===studyplanid||!Number.isInteger(Number(studyplanid)))return void debug.error("Error: studyplan id and page id not provided as integer numbers to script.",studyplanid,pageid,firstperiod,lastperiod);studyplanid=Number(studyplanid),pageid=Number(pageid);new _vue.default({el:"#root",data:{structure:null,studyplan:null,page:null,text:strings.studyplanReport,contextname:contextname,studyplanname:studyplanname,pagename:pagename},created(){this.loadStructure(pageid,firstperiod,lastperiod)},methods:{loadStructure(pageid,firstperiod,lastperiod){const self=this;this.structure=null,(0,_ajax.call)([{methodname:"local_treestudyplan_get_report_structure",args:{pageid:pageid,firstperiod:firstperiod,lastperiod:lastperiod}}])[0].then((response=>{self.structure=response,self.studyplan=response.studyplan,self.page=response.page})).catch(_notification.default.exception)},selectedPage(e){debug.info("SelectedPage",e);const pageid=e.target.value;this.loadStructure(pageid)},selectedFirstPeriod(e){debug.info("selectedFirstPeriod",e);let f=e.target.value,l=this.structure.lastperiod;l<f&&(l=f),this.loadStructure(this.page.id,f,l)},selectedLastPeriod(e){debug.info("selectedLastPeriod",e);let f=this.structure.firstperiod,l=e.target.value;l<f&&(l=f),this.loadStructure(this.page.id,f,l)}}})},_notification=_interopRequireDefault(_notification),_vue=_interopRequireDefault(_vue),_debugger=_interopRequireDefault(_debugger),_studyplanReportComponents=_interopRequireDefault(_studyplanReportComponents),_reportViewerComponents=_interopRequireDefault(_reportViewerComponents),_modeditModal=_interopRequireDefault(_modeditModal),_portalVue=_interopRequireDefault(_portalVue),_bootstrapVue=_interopRequireDefault(_bootstrapVue),_vue.default.use(_studyplanReportComponents.default),_vue.default.use(_reportViewerComponents.default),_vue.default.use(_modeditModal.default),_vue.default.use(_portalVue.default),_vue.default.use(_bootstrapVue.default);let debug=new _debugger.default("treestudyplanviewer"),strings=(0,_stringHelper.loadStrings)({studyplanReport:{studyplan:"studyplan",page:"studyplanpage",periods:"periods",period:"period",loading:"loading@core",all:"all@core",from:"from@core",to:"to@core"}})}));
//# sourceMappingURL=page-result-overview.min.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -41,6 +41,10 @@ let debug = new Debugger("treestudyplancoach");
let strings = loadStrings({
coach: {
back: "back",
selectstudentBtn: "selectstudent_btn",
coacheditmode: "coacheditmode",
showoverview: "showoverview",
},
});

View file

@ -55,6 +55,11 @@ let strings = loadStrings({
'advanced_import_from_file': 'advanced_import_from_file',
'advanced_create_from_template': 'advanced_create_from_template',
'studyplan_add': "studyplan_add",
'loading': "loading@core",
'back': "back",
'studyplanSelect': "studyplan_select",
'defaultaggregation': "defaultaggregation",
'studyplanNoneselected': "studyplan_noneselected",
},
});
@ -62,9 +67,10 @@ let strings = loadStrings({
* Initialize the Page
* @param {int} contextid The context we should attempt to work in (1:1 related to the category)
* @param {int} categoryid The category we shoud attempt to work in (1:1 related to the context)
* @param {string} contextname Name of the current context
* @param {object} options Options to be passed to this script
*/
export function init(contextid, categoryid, options) {
export function init(contextid, categoryid, contextname, options) {
// Make sure the id's are numeric and integer
if (undefined === contextid || !Number.isInteger(Number(contextid)) || contextid < 1) {
contextid = 1;
@ -111,7 +117,7 @@ export function init(contextid, categoryid, options) {
loadingstudyplan: false,
studyplans: [],
templatecount: 0,
contextname: contextname,
text: strings.studyplan,
usedcontexts: [],
},

View file

@ -5,30 +5,40 @@
import Vue from './vue/vue';
import {loadStrings} from './util/string-helper';
import RVComponents from './report-viewer-components';
Vue.use(RVComponents);
import PortalVue from './portal-vue/portal-vue.esm';
Vue.use(PortalVue);
import BootstrapVue from './bootstrap-vue/bootstrap-vue';
import { settings } from './util/settings';
Vue.use(BootstrapVue);
let strings = loadStrings({
myreport: {
manageInvites: "manage_invites",
},
});
/**
* Initialize the Page
* @param {string} type Type of page to show
* @param {Object} arg1 Argument1 as passed
* @param {Object} key Invitekey or userid of another user
* @param {boolean} enableplansharing True if studyplan sharing is enabled
*/
export function init(type = "own", arg1) {
export function init(type = "own", key, enableplansharing) {
let app = new Vue({
el: '#root',
data: {
"studyplans": [],
"type": type,
"invitekey": (type == "invited") ? arg1 : null,
"userid": (type == "other") ? arg1 : null,
studyplans: [],
type: type,
invitekey: (type == "invited") ? key : null,
userid: (type == "other") ? key : null,
text: strings.myreport,
enableplansharing: enableplansharing,
},
methods: {
},
});

View file

@ -25,7 +25,6 @@ Vue.use(PortalVue);
import BootstrapVue from './bootstrap-vue/bootstrap-vue';
Vue.use(BootstrapVue);
let debug = new Debugger("treestudyplanviewer");
let strings = loadStrings({
@ -45,10 +44,14 @@ let strings = loadStrings({
* Initialize the Page
* @param {Number} studyplanid The id of the studyplan we need to view
* @param {Number} pageid The id of the studyplan page we need to view
* @param {string} contextname The name of the current context
* @param {string} studyplanname The name of the current studyplan
* @param {string} pagename The name of the current page
* @param {Number} firstperiod The number of the first period to view
* @param {Number} lastperiod The number of the last period to view
*/
export function init(studyplanid, pageid, firstperiod, lastperiod) {
export function init(studyplanid, pageid, contextname, studyplanname,
pagename, firstperiod, lastperiod) {
if (undefined === pageid || !Number.isInteger(Number(pageid)) ||
undefined === studyplanid || !Number.isInteger(Number(studyplanid))) {
debug.error("Error: studyplan id and page id not provided as integer numbers to script.",
@ -67,13 +70,13 @@ export function init(studyplanid, pageid, firstperiod, lastperiod) {
studyplan: null,
page: null,
text: strings.studyplanReport,
contextname: contextname,
studyplanname: studyplanname,
pagename: pagename,
},
created() {
// On creation, load the page as specified
this.loadStructure(pageid, firstperiod, lastperiod);
},
computed: {
},
methods: {
loadStructure(pageid, firstperiod, lastperiod) {

View file

@ -32,6 +32,12 @@ let debug = new Debugger("treestudyplanviewer");
let strings = loadStrings({
studyplan: {
studyplanSelectPlaceholder: 'studyplan_select_placeholder',
loading: "loading@core",
back: "back",
studyplanSelect: "studyplan_select",
selectstudentBtn: "selectstudent_btn",
studyplanNoneselected: "studyplan_noneselected",
showoverview: "showoverview"
},
});
@ -39,8 +45,9 @@ let strings = loadStrings({
* Initialize the Page
* @param {number} contextid The context we should attempt to work in (1:1 related to the category)
* @param {number} categoryid The category we shoud attempt to work in (1:1 related to the context)
* @param {string} contextname Name of the current context
*/
export function init(contextid, categoryid) {
export function init(contextid, categoryid, contextname) {
// Make sure the id's are numeric and integer
if (undefined === contextid || !Number.isInteger(Number(contextid)) || contextid < 1) {
contextid = 1;
@ -72,6 +79,7 @@ export function init(contextid, categoryid) {
right: true,
},
usedcontexts: [],
contextname: contextname
},
async mounted() {
call([{

View file

@ -48,5 +48,5 @@ if ($CFG->debugdeveloper) {
$PAGE->requires->js_call_amd('local_treestudyplan/page-coach', 'init', []);
print $OUTPUT->header();
print $OUTPUT->render_from_template('local_treestudyplan/edit_plan', []);
print $OUTPUT->render_from_template('local_treestudyplan/coach', []);
print $OUTPUT->footer();

View file

@ -108,9 +108,14 @@ $PAGE->requires->css(new moodle_url($CFG->wwwroot.'/local/treestudyplan/css/boot
if ($CFG->debugdeveloper) {
$PAGE->requires->css(new moodle_url($CFG->wwwroot.'/local/treestudyplan/css/devstyles.css'));
}
$PAGE->requires->js_call_amd('local_treestudyplan/page-edit-plan', 'init', [$studyplancontext->id, $categoryid, [
"defaultAggregation" => get_config("local_treestudyplan", "aggregation_mode"),
]]);
$PAGE->requires->js_call_amd('local_treestudyplan/page-edit-plan', 'init', [
$studyplancontext->id,
$categoryid,
$contextname,
[
"defaultAggregation" => get_config("local_treestudyplan", "aggregation_mode"),
]
]);
print $OUTPUT->header();
print $OUTPUT->render_from_template('local_treestudyplan/edit_plan', ["contextname" => $contextname]);

View file

@ -224,7 +224,7 @@ $string["studyplan_slots"] = 'Number of columns in plan';
$string["studyplan_periods"] = 'Number of periods in plan';
$string["studyplan_startdate"] = 'Start date of plan';
$string["studyplan_enddate"] = 'End date of plan';
$string["studyplan_noneselected"] = "Pick a study plan to start editing";
$string["studyplan_noneselected"] = "Pick a study plan";
$string["studyplan_select"] = "Study plan:";
$string["studyplan_select_placeholder"] = "Select study plan";
$string["studyplan_suspend"] = 'Suspend study plan';

View file

@ -47,17 +47,15 @@ if ($amteaching) {
$PAGE->set_heading(get_string('report_invited', 'local_treestudyplan', "{$USER->firstname} {$USER->lastname}"));
}
$enableplansharing = get_config("local_treestudyplan", "enableplansharing") && !$amteaching;
// Load javascripts and specific css.
$PAGE->requires->css(new moodle_url($CFG->wwwroot.'/local/treestudyplan/css/bootstrap-vue/bootstrap-vue.css'));
if ($CFG->debugdeveloper) {
$PAGE->requires->css(new moodle_url($CFG->wwwroot.'/local/treestudyplan/css/devstyles.css'));
}
$PAGE->requires->js_call_amd('local_treestudyplan/page-myreport', 'init', [$amteaching ? 'teaching' : 'own']);
$PAGE->requires->js_call_amd('local_treestudyplan/page-myreport', 'init', [$amteaching ? 'teaching' : 'own', null, $enableplansharing]);
print $OUTPUT->header();
$data = new \stdClass;
$data->enableplansharing = get_config("local_treestudyplan", "enableplansharing") && !$amteaching;
$data->teachermode = $amteaching;
print $OUTPUT->render_from_template('local_treestudyplan/myreport', $data);
print $OUTPUT->render_from_template('local_treestudyplan/myreport', []);
print $OUTPUT->footer();

View file

@ -59,7 +59,14 @@ if ($CFG->debugdeveloper) {
$PAGE->requires->js_call_amd(
'local_treestudyplan/page-result-overview',
'init',
[$studyplan->id(), $page->id(), $firstperiod, $lastperiod]
[
$studyplan->id(),
$page->id(),
$contextname,
$studyplan->name(),
$page->fullname(),
$firstperiod,
$lastperiod]
);
print $OUTPUT->header();

View file

@ -30,7 +30,6 @@
Example context (json):
{
"contextname": "System",
}
}}
{{! Next line replaces mustache double curly braces with << and >> for this template,
@ -46,13 +45,13 @@ so it does not mess up vue double curly braces}}
<div class="m-buttonbar" style="margin-bottom: 1em;">
<template v-if="displayedstudyplan">
<a href='#' @click.prevent='closeStudyplan'
><i style='font-size: 150%;' class='fa fa-chevron-left'></i> <<#str>> back, local_treestudyplan <</str>></a>
><i style='font-size: 150%;' class='fa fa-chevron-left'></i> {{text.back}}</a>
<s-studyplan-details
v-model="displayedstudyplan"
v-if="displayedstudyplan.description"
></s-studyplan-details>
<div class="flex-grow-1"><!-- Spacer to align student selector right --></div>
<span><<#str>> selectstudent_btn, local_treestudyplan <</str>></span>
<span>{{text.selectstudentBtn}}</span>
<s-prevnext-selector
:options="associatedstudents"
title="firstname"
@ -66,7 +65,7 @@ so it does not mess up vue double curly braces}}
variant="primary"
>
<template v-slot="{value}">{{value.firstname}} {{value.lastname}}</template>
<template #defaultlabel><span class='text-primary'><<#str>> coacheditmode, local_treestudyplan <</str>></span></template>
<template #defaultlabel><span class='text-primary'>{{text.coacheditmode}}</span></template>
</s-prevnext-selector>
</template>
</div>
@ -74,7 +73,7 @@ so it does not mess up vue double curly braces}}
<h2 v-if='displayedstudyplan&& selectedstudent'
><span v-if="studentcount > 1">{{selectedstudent.firstname}} {{selectedstudent.lastname}} - </span
>{{displayedstudyplan.name}}</h2>
<h2 v-else-if='displayedstudyplan'><<#str>> showoverview, local_treestudyplan <</str>> - {{displayedstudyplan.name}}</h2>
<h2 v-else-if='displayedstudyplan'>{{text.showoverview}} - {{displayedstudyplan.name}}</h2>
<template v-if="!loadingstudyplan && displayedstudyplan">
<r-studyplan v-if="selectedstudent"
v-model='displayedstudyplan'

View file

@ -30,7 +30,6 @@
Example context (json):
{
"contextname": "System",
}
}}
{{! Next line replaces mustache double curly braces with << and >> for this template,
@ -44,11 +43,11 @@ so it does not mess up vue double curly braces}}
</div>
<div v-cloak>
<div v-if='!activestudyplan && usedcontexts && !loadingstudyplan' class='ml-3 mb-3 s-context-selector'>
<b-form-select text='<< contextname >>' :value="contextid" @change='switchContext'
<b-form-select :text='contextname' :value="contextid" @change='switchContext'
:class="(!(usedcontexts.length)) ? 'text-primary' : ''">
<b-form-select-option v-if='!(usedcontexts.length)' :value="contextid"
:class="'text-primary'">
<span><<#str>> loading, core<</str>>...</span></b-form-select-option>
<span>{{text.loading}}...</span></b-form-select-option>
<b-form-select-option v-for='ctx in usedcontexts' :key='ctx.id' :value="ctx.context_id"
:class="(ctx.studyplancount > 0) ? 'font-weight-bold' : ''"
><span v-for="(p, i) in ctx.category.path"
@ -60,11 +59,11 @@ so it does not mess up vue double curly braces}}
class="spinner-border text-primary" role="status"></div>
</div>
<h3 v-else><< contextname >></h3>
<h3 v-else>{{contextname}}</h3>
<div class="m-buttonbar" style="margin-bottom: 1em;">
<a href='#' v-if='activestudyplan' @click.prevent='closeStudyplan'
><i style='font-size: 150%;' class='fa fa-chevron-left'></i> <<#str>> back, local_treestudyplan <</str>></a>
<span v-if='activestudyplan'><<#str>> studyplan_select, local_treestudyplan <</str>></span>&nbsp;
><i style='font-size: 150%;' class='fa fa-chevron-left'></i> {{text.back}}</a>
<span v-if='activestudyplan'>{{text.studyplanSelect}}</span>&nbsp;
<b-form-select v-if='activestudyplan' lazy :text='dropdownTitle' :value='activestudyplan.id' @change="selectStudyplan">
<b-form-select-option
v-for='(studyplan, planindex) in studyplans'
@ -79,7 +78,7 @@ so it does not mess up vue double curly braces}}
v-model="create.studyplan"
type="button"
variant="primary"
default-aggregation="<<#str>> defaultaggregation, local_treestudyplan <</str>>"
:default-aggregation="text.degaultaggregation"
:contextid='contextid'
><i class='fa fa-plus'></i> {{ text.studyplan_add }}</t-studyplan-edit>
<b-button
@ -106,7 +105,7 @@ so it does not mess up vue double curly braces}}
<span class="sr-only">Loading...</span>
</div>
<div v-else class='t-studyplan-notselected'>
<p><<#str>> studyplan_noneselected, local_treestudyplan <</str>></p>
<p>{{text.studyplanNoneselected}}</p>
<b-card-group deck>
<s-studyplan-card
v-for='(studyplan, planindex) in studyplans'

View file

@ -37,26 +37,18 @@
{{! Next line replaces mustache double curly braces with << and >> for this template,
so it does not mess up vue double curly braces}}
{{= << >> =}}
<div class="local_treestudyplan_myreport">
<div class="m-buttonbar" style="margin-bottom: 1em; text-align: right;">
<<#enableplansharing>>
<a class="btn btn-primary" href="invitations.php" id="manage_invites">
&nbsp;<i class="fa fa-share"></i>&nbsp;<<#str>> manage_invites, local_treestudyplan <</str>></a>
<</enableplansharing>>
<div id="root" class="local_treestudyplan_myreport">
<div class='vue-loader' v-show='false'>
<div class='spinner-border text-primary' role='status'>
<span class='sr-only'>Loading...</span>
</div>
</div>
<div id='root'>
<div class='vue-loader' v-show='false'>
<div class='spinner-border text-primary' role='status'>
<span class='sr-only'>Loading...</span>
</div>
</div>
<div v-cloak>
<<#teachermode>>
<r-report type='teaching' teachermode ></r-report>
<</teachermode>>
<<^teachermode>>
<r-report type='own' :userid='userid'></r-report>
<</teachermode>>
<div v-cloak>
<div v-if="enableplansharing" class="m-buttonbar" style="margin-bottom: 1em; text-align: right;">
<a class="btn btn-primary" href="invitations.php" id="manage_invites">
&nbsp;<i class="fa fa-share"></i>&nbsp;{{text.manageInvites}}</a>
</div>
<r-report v-if="type == 'teaching'", type='teaching' teachermode ></r-report>
<r-report v-else type='own' :userid='userid'></r-report>
</div>
</div>

View file

@ -30,19 +30,12 @@
Example context (json):
{
"contextname": "System",
"studyplanname": "Name of studyplan",
"pagename": "Name of studyplan page"
}
}}
{{! Next line replaces mustache double curly braces with << and >> for this template,
so it does not mess up vue double curly braces in the rest of the code.}}
{{= << >> =}}
<div class="local_treestudyplan_result_overview">
<h3><b><<contextname>></b> / <<studyplanname>></h3>
<<#pagename>>
<h4><<pagename>></h4>
<</pagename>>
<div id='root'>
<div class='vue-loader' v-show='false'>
<div class='spinner-border text-primary' role='status'>
@ -50,6 +43,8 @@ so it does not mess up vue double curly braces in the rest of the code.}}
</div>
</div>
<div v-cloak>
<h3><b>{{contextname}}</b> / {{studyplanname}}</h3>
<h4 v-if="pagename != studplanname">{{pagename}}</h4>
<div class='vue-loader' v-if='!structure'>
<div class='spinner-border text-primary' role='status'>
<span class='sr-only'>Loading...</span>

View file

@ -30,7 +30,6 @@
Example context (json):
{
"contextname": "System",
}
}}
{{! Next line replaces mustache double curly braces with << and >> for this template,
@ -44,11 +43,11 @@ so it does not mess up vue double curly braces}}
</div>
<div v-cloak>
<div v-if='!activestudyplan && usedcontexts' class='ml-3 mb-3 s-context-selector'>
<b-form-select text='<< contextname >>' :value="contextid" @change='switchContext'
<b-form-select :text='contextname' :value="contextid" @change='switchContext'
:class="(!(usedcontexts.length)) ? 'text-primary' : ''">
<b-form-select-option v-if='!(usedcontexts.length)' :value="contextid"
:class="'text-primary'">
<span><<#str>> loading, core <</str>>...</span></b-form-select-option>
<span>{{text.loading}}...</span></b-form-select-option>
<b-form-select-option v-for='ctx in usedcontexts' :key='ctx.id' :value="ctx.context_id"
:class="(ctx.studyplancount > 0) ? 'font-weight-bold' : ''"
><span v-for="(p, i) in ctx.category.path"><span v-if="i>0"> / </span>{{ p }}</span>
@ -58,12 +57,12 @@ so it does not mess up vue double curly braces}}
style="position: relative; top: 0.3rem; width: 1.2rem; height: 1.2rem; font-size: 0.7rem;"
class="spinner-border text-primary" role="status"></div>
</div>
<h3 v-else><<contextname>></h3>
<h3 v-else>{{contextname}}</h3>
<div class="m-buttonbar" style="margin-bottom: 1em;">
<template v-if="displayedstudyplan">
<a href='#' @click.prevent='closeStudyplan'
><i style='font-size: 150%;' class='fa fa-chevron-left'></i> <<#str>> back, local_treestudyplan <</str>></a>
<span><<#str>> studyplan_select, local_treestudyplan <</str>></span>&nbsp;
><i style='font-size: 150%;' class='fa fa-chevron-left'></i> {{text.back}}</a>
<span>{{text.studyplanSelect}}</span>&nbsp;
<b-form-select lazy :text='dropdownTitle' :value='displayedstudyplan.id'>
<b-form-select-option
v-for='(studyplan, planindex) in studyplans'
@ -78,7 +77,7 @@ so it does not mess up vue double curly braces}}
></s-studyplan-details>
<div class="flex-grow-1"><!-- Spacer to align student selector right --></div>
<div>
<span><<#str>> selectstudent_btn, local_treestudyplan <</str>></span>
<span>{{text.selectstudentBtn}}</span>
<s-prevnext-selector
:options="associatedstudents"
title="firstname"
@ -92,7 +91,7 @@ so it does not mess up vue double curly braces}}
variant="primary"
>
<template v-slot="{value}">{{value.firstname}} {{value.lastname}}</template>
<template #defaultlabel><span class='text-primary'><<#str>> showoverview, local_treestudyplan <</str>></span></template>
<template #defaultlabel><span class='text-primary'>{{text.showoverview}}</span></template>
</s-prevnext-selector>
</div>
</template>
@ -100,7 +99,7 @@ so it does not mess up vue double curly braces}}
<div class='t-studyplan-container'>
<h2 v-if='displayedstudyplan&& selectedstudent'
>{{selectedstudent.firstname}} {{selectedstudent.lastname}} - {{displayedstudyplan.name}}</h2>
<h2 v-else-if='displayedstudyplan'><<#str>> showoverview, local_treestudyplan <</str>> - {{displayedstudyplan.name}}</h2>
<h2 v-else-if='displayedstudyplan'>{{text.showoverview}} - {{displayedstudyplan.name}}</h2>
<r-studyplan v-if='!loadingstudyplan && displayedstudyplan'
v-model='displayedstudyplan' :teachermode='!selectedstudent'
></r-studyplan>
@ -108,7 +107,7 @@ so it does not mess up vue double curly braces}}
<span class="sr-only">Loading...</span>
</div>
<div v-else class='t-studyplan-notselected'>
<p><<#str>> studyplan_noneselected, local_treestudyplan <</str>></p>
<p>{{text.studyplanNoneselected}}</p>
<b-card-group deck>
<s-studyplan-card
v-for='(studyplan, planindex) in studyplans'

View file

@ -110,8 +110,12 @@ $PAGE->requires->css(new moodle_url($CFG->wwwroot.'/local/treestudyplan/css/boot
if ($CFG->debugdeveloper) {
$PAGE->requires->css(new moodle_url($CFG->wwwroot.'/local/treestudyplan/css/devstyles.css'));
}
$PAGE->requires->js_call_amd('local_treestudyplan/page-view-plan', 'init', [$studyplancontext->id, $categoryid]);
$PAGE->requires->js_call_amd('local_treestudyplan/page-view-plan', 'init', [
$studyplancontext->id,
$categoryid,
$contextname
]);
print $OUTPUT->header();
print $OUTPUT->render_from_template('local_treestudyplan/view_plan', ["contextname" => $contextname]);
print $OUTPUT->render_from_template('local_treestudyplan/view_plan', []);
print $OUTPUT->footer();