diff --git a/app/assets/javascripts/protocols/external_protocols_tab.js b/app/assets/javascripts/protocols/external_protocols_tab.js index d11d1ee62..c2a00cab8 100644 --- a/app/assets/javascripts/protocols/external_protocols_tab.js +++ b/app/assets/javascripts/protocols/external_protocols_tab.js @@ -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); diff --git a/app/assets/stylesheets/themes/scinote.scss b/app/assets/stylesheets/themes/scinote.scss index 3f7c529d1..16377420c 100644 --- a/app/assets/stylesheets/themes/scinote.scss +++ b/app/assets/stylesheets/themes/scinote.scss @@ -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 { diff --git a/app/controllers/external_protocols_controller.rb b/app/controllers/external_protocols_controller.rb index 07960ce63..a3d13bda8 100644 --- a/app/controllers/external_protocols_controller.rb +++ b/app/controllers/external_protocols_controller.rb @@ -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 diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 2f9c92b1e..c795ccc38 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -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 @@

<%=t 'general.no_teams.text' %>

<% else %> - <%= yield :flash_messages_div %> <%= yield :content %> <% end %> diff --git a/app/views/layouts/main.html.erb b/app/views/layouts/main.html.erb index 51e0d0a53..181b4b0f6 100644 --- a/app/views/layouts/main.html.erb +++ b/app/views/layouts/main.html.erb @@ -1,5 +1,9 @@ <% content_for :content do %>
+ <% if user_signed_in? %> + <%= render partial: 'shared/flash_alerts', + locals: { flash: flash, notice: notice, alert: alert } %> + <% end %> <%= yield %>
<% end %> diff --git a/app/views/reports/new.html.erb b/app/views/reports/new.html.erb index 17584deef..88f669d8a 100644 --- a/app/views/reports/new.html.erb +++ b/app/views/reports/new.html.erb @@ -5,7 +5,6 @@ <% provide(:head_title, t("projects.reports.new.head_title", project: h(@project.name)).html_safe) %> -
<%= render partial: "reports/new/report_navigation" %>
diff --git a/app/views/repository_columns/index.html.erb b/app/views/repository_columns/index.html.erb index 355603d9d..199a5590b 100644 --- a/app/views/repository_columns/index.html.erb +++ b/app/views/repository_columns/index.html.erb @@ -1,7 +1,5 @@ <% provide(:head_title, t('libraries.repository_columns.head_title', repository: @repository.name)) %> -<% provide(:flash_messages_div) do %> -
-<% end %> +
diff --git a/config/locales/en.yml b/config/locales/en.yml index be2a74ee8..92c045f97 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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 %{name} successfully imported to %{type}.' steps: completed: 'Completed'