Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 24 additions & 20 deletions app/components/form/responses-table-card.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
import Component from '@glimmer/component';
import Component from '@ember/component';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';

export default class FormResponsesTableCardComponent extends Component {
@service session;
@tracked showAllergyInfo = false;
@action
copyUsernames() {
let usernames = this.form
.get('responses')
.map((response) => response.get('user.username'));
if (!this.form.currentUserResponseCompleted) {
usernames = usernames.filter(
(name) => name !== this.session.currentUser.username
);
}
usernames = usernames.join('\n');
navigator.clipboard.writeText(usernames);
}
}
const FormResponsesTableCardComponent = Component.extend({
session: service('session'),
actions: {
copyUsernames() {
let usernames = this.form
.get('responses')
.map((response) => response.get('user.username'));

Check warning on line 10 in app/components/form/responses-table-card.js

View check run for this annotation

Codecov / codecov/patch

app/components/form/responses-table-card.js#L10

Added line #L10 was not covered by tests
if (!this.form.currentUserResponseCompleted) {
usernames = usernames.filter(
(name) => name !== this.session.currentUser.username
);
}

Check warning on line 15 in app/components/form/responses-table-card.js

View check run for this annotation

Codecov / codecov/patch

app/components/form/responses-table-card.js#L12-L15

Added lines #L12 - L15 were not covered by tests
usernames = usernames.join('\n');
navigator.clipboard.writeText(usernames);
},
},

Check warning on line 19 in app/components/form/responses-table-card.js

View check run for this annotation

Codecov / codecov/patch

app/components/form/responses-table-card.js#L18-L19

Added lines #L18 - L19 were not covered by tests
});

FormResponsesTableCardComponent.reopenClass({
positionalParams: ['form'],
});

export default FormResponsesTableCardComponent;
Loading