zizia 4.1.0.alpha.01 → 4.2.0.alpha.01
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -1
- data/app/config/usage.yml +30 -0
- data/app/controllers/zizia/application_controller.rb +1 -1
- data/app/controllers/zizia/metadata_details_controller.rb +20 -0
- data/app/helpers/zizia/metadata_details_helper.rb +9 -0
- data/app/lib/zizia/metadata_details.rb +68 -0
- data/app/lib/zizia/metadata_usage.rb +22 -0
- data/app/lib/zizia/work_attributes.rb +31 -0
- data/app/views/zizia/metadata_details/show.html.erb +49 -0
- data/config/routes.rb +3 -3
- data/lib/zizia/engine.rb +0 -1
- data/lib/zizia/hyrax/hyrax_basic_metadata_mapper.rb +4 -0
- data/lib/zizia/version.rb +1 -1
- data/spec/controllers/metadata_details_spec.rb +73 -0
- data/spec/dummy/spec/system/metadata_details_page_spec.rb +12 -0
- data/spec/rails_helper.rb +1 -0
- data/spec/spec_helper.rb +1 -0
- data/zizia.gemspec +2 -1
- metadata +26 -7
- data/app/controllers/zizia/importer_documentation_controller.rb +0 -11
- data/app/helpers/importer_documentation_helper.rb +0 -13
- data/spec/controllers/importer_documentation_controller_spec.rb +0 -14
- data/spec/dummy/spec/system/importer_documentation_spec.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c529a5323dbb1b929bfc010ef73a81d52f643da989c4a390a691afa881c730c6
|
4
|
+
data.tar.gz: d819c1c9b34ecee1d4ac22c77f53f7dfc7e9b2c99a81cbacbaa3f0bd2336d679
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5144300f68e907db6837c9112929eb436ca5b2072cbae740cab98cd3672b0085e0a12ca12d081c5da2cc63b7fc59a4f150430c04a911d95b95869bcdf10d66c2
|
7
|
+
data.tar.gz: da4bc0d67cbd3e756765ac30083f4c8ccfbed615f07dddefe6dc1701c84fb14d36aaf687490dae1f49000c5b2ba8792ee2ae33ef124a42b6c3d9b1737833623e
|
data/.rubocop.yml
CHANGED
@@ -25,6 +25,7 @@ Metrics/AbcSize:
|
|
25
25
|
- lib/zizia/importer.rb
|
26
26
|
- lib/zizia/hyrax/hyrax_metadata_only_updater.rb
|
27
27
|
- 'app/importers/modular_importer.rb'
|
28
|
+
- 'app/lib/zizia/metadata_details.rb'
|
28
29
|
|
29
30
|
Metrics/BlockLength:
|
30
31
|
Exclude:
|
@@ -75,6 +76,6 @@ RSpec/MultipleExpectations:
|
|
75
76
|
- 'spec/integration/import_hyrax_csv.rb'
|
76
77
|
- 'spec/controllers/importer_documentation_controller_spec.rb'
|
77
78
|
- 'spec/integration/csv_import_detail_spec.rb'
|
78
|
-
|
79
|
+
- 'spec/controllers/**/*'
|
79
80
|
Style/StructInheritance:
|
80
81
|
Enabled: false
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
# Metadata usage hints
|
3
|
+
# attribute: usage
|
4
|
+
|
5
|
+
arkivo_checksum: "-- system field - not directly editable --"
|
6
|
+
based_near: " A location that something is based near, for some broadly human notion of near."
|
7
|
+
contributor: "Identifies contributors to the material; can be used very broadly if exact contributions aren't known"
|
8
|
+
creator: "Identifies the primary Creator(s) of the material"
|
9
|
+
date_created: "The date the material was created"
|
10
|
+
date_modified: "-- system field - not directly editable --"
|
11
|
+
date_uploaded: "-- system field - not directly editable --"
|
12
|
+
depositor: "-- system field - not directly editable --"
|
13
|
+
description: "Free-text, summary description of the content, such as an abstract. Provides additional search terms in natural language; provides important summary information for non-textual resources such as images, audio, and video"
|
14
|
+
has_model: "-- system field - not directly editable --"
|
15
|
+
head: "-- system field - not directly editable --"
|
16
|
+
identifier: "An unambiguous reference to the resource within a given context."
|
17
|
+
keywords: "Uncontrolled keywords describing the material, often provided by content creators"
|
18
|
+
language: "The language of the source content being described: applies to textual or spoken word (linguistic) content"
|
19
|
+
license: "A legal document giving official permission to do something with the resource."
|
20
|
+
on_behalf_of: "-- system field - not directly editable --"
|
21
|
+
owner: "-- system field - not directly editable --"
|
22
|
+
proxy_depositor: "-- system field - not directly editable --"
|
23
|
+
publisher: "The name of the entity formally publishing the work"
|
24
|
+
related_url: "The resource O may provide additional information about S. It may be possible to retrieve representations of O from the Web, but this is not required. When such representations may be retrieved, no constraints are placed on the format of those representations."
|
25
|
+
resource_type: "The nature or genre of the resource."
|
26
|
+
rights_statement: "Standardized rights statement from rightsstatements.org that can be used to communicate the copyright and re-use status of digital objects to the end users [DESCRIPTIVE/USER FACING]"
|
27
|
+
source: "A related resource from which the described resource is derived."
|
28
|
+
state: "-- system field - not directly editable --"
|
29
|
+
tail: "-- system field - not directly editable --"
|
30
|
+
title: "The name of the resource being described. The title may either be transcribed from the resource itself, or it may need to be created."
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Zizia
|
3
|
+
class MetadataDetailsController < ApplicationController
|
4
|
+
def show
|
5
|
+
@details = MetadataDetails.instance.details(work_attributes:
|
6
|
+
WorkAttributes.instance)
|
7
|
+
respond_to do |format|
|
8
|
+
format.html
|
9
|
+
format.json { render json: @details.to_json }
|
10
|
+
format.any { redirect_to action: :show }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def profile
|
15
|
+
@csv = MetadataDetails.instance.to_csv(work_attributes:
|
16
|
+
WorkAttributes.instance)
|
17
|
+
send_data @csv, type: 'text/csv', filename: "metadata-profile-#{Date.current}.csv"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'csv'
|
3
|
+
|
4
|
+
module Zizia
|
5
|
+
class MetadataDetails
|
6
|
+
include Singleton
|
7
|
+
|
8
|
+
def details(work_attributes:)
|
9
|
+
validators = work_attributes.validators
|
10
|
+
work_attributes.properties.sort.map do |p|
|
11
|
+
Hash[
|
12
|
+
attribute: p[0],
|
13
|
+
predicate: p[1].predicate.to_s,
|
14
|
+
multiple: p[1].try(:multiple?).to_s,
|
15
|
+
type: type_to_s(p[1].type),
|
16
|
+
validator: validator_to_string(validator: validators[p[0].to_sym][0]),
|
17
|
+
label: I18n.t("simple_form.labels.defaults.#{p[0]}"),
|
18
|
+
csv_header: csv_header(p[0]),
|
19
|
+
required_on_form: required_on_form_to_s(p[0]),
|
20
|
+
usage: MetadataUsage.instance.usage[p[0]]
|
21
|
+
]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_csv(work_attributes:)
|
26
|
+
attribute_list = details(work_attributes: work_attributes)
|
27
|
+
headers = extract_headers(attribute_list[0])
|
28
|
+
csv_string = CSV.generate do |csv|
|
29
|
+
csv << headers
|
30
|
+
attribute_list.each do |attribute|
|
31
|
+
csv << headers.map { |h| attribute[h] }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
csv_string
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def csv_header(field)
|
40
|
+
Zizia.config.metadata_mapper_class.csv_header(field) || "not configured"
|
41
|
+
end
|
42
|
+
|
43
|
+
def extract_headers(attribute_hash)
|
44
|
+
headers = attribute_hash.keys.sort
|
45
|
+
headers = [:attribute] + (headers - [:attribute]) # force :attribute to the beginning of the list
|
46
|
+
headers = (headers - [:usage]) + [:usage] # force :usage to the end of the list becuause it's so long
|
47
|
+
headers
|
48
|
+
end
|
49
|
+
|
50
|
+
def required_on_form_to_s(attribute)
|
51
|
+
Hyrax::Forms::WorkForm.required_fields.include?(attribute.to_sym).to_s
|
52
|
+
end
|
53
|
+
|
54
|
+
def type_to_s(type)
|
55
|
+
return 'Not specified' unless type.present?
|
56
|
+
type.to_s
|
57
|
+
end
|
58
|
+
|
59
|
+
def validator_to_string(validator:)
|
60
|
+
case validator
|
61
|
+
when ActiveModel::Validations::PresenceValidator
|
62
|
+
'required'
|
63
|
+
else
|
64
|
+
'No validation present in the model.'
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Zizia
|
4
|
+
class MetadataUsage
|
5
|
+
include Singleton
|
6
|
+
|
7
|
+
def usage
|
8
|
+
YAML.load_file(config)
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def default_location
|
14
|
+
File.join(File.dirname(__FILE__), '../../config/usage.yml')
|
15
|
+
end
|
16
|
+
|
17
|
+
def config
|
18
|
+
return default_location unless File.exist?(Rails.root.join("config", "usage.yml"))
|
19
|
+
Rails.root.join("config", "usage.yml")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# A singleton class to get the list of attributes
|
4
|
+
# from a work.
|
5
|
+
#
|
6
|
+
# It is a Singleton so that there is only one of these
|
7
|
+
# initialized and uses the ||= operator so that when you
|
8
|
+
# read the attributes property it uses an already initialized
|
9
|
+
# work.
|
10
|
+
#
|
11
|
+
# This is to ensure that we can get a list of the attributes
|
12
|
+
# programmatically, but without using any unnecessary memory.
|
13
|
+
module Zizia
|
14
|
+
class WorkAttributes
|
15
|
+
include Singleton
|
16
|
+
attr_reader :attributes, :properties, :validators, :local_attributes
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
work ||= klass.new
|
20
|
+
@local_attributes || work.local_attributes
|
21
|
+
@attributes ||= work.local_attributes
|
22
|
+
@properties ||= work.send(:properties)
|
23
|
+
@validators ||= work.send(:_validators)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Override to choose a different Work class
|
27
|
+
def klass
|
28
|
+
Work
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
<% content_for :title, 'Importer Field Guide' %>
|
2
|
+
<div class="guide-container">
|
3
|
+
<a class="btn btn-primary" href="/importer_documentation/profile">Download as CSV</a>
|
4
|
+
<dl>
|
5
|
+
<% @details.each do |detail| %>
|
6
|
+
<h2>
|
7
|
+
<dt>
|
8
|
+
<%= detail[:attribute] %>
|
9
|
+
</dt>
|
10
|
+
</h2>
|
11
|
+
<dd>
|
12
|
+
<div>
|
13
|
+
<b>Predicate:</b>
|
14
|
+
<a href="<%= detail[:predicate] %>"><%= detail[:predicate] %></a>
|
15
|
+
</div>
|
16
|
+
<div>
|
17
|
+
<b>Type:</b>
|
18
|
+
<%= detail[:type] %>
|
19
|
+
</div>
|
20
|
+
<div>
|
21
|
+
<b>Validation:</b>
|
22
|
+
<%= detail[:validator] %>
|
23
|
+
</div>
|
24
|
+
<div>
|
25
|
+
<b>Multiple:</b>
|
26
|
+
<%= detail[:multiple] %>
|
27
|
+
</div>
|
28
|
+
<div>
|
29
|
+
<b>Edit Form Label:</b>
|
30
|
+
<%= detail[:label] %>
|
31
|
+
</div>
|
32
|
+
<div>
|
33
|
+
<b>Import header:</b>
|
34
|
+
<span class=<%= css_class(detail[:csv_header])%>>
|
35
|
+
<%= detail[:csv_header] %>
|
36
|
+
</span>
|
37
|
+
</div>
|
38
|
+
<div>
|
39
|
+
<b>Required on Edit Form:</b>
|
40
|
+
<%= detail[:required_on_form] %>
|
41
|
+
</div>
|
42
|
+
<div class=metadata_usage>
|
43
|
+
<b>Usage:</b>
|
44
|
+
<%= detail[:usage] %>
|
45
|
+
</div>
|
46
|
+
</dd>
|
47
|
+
<% end %>
|
48
|
+
</dl>
|
49
|
+
</div>
|
data/config/routes.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
Zizia::Engine.routes.draw do
|
3
|
-
get 'importer_documentation/guide'
|
4
|
-
get 'importer_documentation/csv'
|
5
|
-
|
6
3
|
post 'csv_imports/preview', as: 'preview_csv_import'
|
7
4
|
get 'csv_imports/preview', to: redirect('csv_imports/new')
|
8
5
|
resources :csv_imports, only: [:index, :show, :new, :create]
|
6
|
+
|
7
|
+
get 'importer_documentation/guide', to: 'metadata_details#show'
|
8
|
+
get 'importer_documentation/profile', to: 'metadata_details#profile'
|
9
9
|
end
|
data/lib/zizia/engine.rb
CHANGED
data/lib/zizia/version.rb
CHANGED
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails_helper'
|
4
|
+
|
5
|
+
RSpec.describe Zizia::MetadataDetailsController, type: :controller do
|
6
|
+
routes { Zizia::Engine.routes }
|
7
|
+
|
8
|
+
describe 'GET show' do
|
9
|
+
it 'has 200 code for show' do
|
10
|
+
get :show
|
11
|
+
expect(response.status).to eq(200)
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'responds with html when no format is specified' do
|
15
|
+
get :show
|
16
|
+
expect(response.content_type).to eq "text/html"
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'responds to json requests' do
|
20
|
+
get :show, format: :json
|
21
|
+
expect(response.content_type).to eq "application/json"
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'has details' do
|
25
|
+
get :show
|
26
|
+
details = assigns(:details)
|
27
|
+
title = details.find { |h| h[:attribute] == 'title' }
|
28
|
+
expect(title[:predicate]).to eq('http://purl.org/dc/terms/title')
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'has details in json' do
|
32
|
+
get :show, format: :json
|
33
|
+
details = JSON[response.body, symbolize_names: true]
|
34
|
+
title = details.find { |h| h[:attribute] == 'title' }
|
35
|
+
expect(title[:predicate]).to eq('http://purl.org/dc/terms/title')
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'redirects unknown formats to html' do
|
39
|
+
get :show, format: :something_else
|
40
|
+
expect(response).to redirect_to action: :show
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe 'GET profile' do
|
45
|
+
it 'has a downloadable csv' do
|
46
|
+
get :profile
|
47
|
+
expect(response.content_type).to eq('text/csv')
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'includes expected headers' do
|
51
|
+
get :profile
|
52
|
+
first_row = response.body.lines.first
|
53
|
+
expect(first_row).to include('csv_header')
|
54
|
+
expect(first_row).to include('required_on_form')
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'includes usage' do
|
58
|
+
get :profile
|
59
|
+
profile_table = CSV.parse(response.body, headers: :first_row)
|
60
|
+
title_definition = profile_table.find { |r| r.field('attribute') == 'title' }
|
61
|
+
expect(title_definition.field('usage')).to include 'name of the resource being described' # match text extracted from ./config/emory/usage.yml
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'includes a date in the filename' do
|
65
|
+
todays_date = "Wed, 03 Jul 1985".to_date
|
66
|
+
allow(Date).to receive(:current) { todays_date }
|
67
|
+
|
68
|
+
get :profile
|
69
|
+
filename = response.headers['Content-Disposition']
|
70
|
+
expect(filename).to include "1985-07-03"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'rails_helper'
|
3
|
+
include Warden::Test::Helpers
|
4
|
+
|
5
|
+
RSpec.describe 'Viewing the field guide' do
|
6
|
+
it 'renders correctly' do
|
7
|
+
visit('/importer_documentation/guide')
|
8
|
+
expect(page).to have_content('title')
|
9
|
+
expect(page).to have_content('The name of the resource being described. The title may either be transcribed from the resource itself, or it may need to be created.')
|
10
|
+
expect(page).to have_content('-- system field - not directly editable --')
|
11
|
+
end
|
12
|
+
end
|
data/spec/rails_helper.rb
CHANGED
@@ -10,6 +10,7 @@ require 'factory_bot'
|
|
10
10
|
require 'ffaker'
|
11
11
|
require 'hydra-role-management'
|
12
12
|
require 'byebug'
|
13
|
+
require 'rails-controller-testing'
|
13
14
|
# Add additional requires below this line. Rails is not loaded until this point!
|
14
15
|
|
15
16
|
# Requires supporting ruby files with custom matchers and macros, etc, in
|
data/spec/spec_helper.rb
CHANGED
data/zizia.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.add_dependency 'active-fedora'
|
20
20
|
gem.add_dependency 'rails', '~> 5.1.4'
|
21
21
|
gem.add_dependency 'carrierwave'
|
22
|
-
gem.add_dependency '
|
22
|
+
gem.add_dependency 'rails-controller-testing'
|
23
23
|
|
24
24
|
gem.add_development_dependency 'bixby'
|
25
25
|
gem.add_development_dependency 'bootstrap-sass', '~> 3.0'
|
@@ -43,6 +43,7 @@ Gem::Specification.new do |gem|
|
|
43
43
|
gem.add_development_dependency 'rake'
|
44
44
|
gem.add_development_dependency 'riiif', '~> 2.0'
|
45
45
|
gem.add_development_dependency 'rsolr', '>= 1.0'
|
46
|
+
gem.add_development_dependency 'rails-controller-testing'
|
46
47
|
gem.add_development_dependency 'rspec'
|
47
48
|
gem.add_development_dependency 'rspec-rails'
|
48
49
|
gem.add_development_dependency 'rspec_junit_formatter'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zizia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.2.0.alpha.01
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Data Curation Experts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active-fedora
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rails-controller-testing
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -380,6 +380,20 @@ dependencies:
|
|
380
380
|
- - ">="
|
381
381
|
- !ruby/object:Gem::Version
|
382
382
|
version: '1.0'
|
383
|
+
- !ruby/object:Gem::Dependency
|
384
|
+
name: rails-controller-testing
|
385
|
+
requirement: !ruby/object:Gem::Requirement
|
386
|
+
requirements:
|
387
|
+
- - ">="
|
388
|
+
- !ruby/object:Gem::Version
|
389
|
+
version: '0'
|
390
|
+
type: :development
|
391
|
+
prerelease: false
|
392
|
+
version_requirements: !ruby/object:Gem::Requirement
|
393
|
+
requirements:
|
394
|
+
- - ">="
|
395
|
+
- !ruby/object:Gem::Version
|
396
|
+
version: '0'
|
383
397
|
- !ruby/object:Gem::Dependency
|
384
398
|
name: rspec
|
385
399
|
requirement: !ruby/object:Gem::Requirement
|
@@ -629,14 +643,18 @@ files:
|
|
629
643
|
- app/assets/stylesheets/zizia/_file_upload.scss
|
630
644
|
- app/assets/stylesheets/zizia/application.css
|
631
645
|
- app/assets/stylesheets/zizia/zizia.scss
|
646
|
+
- app/config/usage.yml
|
632
647
|
- app/controllers/zizia/application_controller.rb
|
633
648
|
- app/controllers/zizia/csv_imports_controller.rb
|
634
|
-
- app/controllers/zizia/
|
635
|
-
- app/helpers/importer_documentation_helper.rb
|
649
|
+
- app/controllers/zizia/metadata_details_controller.rb
|
636
650
|
- app/helpers/zizia/application_helper.rb
|
651
|
+
- app/helpers/zizia/metadata_details_helper.rb
|
637
652
|
- app/importers/modular_importer.rb
|
638
653
|
- app/jobs/zizia/application_job.rb
|
639
654
|
- app/jobs/zizia/start_csv_import_job.rb
|
655
|
+
- app/lib/zizia/metadata_details.rb
|
656
|
+
- app/lib/zizia/metadata_usage.rb
|
657
|
+
- app/lib/zizia/work_attributes.rb
|
640
658
|
- app/models/zizia/application_record.rb
|
641
659
|
- app/models/zizia/csv_import.rb
|
642
660
|
- app/models/zizia/csv_import_detail.rb
|
@@ -659,6 +677,7 @@ files:
|
|
659
677
|
- app/views/zizia/csv_imports/preview.html.erb
|
660
678
|
- app/views/zizia/csv_imports/show.html.erb
|
661
679
|
- app/views/zizia/importer_documentation/guide.html.erb
|
680
|
+
- app/views/zizia/metadata_details/show.html.erb
|
662
681
|
- bin/rails
|
663
682
|
- config/routes.rb
|
664
683
|
- db/migrate/201901162141281_create_zizia_csv_imports.rb
|
@@ -724,7 +743,7 @@ files:
|
|
724
743
|
- solr/config/xslt/example_atom.xsl
|
725
744
|
- solr/config/xslt/example_rss.xsl
|
726
745
|
- solr/config/xslt/luke.xsl
|
727
|
-
- spec/controllers/
|
746
|
+
- spec/controllers/metadata_details_spec.rb
|
728
747
|
- spec/dummy/.fcrepo_wrapper
|
729
748
|
- spec/dummy/.gitignore
|
730
749
|
- spec/dummy/.rspec
|
@@ -1423,7 +1442,7 @@ files:
|
|
1423
1442
|
- spec/dummy/spec/system/import_from_csv_spec.rb
|
1424
1443
|
- spec/dummy/spec/system/import_from_csv_with_errors_spec.rb
|
1425
1444
|
- spec/dummy/spec/system/import_with_no_collection_spec.rb
|
1426
|
-
- spec/dummy/spec/system/
|
1445
|
+
- spec/dummy/spec/system/metadata_details_page_spec.rb
|
1427
1446
|
- spec/dummy/spec/system/view_hyrax_home_page_spec.rb
|
1428
1447
|
- spec/dummy/storage/.keep
|
1429
1448
|
- spec/dummy/test/application_system_test_case.rb
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Zizia
|
4
|
-
class ImporterDocumentationController < ApplicationController
|
5
|
-
def guide; end
|
6
|
-
|
7
|
-
def csv
|
8
|
-
send_data Zizia::CsvTemplate.new.to_s, type: 'text/csv; charset=utf-8', disposition: 'attachment', filename: 'import_manifest.csv'
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ImporterDocumentationHelper
|
4
|
-
def render_guide
|
5
|
-
renderer = Redcarpet::Render::HTML.new(autolink: true, with_toc_data: true)
|
6
|
-
markdown = Redcarpet::Markdown.new(renderer)
|
7
|
-
if File.exist?(Rails.root.join('app', 'assets', 'markdown', 'importer_guide.md'))
|
8
|
-
markdown.render(File.open(Rails.root.join('app', 'assets', 'markdown', 'importer_guide.md')).read)
|
9
|
-
else
|
10
|
-
'There is currently no documentation.'
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'rails_helper'
|
3
|
-
|
4
|
-
RSpec.describe Zizia::ImporterDocumentationController, type: :controller do
|
5
|
-
routes { Zizia::Engine.routes }
|
6
|
-
|
7
|
-
describe "GET csv" do
|
8
|
-
it "provides a csv download" do
|
9
|
-
get :csv
|
10
|
-
expect(response.headers['Content-Type']).to eq('text/csv; charset=utf-8')
|
11
|
-
expect(response.headers['Content-Disposition']).to eq('attachment; filename="import_manifest.csv"')
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'rails_helper'
|
3
|
-
include Warden::Test::Helpers
|
4
|
-
|
5
|
-
RSpec.describe 'Importing records from a CSV file' do
|
6
|
-
context 'logged in as an admin user' do
|
7
|
-
let(:admin_user) { FactoryBot.create(:admin) }
|
8
|
-
before do
|
9
|
-
login_as admin_user
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'shows that there is no documentation if the markdown is absent' do
|
13
|
-
visit '/importer_documentation/guide'
|
14
|
-
expect(page).to have_content 'There is currently no documentation.'
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|