mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-31 03:59:51 +08:00
Add rename task and rename experiment activities
This commit is contained in:
parent
4b7b3a8622
commit
9b7d321666
4 changed files with 11 additions and 2 deletions
|
@ -91,14 +91,18 @@ class ExperimentsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
old_text = @experiment.description
|
old_text = @experiment.description
|
||||||
@experiment.update(experiment_params)
|
@experiment.assign_attributes(experiment_params)
|
||||||
@experiment.last_modified_by = current_user
|
@experiment.last_modified_by = current_user
|
||||||
|
name_changed = @experiment.name_changed?
|
||||||
|
description_changed = @experiment.description_changed?
|
||||||
|
|
||||||
if @experiment.save
|
if @experiment.save
|
||||||
experiment_annotation_notification(old_text) if old_text
|
experiment_annotation_notification(old_text) if old_text
|
||||||
|
|
||||||
activity_type = if experiment_params[:archived] == 'false'
|
activity_type = if experiment_params[:archived] == 'false'
|
||||||
:restore_experiment
|
:restore_experiment
|
||||||
|
elsif name_changed && !description_changed
|
||||||
|
:rename_experiment
|
||||||
else
|
else
|
||||||
:edit_experiment
|
:edit_experiment
|
||||||
end
|
end
|
||||||
|
|
|
@ -145,6 +145,7 @@ class MyModulesController < ApplicationController
|
||||||
def update
|
def update
|
||||||
@my_module.assign_attributes(my_module_params)
|
@my_module.assign_attributes(my_module_params)
|
||||||
@my_module.last_modified_by = current_user
|
@my_module.last_modified_by = current_user
|
||||||
|
name_changed = @my_module.name_changed?
|
||||||
description_changed = @my_module.description_changed?
|
description_changed = @my_module.description_changed?
|
||||||
start_date_changes = @my_module.changes[:started_on]
|
start_date_changes = @my_module.changes[:started_on]
|
||||||
due_date_changes = @my_module.changes[:due_date]
|
due_date_changes = @my_module.changes[:due_date]
|
||||||
|
@ -165,6 +166,7 @@ class MyModulesController < ApplicationController
|
||||||
TinyMceAsset.update_images(@my_module, params[:tiny_mce_images], current_user)
|
TinyMceAsset.update_images(@my_module, params[:tiny_mce_images], current_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
log_activity(:rename_task) if name_changed
|
||||||
log_start_date_change_activity(start_date_changes) if start_date_changes.present?
|
log_start_date_change_activity(start_date_changes) if start_date_changes.present?
|
||||||
log_due_date_change_activity(due_date_changes) if due_date_changes.present?
|
log_due_date_change_activity(due_date_changes) if due_date_changes.present?
|
||||||
end
|
end
|
||||||
|
|
|
@ -282,7 +282,8 @@ class Extends
|
||||||
protocol_description_in_task_edited: 137,
|
protocol_description_in_task_edited: 137,
|
||||||
set_task_start_date: 138,
|
set_task_start_date: 138,
|
||||||
change_task_start_date: 139,
|
change_task_start_date: 139,
|
||||||
remove_task_start_date: 140
|
remove_task_start_date: 140,
|
||||||
|
rename_experiment: 141
|
||||||
}
|
}
|
||||||
|
|
||||||
ACTIVITY_GROUPS = {
|
ACTIVITY_GROUPS = {
|
||||||
|
|
|
@ -86,6 +86,7 @@ en:
|
||||||
assign_user_to_module_html: "%{user} assigned user %{user_target} to task %{my_module}."
|
assign_user_to_module_html: "%{user} assigned user %{user_target} to task %{my_module}."
|
||||||
unassign_user_from_module_html: "%{user} removed user %{user_target} from task %{my_module}."
|
unassign_user_from_module_html: "%{user} removed user %{user_target} from task %{my_module}."
|
||||||
create_experiment_html: "%{user} created experiment %{experiment}."
|
create_experiment_html: "%{user} created experiment %{experiment}."
|
||||||
|
rename_experiment_html: "%{user} renamed experiment %{experiment}."
|
||||||
edit_experiment_html: "%{user} edited experiment %{experiment}."
|
edit_experiment_html: "%{user} edited experiment %{experiment}."
|
||||||
move_experiment_html: "%{user} moved experiment %{experiment} from project %{project_original} to project %{project_new}."
|
move_experiment_html: "%{user} moved experiment %{experiment} from project %{project_original} to project %{project_new}."
|
||||||
clone_experiment_html: "%{user} copied experiment %{experiment_new} from experiment %{experiment_original} as template."
|
clone_experiment_html: "%{user} copied experiment %{experiment_new} from experiment %{experiment_original} as template."
|
||||||
|
@ -219,6 +220,7 @@ en:
|
||||||
assign_user_to_module: "User assigned to Task"
|
assign_user_to_module: "User assigned to Task"
|
||||||
unassign_user_from_module: "User removed from Task"
|
unassign_user_from_module: "User removed from Task"
|
||||||
create_experiment: "Experiment created"
|
create_experiment: "Experiment created"
|
||||||
|
rename_experiment: "Experiment renamed"
|
||||||
edit_experiment: "Experiment edited"
|
edit_experiment: "Experiment edited"
|
||||||
move_experiment: "Experiment moved"
|
move_experiment: "Experiment moved"
|
||||||
clone_experiment: "Experiment copied as template"
|
clone_experiment: "Experiment copied as template"
|
||||||
|
|
Loading…
Reference in a new issue