MDL-56292 message: move notifications page into popup plugin

This commit is contained in:
Ryan Wyllie 2016-10-06 06:18:26 +00:00 committed by Mark Nelson
parent 9f7b7b7c88
commit 641b36e2ab
9 changed files with 24 additions and 28 deletions

View File

@ -17,14 +17,14 @@
* Controls the content area of the notification area on the
* notification page.
*
* @module core_message/notification_area_content_area
* @module message_popup/notification_area_content_area
* @class notification_area_content_area
* @package message
* @copyright 2016 Ryan Wyllie <ryan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define(['jquery', 'core/templates', 'core/notification', 'core/custom_interaction_events',
'message_popup/notification_repository', 'core_message/notification_area_events'],
'message_popup/notification_repository', 'message_popup/notification_area_events'],
function($, Templates, DebugNotification, CustomEvents, NotificationRepo, NotificationAreaEvents) {
var SELECTORS = {
@ -36,9 +36,9 @@ define(['jquery', 'core/templates', 'core/notification', 'core/custom_interactio
};
var TEMPLATES = {
HEADER: 'message/notification_area_content_area_header',
CONTENT: 'message/notification_area_content_area_content',
FOOTER: 'message/notification_area_content_area_footer',
HEADER: 'message_popup/notification_area_content_area_header',
CONTENT: 'message_popup/notification_area_content_area_content',
FOOTER: 'message_popup/notification_area_content_area_footer',
};
/**

View File

@ -16,14 +16,14 @@
/**
* Controls the notification area on the notification page.
*
* @module core_message/notification_area_control_area
* @module message_popup/notification_area_control_area
* @class notification_area_control_area
* @package message
* @copyright 2016 Ryan Wyllie <ryan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define(['jquery', 'core/templates', 'core/notification', 'core/custom_interaction_events',
'message_popup/notification_repository', 'core_message/notification_area_events'],
'message_popup/notification_repository', 'message_popup/notification_area_events'],
function($, Templates, DebugNotification, CustomEvents, NotificationRepo, NotificationAreaEvents) {
var SELECTORS = {

View File

@ -17,7 +17,7 @@
* Contain the events that can be fired in the notification area on
* the notifications page.
*
* @module core/notification_area_events
* @module message_popup/notification_area_events
* @class notification_area_events
* @package core
* @copyright 2016 Ryan Wyllie <ryan@moodle.com>

View File

@ -26,7 +26,7 @@
*/
define(['jquery', 'theme_bootstrapbase/bootstrap', 'core/ajax', 'core/templates', 'core/str', 'core/url',
'core/notification', 'core/custom_interaction_events', 'core/popover_region_controller',
'message_popup/notification_repository', 'core_message/notification_area_events'],
'message_popup/notification_repository', 'message_popup/notification_area_events'],
function($, Bootstrap, Ajax, Templates, Str, URL, DebugNotification, CustomEvents,
PopoverController, NotificationRepo, NotificationAreaEvents) {
@ -236,7 +236,7 @@ define(['jquery', 'theme_bootstrapbase/bootstrap', 'core/ajax', 'core/templates'
var offset = this.getOffset() - this.limit;
// Update the view more url to contain the offset to allow the notifications
// page to load to the correct position in the list of notifications.
notification.viewmoreurl = URL.relativeUrl('/message/notifications.php', {
notification.viewmoreurl = URL.relativeUrl('/message/output/popup/notifications.php', {
notificationid: notification.id,
offset: offset,
}, true);

View File

@ -17,21 +17,19 @@
/**
* View a user's notifications.
*
* @package core_message
* @package message_popup
* @copyright 2016 Ryan Wyllie <ryan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(__DIR__ . '/../config.php');
require_once($CFG->dirroot . '/message/lib.php');
require_once($CFG->dirroot . '/user/lib.php');
require_once(__DIR__ . '/../../../config.php');
$notificationid = optional_param('notificationid', 0, PARAM_INT);
$offset = optional_param('offset', 0, PARAM_INT);
$limit = optional_param('limit', 0, PARAM_INT);
$userid = $USER->id;
$url = new moodle_url('/message/notifications.php');
$url = new moodle_url('/message/output/popup/notifications.php');
$url->param('id', $notificationid);
$PAGE->set_url($url);
@ -67,6 +65,6 @@ $context = [
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('notifications', 'message'));
echo $renderer->render_from_template('message/notification_area', $context);
echo $renderer->render_from_template('message_popup/notification_area', $context);
echo $OUTPUT->footer();

View File

@ -15,7 +15,7 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template message/notification_area
@template message_popup/notification_area
This template will render the notification area on the notifications
page.
@ -24,15 +24,13 @@
* none
Data attributes required for JS:
* data-region="notification-area"
* data-region="control-area"
* data-region="content-area"
* data-region="header"
* data-region="content"
* data-action="toggle-mode"
* All data attributes are required
Context variables required for this template:
* userid The logged in user id
* offset The offset amound of the notification list
* limit The limit amount for the notification list
* notificationid The specific notification to select
Example context (json):
{
@ -58,10 +56,10 @@
</div>
</div>
{{#js}}
require(['jquery', 'core_message/notification_area_control_area', 'core_message/notification_area_content_area'],
require(['jquery', 'message_popup/notification_area_control_area', 'message_popup/notification_area_content_area'],
function($, ControlArea, ContentArea) {
var userId = $('[data-region="notification-area"]').attr('data-user-id');
var userId = {{userid}};
var controlArea = new ControlArea($('[data-region="control-area"]'), userId);
{{#offset}}
controlArea.setOffset({{.}});

View File

@ -15,7 +15,7 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template message/notification_area_content_area_content
@template message_popup/notification_area_content_area_content
This template will render the content for the content area in the
notification area on the notifications page.

View File

@ -15,7 +15,7 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template message/notification_area_content_area_footer
@template message_popup/notification_area_content_area_footer
This template will render the footer for the content area in the
notification area on the notifications page.

View File

@ -15,7 +15,7 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template message/notification_area_content_area_header
@template message_popup/notification_area_content_area_header
This template will render the header for the content area in the
notification area on the notifications page.