File tree 1 file changed +17
-5
lines changed
lib/keila_web/templates/api_key
1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change 39
39
< p class = "font-bold text-emerald-500 " >
40
40
<%= gettext ( "Important: The private API Key is displayed only once and cannot be recovered." ) %>
41
41
</ p >
42
- < div class = "flex flex-row mt-2 " >
43
- < input type = "text " class = "text-white bg-gray-900 " readonly value = { @ token . key } />
42
+ < div class = "flex flex-row mt-2 relative " x-data = "{showFeedback: false} " >
43
+ < input
44
+ type = "text "
45
+ class = "text-white bg-gray-900 "
46
+ readonly value = { @ token . key }
47
+ x-ref = "input "
48
+ @click = "$refs.input.focus(); $refs.input.select() "
49
+ />
44
50
< button
45
51
class = "button "
46
- x-data = "{} "
47
- @click = "navigator.clipboard.writeText($el.previousElementSibling.value) "
52
+ @click = "navigator.clipboard.writeText($refs.input.value); showFeedback = true; setTimeout(() => {showFeedback = false}, 2000) "
48
53
>
49
54
<%= render_icon ( :clipboard ) %>
50
- <%= gettext ( "Copy" ) %>
55
+ <%= gettext ( "Copy to clipboard " ) %>
51
56
</ button >
57
+ < div
58
+ style = "display: none "
59
+ class = "absolute left-0 top-12 bg-green-700 p-2 font-sm rounded text-white "
60
+ x-show.transition = "showFeedback "
61
+ >
62
+ <%= gettext ( "API key copied to clipboard" ) %>
63
+ </ div >
52
64
</ div >
53
65
</ div >
54
66
</ div >
You can’t perform that action at this time.
0 commit comments