You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
1.4 KiB

define(["jquery","core/pubsub","core/str","core_message/message_drawer_events","core_message/message_drawer_view_contacts_section_contacts","core_message/message_drawer_view_contacts_section_requests"],function(a,b,c,d,e,f){var g={ACTION_SHOW_CONTACTS_SECTION:'[data-action="show-contacts-section"]',ACTION_SHOW_REQUESTS_SECTION:'[data-action="show-requests-section"]',CONTACT_REQUEST_COUNT:'[data-region="contact-request-count"]',CONTACTS_SECTION_CONTAINER:'[data-section="contacts"]',REQUESTS_SECTION_CONTAINER:'[data-section="requests"]'},h=function(a){return a.find(g.CONTACTS_SECTION_CONTAINER)},i=function(a){return a.find(g.REQUESTS_SECTION_CONTAINER)},j=function(a){return a.hasClass("active")},k=function(a){return function(){var b=a.find(g.CONTACT_REQUEST_COUNT),c=parseInt(b.text(),10);c=isNaN(c)?0:c-1,c<=0?b.addClass("hidden"):b.text(c)}},l=function(a){var c=h(a),j=i(a),l=a.find(g.ACTION_SHOW_CONTACTS_SECTION),m=a.find(g.ACTION_SHOW_REQUESTS_SECTION);l.on("show.bs.tab",function(){e.show(c)}),m.on("show.bs.tab",function(){f.show(j)}),b.subscribe(d.CONTACT_REQUEST_ACCEPTED,k(a)),b.subscribe(d.CONTACT_REQUEST_DECLINED,k(a))},m=function(b,c,d){d=a(d),d.attr("data-contacts-init")||(l(d),d.attr("data-contacts-init",!0));var g=h(d),k=i(d);return j(g)?e.show(g):f.show(k),a.Deferred().resolve().promise()},n=function(){return c.get_string("messagedrawerviewcontacts","core_message")};return{show:m,description:n}});