Skip to content

Commit

Permalink
Merge pull request #29 from curationexperts/rename-import-manifest
Browse files Browse the repository at this point in the history
Rename CSV Template link and filename
  • Loading branch information
little9 committed Oct 2, 2019
2 parents 7c2d8b6 + 33b3e72 commit b5b685c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
9 changes: 9 additions & 0 deletions app/controllers/zizia/importer_documentation_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

module Zizia
class ImporterDocumentationController < ::ApplicationController
def csv
send_data Zizia::CsvTemplate.new.to_s, type: 'text/csv; charset=utf-8', disposition: 'attachment', filename: 'import_template.csv'
end
end
end
2 changes: 1 addition & 1 deletion app/views/zizia/csv_imports/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<div class="well well-lg">
<p><b>Download a CSV template</b> to get started.</b></p>
<div class="text-center">
<a href="/importer_documentation/csv" data-turbolinks="false" class="btn btn-default btn-lg"><i class="glyphicon glyphicon-list"></i> Download a CSV Template</a>
<a href="/importer_documentation/csv" data-turbolinks="false" class="btn btn-default btn-lg"><i class="glyphicon glyphicon-list"></i> Download an Import Template</a>
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

get 'importer_documentation/guide', to: 'metadata_details#show'
get 'importer_documentation/profile', to: 'metadata_details#profile'
get 'importer_documentation/csv', to: 'importer_documentation#csv'

get 'csv_import_details/index'
get 'csv_import_details/show/:id', to: 'csv_import_details#show', as: 'csv_import_detail'
Expand Down
2 changes: 1 addition & 1 deletion lib/zizia/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Zizia
VERSION = '4.4.0.alpha.01'
VERSION = '4.4.1.alpha.01'
end
14 changes: 14 additions & 0 deletions spec/controllers/importer_documentation_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true
require 'rails_helper'

RSpec.describe Zizia::ImporterDocumentationController, type: :controller do
routes { Zizia::Engine.routes }

describe "GET csv" do
it "provides a csv download" do
get :csv
expect(response.headers['Content-Type']).to eq('text/csv; charset=utf-8')
expect(response.headers['Content-Disposition']).to eq('attachment; filename="import_template.csv"')
end
end
end

0 comments on commit b5b685c

Please sign in to comment.