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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 74db6d9918bf3290f633050b0bd9cd48d5ea2567162f754e900048b7d98a2a16
4
- data.tar.gz: dc240f4af0200bc92480b4a336a3404aa6ee59ded38d484c0b22f1061ff8fa33
3
+ metadata.gz: 36ec581276c27e1c851f430d2390e177763863df1edbf2828f0015607e0e5d7d
4
+ data.tar.gz: ed68bfd105acf8f243ffcadacba335c9fcade7d1bb3aad09e23785f48ebd3583
5
5
  SHA512:
6
- metadata.gz: f49cb007227af1e92be26722e3435fa628c8617c86abbe1d88e91bc441742750b0935a96ecd8656d50b93e0cdee99c6d46f155d33f89be7548011532a8af5991
7
- data.tar.gz: da9aafaeb9ac057e22ba86f52ad00c0ec2fa8ae75ba5beea5e29f629db18d60fe7d1345d5ee64fc2c46f9dff7ff2fae26b0ccf7c4744e889535019b4b044b80e
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 'admin_sets'
15
- render partial: 'to_spotlight/spotlight_transfer/select', locals: { type_name: 'admin_set', data: admin_sets }
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
- admin_set_id = params.permit!.to_h[:admin_set_id]
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
- admin_set_id: admin_set_id,
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 = ::AdminSet.find(transfer.admin_set_id).members
46
+ works = ::Collection.find(transfer.collection_id).members
47
47
  mappings = mapping_invert transfer.mappings
48
48
  SpotlightTransferJob.perform_later(works, mappings)
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'
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
- %w[GenericWork IaffWork]
67
+ Site.first.available_works
68
68
  end
69
69
 
70
- def admin_sets
71
- %w[DefaultSet SecondSet]
70
+ def collections
71
+ ::Collection.all.map { |c| [c.title.first, c.id] }
72
72
  end
73
73
 
74
74
  def curated_fields
75
- genericwork_fields - excluded_fields
75
+ work_fields(params[:work].constantize) - excluded_fields
76
76
  end
77
77
 
78
- def genericwork_fields # GenericWork.new.attributes.keys
79
- %w[id head tail depositor title date_uploaded date_modified state
80
- proxy_depositor on_behalf_of arkivo_checksum owner alternative_title
81
- edition geographic_coverage coordinates chronological_coverage extent
82
- additional_physical_characteristics has_format physical_repository
83
- collection provenance provider sponsor genre format
84
- archival_item_identifier fonds_title fonds_creator fonds_description
85
- fonds_identifier is_referenced_by date_digitized transcript
86
- technical_note year label relative_path import_url creator part_of
87
- resource_type contributor description keyword license rights_statement
88
- publisher date_created subject language identifier based_near
89
- related_url bibliographic_citation source access_control_id
90
- representative_id thumbnail_id rendering_ids admin_set_id
91
- embargo_id lease_id]
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]
@@ -3,7 +3,7 @@
3
3
  <tr>
4
4
  <th><%= "Uploaded" %></th>
5
5
  <th><%= "User" %></th>
6
- <th><%= "Admin Set" %></th>
6
+ <th><%= "Collection" %></th>
7
7
  <th><%= "Actions" %></th>
8
8
  </tr>
9
9
  </thead>
@@ -4,7 +4,7 @@
4
4
 
5
5
  <td><%= transfer.user %></td>
6
6
 
7
- <td><%= transfer.admin_set_id %></td>
7
+ <td><%= transfer.collection_id %></td>
8
8
 
9
9
  <td>
10
10
  <%= form_tag to_spotlight.approve_path, method: :post, class: "form-inline" do %>
data/config/routes.rb CHANGED
@@ -1,6 +1,6 @@
1
- Rails::Application.routes.draw do
2
- get 'to_spotlight/api/:request_type' => 'spotlight_transfer#api'
3
- post 'to_spotlight/receive' => 'spotlight_transfer#receive'
4
- get 'to_spotlight/index' => 'spotlight_transfer#index'
5
- post 'to_spotlight/approve' => 'spotlight_transfer#approve'
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
@@ -4,7 +4,7 @@ class CreateToSpotlightSpotlightTransfers < ActiveRecord::Migration[5.0]
4
4
  t.string :user
5
5
  t.text :mappings
6
6
  t.boolean :approved, default: false
7
- t.string :admin_set_id
7
+ t.string :collection_id
8
8
  t.string :exhibit_id
9
9
 
10
10
  t.timestamps
@@ -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
@@ -1,3 +1,3 @@
1
1
  module ToSpotlight
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
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.2
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-21 00:00:00.000000000 Z
11
+ date: 2020-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails