mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-06 20:05:55 +08:00
Add file duplicate activities [SCI-10257]
This commit is contained in:
parent
247443db4c
commit
be47dbfa24
3 changed files with 38 additions and 6 deletions
|
@ -357,7 +357,6 @@ class AssetsController < ApplicationController
|
|||
def duplicate
|
||||
ActiveRecord::Base.transaction do
|
||||
case @asset.parent
|
||||
|
||||
when Step, Result
|
||||
new_asset = @asset.duplicate(
|
||||
new_name:
|
||||
|
@ -367,6 +366,27 @@ class AssetsController < ApplicationController
|
|||
@asset.parent.assets << new_asset
|
||||
end
|
||||
|
||||
case @asset.parent
|
||||
when Step
|
||||
message_items = { file: @asset.file_name }
|
||||
message_items[:my_module] = @assoc.protocol.my_module.id if @assoc.protocol.in_module?
|
||||
|
||||
log_step_activity(
|
||||
"#{@assoc.protocol.in_module? ? 'task' : 'protocol'}_step_file_duplicated",
|
||||
@assoc,
|
||||
@assoc.my_module&.project,
|
||||
message_items
|
||||
)
|
||||
when Result
|
||||
log_result_activity(
|
||||
:result_file_duplicated,
|
||||
@assoc,
|
||||
file: @asset.file_name,
|
||||
user: current_user.id,
|
||||
my_module: @assoc.my_module.id
|
||||
)
|
||||
end
|
||||
|
||||
render json: new_asset, serializer: AssetSerializer, user: current_user
|
||||
end
|
||||
end
|
||||
|
|
|
@ -489,6 +489,9 @@ class Extends
|
|||
edit_task_step_file_locally: 299,
|
||||
edit_protocol_template_file_locally: 300,
|
||||
edit_task_result_file_locally: 301,
|
||||
task_step_file_duplicated: 302,
|
||||
result_file_duplicated: 303,
|
||||
protocol_step_file_duplicated: 304,
|
||||
task_step_asset_renamed: 305,
|
||||
result_asset_renamed: 306,
|
||||
protocol_step_asset_renamed: 307
|
||||
|
@ -496,11 +499,11 @@ class Extends
|
|||
|
||||
ACTIVITY_GROUPS = {
|
||||
projects: [*0..7, 32, 33, 34, 95, 108, 65, 109, *158..162, 241, 242, 243],
|
||||
task_results: [23, 26, 25, 42, 24, 40, 41, 99, 110, 122, 116, 128, *246..248, *257..273, *284..291, 301, 306],
|
||||
task_results: [23, 26, 25, 42, 24, 40, 41, 99, 110, 122, 116, 128, *246..248, *257..273, *284..291, 301, 303, 306],
|
||||
task: [8, 58, 9, 59, *10..14, 35, 36, 37, 53, 54, *60..63, 138, 139, 140, 64, 66, 106, 126, 120, 132,
|
||||
148, 166],
|
||||
task_protocol: [15, 22, 16, 18, 19, 20, 21, 17, 38, 39, 100, 111, 45, 46, 47, 121, 124, 115, 118, 127, 130, 137,
|
||||
184, 185, 188, 189, *192..203, 221, 222, 224, 225, 226, 236, *249..252, *274..278, 299, 305],
|
||||
184, 185, 188, 189, *192..203, 221, 222, 224, 225, 226, 236, *249..252, *274..278, 299, 302, 305],
|
||||
task_inventory: [55, 56, 146, 147, 183],
|
||||
experiment: [*27..31, 57, 141, 165],
|
||||
reports: [48, 50, 49, 163, 164],
|
||||
|
@ -509,7 +512,7 @@ class Extends
|
|||
protocol_repository: [80, 103, 89, 87, 79, 90, 91, 88, 85, 86, 84, 81, 82,
|
||||
83, 101, 112, 123, 125, 117, 119, 129, 131, 187, 186,
|
||||
190, 191, *204..215, 220, 223, 227, 228, 229, *230..235,
|
||||
*237..240, *253..256, *279..283, 300, 307],
|
||||
*237..240, *253..256, *279..283, 300, 304, 307],
|
||||
team: [92, 94, 93, 97, 104, 244, 245],
|
||||
label_templates: [*216..219]
|
||||
}
|
||||
|
|
|
@ -314,9 +314,12 @@ en:
|
|||
edit_image_on_inventory_item_html: "%{user} edited image %{asset_name} on inventory item %{repository_row} in inventory %{repository}: %{action}."
|
||||
edit_wopi_file_on_inventory_item_html: "%{user} edited Office online file %{asset_name} on inventory item %{repository_row} in inventory %{repository}: %{action}."
|
||||
export_inventory_stock_consumption_html: "%{user} exported stock consumption for inventory item(s) %{inventory_items} in inventory %{repository}."
|
||||
task_step_asset_renamed_html: "%{user} renamed file %{old_name} to %{new_name} on protocol’s step <strong>%{step}</strong> on task <strong>%{my_module}</strong>."
|
||||
protocol_step_asset_renamed_html: "%{user} renamed file %{old_name} to %{new_name} on protocol’s step <strong>%{step}</strong> in Protocol repository."
|
||||
task_step_asset_renamed_html: "%{user} renamed file %{old_name} to %{new_name} on protocol's step <strong>%{step}</strong> on task <strong>%{my_module}</strong>."
|
||||
protocol_step_asset_renamed_html: "%{user} renamed file %{old_name} to %{new_name} on protocol's step <strong>%{step}</strong> in Protocol repository."
|
||||
result_asset_renamed_html: "%{user} renamed file %{old_name} to %{new_name} on result <strong>%{result}</strong> on task <strong>%{my_module}</strong>."
|
||||
task_step_file_duplicated_html: "%{user} duplicated file <strong>%{file}</strong> on protocol's step <strong>%{step}</strong> on task <strong>%{my_module}</strong>."
|
||||
result_file_duplicated_html: "%{user} duplicated file <strong>%{file}</strong> on result <strong>%{result}</strong> on task <strong>%{my_module}</strong>."
|
||||
protocol_step_file_duplicated_html: "%{user} duplicated file <strong>%{file}</strong> on protocol's step <strong>%{step}</strong> in Protocol repository."
|
||||
activity_name:
|
||||
create_project: "Project created"
|
||||
rename_project: "Project renamed"
|
||||
|
@ -588,9 +591,15 @@ en:
|
|||
edit_image_on_inventory_item: "Inventory item image edited"
|
||||
edit_wopi_file_on_inventory_item: "Inventory item wopi file edited"
|
||||
export_inventory_stock_consumption: "Inventory stock consumptions exported"
|
||||
<<<<<<< HEAD
|
||||
task_step_asset_renamed: "File attachment on Task step renamed"
|
||||
protocol_step_asset_renamed: "File attachment on Protocol step renamed"
|
||||
result_asset_renamed: "File attachment on Task result renamed"
|
||||
=======
|
||||
task_step_file_duplicated: "File attachment on Task step duplicated"
|
||||
result_file_duplicated: "File attachment on Task result duplicated"
|
||||
protocol_step_file_duplicated: "File attachment on Protocol step duplicated"
|
||||
>>>>>>> ea4c356e1 (Add file duplicate activities [SCI-10257])
|
||||
activity_group:
|
||||
projects: "Projects"
|
||||
task_results: "Task results"
|
||||
|
|
Loading…
Add table
Reference in a new issue