mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-04 02:45:53 +08:00
Move redirect to controller
This commit is contained in:
parent
d9b691103c
commit
aa88b6bdb4
5 changed files with 13 additions and 21 deletions
|
@ -245,12 +245,7 @@ function applyTaskStatusChangeCallBack() {
|
|||
$.ajax({
|
||||
url: list.data('link-url'),
|
||||
type: 'PATCH',
|
||||
dataType: 'json',
|
||||
data: { my_module: { status_id: item.data('state-id') } },
|
||||
success: function(data) {
|
||||
container.html(data.content);
|
||||
location.reload();
|
||||
},
|
||||
error: function(e) {
|
||||
animateSpinner(null, false);
|
||||
if (e.status === 403) {
|
||||
|
@ -301,9 +296,9 @@ function initTagsSelector() {
|
|||
if (lastTagId > 0) {
|
||||
newTag = { my_module_tag: { tag_id: lastTagId } };
|
||||
$.post(selectElement.data('update-module-tags-url'), newTag)
|
||||
.fail(function(r) {
|
||||
.fail(function(response) {
|
||||
dropdownSelector.removeValue(myModuleTagsSelector, lastTagId, '', true);
|
||||
if (r.status === 403) {
|
||||
if (response.status === 403) {
|
||||
HelperModule.flashAlertMsg(I18n.t('general.no_permissions'), 'danger');
|
||||
}
|
||||
});
|
||||
|
|
|
@ -361,11 +361,11 @@ function loadFromRepository() {
|
|||
// Simply reload page
|
||||
location.reload();
|
||||
},
|
||||
error: function(ev) {
|
||||
if (ev.status === 403) {
|
||||
error: function(response) {
|
||||
if (response.status === 403) {
|
||||
HelperModule.flashAlertMsg(I18n.t('general.no_permissions'), 'danger');
|
||||
} else {
|
||||
alert(ev.responseJSON.message);
|
||||
alert(response.responseJSON.message);
|
||||
}
|
||||
|
||||
modal.modal('hide');
|
||||
|
|
|
@ -635,11 +635,11 @@ var MyModuleRepositories = (function() {
|
|||
updateFullViewRowsCount(data.rows_count);
|
||||
renderFullViewAssignButtons();
|
||||
},
|
||||
error: function(data) {
|
||||
if (data.status === 403) {
|
||||
error: function(response) {
|
||||
if (response.status === 403) {
|
||||
HelperModule.flashAlertMsg(I18n.t('general.no_permissions'), 'danger');
|
||||
} else {
|
||||
HelperModule.flashAlertMsg(data.responseJSON.flash, 'danger');
|
||||
HelperModule.flashAlertMsg(response.responseJSON.flash, 'danger');
|
||||
}
|
||||
UPDATE_REPOSITORY_MODAL.modal('hide');
|
||||
SELECTED_ROWS = {};
|
||||
|
|
|
@ -160,8 +160,8 @@
|
|||
TinyMCE.init('#step_description_textarea');
|
||||
});
|
||||
})
|
||||
.on("ajax:error", function(e, xhr) {
|
||||
if (xhr.status === 403) {
|
||||
.on("ajax:error", function(e, response) {
|
||||
if (response.status === 403) {
|
||||
HelperModule.flashAlertMsg(I18n.t('general.no_permissions'), 'danger');
|
||||
}
|
||||
});
|
||||
|
@ -530,8 +530,8 @@
|
|||
});
|
||||
|
||||
},
|
||||
error: function(request) {
|
||||
if (request.status === 403) {
|
||||
error: function(response) {
|
||||
if (response.status === 403) {
|
||||
HelperModule.flashAlertMsg(I18n.t('general.no_permissions'), 'danger');
|
||||
animateSpinner(null, false);
|
||||
}
|
||||
|
|
|
@ -269,10 +269,7 @@ class MyModulesController < ApplicationController
|
|||
log_activity(:change_status_on_task_flow, @my_module, my_module_status_old: old_status_id,
|
||||
my_module_status_new: @my_module.my_module_status.id)
|
||||
|
||||
render json: { content: render_to_string(
|
||||
partial: 'my_modules/status_flow/task_flow_button.html.erb',
|
||||
locals: { my_module: @my_module }
|
||||
) }, status: :ok
|
||||
return redirect_to protocols_my_module_path(@my_module)
|
||||
else
|
||||
render json: { errors: @my_module.errors.messages.values.flatten.join('\n') }, status: :unprocessable_entity
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue