Skip to content

Commit ab12ae7

Browse files
committed
Improve labels on clipboard copy buttons
1 parent 1cf1492 commit ab12ae7

17 files changed

Lines changed: 24 additions & 8 deletions

File tree

app/components/copy_button.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
class Components::CopyButton < Components::Base
2-
def initialize(text:)
2+
def initialize(text:, label: nil)
33
@text = text
4+
@label = label
5+
end
6+
7+
def before_template
8+
@label ||= t("components.copy_button.copy")
49
end
510

611
def view_template
712
a href: "#", class: "link-secondary", data: {controller: "copy-text", action: "click->copy-text#copy:prevent", copy_text_text_value: @text} do
8-
Icon icon: "clipboard-plus", label: t("components.copy_button.copy")
13+
Icon icon: "clipboard-plus", label: @label
914
end
1015
end
1116
end

app/views/collections/show.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<% elsif SiteSettings.federation_enabled? %>
2121
<small class="text-secondary">
2222
<%= @collection.federails_actor.short_at_address %>
23-
<%= CopyButton(text: @collection.federails_actor.at_address) %>
23+
<%= CopyButton(text: @collection.federails_actor.at_address, label: t("general.copy_fediverse_handle")) %>
2424
</small>
2525
<% end %>
2626
</p>

app/views/creators/show.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<% elsif SiteSettings.federation_enabled? %>
2727
<small class="text-secondary">
2828
<%= @creator.federails_actor.short_at_address %>
29-
<%= CopyButton(text: @creator.federails_actor.at_address) %>
29+
<%= CopyButton(text: @creator.federails_actor.at_address, label: t("general.copy_fediverse_handle")) %>
3030
</small>
3131
<% end %>
3232
</p>

app/views/devise/registrations/edit.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<div class="col-auto col-form-label"><%= t("settings.users.index.fediverse_address") %></div>
1717
<div class="col col-form-label">
1818
<code><%= resource.federails_actor.at_address %></code>
19-
<%= CopyButton(text: resource.federails_actor.at_address) %>
19+
<%= CopyButton(text: resource.federails_actor.at_address, label: t("general.copy_fediverse_handle")) %>
2020
</div>
2121
<% end %>
2222
</div>

app/views/home/_federation.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<div class="col col-auto"><%= t(".creator_handle") %></div>
2121
<div class="col">
2222
<code><%= current_user.creators.local.first.federails_actor.at_address %></code>
23-
<%= CopyButton text: current_user.creators.local.first.federails_actor.at_address %>
23+
<%= CopyButton text: current_user.creators.local.first.federails_actor.at_address, label: t("general.copy_fediverse_handle") %>
2424
</div>
2525
</div>
2626
</div>
@@ -34,7 +34,7 @@
3434
<div class="col col-auto"><%= t(".account_handle") %></div>
3535
<div class="col">
3636
<code><%= current_user.federails_actor.at_address %></code>
37-
<%= CopyButton text: current_user.federails_actor.at_address %>
37+
<%= CopyButton text: current_user.federails_actor.at_address, label: t("general.copy_fediverse_handle") %>
3838
</div>
3939
</div>
4040
</div>

app/views/models/show.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
<% else %>
9999
<small>
100100
<%= @model.federails_actor.short_at_address %>
101-
<%= CopyButton(text: @model.federails_actor.at_address) %>
101+
<%= CopyButton(text: @model.federails_actor.at_address, label: t("general.copy_fediverse_handle")) %>
102102
</small>
103103
<% end %>
104104
</div>

config/locales/cs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,7 @@ cs:
640640
unfollow_remote_actor:
641641
unfollowed: Již nesledován %{actor}
642642
general:
643+
copy_fediverse_handle:
643644
delete: Smazat
644645
download: Stáhnout
645646
edit: Upravit

config/locales/de.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,7 @@ de:
640640
unfollow_remote_actor:
641641
unfollowed: "%{actor} nicht mehr Folgen"
642642
general:
643+
copy_fediverse_handle:
643644
delete: Löschen
644645
download: Herunterladen
645646
edit: Bearbeiten

config/locales/en.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,7 @@ en:
640640
unfollow_remote_actor:
641641
unfollowed: Unfollowed %{actor}
642642
general:
643+
copy_fediverse_handle: Copy Fediverse handle to clipboard
643644
delete: Delete
644645
download: Download
645646
edit: Edit

config/locales/es.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,7 @@ es:
640640
unfollow_remote_actor:
641641
unfollowed: Dejar de seguir a %{actor}
642642
general:
643+
copy_fediverse_handle:
643644
delete: Borrar
644645
download: Descargar
645646
edit: Editar

0 commit comments

Comments
 (0)