1 |
efrain |
1 |
// This file is part of Moodle - http://moodle.org/
|
|
|
2 |
//
|
|
|
3 |
// Moodle is free software: you can redistribute it and/or modify
|
|
|
4 |
// it under the terms of the GNU General Public License as published by
|
|
|
5 |
// the Free Software Foundation, either version 3 of the License, or
|
|
|
6 |
// (at your option) any later version.
|
|
|
7 |
//
|
|
|
8 |
// Moodle is distributed in the hope that it will be useful,
|
|
|
9 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
10 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
11 |
// GNU General Public License for more details.
|
|
|
12 |
//
|
|
|
13 |
// You should have received a copy of the GNU General Public License
|
|
|
14 |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
15 |
|
|
|
16 |
/**
|
|
|
17 |
* Controls the preference for an individual notification type on the
|
|
|
18 |
* message preference page.
|
|
|
19 |
*
|
|
|
20 |
* @module core_message/message_notification_preference
|
|
|
21 |
* @copyright 2016 Ryan Wyllie <ryan@moodle.com>
|
|
|
22 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
23 |
*/
|
|
|
24 |
define(['jquery', 'core_message/notification_preference'],
|
|
|
25 |
function($, NotificationPreference) {
|
|
|
26 |
|
|
|
27 |
var SELECTORS = {
|
|
|
28 |
PREFERENCE_KEY: '[data-preference-key]',
|
|
|
29 |
};
|
|
|
30 |
|
|
|
31 |
/**
|
|
|
32 |
* Constructor for the Preference.
|
|
|
33 |
*
|
|
|
34 |
* @class
|
|
|
35 |
* @param {object} element jQuery object root element of the preference
|
|
|
36 |
* @param {int} userId The current user id
|
|
|
37 |
*/
|
|
|
38 |
var MessageNotificationPreference = function(element, userId) {
|
|
|
39 |
NotificationPreference.call(this, element, userId);
|
|
|
40 |
};
|
|
|
41 |
|
|
|
42 |
/**
|
|
|
43 |
* Clone the parent prototype.
|
|
|
44 |
*/
|
|
|
45 |
MessageNotificationPreference.prototype = Object.create(NotificationPreference.prototype);
|
|
|
46 |
|
|
|
47 |
/**
|
|
|
48 |
* Set constructor.
|
|
|
49 |
*/
|
|
|
50 |
MessageNotificationPreference.prototype.constructor = MessageNotificationPreference;
|
|
|
51 |
|
|
|
52 |
/**
|
|
|
53 |
* Get the unique prefix key that identifies this user preference.
|
|
|
54 |
*
|
|
|
55 |
* @method getPreferenceKey
|
|
|
56 |
* @return {string}
|
|
|
57 |
*/
|
|
|
58 |
MessageNotificationPreference.prototype.getPreferenceKey = function() {
|
|
|
59 |
return this.root.find(SELECTORS.PREFERENCE_KEY).attr('data-preference-key');
|
|
|
60 |
};
|
|
|
61 |
|
|
|
62 |
return MessageNotificationPreference;
|
|
|
63 |
});
|