-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e50f3e1
commit ea05990
Showing
18 changed files
with
189 additions
and
19 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,7 @@ | |
//= require popper | ||
//= require bootstrap-sprockets | ||
//= require_tree . | ||
|
||
$(function() { | ||
setupCopyableInputs(); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
function setupCopyableInputs() { | ||
$(".copyable-input").each(function(ix, element) { | ||
let input = $(element).find("input"); | ||
let button = $(element).find("button"); | ||
input.focus(function(event) { | ||
input.select(); | ||
}); | ||
button.click(function(event) { | ||
input.select(); | ||
navigator.clipboard.writeText(input.val()); | ||
}); | ||
console.log(input, button); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,4 @@ | |
@import "nav"; | ||
@import "footer"; | ||
@import "user_profile"; | ||
|
||
@import "components/copyable_input"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.copyable-input { | ||
input { | ||
color: $black; | ||
font-family: $font-family-monospace; | ||
&:active, &:focus, &:focus-visible { | ||
outline-offset: -5px; | ||
border-width: 2px; | ||
} | ||
} | ||
svg { | ||
vertical-align: top; | ||
height: 1rem; | ||
margin-top: 3px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,4 +23,8 @@ def request_password_reset? | |
def update_password? | ||
create? | ||
end | ||
|
||
def show_secrets? | ||
user == record | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<label class="form-label" for="copyable-input-<%= id %>"><%= name %></label> | ||
<div class="copyable-input input-group input-group-lg mb-3"> | ||
<input type="text" class="form-control" placeholder="<%= name %>" value="<%= value %>" id="copyable-input-<%= id%>"> | ||
<div class="input-group-append"> | ||
<button class="btn btn-primary btn-right" title="<%= t(:copyable_input_button_title) %>" id="api-key-copy-button" type="button" aria-controls="copyable-input-<%= id %>"> | ||
<%= show_svg("clipboard_icon.svg") %> | ||
</button> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<p><%= t :secrets_user_blurb_html %></p> | ||
<%= render partial: "ui/shared/copyable_input", locals: { | ||
name: t(:secrets_user_api_key_label), | ||
value: @user.access_token.token, | ||
id: "api-key" | ||
} %> | ||
|
||
<% if @user.forward_device_readings? %> | ||
<div class="mt-5"> | ||
<h1 class="mb-4"><%= t :secrets_user_forwarding_heading %></h1> | ||
<p><%= t :secrets_user_forwarding_blurb_html %></p> | ||
<%= render partial: "ui/shared/copyable_input", locals: { | ||
name: t(:secrets_user_forwarding_token_label), | ||
value: @user.forwarding_token, | ||
id: "forwarding-token" | ||
} %> | ||
<%= render partial: "ui/shared/copyable_input", locals: { | ||
name: t(:secrets_user_forwarding_username_label), | ||
value: @user.forwarding_username, | ||
id: "forwarding-username" | ||
} %> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
en: | ||
copyable_input_button_title: Copy to clipboard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
member do | ||
get :delete | ||
get :edit | ||
get :secrets | ||
end | ||
collection do | ||
get :post_delete | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters