Merge branch 'MDL-66477-master' of git://github.com/junpataleta/moodle

This commit is contained in:
Adrian Greeve 2019-10-02 16:15:13 +08:00
commit 8fec1626d0
53 changed files with 1007 additions and 188 deletions

2
lib/amd/build/drawer.min.js vendored Normal file
View File

@ -0,0 +1,2 @@
define ("core/drawer",["exports","jquery","core/pubsub","core/drawer_events"],function(a,b,c,d){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;b=e(b);c=function(a){if(a&&a.__esModule){return a}else{var b={};if(null!=a){for(var c in a){if(Object.prototype.hasOwnProperty.call(a,c)){var d=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(a,c):{};if(d.get||d.set){Object.defineProperty(b,c,d)}else{b[c]=a[c]}}}}b.default=a;return b}}(c);d=e(d);function e(a){return a&&a.__esModule?a:{default:a}}var f=function(a){a.removeClass("hidden");a.attr("aria-expanded",!0);a.attr("aria-hidden",!1);a.focus();c.publish(d.default.DRAWER_SHOWN,a)},g=function(a){a.addClass("hidden");a.attr("aria-expanded",!1);a.attr("aria-hidden",!0);c.publish(d.default.DRAWER_HIDDEN,a)},h=function(a){var b=a.hasClass("hidden");return!b},i=function(a){if(h(a)){g(a)}else{f(a)}},j=function(a){a=(0,b.default)(a);return a.closest("[data-region=\"right-hand-drawer\"]")};a.default={hide:g,show:f,isVisible:h,toggle:i,registerToggles:function registerToggles(a,b){var c=null;b.attr("aria-expanded",h(a));b.on("click",function(d){d.preventDefault();var e=h(a);i(a);b.attr("aria-expanded",!e);if(!e){c=b.filter(function(a,b){return b==d.target||b.contains(d.target)})}else if(c){c.focus();c=null}})},getDrawerRoot:j};return a.default});
//# sourceMappingURL=drawer.min.js.map

File diff suppressed because one or more lines are too long

2
lib/amd/build/drawer_events.min.js vendored Normal file
View File

@ -0,0 +1,2 @@
define ("core/drawer_events",["exports"],function(a){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;a.default={DRAWER_SHOWN:"drawer-shown",DRAWER_HIDDEN:"drawer-hidden"};return a.default});
//# sourceMappingURL=drawer_events.min.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../src/drawer_events.js"],"names":["DRAWER_SHOWN","DRAWER_HIDDEN"],"mappings":"8IAuBe,CACXA,YAAY,CAAE,cADH,CAEXC,aAAa,CAAE,eAFJ,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 * Events for the drawer.\n *\n * @module core/drawer_events\n * @package core\n * @copyright 2019 Jun Pataleta <jun@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nexport default {\n DRAWER_SHOWN: 'drawer-shown',\n DRAWER_HIDDEN: 'drawer-hidden',\n};\n"],"file":"drawer_events.min.js"}

125
lib/amd/src/drawer.js Normal file
View File

@ -0,0 +1,125 @@
// 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/>.
/**
* Controls the drawer.
*
* @module core/drawer
* @copyright 2019 Jun Pataleta <jun@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
import $ from 'jquery';
import * as PubSub from 'core/pubsub';
import DrawerEvents from 'core/drawer_events';
/**
* Show the drawer.
*
* @param {Object} root The drawer container.
*/
const show = (root) => {
root.removeClass('hidden');
root.attr('aria-expanded', true);
root.attr('aria-hidden', false);
root.focus();
PubSub.publish(DrawerEvents.DRAWER_SHOWN, root);
};
/**
* Hide the drawer.
*
* @param {Object} root The drawer container.
*/
const hide = (root) => {
root.addClass('hidden');
root.attr('aria-expanded', false);
root.attr('aria-hidden', true);
PubSub.publish(DrawerEvents.DRAWER_HIDDEN, root);
};
/**
* Check if the drawer is visible.
*
* @param {Object} root The drawer container.
* @return {boolean}
*/
const isVisible = (root) => {
let isHidden = root.hasClass('hidden');
return !isHidden;
};
/**
* Toggle the drawer visibility.
*
* @param {Object} root The drawer container.
*/
const toggle = (root) => {
if (isVisible(root)) {
hide(root);
} else {
show(root);
}
};
/**
* Add event listeners to toggle the drawer.
*
* @param {Object} root The drawer container.
* @param {Object} toggleElements The toggle elements.
*/
const registerToggles = (root, toggleElements) => {
let openTrigger = null;
toggleElements.attr('aria-expanded', isVisible(root));
toggleElements.on('click', (e) => {
e.preventDefault();
const wasVisible = isVisible(root);
toggle(root);
toggleElements.attr('aria-expanded', !wasVisible);
if (!wasVisible) {
// Remember which trigger element opened the drawer.
openTrigger = toggleElements.filter((index, element) => {
return element == e.target || element.contains(e.target);
});
} else if (openTrigger) {
// The drawer has gone from open to close so we need to set the focus back
// to the element that openend it.
openTrigger.focus();
openTrigger = null;
}
});
};
/**
* Find the root element of the drawer based on the using the drawer content root's ID.
*
* @param {Object} contentRoot The drawer content's root element.
* @returns {*|jQuery}
*/
const getDrawerRoot = (contentRoot) => {
contentRoot = $(contentRoot);
return contentRoot.closest('[data-region="right-hand-drawer"]');
};
export default {
hide: hide,
show: show,
isVisible: isVisible,
toggle: toggle,
registerToggles: registerToggles,
getDrawerRoot: getDrawerRoot
};

View File

@ -0,0 +1,27 @@
// 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/>.
/**
* Events for the drawer.
*
* @module core/drawer_events
* @package core
* @copyright 2019 Jun Pataleta <jun@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
export default {
DRAWER_SHOWN: 'drawer-shown',
DRAWER_HIDDEN: 'drawer-hidden',
};

View File

@ -4261,6 +4261,14 @@ EOD;
public function full_header() {
global $PAGE;
if ($PAGE->include_region_main_settings_in_header_actions()) {
$PAGE->add_header_action(html_writer::div(
$this->region_main_settings_menu(),
'd-print-none',
['id' => 'region-main-settings-menu']
));
}
$header = new stdClass();
$header->settingsmenu = $this->context_header_settings_menu();
$header->contextheader = $this->context_header();
@ -4268,6 +4276,7 @@ EOD;
$header->navbar = $this->navbar();
$header->pageheadingbutton = $this->page_heading_button();
$header->courseheader = $this->course_header();
$header->headeractions = $PAGE->get_header_actions();
return $this->render_from_template('core/full_header', $header);
}

View File

@ -353,6 +353,16 @@ class moodle_page {
*/
protected $_forcesettingsmenu = false;
/**
* @var array Array of header actions HTML to add to the page header actions menu.
*/
protected $_headeractions = [];
/**
* @var bool Should the region main settings menu be rendered in the header.
*/
protected $_regionmainsettingsinheader = false;
/**
* Force the settings menu to be displayed on this page. This will only force the
* settings menu on an activity / resource page that is being displayed on a theme that
@ -2032,4 +2042,42 @@ class moodle_page {
// Finally add the report to the navigation tree.
$reportnode->add($nodeinfo['name'], $nodeinfo['url'], navigation_node::TYPE_COURSE);
}
/**
* Add some HTML to the list of actions to render in the header actions menu.
*
* @param string $html The HTML to add.
*/
public function add_header_action(string $html) : void {
$this->_headeractions[] = $html;
}
/**
* Get the list of HTML for actions to render in the header actions menu.
*
* @return string[]
*/
public function get_header_actions() : array {
return $this->_headeractions;
}
/**
* Set the flag to indicate if the region main settings should be rendered as an action
* in the header actions menu rather than at the top of the content.
*
* @param bool $value If the settings should be in the header.
*/
public function set_include_region_main_settings_in_header_actions(bool $value) : void {
$this->_regionmainsettingsinheader = $value;
}
/**
* Check if the region main settings should be rendered as an action in the header actions
* menu rather than at the top of the content.
*
* @return bool
*/
public function include_region_main_settings_in_header_actions() : bool {
return $this->_regionmainsettingsinheader;
}
}

View File

@ -0,0 +1,44 @@
{{!
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/drawer
This template will render a generic drawer panel.
Classes required for JS:
* none
Data attributes required for JS:
* none
Context variables required for this template:
* none
Example context (json):
{}
}}
<div
id="{{$drawerid}}drawer-{{uniqid}}{{/drawerid}}"
class="{{$drawerclasses}}{{/drawerclasses}} drawer bg-white hidden"
aria-expanded="false"
aria-hidden="true"
data-region="right-hand-drawer"
role="region"
tabindex="-1"
>
{{$drawercontent}}{{/drawercontent}}
</div>

View File

