2024-03-02 22:13:09 +01:00
|
|
|
FactoryBot.define do
|
|
|
|
factory :export_template do
|
|
|
|
name { "Mon export" }
|
|
|
|
groupe_instructeur
|
|
|
|
content {
|
|
|
|
{
|
|
|
|
"pdf_name" =>
|
|
|
|
{
|
|
|
|
"type" => "doc",
|
|
|
|
"content" => [
|
|
|
|
{ "type" => "paragraph", "content" => [{ "text" => "export_", "type" => "text" }, { "type" => "mention", "attrs" => { "id" => "dossier_id", "label" => "id dossier" } }, { "text" => " .pdf", "type" => "text" }] }
|
|
|
|
]
|
|
|
|
},
|
2024-05-28 10:06:30 +02:00
|
|
|
"default_dossier_directory" => {
|
|
|
|
"type" => "doc",
|
|
|
|
"content" =>
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"type" => "paragraph",
|
|
|
|
"content" =>
|
|
|
|
[
|
|
|
|
{ "text" => "dossier_", "type" => "text" },
|
|
|
|
{ "type" => "mention", "attrs" => { "id" => "dossier_number", "label" => "numéro du dossier" } },
|
|
|
|
{ "text" => " ", "type" => "text" }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
2024-03-02 22:13:09 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
kind { "zip" }
|
2024-05-28 10:06:30 +02:00
|
|
|
|
|
|
|
to_create do |export_template, _context|
|
|
|
|
export_template.set_default_values
|
|
|
|
export_template.save
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :with_custom_content do
|
|
|
|
to_create do |export_template, context|
|
|
|
|
export_template.set_default_values
|
|
|
|
export_template.content = context.content
|
|
|
|
export_template.save
|
|
|
|
end
|
|
|
|
end
|
2024-05-28 11:06:31 +02:00
|
|
|
|
|
|
|
trait :with_custom_ddd_prefix do
|
|
|
|
transient do
|
|
|
|
ddd_prefix { 'dossier_' }
|
|
|
|
end
|
|
|
|
|
|
|
|
to_create do |export_template, context|
|
|
|
|
export_template.set_default_values
|
|
|
|
export_template.content["default_dossier_directory"]["content"] = [
|
|
|
|
{
|
|
|
|
"type" => "paragraph",
|
|
|
|
"content" =>
|
|
|
|
[
|
|
|
|
{ "text" => context.ddd_prefix, "type" => "text" },
|
|
|
|
{ "type" => "mention", "attrs" => { "id" => "dossier_number", "label" => "numéro du dossier" } },
|
|
|
|
{ "text" => " ", "type" => "text" }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
export_template.save
|
|
|
|
end
|
|
|
|
end
|
2024-03-02 22:13:09 +01:00
|
|
|
end
|
|
|
|
end
|