mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-09 22:23:28 +08:00
Add model name to the archive folders in export-all ZIP structure [SCI-2817]
This commit is contained in:
parent
57dbd63aa3
commit
dea4ed4e15
1 changed files with 10 additions and 5 deletions
|
@ -144,14 +144,19 @@ class TeamZipExport < ZipExport
|
|||
# Create directory for project, experiment, or module
|
||||
def make_model_dir(parent_path, model, index)
|
||||
# For MyModule, the index indicates its position in project sidebar
|
||||
model_name = format(
|
||||
model.class == MyModule ? '(%<idx>s) %<name>s' : '%<name>s (%<idx>s)',
|
||||
idx: index, name: to_filesystem_name(model.name)
|
||||
)
|
||||
if model.class == MyModule
|
||||
class_name = 'module'
|
||||
model_format = '(%<idx>s) %<name>s'
|
||||
else
|
||||
class_name = model.class.to_s.downcase.pluralize
|
||||
model_format = '%<name>s (%<idx>s)'
|
||||
end
|
||||
model_name =
|
||||
format(model_format, idx: index, name: to_filesystem_name(model.name))
|
||||
|
||||
model_path = parent_path
|
||||
if model.archived
|
||||
model_path += '/Archived'
|
||||
model_path += "/Archived #{class_name}"
|
||||
FileUtils.mkdir_p(model_path)
|
||||
end
|
||||
model_path += "/#{model_name}"
|
||||
|
|
Loading…
Reference in a new issue