to_spotlight 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/to_spotlight/spotlight_transfer_controller.rb +31 -30
- data/app/views/to_spotlight/spotlight_transfer/_default_group.html.erb +1 -1
- data/app/views/to_spotlight/spotlight_transfer/_list_transfers.html.erb +1 -1
- data/config/routes.rb +5 -5
- data/db/migrate/20200310153953_create_to_spotlight_spotlight_transfers.rb +1 -1
- data/lib/to_spotlight/engine.rb +7 -0
- data/lib/to_spotlight/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36ec581276c27e1c851f430d2390e177763863df1edbf2828f0015607e0e5d7d
|
4
|
+
data.tar.gz: ed68bfd105acf8f243ffcadacba335c9fcade7d1bb3aad09e23785f48ebd3583
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f496d05636aa8eca5681226d0e027fb45735917324568ecb945eb252f69fd7b436c633336765fc2defc57d833d4105f6cbfda917cbe9a7848226e674ffe9a212
|
7
|
+
data.tar.gz: cead82120d6613d68bde233aeb1a653216e7ceb30da0c3579624f20c69eddd8e6dd3fb01f7e01da18c5b01f119200ba987e06eed18f74bbfebbdb87846a18ff0
|
@@ -11,8 +11,8 @@ module ToSpotlight
|
|
11
11
|
render plain: curated_fields
|
12
12
|
when 'works'
|
13
13
|
render partial: 'to_spotlight/spotlight_transfer/select', locals: { type_name: 'work', data: curated_works }
|
14
|
-
when '
|
15
|
-
render partial: 'to_spotlight/spotlight_transfer/select', locals: { type_name: '
|
14
|
+
when 'collections'
|
15
|
+
render partial: 'to_spotlight/spotlight_transfer/select', locals: { type_name: 'collection', data: collections }
|
16
16
|
else
|
17
17
|
render plain: 'Invalid Request Type'
|
18
18
|
end
|
@@ -21,13 +21,13 @@ module ToSpotlight
|
|
21
21
|
|
22
22
|
def receive
|
23
23
|
return unless params[:token]
|
24
|
-
mappings = params.permit!.to_h[:mappings]
|
25
24
|
user = params.permit!.to_h[:user]
|
26
|
-
|
25
|
+
mappings = params.permit!.to_h[:mappings]
|
26
|
+
collection_id = params.permit!.to_h[:collection_id]
|
27
27
|
exhibit_id = params.permit!.to_h[:exhibit_id]
|
28
28
|
@transfer = ToSpotlight::SpotlightTransfer.new user: user,
|
29
29
|
mappings: mappings,
|
30
|
-
|
30
|
+
collection_id: collection_id,
|
31
31
|
exhibit_id: exhibit_id
|
32
32
|
if @transfer.save
|
33
33
|
render plain: 'Transfer Request Received'
|
@@ -43,14 +43,14 @@ module ToSpotlight
|
|
43
43
|
def approve
|
44
44
|
now = params[:commit].downcase.include?('now')
|
45
45
|
transfer = ToSpotlight::SpotlightTransfer.find params[:transfer_id]
|
46
|
-
works = ::
|
46
|
+
works = ::Collection.find(transfer.collection_id).members
|
47
47
|
mappings = mapping_invert transfer.mappings
|
48
48
|
SpotlightTransferJob.perform_later(works, mappings)
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
49
|
+
#@res = ::Net::HTTP.post URI('http://localhost:3000/from_hyrax/receive'),
|
50
|
+
# { transfer: transfer.attributes,
|
51
|
+
# now: now,
|
52
|
+
# token: 'secret_token' }.to_json,
|
53
|
+
# 'Content-Type' => 'application/json'
|
54
54
|
|
55
55
|
end
|
56
56
|
|
@@ -64,35 +64,36 @@ module ToSpotlight
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def curated_works
|
67
|
-
|
67
|
+
Site.first.available_works
|
68
68
|
end
|
69
69
|
|
70
|
-
def
|
71
|
-
|
70
|
+
def collections
|
71
|
+
::Collection.all.map { |c| [c.title.first, c.id] }
|
72
72
|
end
|
73
73
|
|
74
74
|
def curated_fields
|
75
|
-
|
75
|
+
work_fields(params[:work].constantize) - excluded_fields
|
76
76
|
end
|
77
77
|
|
78
|
-
def
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
78
|
+
def work_fields work
|
79
|
+
work.new.attributes.keys
|
80
|
+
#%w[id head tail depositor title date_uploaded date_modified state
|
81
|
+
# proxy_depositor on_behalf_of arkivo_checksum owner alternative_title
|
82
|
+
# edition geographic_coverage coordinates chronological_coverage extent
|
83
|
+
# additional_physical_characteristics has_format physical_repository
|
84
|
+
# collection provenance provider sponsor genre format
|
85
|
+
# archival_item_identifier fonds_title fonds_creator fonds_description
|
86
|
+
# fonds_identifier is_referenced_by date_digitized transcript
|
87
|
+
# technical_note year label relative_path import_url creator part_of
|
88
|
+
# resource_type contributor description keyword license rights_statement
|
89
|
+
# publisher date_created subject language identifier based_near
|
90
|
+
# related_url bibliographic_citation source access_control_id
|
91
|
+
# representative_id thumbnail_id rendering_ids admin_set_id
|
92
|
+
# embargo_id lease_id]
|
92
93
|
end
|
93
94
|
|
94
95
|
def excluded_fields
|
95
|
-
%w[id head tail state proxy_depositor on_behalf_of arkivo_checksum label
|
96
|
+
%w[id title head tail state proxy_depositor on_behalf_of arkivo_checksum label
|
96
97
|
relative_path import_url part_of resource_type access_control_id
|
97
98
|
representative_id thumbnail_id rendering_ids admin_set_id embargo_id
|
98
99
|
lease_id]
|
data/config/routes.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
2
|
-
get '
|
3
|
-
post '
|
4
|
-
get '
|
5
|
-
post '
|
1
|
+
ToSpotlight::Engine.routes.draw do
|
2
|
+
get 'api/:request_type' => 'spotlight_transfer#api'
|
3
|
+
post 'receive' => 'spotlight_transfer#receive'
|
4
|
+
get 'index' => 'spotlight_transfer#index'
|
5
|
+
post 'approve' => 'spotlight_transfer#approve'
|
6
6
|
end
|
data/lib/to_spotlight/engine.rb
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
module ToSpotlight
|
2
2
|
class Engine < ::Rails::Engine
|
3
3
|
isolate_namespace ToSpotlight
|
4
|
+
initializer :append_migrations do |app|
|
5
|
+
unless app.root.to_s.match root.to_s
|
6
|
+
config.paths["db/migrate"].expanded.each do |expanded_path|
|
7
|
+
app.config.paths["db/migrate"] << expanded_path
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
4
11
|
end
|
5
12
|
end
|
data/lib/to_spotlight/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: to_spotlight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sephirothkod
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|