Implement default name for results [SCI-9425]

This commit is contained in:
Martin Artnik 2023-09-29 13:01:41 +02:00
parent a1df2b7b52
commit 295de7b0bc
2 changed files with 7 additions and 1 deletions

View file

@ -30,6 +30,8 @@ class Result < ApplicationRecord
accepts_nested_attributes_for :assets
accepts_nested_attributes_for :tables
before_save :ensure_default_name
def self.search(user,
include_archived,
query = nil,
@ -166,4 +168,8 @@ class Result < ApplicationRecord
element.update!(position: index) unless element.position == index
end
end
def ensure_default_name
self.name = name.presence || I18n.t('my_modules.results.default_name')
end
end

View file

@ -1255,7 +1255,7 @@ en:
head_title: "%{project} | %{module} | Results"
active_results: "Active results"
archived_results: "Archived results"
default_name: "New result"
default_name: "Untitled result"
placeholder: "Enter result name"
add_label: "New result"
add_title: "Create new result"