From 9dbcfddf9829538ff577c588695a98dd130e3f55 Mon Sep 17 00:00:00 2001 From: cryptogopher Date: Sat, 26 Apr 2025 19:12:56 +0200 Subject: [PATCH] Merge corrections provided by Bambuch, cont. --- app/assets/stylesheets/application.css | 1 + app/javascript/application.js | 2 +- app/models/user.rb | 5 +++-- app/views/measurements/index.html.erb | 2 +- app/views/quantities/create.turbo_stream.erb | 2 +- app/views/quantities/destroy.turbo_stream.erb | 2 +- .../quantities/reparent.turbo_stream.erb | 2 +- app/views/quantities/update.turbo_stream.erb | 2 +- app/views/users/index.html.erb | 22 ++++++++++--------- 9 files changed, 22 insertions(+), 18 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 77442e2..895c0e9 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -172,6 +172,7 @@ input[type=checkbox]:checked { } /* Hide spin buttons in input number fields */ input[type=number] { + appearance: textfield; -moz-appearance: textfield; } input::-webkit-inner-spin-button { diff --git a/app/javascript/application.js b/app/javascript/application.js index 54a9026..ad91a40 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -106,7 +106,7 @@ function dragLeave(event) { if (event.timeStamp <= lastEnterTime) return; event.currentTarget.closest("table").querySelectorAll(".dropzone").forEach((tr) => { tr.classList.remove("dropzone"); - }) + }); } window.dragLeave = dragLeave; diff --git a/app/models/user.rb b/app/models/user.rb index d76568b..60e9df1 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -7,9 +7,10 @@ class User < ApplicationRecord admin: 4, # admin level access active: 3, # read-write user level access restricted: 2, # read-only user level access - locked: 1, # disallowed to sign in due to failed logins; maintained by Devise :lockable + locked: 1, # disallowed to sign in due to failed logins; maintained by + # Devise :lockable disabled: 0, # administratively disallowed to sign in - }, default: :active + }, default: :active, validate: true has_many :readouts, dependent: :destroy accepts_nested_attributes_for :readouts diff --git a/app/views/measurements/index.html.erb b/app/views/measurements/index.html.erb index 7be4cbf..25d2013 100644 --- a/app/views/measurements/index.html.erb +++ b/app/views/measurements/index.html.erb @@ -4,7 +4,7 @@ <%# TODO: show hint when no quantities/units defined %>
<%= select_tag :id, options_from_collection_for_select( - @quantities, :id, ->(q){ sanitize(' '*q.depth + q.name) } + @quantities, :id, ->(q){ sanitize(' ' * q.depth + q.name) } ), form: :new_readouts_form %> <% common_options = {form: :new_readouts_form, formaction: new_measurement_path, formmethod: :get, formnovalidate: true, diff --git a/app/views/quantities/create.turbo_stream.erb b/app/views/quantities/create.turbo_stream.erb index 7a5c339..d70c0af 100644 --- a/app/views/quantities/create.turbo_stream.erb +++ b/app/views/quantities/create.turbo_stream.erb @@ -1,6 +1,6 @@ <%= turbo_stream.close_form dom_id(@quantity.parent || Quantity, :new) %> <%= turbo_stream.remove :no_items %> -<% @ancestors.map do |ancestor| %> +<% @ancestors.each do |ancestor| %> <%= turbo_stream.replace ancestor %> <% end %> <%= @before ? turbo_stream.before(@before, @quantity) : diff --git a/app/views/quantities/destroy.turbo_stream.erb b/app/views/quantities/destroy.turbo_stream.erb index 5330055..9dd001e 100644 --- a/app/views/quantities/destroy.turbo_stream.erb +++ b/app/views/quantities/destroy.turbo_stream.erb @@ -1,4 +1,4 @@ -<% @ancestors.map do |ancestor| %> +<% @ancestors.each do |ancestor| %> <%= turbo_stream.replace ancestor %> <% end %> <%= turbo_stream.remove @quantity %> diff --git a/app/views/quantities/reparent.turbo_stream.erb b/app/views/quantities/reparent.turbo_stream.erb index 0533837..e0517ae 100644 --- a/app/views/quantities/reparent.turbo_stream.erb +++ b/app/views/quantities/reparent.turbo_stream.erb @@ -1,7 +1,7 @@ <% @self_and_progenies.each do |q| %> <%= turbo_stream.remove q %> <% end %> -<% @previous_ancestors.union(@ancestors).map do |ancestor| %> +<% @previous_ancestors.union(@ancestors).each do |ancestor| %> <%= turbo_stream.replace ancestor %> <% end %> <% @self_and_progenies.each do |q| %> diff --git a/app/views/quantities/update.turbo_stream.erb b/app/views/quantities/update.turbo_stream.erb index b94fd49..3275ed3 100644 --- a/app/views/quantities/update.turbo_stream.erb +++ b/app/views/quantities/update.turbo_stream.erb @@ -1,4 +1,4 @@ <%= turbo_stream.close_form dom_id(@quantity, :edit) %> -<% @ancestors.push(@quantity).map do |ancestor| %> +<% @ancestors.push(@quantity).each do |ancestor| %> <%= turbo_stream.replace ancestor %> <% end %> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 26c5502..a635b2a 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -4,7 +4,9 @@ <%= User.human_attribute_name(:email).capitalize %> <%= User.human_attribute_name(:status).capitalize %> <%= User.human_attribute_name(:confirmed_at).capitalize %> - <%= User.human_attribute_name(:created_at).capitalize %> UTC + + <%= User.human_attribute_name(:created_at).capitalize %> UTC + <%= t :actions %> @@ -22,15 +24,15 @@ <% end %> <% end %> - - <%= svg_tag "pictograms/checkbox-marked-outline" if user.confirmed_at.present? %> - - <%= user.created_at.to_fs(:db_without_sec) %> - - <% if allow_disguise?(user) %> - <%= image_link_to t(".disguise"), "incognito", disguise_user_path(user) %> - <% end %> - + + <%= svg_tag "pictograms/checkbox-marked-outline" if user.confirmed_at.present? %> + + <%= user.created_at.to_fs(:db_without_sec) %> + + <% if allow_disguise?(user) %> + <%= image_link_to t(".disguise"), "incognito", disguise_user_path(user) %> + <% end %> + <% end %>