Skip to content

Commit

Permalink
Add copy usernames button to activity responses table (#768)
Browse files Browse the repository at this point in the history
* Add copy usernames button to activity responses table

* Fix lint
  • Loading branch information
wilco375 authored May 19, 2023
1 parent d8b9135 commit dbd2aea
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
9 changes: 7 additions & 2 deletions app/components/form/responses-table-card.hbs
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{{#if form.amountOfResponses}}
<div class='card'>
<div class='card-header my-2'>
<div class='card-header my-2 py-1'>
<div class='row align-items-center'>
<h5 class='card-title col'>Inschrijvingen</h5>
<div class='col col-md-auto'>
<div class='col col-md-auto d-flex align-items-center flex-wrap'>
{{#if (can 'create debit/collections')}}
<button class='btn btn-primary btn-sm me-3 my-2 text-nowrap' type="button" {{on 'click' (action 'copyUsernames')}}>
Kopieer gebruikersnamen
</button>
{{/if}}
<div class="form-check">
<Input
@type='checkbox'
Expand Down
13 changes: 12 additions & 1 deletion app/components/form/responses-table-card.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
import Component from '@ember/component';

const FormResponsesTableCardComponent = Component.extend({});
const FormResponsesTableCardComponent = Component.extend({
actions: {
copyUsernames() {
const usernames = this.form
.get('responses')
.map((response) => response.get('user.username'))
.join('\n');

navigator.clipboard.writeText(usernames);
},
},
});

FormResponsesTableCardComponent.reopenClass({
positionalParams: ['form'],
Expand Down

0 comments on commit dbd2aea

Please sign in to comment.