diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a7fa5b0..4a92ba7 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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 diff --git a/app/views/default/units/index.html.erb b/app/views/default/units/index.html.erb index 0d5c3d8..13c5a3e 100644 --- a/app/views/default/units/index.html.erb +++ b/app/views/default/units/index.html.erb @@ -1,7 +1,7 @@
<% 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' %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 20cb320..ff3c4fd 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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