mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-26 01:35:34 +08:00
Implement default name for results [SCI-9425]
This commit is contained in:
parent
a1df2b7b52
commit
295de7b0bc
2 changed files with 7 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue