distribution_list_badge.ts 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /**
  2. * This file is part of Threema Web.
  3. *
  4. * Threema Web is free software: you can redistribute it and/or modify it
  5. * under the terms of the GNU Affero General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or (at
  7. * your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
  12. * General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Affero General Public License
  15. * along with Threema Web. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. import {StateService as UiStateService} from '@uirouter/angularjs';
  18. /**
  19. * Show a distribution list receiver with small avatar, name and verification level
  20. */
  21. export default [
  22. '$state',
  23. function($state: UiStateService) {
  24. return {
  25. restrict: 'EA',
  26. scope: {},
  27. bindToController: {
  28. distributionListReceiver: '=eeeDistributionListReceiver',
  29. },
  30. controllerAs: 'ctrl',
  31. controller: [function() {
  32. this.click = () => {
  33. $state.go('messenger.home.conversation', {
  34. type: 'distributionList',
  35. id: this.distributionListReceiver.id,
  36. initParams: null,
  37. });
  38. };
  39. }],
  40. template: `
  41. <div class="distribution-list-badge receiver-badge" ng-click="ctrl.click()">
  42. <section class="avatar-box">
  43. <eee-avatar eee-receiver="ctrl.distributionListReceiver"
  44. eee-resolution="'low'"></eee-avatar>
  45. </section>
  46. <div class="receiver-badge-name"
  47. ng-bind-html="ctrl.distributionListReceiver.displayName | escapeHtml | emojify">
  48. </div>
  49. </div>
  50. `,
  51. };
  52. },
  53. ];