|
1 | | -import Component from '@glimmer/component'; |
| 1 | +import Component from '@ember/component'; |
2 | 2 | import { inject as service } from '@ember/service'; |
3 | | -import { action } from '@ember/object'; |
4 | | -import { tracked } from '@glimmer/tracking'; |
5 | 3 |
|
6 | | -export default class FormResponsesTableCardComponent extends Component { |
7 | | - @service session; |
8 | | - @tracked showAllergyInfo = false; |
9 | | - @action |
10 | | - copyUsernames() { |
11 | | - let usernames = this.form |
12 | | - .get('responses') |
13 | | - .map((response) => response.get('user.username')); |
14 | | - if (!this.form.currentUserResponseCompleted) { |
15 | | - usernames = usernames.filter( |
16 | | - (name) => name !== this.session.currentUser.username |
17 | | - ); |
18 | | - } |
19 | | - usernames = usernames.join('\n'); |
20 | | - navigator.clipboard.writeText(usernames); |
21 | | - } |
22 | | -} |
| 4 | +const FormResponsesTableCardComponent = Component.extend({ |
| 5 | + session: service('session'), |
| 6 | + actions: { |
| 7 | + copyUsernames() { |
| 8 | + let usernames = this.form |
| 9 | + .get('responses') |
| 10 | + .map((response) => response.get('user.username')); |
| 11 | + if (!this.form.currentUserResponseCompleted) { |
| 12 | + usernames = usernames.filter( |
| 13 | + (name) => name !== this.session.currentUser.username |
| 14 | + ); |
| 15 | + } |
| 16 | + usernames = usernames.join('\n'); |
| 17 | + navigator.clipboard.writeText(usernames); |
| 18 | + }, |
| 19 | + }, |
| 20 | +}); |
| 21 | + |
| 22 | +FormResponsesTableCardComponent.reopenClass({ |
| 23 | + positionalParams: ['form'], |
| 24 | +}); |
| 25 | + |
| 26 | +export default FormResponsesTableCardComponent; |
0 commit comments