changed flash message

This commit is contained in:
Giga Chubinidze 2024-01-17 12:58:43 +04:00
parent eaf713e4bd
commit a5c7e7b8c8
2 changed files with 7 additions and 9 deletions

View file

@ -297,8 +297,7 @@ class ExperimentsController < ApplicationController
# POST: move_experiment(id) # POST: move_experiment(id)
def move def move
move_response = nil project = Project.find_by(id: params[:project_id])
status = nil
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
@experiments.each do |experiment| @experiments.each do |experiment|
@ -309,20 +308,18 @@ class ExperimentsController < ApplicationController
user_id: current_user.id) user_id: current_user.id)
if service.succeed? if service.succeed?
flash[:success] = t('experiments.move.success_flash', experiment: experiment.name) flash[:success] = t('experiments.move.success_flash', experiment: experiment.name)
status = :ok
view_state = experiment.current_view_state(current_user) view_state = experiment.current_view_state(current_user)
view_type = view_state.state['my_modules']['view_type'] || 'canvas' view_type = view_state.state['my_modules']['view_type'] || 'canvas'
path = view_mode_redirect_url(view_type)
else else
message = "#{service.errors.values.join('. ')}." render json: {
status = :unprocessable_entity message: service.errors.values.join('. ')
}, status: :unprocessable_entity
end end
move_response = { message: message, path: path }
end end
end end
render json: move_response, status: status render json: { message: t('experiments.table.move_success_flash',
project: escape_input(project.name)), path: project_path(project) }
end end
def move_modules_modal def move_modules_modal

View file

@ -1526,6 +1526,7 @@ en:
no_projects: 'No projects: You dont have edit access to any other projects.' no_projects: 'No projects: You dont have edit access to any other projects.'
table: table:
head_title: "%{experiment} | Overview" head_title: "%{experiment} | Overview"
move_success_flash: "Successfully moved experiment(s) to project %{project}."
column: column:
id_html: 'ID' id_html: 'ID'
task_name_html: 'Task name' task_name_html: 'Task name'