Autoría | Ultima modificación | Ver Log |
/**
* Controls the group info page of the message drawer.
*
* @module core_message/message_drawer_view_group_info
* @copyright 2018 Ryan Wyllie <ryan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define("core_message/message_drawer_view_group_info",["jquery","core/str","core/templates","core_message/message_repository","core_message/message_drawer_lazy_load_list"],(function($,Str,Templates,Repository,LazyLoadList){var SELECTORS_CONTENT_CONTAINER='[data-region="group-info-content-container"]',TEMPLATES_CONTENT="core_message/message_drawer_view_group_info_body_content",TEMPLATES_MEMBERS_LIST="core_message/message_drawer_view_group_info_participants_list",getContentContainer=function(root){return root.find(SELECTORS_CONTENT_CONTAINER)},renderMembersCallback=function(contentContainer,members){return Templates.render(TEMPLATES_MEMBERS_LIST,{contacts:members}).then((function(html){return contentContainer.append(html),html}))};return{show:function(namespace,header,body,footer,conversation,loggedInUserId){var root=$(body);return getContentContainer(root).empty(),function(root,conversation,loggedInUserId){var placeholderCount=conversation.totalMemberCount>50?50:conversation.totalMemberCount,placeholders=Array
.apply(null,Array(placeholderCount)).map((function(){return!0})),templateContext={name:conversation.name,subname:conversation.subname,imageurl:conversation.imageUrl,placeholders:placeholders,loggedinuser:{id:loggedInUserId}};return Templates.render(TEMPLATES_CONTENT,templateContext).then((function(html){return getContentContainer(root).append(html),html}))}(root,conversation,loggedInUserId).then((function(){var listRoot=LazyLoadList.getRoot(root);LazyLoadList.show(listRoot,function(conversation,limit,offset){return function(root,userId){return Repository.getConversationMembers(conversation.id,userId,limit+1,offset).then((function(members){return members.length>limit?members=members.slice(0,-1):LazyLoadList.setLoadedAll(root,!0),offset+=limit,members.filter((function(member){return member.id!=userId}))}))}}(conversation,50,0),renderMembersCallback)}))},description:function(root,conversation){return Str.get_string("messagedrawerviewgroupinfo","core_message",conversation.name)}}}));
//# sourceMappingURL=message_drawer_view_group_info.min.js.map