adds view if download expires

This commit is contained in:
zmagod 2017-03-27 10:38:28 +02:00
parent 9aeefbdf96
commit 2235fd3fb7
4 changed files with 18 additions and 3 deletions

View file

@ -1,6 +1,6 @@
class ZipExportsController < ApplicationController
before_action :load_var
before_action :check_edit_permissions
before_action :load_var, only: :download
before_action :check_edit_permissions, only: :download
def download
if @zip_export.stored_on_s3?
@ -12,11 +12,14 @@ class ZipExportsController < ApplicationController
end
end
def file_expired
end
private
def load_var
@zip_export = ZipExport.find_by_id(params[:id])
render_404 unless @zip_export
redirect_to(file_expired_url, status: 301) and return unless @zip_export
end
def check_edit_permissions

View file

@ -0,0 +1,6 @@
<div class="container">
<div class="jumbotron">
<h2><%=t 'zip_export.expired_title' %></h2>
<p><%=t 'zip_export.expired_description' %></p>
</div>
</div>

View file

@ -1545,6 +1545,8 @@ en:
zip_export:
notification_title: 'Your package is ready to be exported!'
expired_title: 'The required file was expired!'
expired_description: 'The downloadable file expires in 3 days after is created.'
# This section contains general words that can be used in any parts of
# application.

View file

@ -118,6 +118,10 @@ Rails.application.routes.draw do
to: 'zip_exports#download',
as: 'zip_exports_download'
get 'zip_exports/file_expired',
to: 'zip_exports#file_expired',
as: 'file_expired'
resources :teams do
resources :samples, only: [:new, :create]
resources :sample_types, except: [:show, :new] do