mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-06 03:46:39 +08:00
Merge pull request #4715 from aignatov-bio/ai-sci-7559-add-step-text-notification
Add new step text notification [SCI-7559]
This commit is contained in:
commit
6af72a28ee
3 changed files with 17 additions and 0 deletions
|
@ -55,6 +55,17 @@ module StepsActions
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def step_text_annotation(step, step_text, old_text = nil)
|
||||||
|
smart_annotation_notification(
|
||||||
|
old_text: old_text,
|
||||||
|
new_text: step_text.text,
|
||||||
|
title: t('notifications.step_text_title',
|
||||||
|
user: current_user.full_name,
|
||||||
|
step: step.name),
|
||||||
|
message: annotation_message(step)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
def checklist_name_annotation(step, checklist, old_text = nil)
|
def checklist_name_annotation(step, checklist, old_text = nil)
|
||||||
smart_annotation_notification(
|
smart_annotation_notification(
|
||||||
old_text: old_text,
|
old_text: old_text,
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
module StepElements
|
module StepElements
|
||||||
class TextsController < BaseController
|
class TextsController < BaseController
|
||||||
|
include ApplicationHelper
|
||||||
|
include StepsActions
|
||||||
|
|
||||||
before_action :load_step_text, only: %i(update destroy duplicate)
|
before_action :load_step_text, only: %i(update destroy duplicate)
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
@ -18,10 +21,12 @@ module StepElements
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
old_text = @step_text.text
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
@step_text.update!(step_text_params)
|
@step_text.update!(step_text_params)
|
||||||
TinyMceAsset.update_images(@step_text, params[:tiny_mce_images], current_user)
|
TinyMceAsset.update_images(@step_text, params[:tiny_mce_images], current_user)
|
||||||
log_step_activity(:text_edited, { text_name: @step_text.name })
|
log_step_activity(:text_edited, { text_name: @step_text.name })
|
||||||
|
step_text_annotation(@step, @step_text, old_text)
|
||||||
end
|
end
|
||||||
|
|
||||||
render json: @step_text, serializer: StepTextSerializer, user: current_user
|
render json: @step_text, serializer: StepTextSerializer, user: current_user
|
||||||
|
|
|
@ -3021,6 +3021,7 @@ en:
|
||||||
step_comment_annotation_title: "%{user} mentioned you in a comment on step %{step}."
|
step_comment_annotation_title: "%{user} mentioned you in a comment on step %{step}."
|
||||||
step_description_title: "%{user} mentioned you in a description on step %{step}."
|
step_description_title: "%{user} mentioned you in a description on step %{step}."
|
||||||
checklist_title: "%{user} mentioned you in a checklist on step %{step}."
|
checklist_title: "%{user} mentioned you in a checklist on step %{step}."
|
||||||
|
step_text_title: "%{user} mentioned you in a text on step %{step}."
|
||||||
step_annotation_message_html: "Project: %{project} | Experiment: %{experiment} | Task: %{my_module} | Step: %{step}"
|
step_annotation_message_html: "Project: %{project} | Experiment: %{experiment} | Task: %{my_module} | Step: %{step}"
|
||||||
result_annotation_title: "%{user} mentioned you in result %{result}."
|
result_annotation_title: "%{user} mentioned you in result %{result}."
|
||||||
result_comment_annotation_title: "%{user} mentioned you in a comment on result %{result}."
|
result_comment_annotation_title: "%{user} mentioned you in a comment on result %{result}."
|
||||||
|
|
Loading…
Add table
Reference in a new issue