diff --git a/assets/controllers/clipboard_controller.js b/assets/controllers/clipboard_controller.js new file mode 100644 index 000000000..eba297138 --- /dev/null +++ b/assets/controllers/clipboard_controller.js @@ -0,0 +1,16 @@ +import { Controller } from '@hotwired/stimulus'; +import ClipboardJS from 'clipboard'; + +export default class extends Controller { + connect() { + this.clipboard = new ClipboardJS(this.element); + + this.clipboard.on('success', (e) => { + e.clearSelection(); + }); + } + + disconnect() { + this.clipboard.destroy(); + } +} diff --git a/assets/index.js b/assets/index.js index 1f8d3256d..92b434abb 100755 --- a/assets/index.js +++ b/assets/index.js @@ -6,7 +6,6 @@ import $ from 'jquery'; import '@materializecss/materialize/dist/css/materialize.css'; import '@materializecss/materialize/dist/js/materialize'; -import ClipboardJS from 'clipboard'; import 'mathjax/es5/tex-svg'; /* Fonts */ @@ -67,12 +66,6 @@ $(document).ready(() => { $('#user_emailTwoFactor').on('change', () => { $('#user_googleTwoFactor').prop('checked', false); }); - - // handle copy to clipboard for developer stuff - const clipboard = new ClipboardJS('.btn'); - clipboard.on('success', (e) => { - e.clearSelection(); - }); }); (function darkTheme() { diff --git a/templates/Developer/client_parameters.html.twig b/templates/Developer/client_parameters.html.twig index b17d3ea34..70fe3943d 100644 --- a/templates/Developer/client_parameters.html.twig +++ b/templates/Developer/client_parameters.html.twig @@ -18,14 +18,14 @@
{{ client_id }}
-
+
{{ client_secret }}
-
+
{{ client.clientId }}
-
+
{{ client.secret }}
-
+