@ -32,7 +32,7 @@
<div class="col-12 pt-3 pb-3">
<div class="card {{^contextheader}}border-0 bg-transparent{{/contextheader}}">
<div class="card-body {{^contextheader}}p-2{{/contextheader}}">
<div class="d-flex">
<div class="d-flex align-items-center">
{{#contextheader}}
<div class="mr-auto">
{{{contextheader}}}
@ -44,6 +44,11 @@
{{{settingsmenu}}}
</div>
{{/settingsmenu}}
<div class="header-actions-container flex-shrink-0" data-region="header-actions-container">
{{#headeractions}}
<div class="header-action ml-2">{{{.}}}</div>
{{/headeractions}}
</div>
</div>
<div class="d-flex flex-wrap">
{{#hasnavbar}}

View File

@ -1,2 +1,2 @@
define ("core_message/message_drawer",["jquery","core/custom_interaction_events","core/pubsub","core_message/message_drawer_view_contact","core_message/message_drawer_view_contacts","core_message/message_drawer_view_conversation","core_message/message_drawer_view_group_info","core_message/message_drawer_view_overview","core_message/message_drawer_view_search","core_message/message_drawer_view_settings","core_message/message_drawer_router","core_message/message_drawer_routes","core_message/message_drawer_events","core/pending"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){var o={PANEL_BODY_CONTAINER:"[data-region=\"panel-body-container\"]",PANEL_HEADER_CONTAINER:"[data-region=\"panel-header-container\"]",VIEW_CONTACT:"[data-region=\"view-contact\"]",VIEW_CONTACTS:"[data-region=\"view-contacts\"]",VIEW_CONVERSATION:"[data-region=\"view-conversation\"]",VIEW_GROUP_INFO:"[data-region=\"view-group-info\"]",VIEW_OVERVIEW:"[data-region=\"view-overview\"]",VIEW_SEARCH:"[data-region=\"view-search\"]",VIEW_SETTINGS:"[data-region=\"view-settings\"]",ROUTES:"[data-route]",ROUTES_BACK:"[data-route-back]",HEADER_CONTAINER:"[data-region=\"header-container\"]",BODY_CONTAINER:"[data-region=\"body-container\"]",FOOTER_CONTAINER:"[data-region=\"footer-container\"]"},p=function(a,b,c){var d=b.find(o.HEADER_CONTAINER).find(c);if(!d.length){d=b.find(o.PANEL_HEADER_CONTAINER).find(c)}var e=b.find(o.BODY_CONTAINER).find(c);if(!e.length){e=b.find(o.PANEL_BODY_CONTAINER).find(c)}var f=b.find(o.FOOTER_CONTAINER).find(c);return[a,d.length?d:null,e.length?e:null,f.length?f:null]},q=[[l.VIEW_CONTACT,o.VIEW_CONTACT,d.show,d.description],[l.VIEW_CONTACTS,o.VIEW_CONTACTS,e.show,e.description],[l.VIEW_CONVERSATION,o.VIEW_CONVERSATION,f.show,f.description],[l.VIEW_GROUP_INFO,o.VIEW_GROUP_INFO,g.show,g.description],[l.VIEW_OVERVIEW,o.VIEW_OVERVIEW,h.show,h.description],[l.VIEW_SEARCH,o.VIEW_SEARCH,i.show,i.description],[l.VIEW_SETTINGS,o.VIEW_SETTINGS,j.show,j.description]],r=function(a,b){q.forEach(function(c){k.add(a,c[0],p(a,b,c[1]),c[2],c[3])})},s=function(a,b){if(!b.attr("data-shown")){k.go(a,l.VIEW_OVERVIEW);b.attr("data-shown",!0)}b.removeClass("hidden");b.attr("aria-expanded",!0);b.attr("aria-hidden",!1)},t=function(a){a.addClass("hidden");a.attr("aria-expanded",!1);a.attr("aria-hidden",!0)},u=function(a){return!a.hasClass("hidden")},v=function(d,e,f){b.define(e,[b.events.activate]);var g=/^data-route-param-?(\d*)$/;e.on(b.events.activate,o.ROUTES,function(b,c){for(var e=a(b.target).closest(o.ROUTES),f=e.attr("data-route"),h=[],j=0;j<e[0].attributes.length;j++){h.push(e[0].attributes[j])}var l=h.filter(function(a){var b=a.nodeName,c=g.test(b);return c});l.sort(function(c,a){var b=g.exec(c.nodeName),d=g.exec(a.nodeName),e=1<b.length?b[1]:0,f=1<d.length?d[1]:0;if(e<f){return-1}else if(f<e){return 1}else{return 0}});var m=l.map(function(a){return a.nodeValue}),n=[d,f].concat(m);k.go.apply(null,n);c.originalEvent.preventDefault()});e.on(b.events.activate,o.ROUTES_BACK,function(a,b){k.back(d);b.originalEvent.preventDefault()});e.on("hide.bs.collapse",".collapse",function(b){var c=new n;a(b.target).one("hidden.bs.collapse",function(){c.resolve()})});e.on("show.bs.collapse",".collapse",function(b){var c=new n;a(b.target).one("shown.bs.collapse",function(){c.resolve()})});if(!f){c.subscribe(m.SHOW,function(){s(d,e)});c.subscribe(m.HIDE,function(){t(e)});c.subscribe(m.TOGGLE_VISIBILITY,function(){if(u(e)){t(e)}else{s(d,e)}})}c.subscribe(m.SHOW_CONVERSATION,function(a){s(d,e);k.go(d,l.VIEW_CONVERSATION,a)});c.subscribe(m.CREATE_CONVERSATION_WITH_USER,function(a){s(d,e);k.go(d,l.VIEW_CONVERSATION,null,"create",a)});c.subscribe(m.SHOW_SETTINGS,function(){s(d,e);k.go(d,l.VIEW_SETTINGS)});c.subscribe(m.PREFERENCES_UPDATED,function(a){var b=a.filter(function(a){return"message_entertosend"==a.type}),c=b.length?b[0]:null;if(c){var d=e.find(o.FOOTER_CONTAINER).find(o.VIEW_CONVERSATION);d.attr("data-enter-to-send",c.value)}})};return{init:function init(b,c,d,e){b=a(b);r(c,b);v(c,b,d);if(d){s(c,b);if(e){var f=e.params||[];f=[c,e.path].concat(f);k.go.apply(null,f)}}}}});
define ("core_message/message_drawer",["jquery","core/custom_interaction_events","core/pubsub","core_message/message_drawer_view_contact","core_message/message_drawer_view_contacts","core_message/message_drawer_view_conversation","core_message/message_drawer_view_group_info","core_message/message_drawer_view_overview","core_message/message_drawer_view_search","core_message/message_drawer_view_settings","core_message/message_drawer_router","core_message/message_drawer_routes","core_message/message_drawer_events","core/pending","core/drawer"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){var p={PANEL_BODY_CONTAINER:"[data-region=\"panel-body-container\"]",PANEL_HEADER_CONTAINER:"[data-region=\"panel-header-container\"]",VIEW_CONTACT:"[data-region=\"view-contact\"]",VIEW_CONTACTS:"[data-region=\"view-contacts\"]",VIEW_CONVERSATION:"[data-region=\"view-conversation\"]",VIEW_GROUP_INFO:"[data-region=\"view-group-info\"]",VIEW_OVERVIEW:"[data-region=\"view-overview\"]",VIEW_SEARCH:"[data-region=\"view-search\"]",VIEW_SETTINGS:"[data-region=\"view-settings\"]",ROUTES:"[data-route]",ROUTES_BACK:"[data-route-back]",HEADER_CONTAINER:"[data-region=\"header-container\"]",BODY_CONTAINER:"[data-region=\"body-container\"]",FOOTER_CONTAINER:"[data-region=\"footer-container\"]"},q=function(a,b,c){var d=b.find(p.HEADER_CONTAINER).find(c);if(!d.length){d=b.find(p.PANEL_HEADER_CONTAINER).find(c)}var e=b.find(p.BODY_CONTAINER).find(c);if(!e.length){e=b.find(p.PANEL_BODY_CONTAINER).find(c)}var f=b.find(p.FOOTER_CONTAINER).find(c);return[a,d.length?d:null,e.length?e:null,f.length?f:null]},r=[[l.VIEW_CONTACT,p.VIEW_CONTACT,d.show,d.description],[l.VIEW_CONTACTS,p.VIEW_CONTACTS,e.show,e.description],[l.VIEW_CONVERSATION,p.VIEW_CONVERSATION,f.show,f.description],[l.VIEW_GROUP_INFO,p.VIEW_GROUP_INFO,g.show,g.description],[l.VIEW_OVERVIEW,p.VIEW_OVERVIEW,h.show,h.description],[l.VIEW_SEARCH,p.VIEW_SEARCH,i.show,i.description],[l.VIEW_SETTINGS,p.VIEW_SETTINGS,j.show,j.description]],s=function(a,b){r.forEach(function(c){k.add(a,c[0],q(a,b,c[1]),c[2],c[3])})},t=function(a,b){if(!b.attr("data-shown")){k.go(a,l.VIEW_OVERVIEW);b.attr("data-shown",!0)}var c=o.getDrawerRoot(b);if(c.length){o.show(c)}},u=function(a){var b=o.getDrawerRoot(a);if(b.length){o.hide(b)}},v=function(a){var b=o.getDrawerRoot(a);if(b.length){return o.isVisible(b)}return!0},w=function(d,e,f){b.define(e,[b.events.activate]);var g=/^data-route-param-?(\d*)$/;e.on(b.events.activate,p.ROUTES,function(b,c){for(var e=a(b.target).closest(p.ROUTES),f=e.attr("data-route"),h=[],j=0;j<e[0].attributes.length;j++){h.push(e[0].attributes[j])}var l=h.filter(function(a){var b=a.nodeName,c=g.test(b);return c});l.sort(function(c,a){var b=g.exec(c.nodeName),d=g.exec(a.nodeName),e=1<b.length?b[1]:0,f=1<d.length?d[1]:0;if(e<f){return-1}else if(f<e){return 1}else{return 0}});var m=l.map(function(a){return a.nodeValue}),n=[d,f].concat(m);k.go.apply(null,n);c.originalEvent.preventDefault()});e.on(b.events.activate,p.ROUTES_BACK,function(a,b){k.back(d);b.originalEvent.preventDefault()});e.on("hide.bs.collapse",".collapse",function(b){var c=new n;a(b.target).one("hidden.bs.collapse",function(){c.resolve()})});e.on("show.bs.collapse",".collapse",function(b){var c=new n;a(b.target).one("shown.bs.collapse",function(){c.resolve()})});if(!f){c.subscribe(m.SHOW,function(){t(d,e)});c.subscribe(m.HIDE,function(){u(e)});c.subscribe(m.TOGGLE_VISIBILITY,function(){if(v(e)){u(e)}else{t(d,e)}})}c.subscribe(m.SHOW_CONVERSATION,function(a){t(d,e);k.go(d,l.VIEW_CONVERSATION,a)});c.subscribe(m.CREATE_CONVERSATION_WITH_USER,function(a){t(d,e);k.go(d,l.VIEW_CONVERSATION,null,"create",a)});c.subscribe(m.SHOW_SETTINGS,function(){t(d,e);k.go(d,l.VIEW_SETTINGS)});c.subscribe(m.PREFERENCES_UPDATED,function(a){var b=a.filter(function(a){return"message_entertosend"==a.type}),c=b.length?b[0]:null;if(c){var d=e.find(p.FOOTER_CONTAINER).find(p.VIEW_CONVERSATION);d.attr("data-enter-to-send",c.value)}})};return{init:function init(b,c,d,e){b=a(b);s(c,b);w(c,b,d);if(d){t(c,b);if(e){var f=e.params||[];f=[c,e.path].concat(f);k.go.apply(null,f)}}}}});
//# sourceMappingURL=message_drawer.min.js.map

File diff suppressed because one or more lines are too long

View File

@ -36,6 +36,7 @@ define(
'core_message/message_drawer_routes',
'core_message/message_drawer_events',
'core/pending',
'core/drawer',
],
function(
$,
@ -51,7 +52,8 @@ function(
Router,
Routes,
Events,
Pending
Pending,
Drawer
) {
var SELECTORS = {
@ -134,9 +136,10 @@ function(
root.attr('data-shown', true);
}
root.removeClass('hidden');
root.attr('aria-expanded', true);
root.attr('aria-hidden', false);
var drawerRoot = Drawer.getDrawerRoot(root);
if (drawerRoot.length) {
Drawer.show(drawerRoot);
}
};
/**
@ -145,19 +148,24 @@ function(
* @param {Object} root The message drawer container.
*/
var hide = function(root) {
root.addClass('hidden');
root.attr('aria-expanded', false);
root.attr('aria-hidden', true);
var drawerRoot = Drawer.getDrawerRoot(root);
if (drawerRoot.length) {
Drawer.hide(drawerRoot);
}
};
/**
* Check if the drawer is visible.
*
* @param {Object} root The message drawer container.
* @return {bool}
* @return {boolean}
*/
var isVisible = function(root) {
return !root.hasClass('hidden');
var drawerRoot = Drawer.getDrawerRoot(root);
if (drawerRoot.length) {
return Drawer.isVisible(drawerRoot);
}
return true;
};
/**

View File

@ -33,36 +33,33 @@
{}
}}
{{< core/drawer}}
{{$drawercontent}}
<div id="message-drawer-{{uniqid}}" class="message-app" data-region="message-drawer" role="region">
<div class="header-container position-relative" data-region="header-container">
{{> core_message/message_drawer_view_contacts_header }}
{{> core_message/message_drawer_view_conversation_header }}
{{> core_message/message_drawer_view_overview_header }}
{{> core_message/message_drawer_view_search_header }}
{{> core_message/message_drawer_view_settings_header }}
</div>
<div class="body-container position-relative" data-region="body-container">
{{> core_message/message_drawer_view_contact_body }}
{{> core_message/message_drawer_view_contacts_body }}
{{> core_message/message_drawer_view_conversation_body }}
{{> core_message/message_drawer_view_group_info_body }}
{{> core_message/message_drawer_view_overview_body }}
{{> core_message/message_drawer_view_search_body }}
{{> core_message/message_drawer_view_settings_body }}
</div>
<div class="footer-container position-relative" data-region="footer-container">
{{> core_message/message_drawer_view_conversation_footer }}
{{> core_message/message_drawer_view_overview_footer }}
</div>
</div>
{{/drawercontent}}
{{/core/drawer}}
<div
id="message-drawer-{{uniqid}}"
class="message-app drawer hidden"
aria-expanded="false"
aria-hidden="true"
data-region="message-drawer"
role="region"
>
<div class="header-container position-relative" data-region="header-container">
{{> core_message/message_drawer_view_contacts_header }}
{{> core_message/message_drawer_view_conversation_header }}
{{> core_message/message_drawer_view_overview_header }}
{{> core_message/message_drawer_view_search_header }}
{{> core_message/message_drawer_view_settings_header }}
</div>
<div class="body-container position-relative" data-region="body-container">
{{> core_message/message_drawer_view_contact_body }}
{{> core_message/message_drawer_view_contacts_body }}
{{> core_message/message_drawer_view_conversation_body }}
{{> core_message/message_drawer_view_group_info_body }}
{{> core_message/message_drawer_view_overview_body }}
{{> core_message/message_drawer_view_search_body }}
{{> core_message/message_drawer_view_settings_body }}
</div>
<div class="footer-container position-relative" data-region="footer-container">
{{> core_message/message_drawer_view_conversation_footer }}
{{> core_message/message_drawer_view_overview_footer }}
</div>
</div>
{{#js}}
require(['jquery', 'core_message/message_drawer'], function($, MessageDrawer) {
var root = $('#message-drawer-{{uniqid}}');

View File

@ -1,2 +1,2 @@
define ("mod_forum/discussion_list",["jquery","core/templates","core/str","core/notification","mod_forum/subscription_toggle","mod_forum/selectors","mod_forum/repository","core/pubsub","mod_forum/forum_events"],function(a,b,c,d,e,f,g,h,i){var j=function(e){h.subscribe(i.SUBSCRIPTION_TOGGLED,function(a){var b=a.discussionId,c=a.subscriptionState,d=e.find(f.discussion.item+"[data-discussionid= "+b+"] "+f.discussion.subscribedLabel);if(c){d.removeAttr("hidden")}else{d.attr("hidden",!0)}});e.on("click",f.favourite.toggle,function(){var b=a(this),c=b.data("forumid"),e=b.data("discussionid"),f=b.data("targetstate");g.setFavouriteDiscussionState(c,e,f).then(function(){return location.reload()}).catch(d.exception)});e.on("click",f.pin.toggle,function(b){b.preventDefault();var c=a(this),e=c.data("forumid"),f=c.data("discussionid"),h=c.data("targetstate");g.setPinDiscussionState(e,f,h).then(function(){return location.reload()}).catch(d.exception)});e.on("click",f.lock.toggle,function(h){var e=a(this),i=e.data("forumid"),j=e.data("discussionid"),k=e.data("state");g.setDiscussionLockState(i,j,k).then(function(a){var b=e.parents(f.summary.actions).find(f.lock.icon),c=e.parents(f.discussion.item).find(f.discussion.lockedLabel);if(a.locked){b.removeClass("hidden");c.removeAttr("hidden")}else{b.addClass("hidden");c.attr("hidden",!0)}return a}).then(function(a){a.forumid=i;return b.render("mod_forum/discussion_lock_toggle",a)}).then(function(a,c){return b.replaceNode(e,a,c)}).then(function(){return c.get_string("lockupdated","forum").done(function(a){return d.addNotification({message:a,type:"info"})})}).catch(d.exception);h.preventDefault()})};return{init:function init(a){e.init(a);j(a)}}});
define ("mod_forum/discussion_list",["jquery","core/templates","core/str","core/notification","mod_forum/subscription_toggle","mod_forum/selectors","mod_forum/repository","core/pubsub","mod_forum/forum_events"],function(a,b,c,d,e,f,g,h,i){var j=function(e){h.subscribe(i.SUBSCRIPTION_TOGGLED,function(a){var b=a.discussionId,c=a.subscriptionState,d=e.find(f.discussion.item+"[data-discussionid= "+b+"] "+f.discussion.subscribedLabel);if(c){d.removeAttr("hidden")}else{d.attr("hidden",!0)}});e.on("click",f.favourite.toggle,function(){var b=a(this),c=b.data("forumid"),e=b.data("discussionid"),f=b.data("targetstate");g.setFavouriteDiscussionState(c,e,f).then(function(){return location.reload()}).catch(d.exception)});e.on("click",f.pin.toggle,function(b){b.preventDefault();var c=a(this),e=c.data("forumid"),f=c.data("discussionid"),h=c.data("targetstate");g.setPinDiscussionState(e,f,h).then(function(){return location.reload()}).catch(d.exception)});e.on("click",f.lock.toggle,function(h){var e=a(this),i=e.data("forumid"),j=e.data("discussionid"),k=e.data("state");g.setDiscussionLockState(i,j,k).then(function(a){var b=e.parents(f.summary.actions).find(f.lock.icon),c=e.parents(f.discussion.item).find(f.discussion.lockedLabel);if(a.locked){b.removeClass("hidden");c.removeAttr("hidden")}else{b.addClass("hidden");c.attr("hidden",!0)}return a}).then(function(a){a.forumid=i;return b.render("mod_forum/discussion_lock_toggle",a)}).then(function(a,c){return b.replaceNode(e,a,c)}).then(function(){return c.get_string("lockupdated","forum").done(function(a){return d.addNotification({message:a,type:"info"})})}).catch(d.exception);h.preventDefault()})};return{init:function init(a){e.init(a,!0,function(a,c){return b.render("mod_forum/discussion_subscription_toggle",c).then(function(c,d){return b.replaceNode(a,c,d)})});j(a)}}});
//# sourceMappingURL=discussion_list.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

@ -1,2 +1,2 @@
define ("mod_forum/favourite_toggle",["jquery","core/templates","core/notification","mod_forum/repository","mod_forum/selectors","core/str"],function(a,b,c,d,e,f){var g=function(g){g.on("click",e.favourite.toggle,function(g){var e=a(this),h=e.data("forumid"),i=e.data("discussionid"),j=e.data("targetstate");d.setFavouriteDiscussionState(h,i,j).then(function(a){return b.render("mod_forum/discussion_favourite_toggle",a)}).then(function(a,c){return b.replaceNode(e,a,c)}).then(function(){return f.get_string("favouriteupdated","forum").done(function(a){return c.addNotification({message:a,type:"info"})})}).catch(c.exception);g.preventDefault()})};return{init:function init(a){g(a)}}});
define ("mod_forum/favourite_toggle",["jquery","core/templates","core/notification","mod_forum/repository","mod_forum/selectors","core/str"],function(a,b,c,d,e,f){return{init:function registerEventListeners(b,g,h){b.on("click",e.favourite.toggle,function(b){var e=a(this),i=e.data("forumid"),j=e.data("discussionid"),k=e.data("targetstate");d.setFavouriteDiscussionState(i,j,k).then(function(a){return h(e,a)}).then(function(){return f.get_string("favouriteupdated","forum").done(function(a){return c.addNotification({message:a,type:"info"})})}).catch(c.exception);if(g){b.preventDefault()}})}}});
//# sourceMappingURL=favourite_toggle.min.js.map

View File

@ -1 +1 @@
{"version":3,"sources":["../src/favourite_toggle.js"],"names":["define","$","Templates","Notification","Repository","Selectors","String","registerEventListeners","root","on","favourite","toggle","e","toggleElement","forumId","data","discussionId","subscriptionState","setFavouriteDiscussionState","then","context","render","html","js","replaceNode","get_string","done","s","addNotification","message","type","catch","exception","preventDefault","init"],"mappings":"AAwBAA,OAAM,8BAAC,CACC,QADD,CAEC,gBAFD,CAGC,mBAHD,CAIC,sBAJD,CAKC,qBALD,CAMC,UAND,CAAD,CAOC,SACCC,CADD,CAECC,CAFD,CAGCC,CAHD,CAICC,CAJD,CAKCC,CALD,CAMCC,CAND,CAOD,CAOF,GAAIC,CAAAA,CAAsB,CAAG,SAASC,CAAT,CAAe,CACxCA,CAAI,CAACC,EAAL,CAAQ,OAAR,CAAiBJ,CAAS,CAACK,SAAV,CAAoBC,MAArC,CAA6C,SAASC,CAAT,CAAY,IACjDC,CAAAA,CAAa,CAAGZ,CAAC,CAAC,IAAD,CADgC,CAEjDa,CAAO,CAAGD,CAAa,CAACE,IAAd,CAAmB,SAAnB,CAFuC,CAGjDC,CAAY,CAAGH,CAAa,CAACE,IAAd,CAAmB,cAAnB,CAHkC,CAIjDE,CAAiB,CAAGJ,CAAa,CAACE,IAAd,CAAmB,aAAnB,CAJ6B,CAMrDX,CAAU,CAACc,2BAAX,CAAuCJ,CAAvC,CAAgDE,CAAhD,CAA8DC,CAA9D,EACKE,IADL,CACU,SAASC,CAAT,CAAkB,CACpB,MAAOlB,CAAAA,CAAS,CAACmB,MAAV,CAAiB,uCAAjB,CAA0DD,CAA1D,CACV,CAHL,EAIKD,IAJL,CAIU,SAASG,CAAT,CAAeC,CAAf,CAAmB,CACrB,MAAOrB,CAAAA,CAAS,CAACsB,WAAV,CAAsBX,CAAtB,CAAqCS,CAArC,CAA2CC,CAA3C,CACV,CANL,EAOKJ,IAPL,CAOU,UAAW,CACb,MAAOb,CAAAA,CAAM,CAACmB,UAAP,CAAkB,kBAAlB,CAAsC,OAAtC,EACFC,IADE,CACG,SAASC,CAAT,CAAY,CACd,MAAOxB,CAAAA,CAAY,CAACyB,eAAb,CAA6B,CAChCC,OAAO,CAAEF,CADuB,CAEhCG,IAAI,CAAE,MAF0B,CAA7B,CAIV,CANE,CAOV,CAfL,EAgBKC,KAhBL,CAgBW5B,CAAY,CAAC6B,SAhBxB,EAkBApB,CAAC,CAACqB,cAAF,EACH,CAzBD,CA0BH,CA3BD,CA6BA,MAAO,CACHC,IAAI,CAAE,cAAS1B,CAAT,CAAe,CACjBD,CAAsB,CAACC,CAAD,CACzB,CAHE,CAKV,CAvDK,CAAN","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 * Handle discussion subscription toggling on a discussion list in\n * the forum view.\n *\n * @module mod_forum/favourite_toggle\n * @package mod_forum\n * @copyright 2019 Peter Dias <peter@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/templates',\n 'core/notification',\n 'mod_forum/repository',\n 'mod_forum/selectors',\n 'core/str',\n ], function(\n $,\n Templates,\n Notification,\n Repository,\n Selectors,\n String\n ) {\n\n /**\n * Register event listeners for the subscription toggle.\n *\n * @param {object} root The discussion list root element\n */\n var registerEventListeners = function(root) {\n root.on('click', Selectors.favourite.toggle, function(e) {\n var toggleElement = $(this);\n var forumId = toggleElement.data('forumid');\n var discussionId = toggleElement.data('discussionid');\n var subscriptionState = toggleElement.data('targetstate');\n\n Repository.setFavouriteDiscussionState(forumId, discussionId, subscriptionState)\n .then(function(context) {\n return Templates.render('mod_forum/discussion_favourite_toggle', context);\n })\n .then(function(html, js) {\n return Templates.replaceNode(toggleElement, html, js);\n })\n .then(function() {\n return String.get_string(\"favouriteupdated\", \"forum\")\n .done(function(s) {\n return Notification.addNotification({\n message: s,\n type: \"info\"\n });\n });\n })\n .catch(Notification.exception);\n\n e.preventDefault();\n });\n };\n\n return {\n init: function(root) {\n registerEventListeners(root);\n }\n };\n});\n"],"file":"favourite_toggle.min.js"}
{"version":3,"sources":["../src/favourite_toggle.js"],"names":["define","$","Templates","Notification","Repository","Selectors","String","init","registerEventListeners","root","preventDefault","callback","on","favourite","toggle","e","toggleElement","forumId","data","discussionId","subscriptionState","setFavouriteDiscussionState","then","context","get_string","done","s","addNotification","message","type","catch","exception"],"mappings":"AAwBAA,OAAM,8BAAC,CACC,QADD,CAEC,gBAFD,CAGC,mBAHD,CAIC,sBAJD,CAKC,qBALD,CAMC,UAND,CAAD,CAOC,SACCC,CADD,CAECC,CAFD,CAGCC,CAHD,CAICC,CAJD,CAKCC,CALD,CAMCC,CAND,CAOD,CAqCF,MAAO,CACHC,IAAI,CA7BqB,QAAzBC,CAAAA,sBAAyB,CAASC,CAAT,CAAeC,CAAf,CAA+BC,CAA/B,CAAyC,CAClEF,CAAI,CAACG,EAAL,CAAQ,OAAR,CAAiBP,CAAS,CAACQ,SAAV,CAAoBC,MAArC,CAA6C,SAASC,CAAT,CAAY,IACjDC,CAAAA,CAAa,CAAGf,CAAC,CAAC,IAAD,CADgC,CAEjDgB,CAAO,CAAGD,CAAa,CAACE,IAAd,CAAmB,SAAnB,CAFuC,CAGjDC,CAAY,CAAGH,CAAa,CAACE,IAAd,CAAmB,cAAnB,CAHkC,CAIjDE,CAAiB,CAAGJ,CAAa,CAACE,IAAd,CAAmB,aAAnB,CAJ6B,CAMrDd,CAAU,CAACiB,2BAAX,CAAuCJ,CAAvC,CAAgDE,CAAhD,CAA8DC,CAA9D,EACKE,IADL,CACU,SAASC,CAAT,CAAkB,CACpB,MAAOZ,CAAAA,CAAQ,CAACK,CAAD,CAAgBO,CAAhB,CAClB,CAHL,EAIKD,IAJL,CAIU,UAAW,CACb,MAAOhB,CAAAA,CAAM,CAACkB,UAAP,CAAkB,kBAAlB,CAAsC,OAAtC,EACFC,IADE,CACG,SAASC,CAAT,CAAY,CACd,MAAOvB,CAAAA,CAAY,CAACwB,eAAb,CAA6B,CAChCC,OAAO,CAAEF,CADuB,CAEhCG,IAAI,CAAE,MAF0B,CAA7B,CAIV,CANE,CAOV,CAZL,EAaKC,KAbL,CAaW3B,CAAY,CAAC4B,SAbxB,EAeA,GAAIrB,CAAJ,CAAoB,CAChBK,CAAC,CAACL,cAAF,EACH,CACJ,CAxBD,CAyBH,CAEM,CAGV,CAtDK,CAAN","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 * Handle discussion subscription toggling on a discussion list in\n * the forum view.\n *\n * @module mod_forum/favourite_toggle\n * @package mod_forum\n * @copyright 2019 Peter Dias <peter@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/templates',\n 'core/notification',\n 'mod_forum/repository',\n 'mod_forum/selectors',\n 'core/str',\n ], function(\n $,\n Templates,\n Notification,\n Repository,\n Selectors,\n String\n ) {\n\n /**\n * Register event listeners for the subscription toggle.\n *\n * @param {object} root The discussion list root element\n * @param {boolean} preventDefault Should the default action of the event be prevented\n * @param {function} callback Success callback\n */\n var registerEventListeners = function(root, preventDefault, callback) {\n root.on('click', Selectors.favourite.toggle, function(e) {\n var toggleElement = $(this);\n var forumId = toggleElement.data('forumid');\n var discussionId = toggleElement.data('discussionid');\n var subscriptionState = toggleElement.data('targetstate');\n\n Repository.setFavouriteDiscussionState(forumId, discussionId, subscriptionState)\n .then(function(context) {\n return callback(toggleElement, context);\n })\n .then(function() {\n return String.get_string(\"favouriteupdated\", \"forum\")\n .done(function(s) {\n return Notification.addNotification({\n message: s,\n type: \"info\"\n });\n });\n })\n .catch(Notification.exception);\n\n if (preventDefault) {\n e.preventDefault();\n }\n });\n };\n\n return {\n init: registerEventListeners\n };\n});\n"],"file":"favourite_toggle.min.js"}

View File

@ -1,2 +1,2 @@
define ("mod_forum/lock_toggle",["jquery","core/templates","core/notification","mod_forum/repository","mod_forum/selectors"],function(a,b,c,d,e){var f=function(b){b.on("click",e.lock.toggle,function(b){var e=a(this),f=e.data("forumid"),g=e.data("discussionid"),h=e.data("state");d.setDiscussionLockState(f,g,h).then(function(){return location.reload()}).catch(c.exception);b.preventDefault()})};return{init:function init(a){f(a)}}});
define ("mod_forum/lock_toggle",["jquery","core/templates","core/notification","mod_forum/repository","mod_forum/selectors"],function(a,b,c,d,e){return{init:function registerEventListeners(b,f){b.on("click",e.lock.toggle,function(b){var e=a(this),g=e.data("forumid"),h=e.data("discussionid"),i=e.data("state");d.setDiscussionLockState(g,h,i).then(function(){return location.reload()}).catch(c.exception);if(f){b.preventDefault()}})}}});
//# sourceMappingURL=lock_toggle.min.js.map

View File

@ -1 +1 @@
{"version":3,"sources":["../src/lock_toggle.js"],"names":["define","$","Templates","Notification","Repository","Selectors","registerEventListeners","root","on","lock","toggle","e","toggleElement","forumId","data","discussionId","state","setDiscussionLockState","then","location","reload","catch","exception","preventDefault","init"],"mappings":"AAuBAA,OAAM,yBAAC,CACC,QADD,CAEC,gBAFD,CAGC,mBAHD,CAIC,sBAJD,CAKC,qBALD,CAAD,CAMC,SACCC,CADD,CAECC,CAFD,CAGCC,CAHD,CAICC,CAJD,CAKCC,CALD,CAMD,CAOF,GAAIC,CAAAA,CAAsB,CAAG,SAASC,CAAT,CAAe,CACxCA,CAAI,CAACC,EAAL,CAAQ,OAAR,CAAiBH,CAAS,CAACI,IAAV,CAAeC,MAAhC,CAAwC,SAASC,CAAT,CAAY,IAC5CC,CAAAA,CAAa,CAAGX,CAAC,CAAC,IAAD,CAD2B,CAE5CY,CAAO,CAAGD,CAAa,CAACE,IAAd,CAAmB,SAAnB,CAFkC,CAG5CC,CAAY,CAAGH,CAAa,CAACE,IAAd,CAAmB,cAAnB,CAH6B,CAI5CE,CAAK,CAAGJ,CAAa,CAACE,IAAd,CAAmB,OAAnB,CAJoC,CAMhDV,CAAU,CAACa,sBAAX,CAAkCJ,CAAlC,CAA2CE,CAA3C,CAAyDC,CAAzD,EACKE,IADL,CACU,UAAW,CACb,MAAOC,CAAAA,QAAQ,CAACC,MAAT,EACV,CAHL,EAIKC,KAJL,CAIWlB,CAAY,CAACmB,SAJxB,EAMAX,CAAC,CAACY,cAAF,EACH,CAbD,CAcH,CAfD,CAiBA,MAAO,CACHC,IAAI,CAAE,cAASjB,CAAT,CAAe,CACjBD,CAAsB,CAACC,CAAD,CACzB,CAHE,CAKV,CAzCK,CAAN","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 * Handle the manual locking of individual discussions\n *\n * @module mod_forum/lock_toggle\n * @package mod_forum\n * @copyright 2019 Peter Dias <peter@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/templates',\n 'core/notification',\n 'mod_forum/repository',\n 'mod_forum/selectors',\n ], function(\n $,\n Templates,\n Notification,\n Repository,\n Selectors\n ) {\n\n /**\n * Register event listeners for the subscription toggle.\n *\n * @param {object} root The discussion list root element\n */\n var registerEventListeners = function(root) {\n root.on('click', Selectors.lock.toggle, function(e) {\n var toggleElement = $(this);\n var forumId = toggleElement.data('forumid');\n var discussionId = toggleElement.data('discussionid');\n var state = toggleElement.data('state');\n\n Repository.setDiscussionLockState(forumId, discussionId, state)\n .then(function() {\n return location.reload();\n })\n .catch(Notification.exception);\n\n e.preventDefault();\n });\n };\n\n return {\n init: function(root) {\n registerEventListeners(root);\n }\n };\n});\n"],"file":"lock_toggle.min.js"}
{"version":3,"sources":["../src/lock_toggle.js"],"names":["define","$","Templates","Notification","Repository","Selectors","init","registerEventListeners","root","preventDefault","on","lock","toggle","e","toggleElement","forumId","data","discussionId","state","setDiscussionLockState","then","location","reload","catch","exception"],"mappings":"AAuBAA,OAAM,yBAAC,CACC,QADD,CAEC,gBAFD,CAGC,mBAHD,CAIC,sBAJD,CAKC,qBALD,CAAD,CAMC,SACCC,CADD,CAECC,CAFD,CAGCC,CAHD,CAICC,CAJD,CAKCC,CALD,CAMD,CA2BF,MAAO,CACHC,IAAI,CApBqB,QAAzBC,CAAAA,sBAAyB,CAASC,CAAT,CAAeC,CAAf,CAA+B,CACxDD,CAAI,CAACE,EAAL,CAAQ,OAAR,CAAiBL,CAAS,CAACM,IAAV,CAAeC,MAAhC,CAAwC,SAASC,CAAT,CAAY,IAC5CC,CAAAA,CAAa,CAAGb,CAAC,CAAC,IAAD,CAD2B,CAE5Cc,CAAO,CAAGD,CAAa,CAACE,IAAd,CAAmB,SAAnB,CAFkC,CAG5CC,CAAY,CAAGH,CAAa,CAACE,IAAd,CAAmB,cAAnB,CAH6B,CAI5CE,CAAK,CAAGJ,CAAa,CAACE,IAAd,CAAmB,OAAnB,CAJoC,CAMhDZ,CAAU,CAACe,sBAAX,CAAkCJ,CAAlC,CAA2CE,CAA3C,CAAyDC,CAAzD,EACKE,IADL,CACU,UAAW,CACb,MAAOC,CAAAA,QAAQ,CAACC,MAAT,EACV,CAHL,EAIKC,KAJL,CAIWpB,CAAY,CAACqB,SAJxB,EAMA,GAAIf,CAAJ,CAAoB,CAChBI,CAAC,CAACJ,cAAF,EACH,CACJ,CAfD,CAgBH,CAEM,CAGV,CA1CK,CAAN","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 * Handle the manual locking of individual discussions\n *\n * @module mod_forum/lock_toggle\n * @package mod_forum\n * @copyright 2019 Peter Dias <peter@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/templates',\n 'core/notification',\n 'mod_forum/repository',\n 'mod_forum/selectors',\n ], function(\n $,\n Templates,\n Notification,\n Repository,\n Selectors\n ) {\n\n /**\n * Register event listeners for the subscription toggle.\n *\n * @param {object} root The discussion list root element\n * @param {boolean} preventDefault Should the default action of the event be prevented\n */\n var registerEventListeners = function(root, preventDefault) {\n root.on('click', Selectors.lock.toggle, function(e) {\n var toggleElement = $(this);\n var forumId = toggleElement.data('forumid');\n var discussionId = toggleElement.data('discussionid');\n var state = toggleElement.data('state');\n\n Repository.setDiscussionLockState(forumId, discussionId, state)\n .then(function() {\n return location.reload();\n })\n .catch(Notification.exception);\n\n if (preventDefault) {\n e.preventDefault();\n }\n });\n };\n\n return {\n init: registerEventListeners\n };\n});\n"],"file":"lock_toggle.min.js"}

View File

@ -1,2 +1,2 @@
define ("mod_forum/pin_toggle",["jquery","core/ajax","core/str","core/templates","core/notification","mod_forum/repository","mod_forum/selectors","core/str"],function(a,b,c,d,f,g,h,i){var j=function(b){b.on("click",h.pin.toggle,function(b){var c=a(this),e=c.data("forumid"),h=c.data("discussionid"),j=c.data("targetstate");g.setPinDiscussionState(e,h,j).then(function(a){return d.render("mod_forum/discussion_pin_toggle",a)}).then(function(a,b){return d.replaceNode(c,a,b)}).then(function(){return i.get_string("pinupdated","forum").done(function(a){return f.addNotification({message:a,type:"info"})})}).fail(f.exception);b.preventDefault()})};return{init:function init(a){j(a)}}});
define ("mod_forum/pin_toggle",["jquery","core/ajax","core/str","core/templates","core/notification","mod_forum/repository","mod_forum/selectors","core/str"],function(a,b,c,d,f,g,h,i){return{init:function registerEventListeners(b,c,d){b.on("click",h.pin.toggle,function(b){var e=a(this),h=e.data("forumid"),j=e.data("discussionid"),k=e.data("targetstate");g.setPinDiscussionState(h,j,k).then(function(a){return d(e,a)}).then(function(){return i.get_string("pinupdated","forum").done(function(a){return f.addNotification({message:a,type:"info"})})}).fail(f.exception);if(c){b.preventDefault()}})}}});
//# sourceMappingURL=pin_toggle.min.js.map

View File

@ -1 +1 @@
{"version":3,"sources":["../src/pin_toggle.js"],"names":["define","$","Ajax","Str","Templates","Notification","Repository","Selectors","String","registerEventListeners","root","on","pin","toggle","e","toggleElement","forumid","data","discussionid","pinstate","setPinDiscussionState","then","context","render","html","js","replaceNode","get_string","done","s","addNotification","message","type","fail","exception","preventDefault","init"],"mappings":"AA2BAA,OAAM,wBAAC,CACH,QADG,CAEH,WAFG,CAGH,UAHG,CAIH,gBAJG,CAKH,mBALG,CAMH,sBANG,CAOH,qBAPG,CAQH,UARG,CAAD,CASH,SACCC,CADD,CAECC,CAFD,CAGCC,CAHD,CAICC,CAJD,CAKCC,CALD,CAMCC,CAND,CAOCC,CAPD,CAQCC,CARD,CASD,CAOE,GAAIC,CAAAA,CAAsB,CAAG,SAASC,CAAT,CAAe,CACxCA,CAAI,CAACC,EAAL,CAAQ,OAAR,CAAiBJ,CAAS,CAACK,GAAV,CAAcC,MAA/B,CAAuC,SAASC,CAAT,CAAY,IAC3CC,CAAAA,CAAa,CAAGd,CAAC,CAAC,IAAD,CAD0B,CAE3Ce,CAAO,CAAGD,CAAa,CAACE,IAAd,CAAmB,SAAnB,CAFiC,CAG3CC,CAAY,CAAGH,CAAa,CAACE,IAAd,CAAmB,cAAnB,CAH4B,CAI3CE,CAAQ,CAAGJ,CAAa,CAACE,IAAd,CAAmB,aAAnB,CAJgC,CAK/CX,CAAU,CAACc,qBAAX,CAAiCJ,CAAjC,CAA0CE,CAA1C,CAAwDC,CAAxD,EACKE,IADL,CACU,SAASC,CAAT,CAAkB,CACpB,MAAOlB,CAAAA,CAAS,CAACmB,MAAV,CAAiB,iCAAjB,CAAoDD,CAApD,CACV,CAHL,EAIKD,IAJL,CAIU,SAASG,CAAT,CAAeC,CAAf,CAAmB,CACrB,MAAOrB,CAAAA,CAAS,CAACsB,WAAV,CAAsBX,CAAtB,CAAqCS,CAArC,CAA2CC,CAA3C,CACV,CANL,EAOKJ,IAPL,CAOU,UAAW,CACb,MAAOb,CAAAA,CAAM,CAACmB,UAAP,CAAkB,YAAlB,CAAgC,OAAhC,EACFC,IADE,CACG,SAASC,CAAT,CAAY,CACd,MAAOxB,CAAAA,CAAY,CAACyB,eAAb,CAA6B,CAChCC,OAAO,CAAEF,CADuB,CAEhCG,IAAI,CAAE,MAF0B,CAA7B,CAIV,CANE,CAOV,CAfL,EAgBKC,IAhBL,CAgBU5B,CAAY,CAAC6B,SAhBvB,EAkBApB,CAAC,CAACqB,cAAF,EACH,CAxBD,CAyBH,CA1BD,CA4BA,MAAO,CACHC,IAAI,CAAE,cAAS1B,CAAT,CAAe,CACjBD,CAAsB,CAACC,CAAD,CACzB,CAHE,CAKV,CA1DK,CAAN","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 * This module is the highest level module for the calendar. It is\n * responsible for initialising all of the components required for\n * the calendar to run. It also coordinates the interaction between\n * components by listening for and responding to different events\n * triggered within the calendar UI.\n *\n * @module mod_forum/pin_toggle\n * @package mod_forum\n * @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/ajax',\n 'core/str',\n 'core/templates',\n 'core/notification',\n 'mod_forum/repository',\n 'mod_forum/selectors',\n 'core/str',\n], function(\n $,\n Ajax,\n Str,\n Templates,\n Notification,\n Repository,\n Selectors,\n String\n) {\n\n /**\n * Registery event listeners for the pin toggle.\n *\n * @param {object} root The calendar root element\n */\n var registerEventListeners = function(root) {\n root.on('click', Selectors.pin.toggle, function(e) {\n var toggleElement = $(this);\n var forumid = toggleElement.data('forumid');\n var discussionid = toggleElement.data('discussionid');\n var pinstate = toggleElement.data('targetstate');\n Repository.setPinDiscussionState(forumid, discussionid, pinstate)\n .then(function(context) {\n return Templates.render('mod_forum/discussion_pin_toggle', context);\n })\n .then(function(html, js) {\n return Templates.replaceNode(toggleElement, html, js);\n })\n .then(function() {\n return String.get_string(\"pinupdated\", \"forum\")\n .done(function(s) {\n return Notification.addNotification({\n message: s,\n type: \"info\"\n });\n });\n })\n .fail(Notification.exception);\n\n e.preventDefault();\n });\n };\n\n return {\n init: function(root) {\n registerEventListeners(root);\n }\n };\n});"],"file":"pin_toggle.min.js"}
{"version":3,"sources":["../src/pin_toggle.js"],"names":["define","$","Ajax","Str","Templates","Notification","Repository","Selectors","String","init","registerEventListeners","root","preventDefault","callback","on","pin","toggle","e","toggleElement","forumid","data","discussionid","pinstate","setPinDiscussionState","then","context","get_string","done","s","addNotification","message","type","fail","exception"],"mappings":"AA2BAA,OAAM,wBAAC,CACH,QADG,CAEH,WAFG,CAGH,UAHG,CAIH,gBAJG,CAKH,mBALG,CAMH,sBANG,CAOH,qBAPG,CAQH,UARG,CAAD,CASH,SACCC,CADD,CAECC,CAFD,CAGCC,CAHD,CAICC,CAJD,CAKCC,CALD,CAMCC,CAND,CAOCC,CAPD,CAQCC,CARD,CASD,CAoCE,MAAO,CACHC,IAAI,CA5BqB,QAAzBC,CAAAA,sBAAyB,CAASC,CAAT,CAAeC,CAAf,CAA+BC,CAA/B,CAAyC,CAClEF,CAAI,CAACG,EAAL,CAAQ,OAAR,CAAiBP,CAAS,CAACQ,GAAV,CAAcC,MAA/B,CAAuC,SAASC,CAAT,CAAY,IAC3CC,CAAAA,CAAa,CAAGjB,CAAC,CAAC,IAAD,CAD0B,CAE3CkB,CAAO,CAAGD,CAAa,CAACE,IAAd,CAAmB,SAAnB,CAFiC,CAG3CC,CAAY,CAAGH,CAAa,CAACE,IAAd,CAAmB,cAAnB,CAH4B,CAI3CE,CAAQ,CAAGJ,CAAa,CAACE,IAAd,CAAmB,aAAnB,CAJgC,CAK/Cd,CAAU,CAACiB,qBAAX,CAAiCJ,CAAjC,CAA0CE,CAA1C,CAAwDC,CAAxD,EACKE,IADL,CACU,SAASC,CAAT,CAAkB,CACpB,MAAOZ,CAAAA,CAAQ,CAACK,CAAD,CAAgBO,CAAhB,CAClB,CAHL,EAIKD,IAJL,CAIU,UAAW,CACb,MAAOhB,CAAAA,CAAM,CAACkB,UAAP,CAAkB,YAAlB,CAAgC,OAAhC,EACFC,IADE,CACG,SAASC,CAAT,CAAY,CACd,MAAOvB,CAAAA,CAAY,CAACwB,eAAb,CAA6B,CAChCC,OAAO,CAAEF,CADuB,CAEhCG,IAAI,CAAE,MAF0B,CAA7B,CAIV,CANE,CAOV,CAZL,EAaKC,IAbL,CAaU3B,CAAY,CAAC4B,SAbvB,EAeA,GAAIrB,CAAJ,CAAoB,CAChBK,CAAC,CAACL,cAAF,EACH,CACJ,CAvBD,CAwBH,CAEM,CAGV,CAzDK,CAAN","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 * This module is the highest level module for the calendar. It is\n * responsible for initialising all of the components required for\n * the calendar to run. It also coordinates the interaction between\n * components by listening for and responding to different events\n * triggered within the calendar UI.\n *\n * @module mod_forum/pin_toggle\n * @package mod_forum\n * @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/ajax',\n 'core/str',\n 'core/templates',\n 'core/notification',\n 'mod_forum/repository',\n 'mod_forum/selectors',\n 'core/str',\n], function(\n $,\n Ajax,\n Str,\n Templates,\n Notification,\n Repository,\n Selectors,\n String\n) {\n\n /**\n * Registery event listeners for the pin toggle.\n *\n * @param {object} root The calendar root element\n * @param {boolean} preventDefault Should the default action of the event be prevented\n * @param {function} callback Success callback\n */\n var registerEventListeners = function(root, preventDefault, callback) {\n root.on('click', Selectors.pin.toggle, function(e) {\n var toggleElement = $(this);\n var forumid = toggleElement.data('forumid');\n var discussionid = toggleElement.data('discussionid');\n var pinstate = toggleElement.data('targetstate');\n Repository.setPinDiscussionState(forumid, discussionid, pinstate)\n .then(function(context) {\n return callback(toggleElement, context);\n })\n .then(function() {\n return String.get_string(\"pinupdated\", \"forum\")\n .done(function(s) {\n return Notification.addNotification({\n message: s,\n type: \"info\"\n });\n });\n })\n .fail(Notification.exception);\n\n if (preventDefault) {\n e.preventDefault();\n }\n });\n };\n\n return {\n init: registerEventListeners\n };\n});"],"file":"pin_toggle.min.js"}

View File

@ -1,2 +1,2 @@
define ("mod_forum/subscription_toggle",["jquery","core/templates","core/notification","mod_forum/repository","mod_forum/selectors","core/pubsub","mod_forum/forum_events"],function(a,b,c,d,e,f,g){var h=function(h){h.on("click",e.subscription.toggle,function(h){var e=a(this),i=e.data("forumid"),j=e.data("discussionid"),k=e.data("targetstate");d.setDiscussionSubscriptionState(i,j,k).then(function(a){f.publish(g.SUBSCRIPTION_TOGGLED,{discussionId:j,subscriptionState:k});return b.render("mod_forum/discussion_subscription_toggle",a)}).then(function(a,c){return b.replaceNode(e,a,c)}).catch(c.exception);h.preventDefault()})};return{init:function init(a){h(a)}}});
define ("mod_forum/subscription_toggle",["jquery","core/templates","core/notification","mod_forum/repository","mod_forum/selectors","core/pubsub","mod_forum/forum_events"],function(a,b,c,d,e,f,g){return{init:function registerEventListeners(b,h,i){b.on("click",e.subscription.toggle,function(b){var e=a(this),j=e.data("forumid"),k=e.data("discussionid"),l=e.data("targetstate");d.setDiscussionSubscriptionState(j,k,l).then(function(a){f.publish(g.SUBSCRIPTION_TOGGLED,{discussionId:k,subscriptionState:l});return i(e,a)}).catch(c.exception);if(h){b.preventDefault()}})}}});
//# sourceMappingURL=subscription_toggle.min.js.map

View File

@ -1 +1 @@
{"version":3,"sources":["../src/subscription_toggle.js"],"names":["define","$","Templates","Notification","Repository","Selectors","PubSub","ForumEvents","registerEventListeners","root","on","subscription","toggle","e","toggleElement","forumId","data","discussionId","subscriptionState","setDiscussionSubscriptionState","then","context","publish","SUBSCRIPTION_TOGGLED","render","html","js","replaceNode","catch","exception","preventDefault","init"],"mappings":"AAwBAA,OAAM,iCAAC,CACC,QADD,CAEC,gBAFD,CAGC,mBAHD,CAIC,sBAJD,CAKC,qBALD,CAMC,aAND,CAOC,wBAPD,CAAD,CAQC,SACCC,CADD,CAECC,CAFD,CAGCC,CAHD,CAICC,CAJD,CAKCC,CALD,CAMCC,CAND,CAOCC,CAPD,CAQD,CAOF,GAAIC,CAAAA,CAAsB,CAAG,SAASC,CAAT,CAAe,CACxCA,CAAI,CAACC,EAAL,CAAQ,OAAR,CAAiBL,CAAS,CAACM,YAAV,CAAuBC,MAAxC,CAAgD,SAASC,CAAT,CAAY,IACpDC,CAAAA,CAAa,CAAGb,CAAC,CAAC,IAAD,CADmC,CAEpDc,CAAO,CAAGD,CAAa,CAACE,IAAd,CAAmB,SAAnB,CAF0C,CAGpDC,CAAY,CAAGH,CAAa,CAACE,IAAd,CAAmB,cAAnB,CAHqC,CAIpDE,CAAiB,CAAGJ,CAAa,CAACE,IAAd,CAAmB,aAAnB,CAJgC,CAMxDZ,CAAU,CAACe,8BAAX,CAA0CJ,CAA1C,CAAmDE,CAAnD,CAAiEC,CAAjE,EACKE,IADL,CACU,SAASC,CAAT,CAAkB,CACpBf,CAAM,CAACgB,OAAP,CAAef,CAAW,CAACgB,oBAA3B,CAAiD,CAC7CN,YAAY,CAAEA,CAD+B,CAE7CC,iBAAiB,CAAEA,CAF0B,CAAjD,EAIA,MAAOhB,CAAAA,CAAS,CAACsB,MAAV,CAAiB,0CAAjB,CAA6DH,CAA7D,CACV,CAPL,EAQKD,IARL,CAQU,SAASK,CAAT,CAAeC,CAAf,CAAmB,CACrB,MAAOxB,CAAAA,CAAS,CAACyB,WAAV,CAAsBb,CAAtB,CAAqCW,CAArC,CAA2CC,CAA3C,CACV,CAVL,EAWKE,KAXL,CAWWzB,CAAY,CAAC0B,SAXxB,EAaAhB,CAAC,CAACiB,cAAF,EACH,CApBD,CAqBH,CAtBD,CAwBA,MAAO,CACHC,IAAI,CAAE,cAAStB,CAAT,CAAe,CACjBD,CAAsB,CAACC,CAAD,CACzB,CAHE,CAKV,CApDK,CAAN","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 * Handle discussion subscription toggling on a discussion list in\n * the forum view.\n *\n * @module mod_forum/subscription_toggle\n * @package mod_forum\n * @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/templates',\n 'core/notification',\n 'mod_forum/repository',\n 'mod_forum/selectors',\n 'core/pubsub',\n 'mod_forum/forum_events',\n ], function(\n $,\n Templates,\n Notification,\n Repository,\n Selectors,\n PubSub,\n ForumEvents\n ) {\n\n /**\n * Register event listeners for the subscription toggle.\n *\n * @param {object} root The discussion list root element\n */\n var registerEventListeners = function(root) {\n root.on('click', Selectors.subscription.toggle, function(e) {\n var toggleElement = $(this);\n var forumId = toggleElement.data('forumid');\n var discussionId = toggleElement.data('discussionid');\n var subscriptionState = toggleElement.data('targetstate');\n\n Repository.setDiscussionSubscriptionState(forumId, discussionId, subscriptionState)\n .then(function(context) {\n PubSub.publish(ForumEvents.SUBSCRIPTION_TOGGLED, {\n discussionId: discussionId,\n subscriptionState: subscriptionState\n });\n return Templates.render('mod_forum/discussion_subscription_toggle', context);\n })\n .then(function(html, js) {\n return Templates.replaceNode(toggleElement, html, js);\n })\n .catch(Notification.exception);\n\n e.preventDefault();\n });\n };\n\n return {\n init: function(root) {\n registerEventListeners(root);\n }\n };\n});\n"],"file":"subscription_toggle.min.js"}
{"version":3,"sources":["../src/subscription_toggle.js"],"names":["define","$","Templates","Notification","Repository","Selectors","PubSub","ForumEvents","init","registerEventListeners","root","preventDefault","callback","on","subscription","toggle","e","toggleElement","forumId","data","discussionId","subscriptionState","setDiscussionSubscriptionState","then","context","publish","SUBSCRIPTION_TOGGLED","catch","exception"],"mappings":"AAwBAA,OAAM,iCAAC,CACC,QADD,CAEC,gBAFD,CAGC,mBAHD,CAIC,sBAJD,CAKC,qBALD,CAMC,aAND,CAOC,wBAPD,CAAD,CAQC,SACCC,CADD,CAECC,CAFD,CAGCC,CAHD,CAICC,CAJD,CAKCC,CALD,CAMCC,CAND,CAOCC,CAPD,CAQD,CAgCF,MAAO,CACHC,IAAI,CAxBqB,QAAzBC,CAAAA,sBAAyB,CAASC,CAAT,CAAeC,CAAf,CAA+BC,CAA/B,CAAyC,CAClEF,CAAI,CAACG,EAAL,CAAQ,OAAR,CAAiBR,CAAS,CAACS,YAAV,CAAuBC,MAAxC,CAAgD,SAASC,CAAT,CAAY,IACpDC,CAAAA,CAAa,CAAGhB,CAAC,CAAC,IAAD,CADmC,CAEpDiB,CAAO,CAAGD,CAAa,CAACE,IAAd,CAAmB,SAAnB,CAF0C,CAGpDC,CAAY,CAAGH,CAAa,CAACE,IAAd,CAAmB,cAAnB,CAHqC,CAIpDE,CAAiB,CAAGJ,CAAa,CAACE,IAAd,CAAmB,aAAnB,CAJgC,CAMxDf,CAAU,CAACkB,8BAAX,CAA0CJ,CAA1C,CAAmDE,CAAnD,CAAiEC,CAAjE,EACKE,IADL,CACU,SAASC,CAAT,CAAkB,CACpBlB,CAAM,CAACmB,OAAP,CAAelB,CAAW,CAACmB,oBAA3B,CAAiD,CAC7CN,YAAY,CAAEA,CAD+B,CAE7CC,iBAAiB,CAAEA,CAF0B,CAAjD,EAIA,MAAOT,CAAAA,CAAQ,CAACK,CAAD,CAAgBO,CAAhB,CAClB,CAPL,EAQKG,KARL,CAQWxB,CAAY,CAACyB,SARxB,EAUA,GAAIjB,CAAJ,CAAoB,CAChBK,CAAC,CAACL,cAAF,EACH,CACJ,CAnBD,CAoBH,CAEM,CAGV,CAnDK,CAAN","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 * Handle discussion subscription toggling on a discussion list in\n * the forum view.\n *\n * @module mod_forum/subscription_toggle\n * @package mod_forum\n * @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/templates',\n 'core/notification',\n 'mod_forum/repository',\n 'mod_forum/selectors',\n 'core/pubsub',\n 'mod_forum/forum_events',\n ], function(\n $,\n Templates,\n Notification,\n Repository,\n Selectors,\n PubSub,\n ForumEvents\n ) {\n\n /**\n * Register event listeners for the subscription toggle.\n *\n * @param {object} root The discussion list root element\n * @param {boolean} preventDefault Should the default action of the event be prevented\n * @param {function} callback Success callback\n */\n var registerEventListeners = function(root, preventDefault, callback) {\n root.on('click', Selectors.subscription.toggle, function(e) {\n var toggleElement = $(this);\n var forumId = toggleElement.data('forumid');\n var discussionId = toggleElement.data('discussionid');\n var subscriptionState = toggleElement.data('targetstate');\n\n Repository.setDiscussionSubscriptionState(forumId, discussionId, subscriptionState)\n .then(function(context) {\n PubSub.publish(ForumEvents.SUBSCRIPTION_TOGGLED, {\n discussionId: discussionId,\n subscriptionState: subscriptionState\n });\n return callback(toggleElement, context);\n })\n .catch(Notification.exception);\n\n if (preventDefault) {\n e.preventDefault();\n }\n });\n };\n\n return {\n init: registerEventListeners\n };\n});\n"],"file":"subscription_toggle.min.js"}

View File

@ -123,7 +123,12 @@ define([
return {
init: function(root) {
SubscriptionToggle.init(root);
SubscriptionToggle.init(root, true, function(toggleElement, context) {
return Templates.render('mod_forum/discussion_subscription_toggle', context)
.then(function(html, js) {
return Templates.replaceNode(toggleElement, html, js);
});
});
registerEventListeners(root);
}
};

View File

@ -30,6 +30,7 @@ import LockToggle from 'mod_forum/lock_toggle';
import FavouriteToggle from 'mod_forum/favourite_toggle';
import Pin from 'mod_forum/pin_toggle';
import Selectors from 'mod_forum/selectors';
import Subscribe from 'mod_forum/subscription_toggle';
const ANIMATION_DURATION = 150;
@ -409,7 +410,17 @@ export const init = (root, context) => {
// Initialise the settings menu javascript.
const discussionToolsContainer = root.find(Selectors.discussion.tools);
LockToggle.init(discussionToolsContainer);
FavouriteToggle.init(discussionToolsContainer);
Pin.init(discussionToolsContainer);
LockToggle.init(discussionToolsContainer, false);
FavouriteToggle.init(discussionToolsContainer, false, (toggleElement, response) => {
const newTargetState = response.userstate.favourited ? 0 : 1;
return toggleElement.data('targetstate', newTargetState);
});
Pin.init(discussionToolsContainer, false, (toggleElement, response) => {
const newTargetState = response.pinned ? 0 : 1;
return toggleElement.data('targetstate', newTargetState);
});
Subscribe.init(discussionToolsContainer, false, (toggleElement, response) => {
const newTargetState = response.userstate.subscribed ? 0 : 1;
toggleElement.data('targetstate', newTargetState);
});
};

View File

@ -42,8 +42,10 @@ define([
* Register event listeners for the subscription toggle.
*
* @param {object} root The discussion list root element
* @param {boolean} preventDefault Should the default action of the event be prevented
* @param {function} callback Success callback
*/
var registerEventListeners = function(root) {
var registerEventListeners = function(root, preventDefault, callback) {
root.on('click', Selectors.favourite.toggle, function(e) {
var toggleElement = $(this);
var forumId = toggleElement.data('forumid');
@ -52,10 +54,7 @@ define([
Repository.setFavouriteDiscussionState(forumId, discussionId, subscriptionState)
.then(function(context) {
return Templates.render('mod_forum/discussion_favourite_toggle', context);
})
.then(function(html, js) {
return Templates.replaceNode(toggleElement, html, js);
return callback(toggleElement, context);
})
.then(function() {
return String.get_string("favouriteupdated", "forum")
@ -68,13 +67,13 @@ define([
})
.catch(Notification.exception);
e.preventDefault();
if (preventDefault) {
e.preventDefault();
}
});
};
return {
init: function(root) {
registerEventListeners(root);
}
init: registerEventListeners
};
});

View File

@ -39,8 +39,9 @@ define([
* Register event listeners for the subscription toggle.
*
* @param {object} root The discussion list root element
* @param {boolean} preventDefault Should the default action of the event be prevented
*/
var registerEventListeners = function(root) {
var registerEventListeners = function(root, preventDefault) {
root.on('click', Selectors.lock.toggle, function(e) {
var toggleElement = $(this);
var forumId = toggleElement.data('forumid');
@ -53,13 +54,13 @@ define([
})
.catch(Notification.exception);
e.preventDefault();
if (preventDefault) {
e.preventDefault();
}
});
};
return {
init: function(root) {
registerEventListeners(root);
}
init: registerEventListeners
};
});

View File

@ -49,8 +49,10 @@ define([
* Registery event listeners for the pin toggle.
*
* @param {object} root The calendar root element
* @param {boolean} preventDefault Should the default action of the event be prevented
* @param {function} callback Success callback
*/
var registerEventListeners = function(root) {
var registerEventListeners = function(root, preventDefault, callback) {
root.on('click', Selectors.pin.toggle, function(e) {
var toggleElement = $(this);
var forumid = toggleElement.data('forumid');
@ -58,10 +60,7 @@ define([
var pinstate = toggleElement.data('targetstate');
Repository.setPinDiscussionState(forumid, discussionid, pinstate)
.then(function(context) {
return Templates.render('mod_forum/discussion_pin_toggle', context);
})
.then(function(html, js) {
return Templates.replaceNode(toggleElement, html, js);
return callback(toggleElement, context);
})
.then(function() {
return String.get_string("pinupdated", "forum")
@ -74,13 +73,13 @@ define([
})
.fail(Notification.exception);
e.preventDefault();
if (preventDefault) {
e.preventDefault();
}
});
};
return {
init: function(root) {
registerEventListeners(root);
}
init: registerEventListeners
};
});

View File

@ -44,8 +44,10 @@ define([
* Register event listeners for the subscription toggle.
*
* @param {object} root The discussion list root element
* @param {boolean} preventDefault Should the default action of the event be prevented
* @param {function} callback Success callback
*/
var registerEventListeners = function(root) {
var registerEventListeners = function(root, preventDefault, callback) {
root.on('click', Selectors.subscription.toggle, function(e) {
var toggleElement = $(this);
var forumId = toggleElement.data('forumid');
@ -58,20 +60,17 @@ define([
discussionId: discussionId,
subscriptionState: subscriptionState
});
return Templates.render('mod_forum/discussion_subscription_toggle', context);
})
.then(function(html, js) {
return Templates.replaceNode(toggleElement, html, js);
return callback(toggleElement, context);
})
.catch(Notification.exception);
e.preventDefault();
if (preventDefault) {
e.preventDefault();
}
});
};
return {
init: function(root) {
registerEventListeners(root);
}
init: registerEventListeners
};
});

View File

@ -330,9 +330,15 @@ class discussion {
}
if (!empty($forummenu)) {
$html = '<div class="movediscussionoption">';
$movebutton = get_string('move');
if ($this->displaymode === FORUM_MODE_MODERN) {
// Move discussion selector will be rendered on the settings drawer. We won't output the button in this mode.
$movebutton = null;
}
$select = new url_select($forummenu, '',
['/mod/forum/discuss.php?d=' . $discussion->get_id() => get_string("movethisdiscussionto", "forum")],
'forummenu', get_string('move'));
'forummenu', $movebutton);
$html .= $this->renderer->render($select);
$html .= "</div>";
return $html;

View File

@ -296,6 +296,9 @@ $PAGE->set_title("$course->shortname: " . format_string($discussion->get_name())
$PAGE->set_heading($course->fullname);
if ($ismoderndisplaymode) {
$PAGE->add_body_class('modern-display-mode reset-style');
$PAGE->set_include_region_main_settings_in_header_actions(true);
$settingstrigger = $OUTPUT->render_from_template('mod_forum/settings_drawer_trigger', null);
$PAGE->add_header_action($settingstrigger);
} else {
$PAGE->set_button(forum_search_form($course));
}

View File

@ -659,6 +659,7 @@ $string['timedhidden'] = 'Timed status: Hidden from students';
$string['timedposts'] = 'Timed posts';
$string['timedvisible'] = 'Timed status: Visible to all users';
$string['timestartenderror'] = 'Display end date cannot be earlier than the start date';
$string['togglesettingsdrawer'] = 'Toggle settings drawer';
$string['trackforum'] = 'Track unread posts';
$string['trackreadposts_header'] = 'Forum tracking';
$string['tracking'] = 'Track';

View File

@ -0,0 +1,119 @@
{{!
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 mod_forum/discussion_settings_body_content
This template will render the content for the body of the settings page in the message drawer.
Classes required for JS:
* none
Data attributes required for JS:
* All data attributes are required
Context variables required for this template:
* userid The logged in user id
* urls The URLs for the popover
Example context (json):
{}
}}
<div class="p-2 discussion-settings-container" data-container="discussion-tools">
<h3 class="mb-2 mt-2 h6 font-weight-bold">{{#str}} general, core {{/str}}</h3>
{{#capabilities.subscribe}}
{{< mod_forum/setting_switch}}
{{$switchid}}subscription-toggle-{{uniqid}}{{/switchid}}
{{$type}}subscription-toggle{{/type}}
{{$otherattributes}}
data-discussionid="{{id}}"
data-forumid="{{forumid}}"
{{#userstate.subscribed}}data-targetstate="0" checked{{/userstate.subscribed}}
{{^userstate.subscribed}}data-targetstate="1"{{/userstate.subscribed}}
{{/otherattributes}}
{{$labeltext}}
{{#str}} subscribediscussion, mod_forum {{/str}}
{{/labeltext}}
{{/mod_forum/setting_switch}}
{{/capabilities.subscribe}}
{{#capabilities.favourite}}
{{< mod_forum/setting_switch}}
{{$switchid}}favorite-toggle-{{uniqid}}{{/switchid}}
{{$type}}favorite-toggle{{/type}}
{{$otherattributes}}
data-discussionid="{{id}}"
data-forumid="{{forumid}}"
{{#userstate.favourited}}data-targetstate="0" checked{{/userstate.favourited}}
{{^userstate.favourited}}data-targetstate="1"{{/userstate.favourited}}
{{/otherattributes}}
{{$labeltext}}
{{#str}} addtofavourites, mod_forum {{/str}}
{{/labeltext}}
{{/mod_forum/setting_switch}}
{{/capabilities.favourite}}
{{#capabilities.pin}}
{{< mod_forum/setting_switch}}
{{$switchid}}pin-toggle-{{uniqid}}{{/switchid}}
{{$type}}pin-toggle{{/type}}
{{$otherattributes}}
data-discussionid="{{id}}"
data-forumid="{{forumid}}"
{{#pinned}}data-targetstate="0" checked{{/pinned}}
{{^pinned}}data-targetstate="1"{{/pinned}}
{{/otherattributes}}
{{$labeltext}}
{{#str}} pindiscussion, mod_forum {{/str}}
{{/labeltext}}
{{/mod_forum/setting_switch}}
{{/capabilities.pin}}
{{#capabilities.manage}}
{{^istimelocked}}
{{< mod_forum/setting_switch}}
{{$switchid}}lock-toggle-{{uniqid}}{{/switchid}}
{{$type}}lock-toggle{{/type}}
{{$otherattributes}}
data-discussionid="{{id}}"
data-forumid="{{forumid}}"
data-state="{{times.locked}}"
{{#locked}}checked{{/locked}}
{{/otherattributes}}
{{$labeltext}}
{{#str}} lockdiscussion, mod_forum {{/str}}
{{/labeltext}}
{{/mod_forum/setting_switch}}
{{/istimelocked}}
{{/capabilities.manage}}
{{#modeselectorform}}
<h3 class="h6 mt-4 font-weight-bold">{{#str}} view, core {{/str}}</h3>
{{{.}}}
{{/modeselectorform}}
{{#movediscussion}}
<h3 class="h6 mt-4 font-weight-bold">{{#str}} move, core {{/str}}</h3>
{{{.}}}
{{/movediscussion}}
{{#exportdiscussion}}
<h3 class="h6 mt-4 font-weight-bold">{{#str}} portfolio, portfolio {{/str}}</h3>
{{{.}}}
{{/exportdiscussion}}
</div>

View File

@ -0,0 +1,46 @@
{{!
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 mod_forum/discussion_settings_drawer
This template will render the discussion settings drawer.
Classes required for JS:
* none
Data attributes required for JS:
* All data attributes are required
Context variables required for this template:
* userid The logged in user id
* urls The URLs for the popover
Example context (json):
{}
}}
{{<core/drawer}}
{{$drawerid}}discussion-settings-drawer{{/drawerid}}
{{$drawercontent}}
<div class="h-100 w-100 bg-white d-flex flex-column p-2">
{{> mod_forum/settings_header}}
<div class="body-container position-relative" data-region="body-container">
{{> mod_forum/discussion_settings_body_content}}
</div>
</div>
{{/drawercontent}}
{{/core/drawer}}

View File

@ -59,16 +59,49 @@
{{#html.neighbourlinks}}{{{.}}}{{/html.neighbourlinks}}
</div>
{{#js}}
require(['jquery', 'mod_forum/discussion', 'mod_forum/posts_list', 'mod_forum/lock_toggle', 'mod_forum/favourite_toggle',
'mod_forum/pin_toggle', 'mod_forum/subscription_toggle'],
function($, Discussion, PostsList, LockToggle, FavouriteToggle, Pin, SubscribeToggle) {
var root = $("[data-content='forum-discussion']");
Discussion.init(root);
PostsList.init(root);
root = $('[data-container="discussion-tools"]');
LockToggle.init(root);
FavouriteToggle.init(root);
Pin.init(root);
SubscribeToggle.init(root);
require(
[
'jquery',
'core/templates',
'mod_forum/discussion',
'mod_forum/posts_list',
'mod_forum/lock_toggle',
'mod_forum/favourite_toggle',
'mod_forum/pin_toggle',
'mod_forum/subscription_toggle'
],
function(
$,
Templates,
Discussion,
PostsList,
LockToggle,
FavouriteToggle,
Pin,
SubscribeToggle
) {
var root = $("[data-content='forum-discussion']");
Discussion.init(root);
PostsList.init(root);
root = $('[data-container="discussion-tools"]');
LockToggle.init(root, true);
FavouriteToggle.init(root, true, function(toggleElement, context) {
return Templates.render('mod_forum/discussion_favourite_toggle', context)
.then(function(html, js) {
return Templates.replaceNode(toggleElement, html, js);
});
});
Pin.init(root, true, function(toggleElement, context) {
return Templates.render('mod_forum/discussion_pin_toggle', context)
.then(function(html, js) {
return Templates.replaceNode(toggleElement, html, js);
});
});
SubscribeToggle.init(root, true, function(toggleElement, context) {
return Templates.render('mod_forum/discussion_subscription_toggle', context)
.then(function(html, js) {
return Templates.replaceNode(toggleElement, html, js);
});
});
});
{{/js}}

View File

@ -30,22 +30,9 @@
}
}}
<div id="discussion-container-{{uniqid}}" data-content="forum-discussion">
<div id="discussion-container-{{uniqid}}" data-content="forum-discussion" class="mt-4">
{{#html}}
<div class="mb-5">
<div class="d-flex flex-wrap">
<div>{{{modeselectorform}}}</div>
<div class="ml-auto d-flex align-items-middle" data-container="discussion-tools">
<div>{{{subscribe}}}</div>
<div class="pl-1">{{> mod_forum/forum_action_menu}}</div>
</div>
</div>
<div class="d-flex mt-2">
<div>{{{movediscussion}}}</div>
<div {{#movediscussion}}class="ml-2"{{/movediscussion}}>{{{exportdiscussion}}}</div>
</div>
</div>
{{> mod_forum/discussion_settings_drawer}}
{{/html}}
{{#notifications}}

View File

@ -0,0 +1,45 @@
{{!
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 mod_forum/setting_switch
This template will render a toggle switch, which can be used for the forum settings drawer.
Classes required for JS:
* none
Data attributes required for JS:
* none
Context variables required for this template:
* none
Example context (json):
{}
}}
<div>
<span class="switch">
<input type="checkbox" id="{{$switchid}}{{uniqid}}{{/switchid}}"
data-type="{{$type}}toggle-switch{{/type}}"
data-action="toggle" class="hidden"
{{$otherattributes}}{{/otherattributes}}/>
<label for="{{$switchid}}{{uniqid}}{{/switchid}}" class="line-height-4">
{{$labeltext}}{{/labeltext}}
</label>
</span>
</div>

View File

@ -0,0 +1,52 @@
{{!
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 mod_forum/settings_drawer_trigger
This template will render the discussion settings drawer.
Classes required for JS:
* none
Data attributes required for JS:
* none
Context variables required for this template:
* none
Example context (json):
{}
}}
<button
id="toggle-discussion-settings-drawer-{{uniqid}}"
class="btn btn-icon icon-size-4 icon-no-margin colour-inherit"
aria-controls="discussion-settings-drawer"
aria-expanded="false"
title="{{#str}} togglesettingsdrawer, mod_forum {{/str}}"
>
{{#pix}} i/settings, core, {{#str}} togglesettingsdrawer, mod_forum {{/str}} {{/pix}}
</button>
{{#js}}
require(['jquery', 'core/drawer'], function($, Drawer) {
var drawer = $('#discussion-settings-drawer');
var toggles = drawer.find('[data-action="toggle-settings-drawer"]');
toggles = toggles.add('#toggle-discussion-settings-drawer-{{uniqid}}');
Drawer.registerToggles(drawer, toggles);
});
{{/js}}

View File

@ -0,0 +1,50 @@
{{!
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 mod_forum/settings_header
This template will render the header for the discussion/forum settings drawer.
Classes required for JS:
* none
Data attributes required for JS:
* none
Context variables required for this template:
* none
Example context (json):
{}
}}
<div class="d-flex align-items-center mb-2">
<button
class="btn btn-icon icon-size-3 icon-no-margin mr-1 colour-inherit"
data-action="toggle-settings-drawer"
aria-controls="discussion-settings-drawer"
aria-expanded="false"
title="{{#str}} closebuttontitle, core {{/str}}"
>
<span class="dir-ltr-hide">{{#pix}} t/left, core {{/pix}}</span>
<span class="dir-rtl-hide">{{#pix}} t/right, core {{/pix}}</span>
</button>
<h2 class="font-weight-bold h3 mb-0">
{{#str}} settings, core {{/str}}
</h2>
</div>

View File

@ -89,6 +89,7 @@ $PAGE->set_title($forum->get_name());
$PAGE->add_body_class('forumtype-' . $forum->get_type() . ' reset-style');
$PAGE->set_heading($course->fullname);
$PAGE->set_button(forum_search_form($course, $search));
$PAGE->set_include_region_main_settings_in_header_actions(true);
if ($istypesingle && $displaymode == FORUM_MODE_MODERN) {
$PAGE->add_body_class('modern-display-mode reset-style');

View File

@ -39,7 +39,9 @@ if ($navdraweropen) {
$bodyattributes = $OUTPUT->body_attributes($extraclasses);
$blockshtml = $OUTPUT->blocks('side-pre');
$hasblocks = strpos($blockshtml, 'data-block=') !== false;
$regionmainsettingsmenu = $OUTPUT->region_main_settings_menu();
$buildregionmainsettings = !$PAGE->include_region_main_settings_in_header_actions();
// If the settings menu will be included in the header then don't add it here.
$regionmainsettingsmenu = $buildregionmainsettings ? $OUTPUT->region_main_settings_menu() : false;
$templatecontext = [
'sitename' => format_string($SITE->shortname, true, ['context' => context_course::instance(SITEID), "escape" => false]),
'output' => $OUTPUT,

View File

@ -69,6 +69,20 @@ $blocks-plus-gutter: $blocks-column-width + ( $grid-gutter-width / 2 );
}
}
.header-action {
#region-main-settings-menu {
position: unset;
float: none;
width: auto;
& > div {
position: unset;
right: auto;
margin: 0;
}
}
}
[data-region="blocks-column"] {
@include media-breakpoint-down(lg) {
width: 100%;

View File

@ -49,8 +49,10 @@ p.arrow_button {
.btn.btn-icon {
@extend .btn-link;
height: $icon-width;
width: $icon-width;
height: ($icon-width + 20px);
width: ($icon-width + 20px);
font-size: $icon-width;
line-height: $icon-width;
padding: 0;
border-radius: 50%;
flex-shrink: 0;
@ -63,6 +65,8 @@ p.arrow_button {
&.icon-size-#{$size} {
height: ($length + 20px) !important; /* stylelint-disable-line declaration-no-important */
width: ($length + 20px) !important; /* stylelint-disable-line declaration-no-important */
font-size: $length !important; /* stylelint-disable-line declaration-no-important */
line-height: $length !important; /* stylelint-disable-line declaration-no-important */
}
}
}

View File

@ -2258,6 +2258,10 @@ $switch-transition: .2s all !default;
text-decoration: none !important; /* stylelint-disable-line declaration-no-important */
}
.colour-inherit {
color: inherit !important; /* stylelint-disable-line declaration-no-important */
}
.position-right {
right: 0 !important; /* stylelint-disable-line declaration-no-important */
}

View File

@ -94,3 +94,40 @@ body.drawer-open-right {
margin-right: $drawer-width;
}
}
$right-drawer-width: 320px;
[data-region=right-hand-drawer] {
display: flex;
flex-direction: column;
@include transition(right .2s ease-in-out);
&.drawer {
z-index: $zindex-sticky;
position: fixed;
top: $navbar-height;
right: 0;
height: calc(100% - #{$navbar-height});
width: $right-drawer-width;
box-shadow: -2px 2px 4px rgba(0, 0, 0, .08);
padding: 0;
visibility: visible;
opacity: 1;
}
&.hidden {
display: block;
right: $right-drawer-width * -1;
// Turn off visibility so that nothing in the drawer can receive focus when
// it is hidden.
visibility: hidden;
opacity: 0;
// Delay visibility changes until after the slide right animation has completed.
@include transition(right .2s ease-in-out, visibility 0s ease-in-out .2s, opacity 0s ease-in-out .2s);
}
}
.dir-rtl {
[data-region=right-hand-drawer] {
box-shadow: 2px 2px 4px rgba(0, 0, 0, .08);
}
}

View File

@ -418,7 +418,6 @@
}
}
$message-drawer-width: 320px;
$message-send-bg: $gray-300 !default;
$message-send-color: color-yiq($message-send-bg) !default;
$message-send-time-color: mix($message-send-color, $message-send-bg, 100%) !default;
@ -428,24 +427,9 @@ $message-received-color-muted: mix($message-received-color, $message-received-bg
$message-app-bg: mix($message-send-bg, $message-received-bg, 50%) !default;
$message-day-color: color-yiq($message-app-bg) !default;
.message-app {
display: flex;
flex-direction: column;
background-color: $message-app-bg;
@include transition();
.icon-back-in-drawer {
display: none;
}
&.drawer {
z-index: $zindex-sticky;
position: fixed;
top: $navbar-height;
right: 0;
height: calc(100% - #{$navbar-height});
width: $message-drawer-width;
box-shadow: -2px 2px 4px rgba(0, 0, 0, .08);
.drawer {
.message-app {
height: 100%;
.icon-back-in-app {
display: none;
}
@ -453,16 +437,21 @@ $message-day-color: color-yiq($message-app-bg) !default;
display: inherit;
}
}
}
.message-app {
display: flex;
flex-direction: column;
background-color: $message-app-bg;
.icon-back-in-drawer {
display: none;
}
&.main {
min-height: 400px;
}
&.hidden {
display: block;
right: $message-drawer-width * -1;
}
.header-container {
flex-shrink: 0;
}

View File

@ -109,6 +109,16 @@ select {
}
}
.discussion-settings-container {
.custom-select {
width: 100%;
}
input {
max-width: 100%;
}
}
.forumpost {
border: $border-width solid $border-color;
display: block;

View File

@ -11453,6 +11453,10 @@ div.editor_atto_toolbar button .icon {
text-decoration: none !important;
/* stylelint-disable-line declaration-no-important */ }
.colour-inherit {
color: inherit !important;
/* stylelint-disable-line declaration-no-important */ }
.position-right {
right: 0 !important;
/* stylelint-disable-line declaration-no-important */ }
@ -12164,6 +12168,15 @@ div.editor_atto_toolbar button .icon {
If modifying make sure block-region is horizontally stacked when in full screen */
display: block; } }
.header-action #region-main-settings-menu {
position: unset;
float: none;
width: auto; }
.header-action #region-main-settings-menu > div {
position: unset;
right: auto;
margin: 0; }
@media (max-width: 1199.98px) {
[data-region="blocks-column"] {
width: 100%; } }
@ -13588,6 +13601,37 @@ body.drawer-ease {
body.drawer-open-right {
margin-right: 285px; } }
[data-region=right-hand-drawer] {
display: flex;
flex-direction: column;
transition: right 0.2s ease-in-out; }
@media (prefers-reduced-motion: reduce) {
[data-region=right-hand-drawer] {
transition: none; } }
[data-region=right-hand-drawer].drawer {
z-index: 1020;
position: fixed;
top: 50px;
right: 0;
height: calc(100% - 50px);
width: 320px;
box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.08);
padding: 0;
visibility: visible;
opacity: 1; }
[data-region=right-hand-drawer].hidden {
display: block;
right: -320px;
visibility: hidden;
opacity: 0;
transition: right 0.2s ease-in-out, visibility 0s ease-in-out 0.2s, opacity 0s ease-in-out 0.2s; }
@media (prefers-reduced-motion: reduce) {
[data-region=right-hand-drawer].hidden {
transition: none; } }
.dir-rtl [data-region=right-hand-drawer] {
box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.08); }
#page-my-index {
background-color: #f8f9fa; }
@ -14626,33 +14670,21 @@ a.ygtvspacer:hover {
visibility: visible;
transition: right 0.25s; } }
.drawer .message-app {
height: 100%; }
.drawer .message-app .icon-back-in-app {
display: none; }
.drawer .message-app .icon-back-in-drawer {
display: inherit; }
.message-app {
display: flex;
flex-direction: column;
background-color: #eff1f3;
transition: all 0.2s ease-in-out; }
@media (prefers-reduced-motion: reduce) {
.message-app {
transition: none; } }
background-color: #eff1f3; }
.message-app .icon-back-in-drawer {
display: none; }
.message-app.drawer {
z-index: 1020;
position: fixed;
top: 50px;
right: 0;
height: calc(100% - 50px);
width: 320px;
box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.08); }
.message-app.drawer .icon-back-in-app {
display: none; }
.message-app.drawer .icon-back-in-drawer {
display: inherit; }
.message-app.main {
min-height: 400px; }
.message-app.hidden {
display: block;
right: -320px; }
.message-app .header-container {
flex-shrink: 0; }
.message-app .body-container {
@ -16085,6 +16117,12 @@ select {
color: #373a3c;
font-weight: bold; }
.discussion-settings-container .custom-select {
width: 100%; }
.discussion-settings-container input {
max-width: 100%; }
.forumpost {
border: 1px solid #dee2e6;
display: block;
@ -16887,8 +16925,10 @@ p.arrow_button {
margin: 0 0 10px 5px; }
.btn.btn-icon, #page-grade-grading-manage .actions .btn-icon.action, #rubric-rubric.gradingform_rubric #rubric-criteria .criterion .addlevel input.btn-icon, #rubric-rubric.gradingform_rubric .btn-icon.addcriterion {
height: 16px;
width: 16px;
height: 36px;
width: 36px;
font-size: 16px;
line-height: 16px;
padding: 0;
border-radius: 50%;
flex-shrink: 0; }
@ -16898,31 +16938,55 @@ p.arrow_button {
height: 20px !important;
/* stylelint-disable-line declaration-no-important */
width: 20px !important;
/* stylelint-disable-line declaration-no-important */
font-size: 0 !important;
/* stylelint-disable-line declaration-no-important */
line-height: 0 !important;
/* stylelint-disable-line declaration-no-important */ }
.btn.btn-icon.icon-size-1, #page-grade-grading-manage .actions .btn-icon.icon-size-1.action, #rubric-rubric.gradingform_rubric #rubric-criteria .criterion .addlevel input.btn-icon.icon-size-1, #rubric-rubric.gradingform_rubric .btn-icon.icon-size-1.addcriterion {
height: 24px !important;
/* stylelint-disable-line declaration-no-important */
width: 24px !important;
/* stylelint-disable-line declaration-no-important */
font-size: 4px !important;
/* stylelint-disable-line declaration-no-important */
line-height: 4px !important;
/* stylelint-disable-line declaration-no-important */ }
.btn.btn-icon.icon-size-2, #page-grade-grading-manage .actions .btn-icon.icon-size-2.action, #rubric-rubric.gradingform_rubric #rubric-criteria .criterion .addlevel input.btn-icon.icon-size-2, #rubric-rubric.gradingform_rubric .btn-icon.icon-size-2.addcriterion {
height: 28px !important;
/* stylelint-disable-line declaration-no-important */
width: 28px !important;
/* stylelint-disable-line declaration-no-important */
font-size: 8px !important;
/* stylelint-disable-line declaration-no-important */
line-height: 8px !important;
/* stylelint-disable-line declaration-no-important */ }
.btn.btn-icon.icon-size-3, #page-grade-grading-manage .actions .btn-icon.icon-size-3.action, #rubric-rubric.gradingform_rubric #rubric-criteria .criterion .addlevel input.btn-icon.icon-size-3, #rubric-rubric.gradingform_rubric .btn-icon.icon-size-3.addcriterion {
height: 36px !important;
/* stylelint-disable-line declaration-no-important */
width: 36px !important;
/* stylelint-disable-line declaration-no-important */
font-size: 16px !important;
/* stylelint-disable-line declaration-no-important */
line-height: 16px !important;
/* stylelint-disable-line declaration-no-important */ }
.btn.btn-icon.icon-size-4, #page-grade-grading-manage .actions .btn-icon.icon-size-4.action, #rubric-rubric.gradingform_rubric #rubric-criteria .criterion .addlevel input.btn-icon.icon-size-4, #rubric-rubric.gradingform_rubric .btn-icon.icon-size-4.addcriterion {
height: 44px !important;
/* stylelint-disable-line declaration-no-important */
width: 44px !important;
/* stylelint-disable-line declaration-no-important */
font-size: 24px !important;
/* stylelint-disable-line declaration-no-important */
line-height: 24px !important;
/* stylelint-disable-line declaration-no-important */ }
.btn.btn-icon.icon-size-5, #page-grade-grading-manage .actions .btn-icon.icon-size-5.action, #rubric-rubric.gradingform_rubric #rubric-criteria .criterion .addlevel input.btn-icon.icon-size-5, #rubric-rubric.gradingform_rubric .btn-icon.icon-size-5.addcriterion {
height: 68px !important;
/* stylelint-disable-line declaration-no-important */
width: 68px !important;
/* stylelint-disable-line declaration-no-important */
font-size: 48px !important;
/* stylelint-disable-line declaration-no-important */
line-height: 48px !important;
/* stylelint-disable-line declaration-no-important */ }
.gradetreebox h4 {

View File

@ -11708,6 +11708,10 @@ div.editor_atto_toolbar button .icon {
text-decoration: none !important;
/* stylelint-disable-line declaration-no-important */ }
.colour-inherit {
color: inherit !important;
/* stylelint-disable-line declaration-no-important */ }
.position-right {
right: 0 !important;
/* stylelint-disable-line declaration-no-important */ }
@ -12420,6 +12424,15 @@ div.editor_atto_toolbar button .icon {
If modifying make sure block-region is horizontally stacked when in full screen */
display: block; } }
.header-action #region-main-settings-menu {
position: unset;
float: none;
width: auto; }
.header-action #region-main-settings-menu > div {
position: unset;
right: auto;
margin: 0; }
@media (max-width: 1199.98px) {
[data-region="blocks-column"] {
width: 100%; } }
@ -13849,6 +13862,37 @@ body.drawer-ease {
body.drawer-open-right {
margin-right: 285px; } }
[data-region=right-hand-drawer] {
display: flex;
flex-direction: column;
transition: right 0.2s ease-in-out; }
@media (prefers-reduced-motion: reduce) {
[data-region=right-hand-drawer] {
transition: none; } }
[data-region=right-hand-drawer].drawer {
z-index: 1020;
position: fixed;
top: 50px;
right: 0;
height: calc(100% - 50px);
width: 320px;
box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.08);
padding: 0;
visibility: visible;
opacity: 1; }
[data-region=right-hand-drawer].hidden {
display: block;
right: -320px;
visibility: hidden;
opacity: 0;
transition: right 0.2s ease-in-out, visibility 0s ease-in-out 0.2s, opacity 0s ease-in-out 0.2s; }
@media (prefers-reduced-motion: reduce) {
[data-region=right-hand-drawer].hidden {
transition: none; } }
.dir-rtl [data-region=right-hand-drawer] {
box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.08); }
#page-my-index {
background-color: #f8f9fa; }
@ -14888,33 +14932,21 @@ a.ygtvspacer:hover {
visibility: visible;
transition: right 0.25s; } }
.drawer .message-app {
height: 100%; }
.drawer .message-app .icon-back-in-app {
display: none; }
.drawer .message-app .icon-back-in-drawer {
display: inherit; }
.message-app {
display: flex;
flex-direction: column;
background-color: #eff1f3;
transition: all 0.2s ease-in-out; }
@media (prefers-reduced-motion: reduce) {
.message-app {
transition: none; } }
background-color: #eff1f3; }
.message-app .icon-back-in-drawer {
display: none; }
.message-app.drawer {
z-index: 1020;
position: fixed;
top: 50px;
right: 0;
height: calc(100% - 50px);
width: 320px;
box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.08); }
.message-app.drawer .icon-back-in-app {
display: none; }
.message-app.drawer .icon-back-in-drawer {
display: inherit; }
.message-app.main {
min-height: 400px; }
.message-app.hidden {
display: block;
right: -320px; }
.message-app .header-container {
flex-shrink: 0; }
.message-app .body-container {
@ -16357,6 +16389,12 @@ select {
color: #373a3c;
font-weight: bold; }
.discussion-settings-container .custom-select {
width: 100%; }
.discussion-settings-container input {
max-width: 100%; }
.forumpost {
border: 1px solid #dee2e6;
display: block;
@ -17163,8 +17201,10 @@ p.arrow_button {
margin: 0 0 10px 5px; }
.btn.btn-icon, #page-grade-grading-manage .actions .btn-icon.action, #rubric-rubric.gradingform_rubric #rubric-criteria .criterion .addlevel input.btn-icon, #rubric-rubric.gradingform_rubric .btn-icon.addcriterion {
height: 16px;
width: 16px;
height: 36px;
width: 36px;
font-size: 16px;
line-height: 16px;
padding: 0;
border-radius: 50%;
flex-shrink: 0; }
@ -17174,31 +17214,55 @@ p.arrow_button {
height: 20px !important;
/* stylelint-disable-line declaration-no-important */
width: 20px !important;
/* stylelint-disable-line declaration-no-important */
font-size: 0 !important;
/* stylelint-disable-line declaration-no-important */
line-height: 0 !important;
/* stylelint-disable-line declaration-no-important */ }
.btn.btn-icon.icon-size-1, #page-grade-grading-manage .actions .btn-icon.icon-size-1.action, #rubric-rubric.gradingform_rubric #rubric-criteria .criterion .addlevel input.btn-icon.icon-size-1, #rubric-rubric.gradingform_rubric .btn-icon.icon-size-1.addcriterion {
height: 24px !important;
/* stylelint-disable-line declaration-no-important */
width: 24px !important;
/* stylelint-disable-line declaration-no-important */
font-size: 4px !important;
/* stylelint-disable-line declaration-no-important */
line-height: 4px !important;
/* stylelint-disable-line declaration-no-important */ }
.btn.btn-icon.icon-size-2, #page-grade-grading-manage .actions .btn-icon.icon-size-2.action, #rubric-rubric.gradingform_rubric #rubric-criteria .criterion .addlevel input.btn-icon.icon-size-2, #rubric-rubric.gradingform_rubric .btn-icon.icon-size-2.addcriterion {
height: 28px !important;
/* stylelint-disable-line declaration-no-important */
width: 28px !important;
/* stylelint-disable-line declaration-no-important */
font-size: 8px !important;
/* stylelint-disable-line declaration-no-important */
line-height: 8px !important;
/* stylelint-disable-line declaration-no-important */ }
.btn.btn-icon.icon-size-3, #page-grade-grading-manage .actions .btn-icon.icon-size-3.action, #rubric-rubric.gradingform_rubric #rubric-criteria .criterion .addlevel input.btn-icon.icon-size-3, #rubric-rubric.gradingform_rubric .btn-icon.icon-size-3.addcriterion {
height: 36px !important;
/* stylelint-disable-line declaration-no-important */
width: 36px !important;
/* stylelint-disable-line declaration-no-important */
font-size: 16px !important;
/* stylelint-disable-line declaration-no-important */
line-height: 16px !important;
/* stylelint-disable-line declaration-no-important */ }
.btn.btn-icon.icon-size-4, #page-grade-grading-manage .actions .btn-icon.icon-size-4.action, #rubric-rubric.gradingform_rubric #rubric-criteria .criterion .addlevel input.btn-icon.icon-size-4, #rubric-rubric.gradingform_rubric .btn-icon.icon-size-4.addcriterion {
height: 44px !important;
/* stylelint-disable-line declaration-no-important */
width: 44px !important;
/* stylelint-disable-line declaration-no-important */
font-size: 24px !important;
/* stylelint-disable-line declaration-no-important */
line-height: 24px !important;
/* stylelint-disable-line declaration-no-important */ }
.btn.btn-icon.icon-size-5, #page-grade-grading-manage .actions .btn-icon.icon-size-5.action, #rubric-rubric.gradingform_rubric #rubric-criteria .criterion .addlevel input.btn-icon.icon-size-5, #rubric-rubric.gradingform_rubric .btn-icon.icon-size-5.addcriterion {
height: 68px !important;
/* stylelint-disable-line declaration-no-important */
width: 68px !important;
/* stylelint-disable-line declaration-no-important */
font-size: 48px !important;
/* stylelint-disable-line declaration-no-important */
line-height: 48px !important;
/* stylelint-disable-line declaration-no-important */ }
.gradetreebox h4 {

View File

@ -31,10 +31,15 @@
<div class="col-12 pt-3 pb-3">
<div class="card {{^contextheader}}border-0 bg-transparent{{/contextheader}}">
<div class="card-body {{^contextheader}}p-2{{/contextheader}}">
<div class="d-flex">
<div class="d-flex align-items-center">
<div class="mr-auto">
{{{contextheader}}}
</div>
<div class="header-actions-container flex-shrink-0" data-region="header-actions-container">
{{#headeractions}}
<div class="header-action ml-2">{{{.}}}</div>
{{/headeractions}}
</div>
</div>
<div class="d-flex flex-wrap">
{{#hasnavbar}}