From b4212298dfe3af089e0dd3958d91a62ef1bcadba Mon Sep 17 00:00:00 2001 From: cryptogopher Date: Sat, 4 May 2024 01:47:53 +0200 Subject: [PATCH] Add Unit defaults import link --- app/assets/images/pictograms/import.svg | 1 + app/assets/stylesheets/application.css | 12 ++++++++++++ app/views/units/index.html.erb | 4 +++- config/locales/en.yml | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 app/assets/images/pictograms/import.svg diff --git a/app/assets/images/pictograms/import.svg b/app/assets/images/pictograms/import.svg new file mode 100644 index 0000000..5784da5 --- /dev/null +++ b/app/assets/images/pictograms/import.svg @@ -0,0 +1 @@ + diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 7c38a6e..18a970b 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -468,3 +468,15 @@ table.items select:focus-visible { .unwrappable { white-space: nowrap; } + + +.buttongrid { + display: grid; + gap: 0.4em; + grid-template-areas: "context empty tools"; + grid-template-columns: auto 1fr auto; + grid-template-rows: max-content; +} +.tools { + grid-area: tools; +} diff --git a/app/views/units/index.html.erb b/app/views/units/index.html.erb index db9e8f4..19177c8 100644 --- a/app/views/units/index.html.erb +++ b/app/views/units/index.html.erb @@ -1,7 +1,9 @@ -
+
<% if current_user.at_least(:active) %> <%= image_link_to t('.add_unit'), 'plus-outline', new_unit_path, id: :add_unit, onclick: 'this.blur();', data: {turbo_stream: true} %> + <%= image_link_to t('.import_units'), 'import', new_unit_path, class: 'tools', + data: {turbo_stream: true} %> <% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index 3123008..530f58e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -52,6 +52,7 @@ en: delete_unit: Delete index: add_unit: Add unit + 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: