hyrax 1.0.0.rc2 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/actors/hyrax/actors/file_set_actor.rb +8 -8
- data/app/views/hyrax/base/_form_permission_under_embargo.html.erb +16 -0
- data/app/views/hyrax/base/_form_permission_under_lease.html.erb +18 -0
- data/app/views/hyrax/file_sets/media_display/_default.html.erb +5 -1
- data/app/views/hyrax/file_sets/media_display/_image.html.erb +2 -0
- data/app/views/hyrax/file_sets/media_display/_office_document.html.erb +2 -0
- data/app/views/hyrax/file_sets/media_display/_pdf.html.erb +2 -0
- data/lib/hyrax/version.rb +1 -1
- data/spec/actors/hyrax/actors/file_set_actor_spec.rb +23 -0
- data/spec/controllers/hyrax/file_sets_controller_spec.rb +1 -1
- data/spec/views/hyrax/file_sets/media_display/_default.html.erb_spec.rb +5 -0
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3425401f62c2b4c3509f2254c84fef91e55d34c
|
4
|
+
data.tar.gz: c959faf3cc3c45eb8ccc024d48567ec5e41d41af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79d50f4747368ff6908659683221905c45f041ccad389580824119ddcdd346c4a9015aa5685dded91e83ba6101defb82608fe52bfc133ef1be81f905fe458f58
|
7
|
+
data.tar.gz: 5fd59a562ca1c3420d8f662a116fe0bdb6975eb6884b0c228b86039ff7e699cfbbd63b0ace358a7fa6855ed67bcae6a1b5d5aa693c6a72734e411244713d8de3
|
data/README.md
CHANGED
@@ -117,7 +117,7 @@ Starting up Redis will depend on your operating system, and may in fact already
|
|
117
117
|
|
118
118
|
## Rails
|
119
119
|
|
120
|
-
We recommend the latest Rails 5.0 release.
|
120
|
+
Hyrax requires Rails 5. We recommend the latest Rails 5.0 release.
|
121
121
|
|
122
122
|
```
|
123
123
|
# If you don't already have Rails at your disposal...
|
@@ -35,7 +35,7 @@ module Hyrax
|
|
35
35
|
file_set.label ||= file.respond_to?(:original_filename) ? file.original_filename : ::File.basename(file)
|
36
36
|
file_set.title = [file_set.label] if file_set.title.blank?
|
37
37
|
return false unless file_set.save # Need to save the file_set in order to get an id
|
38
|
-
|
38
|
+
build_file_actor(relation).ingest_file(file, asynchronous)
|
39
39
|
true
|
40
40
|
end
|
41
41
|
|
@@ -58,8 +58,7 @@ module Hyrax
|
|
58
58
|
# @param [String] revision_id the revision to revert to
|
59
59
|
# @param [String] relation ('original_file')
|
60
60
|
def revert_content(revision_id, relation = 'original_file')
|
61
|
-
|
62
|
-
return false unless file_actor.revert_to(revision_id)
|
61
|
+
return false unless build_file_actor(relation).revert_to(revision_id)
|
63
62
|
Hyrax.config.callback.run(:after_revert_content, file_set, user, revision_id)
|
64
63
|
true
|
65
64
|
end
|
@@ -67,7 +66,7 @@ module Hyrax
|
|
67
66
|
# @param [File, ActionDigest::HTTP::UploadedFile, Tempfile] file the file uploaded by the user.
|
68
67
|
# @param [String] relation ('original_file')
|
69
68
|
def update_content(file, relation = 'original_file')
|
70
|
-
|
69
|
+
build_file_actor(relation).ingest_file(file, true)
|
71
70
|
Hyrax.config.callback.run(:after_update_content, file_set, user)
|
72
71
|
true
|
73
72
|
end
|
@@ -103,14 +102,15 @@ module Hyrax
|
|
103
102
|
@ability ||= ::Ability.new(user)
|
104
103
|
end
|
105
104
|
|
105
|
+
def build_file_actor(relation)
|
106
|
+
file_actor_class.new(file_set, relation, user)
|
107
|
+
end
|
108
|
+
|
106
109
|
# Takes an optional block and executes the block if the save was successful.
|
107
110
|
# @return [Boolean] false if the save was unsuccessful
|
108
111
|
def save
|
109
112
|
on_retry = ->(exception, _, _, _) { ActiveFedora::Base.logger.warn "Hyrax::Actors::FileSetActor#save Caught RSOLR error #{exception.inspect}" }
|
110
|
-
Retriable.retriable on: RSolr::Error::Http,
|
111
|
-
on_retry: on_retry,
|
112
|
-
tries: 4,
|
113
|
-
base_interval: 0.01 do
|
113
|
+
Retriable.retriable on: RSolr::Error::Http, on_retry: on_retry, tries: 4, base_interval: 0.01 do
|
114
114
|
return false unless file_set.save
|
115
115
|
end
|
116
116
|
yield if block_given?
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<fieldset class="set-access-controls">
|
2
|
+
<legend>
|
3
|
+
Visibility
|
4
|
+
<small>Who should be able to view or download this content?</small>
|
5
|
+
</legend>
|
6
|
+
|
7
|
+
<section class="help-block">
|
8
|
+
<p>
|
9
|
+
<strong>This work is under embargo.</strong> You can change the settings of the embargo here, or you can visit the <%= link_to 'Embargo Management Page', main_app.edit_embargo_path(f.object) %> to deactivate it.
|
10
|
+
</p>
|
11
|
+
</section>
|
12
|
+
|
13
|
+
<input type="hidden" name="<%= f.object_name %>[visibility]" value="<%= Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_EMBARGO %>" />
|
14
|
+
<%= render "form_permission_embargo", f: f %>
|
15
|
+
|
16
|
+
</fieldset>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<fieldset class="set-access-controls">
|
2
|
+
<legend>
|
3
|
+
Visibility
|
4
|
+
<small>Who should be able to view or download this content?</small>
|
5
|
+
</legend>
|
6
|
+
|
7
|
+
<section class="help-block">
|
8
|
+
<p>
|
9
|
+
<strong>This work is under lease.</strong> You can change the settings of the lease here, or you can visit the <%= link_to 'Lease Management Page', main_app.edit_lease_path(f.object) %> to deactivate it.
|
10
|
+
</p>
|
11
|
+
</section>
|
12
|
+
|
13
|
+
<div class="form-group">
|
14
|
+
<input type="hidden" name="<%= f.object_name %>[visibility]" value="<%= Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_LEASE %>" />
|
15
|
+
<%= render "form_permission_lease", f: f %>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
</fieldset>
|
@@ -1,6 +1,10 @@
|
|
1
1
|
<div class="no-preview">
|
2
2
|
<%= t('hyrax.works.show.no_preview') %>
|
3
3
|
<% if Hyrax.config.display_media_download_link? %>
|
4
|
-
<p/><%= link_to t('hyrax.file_set.show.download'),
|
4
|
+
<p/><%= link_to t('hyrax.file_set.show.download'),
|
5
|
+
hyrax.download_path(file_set),
|
6
|
+
id: "file_download",
|
7
|
+
data: { label: file_set.id },
|
8
|
+
target: "_new" %>
|
5
9
|
<% end %>
|
6
10
|
</div>
|
@@ -8,6 +8,8 @@
|
|
8
8
|
<%= link_to hyrax.download_path(file_set),
|
9
9
|
data: { turbolinks: false },
|
10
10
|
target: :_blank,
|
11
|
+
id: "file_download",
|
12
|
+
data: { label: file_set.id },
|
11
13
|
class: "btn btn-default" do %>
|
12
14
|
<%= t('hyrax.file_set.show.downloadable_content.image_link') %>
|
13
15
|
<% end %>
|
@@ -8,6 +8,8 @@
|
|
8
8
|
<%= link_to hyrax.download_path(file_set),
|
9
9
|
data: { turbolinks: false },
|
10
10
|
target: :_blank,
|
11
|
+
id: "file_download",
|
12
|
+
data: { label: file_set.id },
|
11
13
|
class: "btn btn-default" do %>
|
12
14
|
<%= t('hyrax.file_set.show.downloadable_content.office_link') %>
|
13
15
|
<% end %>
|
@@ -8,6 +8,8 @@
|
|
8
8
|
<%= link_to hyrax.download_path(file_set),
|
9
9
|
data: { turbolinks: false },
|
10
10
|
target: :_blank,
|
11
|
+
id: "file_download",
|
12
|
+
data: { label: file_set.id },
|
11
13
|
class: "btn btn-default" do %>
|
12
14
|
<%= t('hyrax.file_set.show.downloadable_content.pdf_link') %>
|
13
15
|
<% end %>
|
data/lib/hyrax/version.rb
CHANGED
@@ -139,6 +139,29 @@ describe Hyrax::Actors::FileSetActor do
|
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
142
|
+
describe "#update_content" do
|
143
|
+
let(:relation) { 'original_file' }
|
144
|
+
let(:file_actor) { Hyrax::Actors::FileActor.new(file_set, relation, user) }
|
145
|
+
before do
|
146
|
+
allow(actor).to receive(:build_file_actor).with(relation).and_return(file_actor)
|
147
|
+
end
|
148
|
+
it 'calls ingest_file' do
|
149
|
+
expect(file_actor).to receive(:ingest_file).with(local_file, true)
|
150
|
+
actor.update_content(local_file)
|
151
|
+
end
|
152
|
+
it 'runs callbacks' do
|
153
|
+
# Do not bother ingesting the file -- test only that the callback is run
|
154
|
+
allow(file_actor).to receive(:ingest_file).with(local_file, true)
|
155
|
+
expect(Hyrax.config.callback).to receive(:run).with(:after_update_content, file_set, user)
|
156
|
+
actor.update_content(local_file)
|
157
|
+
end
|
158
|
+
it "returns true" do
|
159
|
+
# Do not bother ingesting the file -- test only the return value
|
160
|
+
allow(file_actor).to receive(:ingest_file).with(local_file, true)
|
161
|
+
expect(actor.update_content(local_file)).to be true
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
142
165
|
describe "#destroy" do
|
143
166
|
it "destroys the object" do
|
144
167
|
actor.destroy
|
@@ -201,7 +201,7 @@ describe Hyrax::FileSetsController do
|
|
201
201
|
it "spawns a content new version event job" do
|
202
202
|
expect(ContentNewVersionEventJob).to receive(:perform_later).with(file_set, user)
|
203
203
|
|
204
|
-
expect(actor).to receive(:ingest_file).with(expected_file_type)
|
204
|
+
expect(actor).to receive(:ingest_file).with(expected_file_type, true)
|
205
205
|
file = fixture_file_upload('/world.png', 'image/png')
|
206
206
|
post :update, params: { id: file_set, filedata: file, file_set: { keyword: [''], permissions_attributes: [{ type: 'person', name: 'archivist1', access: 'edit' }] } }
|
207
207
|
post :update, params: { id: file_set, file_set: { files: [file], keyword: [''], permissions_attributes: [{ type: 'person', name: 'archivist1', access: 'edit' }] } }
|
@@ -15,6 +15,11 @@ describe 'hyrax/file_sets/mdeia_display/_default.html.erb', type: :view do
|
|
15
15
|
expect(rendered).to have_css('a', text: 'Download the file')
|
16
16
|
end
|
17
17
|
|
18
|
+
it "includes google analytics data in the download link" do
|
19
|
+
expect(rendered).to have_css('a#file_download')
|
20
|
+
expect(rendered).to have_selector("a[data-label=\"#{file_set.id}\"]")
|
21
|
+
end
|
22
|
+
|
18
23
|
context "no download links" do
|
19
24
|
let(:link) { false }
|
20
25
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hyrax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date: 2017-05-
|
17
|
+
date: 2017-05-24 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: hydra-head
|
@@ -1590,6 +1590,8 @@ files:
|
|
1590
1590
|
- app/views/hyrax/base/_form_permission.html.erb
|
1591
1591
|
- app/views/hyrax/base/_form_permission_embargo.html.erb
|
1592
1592
|
- app/views/hyrax/base/_form_permission_lease.html.erb
|
1593
|
+
- app/views/hyrax/base/_form_permission_under_embargo.html.erb
|
1594
|
+
- app/views/hyrax/base/_form_permission_under_lease.html.erb
|
1593
1595
|
- app/views/hyrax/base/_form_progress.html.erb
|
1594
1596
|
- app/views/hyrax/base/_form_relationships.html.erb
|
1595
1597
|
- app/views/hyrax/base/_form_representative.html.erb
|
@@ -2552,12 +2554,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
2552
2554
|
version: '0'
|
2553
2555
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
2554
2556
|
requirements:
|
2555
|
-
- - "
|
2557
|
+
- - ">="
|
2556
2558
|
- !ruby/object:Gem::Version
|
2557
|
-
version:
|
2559
|
+
version: '0'
|
2558
2560
|
requirements: []
|
2559
2561
|
rubyforge_project:
|
2560
|
-
rubygems_version: 2.6.
|
2562
|
+
rubygems_version: 2.6.12
|
2561
2563
|
signing_key:
|
2562
2564
|
specification_version: 4
|
2563
2565
|
summary: Hyrax is a front-end based on the robust Hydra framework, providing a user
|