Skip to content

Commit

Permalink
Add a 'copy to clipboard' button to addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosuav committed Nov 8, 2024
1 parent a50d431 commit 51fe0e5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
6 changes: 5 additions & 1 deletion httpstatic/chan_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,11 @@ const view_element = { //Matches _element_types (see Pike code)
simple: (el, r) => [LABEL(SPAN(el.label)), PRE(r.fields[el.name])],
url: (el, r) => [LABEL(SPAN(el.label)), A({href: r.fields[el.name]}, r.fields[el.name])],
paragraph: (el, r) => [LABEL(SPAN(el.label)), BR(), PRE(r.fields[el.name])],
address: (el, r) => PRE(r.fields[el.name]),
address: (el, r) => DIV({class: "twocol"}, [
PRE(r.fields[el.name]),
DIV({class: "column"}, BUTTON({class: "clipbtn", "data-copyme": r.fields[el.name],
title: "Click to copy address"}, "📋")),
]),
checkbox: (el, r) => UL([
(el.label || []).map((l, i) => LI({class: r.fields[el.name + (-i || "")] ? "checkbox-checked" : "checkbox-unchecked"}, [
LABEL(SPAN(r.fields[el.name + (-i || "")] ? "Selected" : "Unselected")),
Expand Down
13 changes: 13 additions & 0 deletions modules/http/chan_form.pike
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,19 @@ tr.archived {
}
tr.row-default {background: #eef;}
tr.row-alternate {background: #efe;}
.twocol {
display: flex;
gap: 1em;
}
.twocol > * {
width: max-content;
margin: 0;
}
.column {
display: flex;
flex-direction: column;
justify-content: space-around;
}
</style>
" + shared_styles;

Expand Down

0 comments on commit 51fe0e5

Please sign in to comment.