mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-21 06:15:31 +08:00
fixes notification when adding new sample
This commit is contained in:
parent
25928bfa0b
commit
53cdbc2638
3 changed files with 24 additions and 3 deletions
|
@ -398,6 +398,7 @@ function onClickSave() {
|
|||
dataType: "json",
|
||||
data: data,
|
||||
success: function (data) {
|
||||
sampleAlertMsg(data.flash);
|
||||
onClickCancel();
|
||||
},
|
||||
error: function (e, eData, status, xhr) {
|
||||
|
|
|
@ -80,7 +80,17 @@ class SamplesController < ApplicationController
|
|||
|
||||
errors.delete_if { |k, v| v.blank? }
|
||||
if errors.empty?
|
||||
format.json { render json: {}, status: :ok }
|
||||
format.json {
|
||||
render json: {
|
||||
id: sample.id,
|
||||
flash: t(
|
||||
'samples.create.success_flash',
|
||||
sample: sample.name,
|
||||
organization: @organization.name
|
||||
)
|
||||
},
|
||||
status: :ok
|
||||
}
|
||||
else
|
||||
format.json { render json: errors, status: :bad_request }
|
||||
end
|
||||
|
@ -227,7 +237,17 @@ class SamplesController < ApplicationController
|
|||
# Now we can destroy empty scfs
|
||||
scf_to_delete.map(&:destroy)
|
||||
|
||||
format.json { render json: {}, status: :ok }
|
||||
format.json {
|
||||
render json: {
|
||||
id: sample.id,
|
||||
flash: t(
|
||||
'samples.update.success_flash',
|
||||
sample: sample.name,
|
||||
organization: @organization.name
|
||||
)
|
||||
},
|
||||
status: :ok
|
||||
}
|
||||
else
|
||||
format.json { render json: errors, status: :bad_request }
|
||||
end
|
||||
|
|
|
@ -909,7 +909,7 @@ en:
|
|||
create: "Edit sample"
|
||||
scf_does_not_exist: "This field does not exists."
|
||||
create:
|
||||
success_flash: "Successfully added sample to team <strong>%{organization}</strong>"
|
||||
success_flash: "Successfully added sample <strong>%{sample}</strong> to team <strong>%{organization}</strong>"
|
||||
update:
|
||||
success_flash: "Successfully updated sample <strong>%{sample}</strong> to team <strong>%{organization}</strong>"
|
||||
destroy:
|
||||
|
|
Loading…
Reference in a new issue