diff --git a/app/assets/images/pictograms/close-circle-outline.svg b/app/assets/images/pictograms/close-circle-outline.svg new file mode 100644 index 0000000..bc755e1 --- /dev/null +++ b/app/assets/images/pictograms/close-circle-outline.svg @@ -0,0 +1 @@ + diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 70c60a5..4832335 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -88,7 +88,6 @@ module ApplicationHelper image_element_to(:link, name, image, options, html_options) end - private def image_element_to(type, name, image = nil, options = nil, html_options = {}) @@ -126,7 +125,7 @@ module ApplicationHelper end end if exponent != 1 - result += "10#{exponent-1}" + result += "10% d" % [exponent-1] end result.html_safe end diff --git a/app/views/units/_form.html.erb b/app/views/units/_form.html.erb index 52a255f..217c54c 100644 --- a/app/views/units/_form.html.erb +++ b/app/views/units/_form.html.erb @@ -1,26 +1,24 @@ -
<%= f.text_field :shortname, required: true, size: 20 %>
-<%= f.text_field :name, size: 60 %>
-
diff --git a/app/views/units/new.html.erb b/app/views/units/new.html.erb
index 289fff6..bb80df3 100644
--- a/app/views/units/new.html.erb
+++ b/app/views/units/new.html.erb
@@ -1,22 +1,12 @@
-<% content_for :navigation, flush: true do %>
-
- <%= image_link_to t(:back), "arrow-left-bold-outline",
- request.referer.present? ? :back : units_url %>
-
-<% end %>
-
-<%= tabular_form_for @unit do |f| %>
- <%= f.text_field :symbol, required: true, size: 10, autofocus: true, autocomplete: "off" %>
- <%= f.text_field :name, size: 25, autocomplete: "off" %>
-
- <% if current_user.units.roots.count %>
- <%= f.select :base_id,
- current_user.units.roots.collect { |u| ["#{u.symbol}#{' - ' + u.name if u.name}", u.id] },
- {include_blank: t(".none")},
- onchange: 'this.form.unit_multiplier.disabled = (this.value == "");' %>
- <%= f.number_field :multiplier, step: "any", disabled: @unit.base.nil?, size: 10,
- autocomplete: "off" %>
+
+<%= turbo_frame_tag @unit do %>
+ <%= turbo_stream.update @unit do %>
+ <%= render partial: 'form', locals: {unit: @unit} %>
<% end %>
- <%= f.submit @unit.persisted? ? t(:update) : t(:add) %>
+ <%= turbo_stream.update :unit_form_frame do %>
+ <%= form_with model: @unit, html: {id: :unit_form} do %>
+ <% end %>
+ <% end %>
<% end %>
|