1
/* Copyright 2011 Canonical Ltd. This software is licensed under the
2
* GNU Affero General Public License version 3 (see the file LICENSE).
4
* Setup for managing subscribers list for questions.
7
* @submodule subscribers
10
YUI.add('lp.answers.subscribers', function(Y) {
12
var namespace = Y.namespace('lp.answers.subscribers');
15
* Possible subscriber levels with descriptive headers for
16
* sections that will hold them.
18
var subscriber_levels = {
19
'Direct': 'Direct subscribers',
20
'Indirect': 'Also notified'
24
* Order of subscribers sections.
26
var subscriber_level_order = ['Direct', 'Indirect'];
30
* Create the SubscribersLoader instance which will load subscribers for
31
* a question and put them in the web page.
33
* @param config {Object} Defines `container_box' CSS selector for the
34
* SubscribersList container box, `context' holding context metadata (at
35
* least with `web_link') and `subscribers_details_view' holding
36
* a relative URI to load subscribers' details from.
38
function createQuestionSubscribersLoader(config) {
39
config.subscriber_levels = subscriber_levels;
40
config.subscriber_level_order = subscriber_level_order;
41
config.context = config.question;
42
config.subscribe_someone_else_level = 'Direct';
43
config.default_subscriber_level = 'Indirect';
44
var module = Y.lp.app.subscribers.subscribers_list;
45
return new module.SubscribersLoader(config);
47
namespace.createQuestionSubscribersLoader = createQuestionSubscribersLoader;
49
}, "0.1", {"requires": ["lp.app.subscribers.subscribers_list"]});