diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 8339dca33..582c84eb8 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -238,18 +238,29 @@ class RepositoriesController < ApplicationController end def export_modal - return unless current_user.has_available_exports? - - respond_to do |format| - format.json do - render json: { - html: render_to_string( - partial: 'export_repositories_modal.html.erb', - locals: { team_name: current_team.name, - export_limit: TeamZipExport.exports_limit, - num_of_requests_left: current_user.exports_left - 1 } - ) - } + if current_user.has_available_exports? + respond_to do |format| + format.json do + render json: { + html: render_to_string( + partial: 'export_repositories_modal.html.erb', + locals: { team_name: current_team.name, + export_limit: TeamZipExport.exports_limit, + num_of_requests_left: current_user.exports_left - 1 } + ) + } + end + end + else + respond_to do |format| + format.json do + render json: { + html: render_to_string( + partial: 'export_limit_exceeded_modal.html.erb', + locals: { requests_limit: TeamZipExport.exports_limit } + ) + } + end end end end diff --git a/app/views/repositories/_export_limit_exceeded_modal.html.erb b/app/views/repositories/_export_limit_exceeded_modal.html.erb new file mode 100644 index 000000000..e1a83633d --- /dev/null +++ b/app/views/repositories/_export_limit_exceeded_modal.html.erb @@ -0,0 +1,22 @@ + diff --git a/config/locales/en.yml b/config/locales/en.yml index ec5c752a4..a255e8235 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1753,6 +1753,10 @@ en: description_p2: "You will receive an email when the .zip file is ready. A link to your file will also appear in your SciNote notification. For security reasons, this link will expire in 7 days." description_p3_html: "After you confirm this export, you will have %{remaining_export_requests} export requests left today (max %{requests_limit} requests per day)." export: "Export" + modal_export_limit_exceeded: + title: "Export denied" + error_p1_html: "It looks like you have exceeded your daily export limit. The number of exports is limited to %{limit} requests per day - you currently have 0 export requests left." + error_p2_html: "Please repeat the desired action tomorrow, when your daily limit will reset back to %{limit} export requests." modal_create: title: "Create new inventory" name_label: "Inventory name"