mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-21 07:26:15 +08:00
Merge pull request #1921 from mlorb/ml-sci-3641
Fix page redirect and add success flash msg after protocols.io import [SCI-3641]
This commit is contained in:
commit
5bc8eb7392
|
@ -1,4 +1,5 @@
|
|||
/* global animateSpinner PerfectSb initHandsOnTable */
|
||||
/* global HelperModule */
|
||||
/* eslint-disable no-use-before-define, no-alert */
|
||||
|
||||
function applyClickCallbackOnProtocolCards() {
|
||||
|
@ -194,7 +195,8 @@ function handleFormSubmit(modal) {
|
|||
data: form.serialize(), // serializes the form's elements.
|
||||
success: function(data) {
|
||||
animateSpinner(modal, false);
|
||||
window.location.replace(data.redirect_url);
|
||||
modal.modal('hide');
|
||||
HelperModule.flashAlertMsg(data.message, 'success');
|
||||
},
|
||||
error: function(data) {
|
||||
showFormErrors(modal, data.responseJSON.errors);
|
||||
|
@ -246,7 +248,7 @@ function initLoadProtocolModalPreview() {
|
|||
handleFormSubmit(modal);
|
||||
},
|
||||
error: function() {
|
||||
alert('Server error');
|
||||
HelperModule.flashAlertMsg('Server error', 'danger');
|
||||
},
|
||||
complete: function() {
|
||||
animateSpinner(null, false);
|
||||
|
|
|
@ -12,6 +12,10 @@ body,
|
|||
min-width: 320px;
|
||||
}
|
||||
|
||||
#content-wrapper .container #notifications {
|
||||
margin-left: -15px;
|
||||
}
|
||||
|
||||
// Word wrapping everywhere, except for table header of "datatables.js"
|
||||
body,
|
||||
table.dataTable td {
|
||||
|
|
|
@ -89,9 +89,11 @@ class ExternalProtocolsController < ApplicationController
|
|||
|
||||
if service_call.succeed?
|
||||
protocol_type = service_call.protocol.in_repository_public? ? 'public' : 'private'
|
||||
|
||||
message = t('protocols.index.external_protocols.import.success_flash',
|
||||
name: service_call.protocol.name,
|
||||
type: t("protocols.index.external_protocols.import.#{protocol_type}"))
|
||||
render json: { protocol: service_call.protocol,
|
||||
redirect_url: protocols_path(type: protocol_type) }
|
||||
message: message }
|
||||
else
|
||||
render json: { errors: service_call.errors }, status: 400
|
||||
end
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
<%= render "shared/file_preview_modal.html.erb" %>
|
||||
<%= render "shared/file_edit_modal.html.erb" %>
|
||||
<%= render "shared/navigation" %>
|
||||
|
||||
|
||||
<% if user_signed_in? && flash[:system_notification_modal] && current_user.show_login_system_notification? %>
|
||||
<%= render partial: "/system_notifications/system_notification_modal", locals: { notification: current_user.user_system_notifications.show_on_login(true) } %>
|
||||
<% else %>
|
||||
|
@ -67,7 +67,6 @@
|
|||
<p data-hook="general-no-teams-text"><%=t 'general.no_teams.text' %></p>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= yield :flash_messages_div %>
|
||||
<%= yield :content %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
<% content_for :content do %>
|
||||
<div class="container <%= yield :container_class %>">
|
||||
<% if user_signed_in? %>
|
||||
<%= render partial: 'shared/flash_alerts',
|
||||
locals: { flash: flash, notice: notice, alert: alert } %>
|
||||
<% end %>
|
||||
<%= yield %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
<% provide(:head_title, t("projects.reports.new.head_title", project: h(@project.name)).html_safe) %>
|
||||
|
||||
<div id="notifications"></div>
|
||||
<%= render partial: "reports/new/report_navigation" %>
|
||||
|
||||
<div class="content-pane" id="report-new">
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<% provide(:head_title, t('libraries.repository_columns.head_title', repository: @repository.name)) %>
|
||||
<% provide(:flash_messages_div) do %>
|
||||
<div id="notifications"></div>
|
||||
<% end %>
|
||||
|
||||
<div class="content-pane">
|
||||
<div class="repository-columns-header container">
|
||||
<div class="row">
|
||||
|
|
|
@ -1761,6 +1761,10 @@ en:
|
|||
empty_title: 'PROTOCOL PREVIEW'
|
||||
empty_subtext: 'Click on the protocol in the list to preview it here'
|
||||
banner_text: 'Protocol Preview'
|
||||
import:
|
||||
public: "Team protocols"
|
||||
private: "My protocols"
|
||||
success_flash: 'Protocol <strong>%{name}</strong> successfully imported to %{type}.'
|
||||
|
||||
steps:
|
||||
completed: 'Completed'
|
||||
|
|
Loading…
Reference in a new issue