mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-01 21:21:50 +08:00
Create an export_limit_exceeded model for repositories export [SCI-8730] (#5667)
Co-authored-by: Sboursen <dev.sboursen@gmail.com>
This commit is contained in:
parent
e2f25eb6c0
commit
fdc4f4ddd7
3 changed files with 49 additions and 12 deletions
|
@ -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
|
||||
|
|
22
app/views/repositories/_export_limit_exceeded_modal.html.erb
Normal file
22
app/views/repositories/_export_limit_exceeded_modal.html.erb
Normal file
|
@ -0,0 +1,22 @@
|
|||
<div class="modal"
|
||||
id="export-repositories-limit-exceeded-modal"
|
||||
class="export-repositories-limit-exceeded-modal"
|
||||
tabindex="-1"
|
||||
role="dialog"
|
||||
aria-labelledby="export-repositories-limit-exceeded-modal-label">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title"><%= t('repositories.index.modal_export_limit_exceeded.title') %></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p><%=t 'repositories.index.modal_export_limit_exceeded.error_p1_html', limit: requests_limit %></p>
|
||||
<p><%=t 'repositories.index.modal_export_limit_exceeded.error_p2_html', limit: requests_limit %></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal"><%=t "general.cancel" %></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -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 <strong>%{remaining_export_requests}</strong> 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 <strong>limited to %{limit} requests per day </strong>- you currently have 0 export requests left."
|
||||
error_p2_html: "Please repeat the desired action <strong>tomorrow</strong>, when your daily limit will reset back to %{limit} export requests."
|
||||
modal_create:
|
||||
title: "Create new inventory"
|
||||
name_label: "Inventory name"
|
||||
|
|
Loading…
Reference in a new issue