MDL-66076 message: Add copy of template plus JS comment fix

This commit is contained in:
Michael Hawkins 2019-10-09 13:45:44 +08:00 committed by Jun Pataleta
parent aa4b62baac
commit fb599f32d6
4 changed files with 45 additions and 4 deletions

View File

@ -1,2 +1,2 @@
define ("core_message/message_send_bulk",["exports","core/str","core/modal_factory","core/templates","core/modal_events","core/ajax","core/notification"],function(a,b,c,d,e,f,g){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.sendMessage=a.showModal=void 0;c=h(c);d=h(d);e=h(e);f=h(f);g=h(g);function h(a){return a&&a.__esModule?a:{default:a}}var i=function(a){var f=1<arguments.length&&arguments[1]!==void 0?arguments[1]:null;if(!a.length){return Promise.resolve()}var g=null;if(1==a.length){g=(0,b.get_string)("sendbulkmessagesingle","core_message")}else{g=(0,b.get_string)("sendbulkmessage","core_message",a.length)}return c.default.create({type:c.default.types.SAVE_CANCEL,body:d.default.render("core_user/send_bulk_message",{}),title:g}).then(function(b){b.setSaveButtonText(g);b.getRoot().on(e.default.hidden,function(){if(f){f()}b.getRoot().remove()});b.getRoot().on(e.default.save,function(){var c=b.getRoot().find("form textarea").val();j(c,a)});b.show();return b})};a.showModal=i;var j=function(a,c){var d=[];c.forEach(function(b){d.push({touserid:b,text:a})});return f.default.call([{methodname:"core_message_send_instant_messages",args:{messages:d}}])[0].then(function(a){if(1==a.length){return(0,b.get_string)("sendbulkmessagesentsingle","core_message")}else{return(0,b.get_string)("sendbulkmessagesent","core_message",a.length)}}).then(function(a){g.default.addNotification({message:a,type:"success"});return!0}).catch(g.default.exception)};a.sendMessage=j});
define ("core_message/message_send_bulk",["exports","core/str","core/modal_factory","core/templates","core/modal_events","core/ajax","core/notification"],function(a,b,c,d,e,f,g){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.sendMessage=a.showModal=void 0;c=h(c);d=h(d);e=h(e);f=h(f);g=h(g);function h(a){return a&&a.__esModule?a:{default:a}}var i=function(a){var f=1<arguments.length&&arguments[1]!==void 0?arguments[1]:null;if(!a.length){return Promise.resolve()}var g=null;if(1==a.length){g=(0,b.get_string)("sendbulkmessagesingle","core_message")}else{g=(0,b.get_string)("sendbulkmessage","core_message",a.length)}return c.default.create({type:c.default.types.SAVE_CANCEL,body:d.default.render("core_message/send_bulk_message",{}),title:g}).then(function(b){b.setSaveButtonText(g);b.getRoot().on(e.default.hidden,function(){if(f){f()}b.getRoot().remove()});b.getRoot().on(e.default.save,function(){var c=b.getRoot().find("form textarea").val();j(c,a)});b.show();return b})};a.showModal=i;var j=function(a,c){var d=[];c.forEach(function(b){d.push({touserid:b,text:a})});return f.default.call([{methodname:"core_message_send_instant_messages",args:{messages:d}}])[0].then(function(a){if(1==a.length){return(0,b.get_string)("sendbulkmessagesentsingle","core_message")}else{return(0,b.get_string)("sendbulkmessagesent","core_message",a.length)}}).then(function(a){g.default.addNotification({message:a,type:"success"});return!0}).catch(g.default.exception)};a.sendMessage=j});
//# sourceMappingURL=message_send_bulk.min.js.map

File diff suppressed because one or more lines are too long

View File

@ -49,13 +49,13 @@ export const showModal = (users, callback = null) => {
return ModalFactory.create({
type: ModalFactory.types.SAVE_CANCEL,
body: Templates.render('core_user/send_bulk_message', {}),
body: Templates.render('core_message/send_bulk_message', {}),
title: titlePromise,
})
.then(function(modal) {
modal.setSaveButtonText(titlePromise);
// We want to focus on the action select when the dialog is closed.
// When the dialog is closed, perform the callback (if provided).
modal.getRoot().on(ModalEvents.hidden, function() {
if (callback) {
callback();

View File

@ -0,0 +1,41 @@
{{!
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_message/send_bulk_message
Template for the send bulk message modal.
Context variables required for this template:
None
Example context (json):
{
}
}}
<form>
<p>
<label for="bulk-message">
<span class="sr-only">{{#str}}message, core_message{{/str}}</span>
</label>
<textarea id="bulk-message" rows="3" data-max-rows="10" data-auto-rows="true" cols="30" class="form-control"></textarea>
</p>
</form>
{{#js}}
require(['core/auto_rows'], function(AutoRows) {
AutoRows.init(document.getElementById('bulk-message'));
});
{{/js}}