Mark redirecting buttons with trailing '...'

Closes #2
This commit is contained in:
cryptogopher 2024-11-23 23:26:08 +01:00
parent e75391ae18
commit f4ca1e91fa
3 changed files with 11 additions and 5 deletions

View File

@ -84,7 +84,8 @@ module ApplicationHelper
[:button_to, :link_to, :link_to_unless_current].each do |method_name|
class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
def image_#{method_name}(name, image = nil, options = nil, html_options = {}, &block)
name = svg_tag("pictograms/\#{image}") + name.to_s if image
name = name.to_s
name = svg_tag("pictograms/\#{image}") + name if image
html_options[:class] = class_names(
html_options[:class],
@ -95,6 +96,11 @@ module ApplicationHelper
html_options[:onclick] = "return confirm('\#{html_options[:onclick][:confirm]}');"
end
if __method__.start_with?('image_link_to') &&
!(html_options[:onclick] || html_options.dig(:data, :turbo_stream))
name = name + '...'
end
send :#{method_name}, name, options, html_options, &block
end
RUBY_EVAL

View File

@ -1,7 +1,7 @@
<div class="rightside buttongrid">
<% if current_user.at_least(:active) %>
<%# TODO: implement Import all %>
<%#= image_link_to t('.import_all'), 'download-multiple-outline',
<%#= image_button_to t('.import_all'), 'download-multiple-outline',
import_all_default_units_path, data: {turbo_stream: true} %>
<% end %>
<%= image_link_to t('.back'), 'arrow-left-bold-outline', units_path, class: 'tools' %>

View File

@ -54,7 +54,7 @@ en:
delete_unit: Delete
index:
add_unit: Add unit
import_units: Import...
import_units: Import
no_items: There are no configured units. You can try to import some defaults.
top_level_drop: Drop here to reposition into top-level unit
new:
@ -76,10 +76,10 @@ en:
index:
actions: Actions on defaults
import_all: Import all
back: Back to units...
back: Back to units
users:
index:
disguise: View as...
disguise: View as
passwords:
edit:
new_password: New password