curation_concerns 1.0.0.beta8 → 1.0.0.beta9

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
  SHA1:
3
- metadata.gz: 2d831ace32b6cd1aacb1efdaf22ac5a9fcf69168
4
- data.tar.gz: 8fc0d5456aa13666591e2939182b0c59257cc6db
3
+ metadata.gz: 486a45336152e853ee3d6382246df41931f4ee82
4
+ data.tar.gz: d2dddd29612f023b7ffd5266d850789e075b9507
5
5
  SHA512:
6
- metadata.gz: 9fdcb4b58d985603b5181365d90e944506b94971849009c4d2539af81215f02647a221d61ac21e27b0f2c84ffa57ceb233b58652e69e062b5f7135f8a7760583
7
- data.tar.gz: 0b120bb5c099ed53c352b533728e088e6dced3b95b08cf2bb57770344415fb46f20b153329c9d5f9a03f4020dcb3320da41857a737c1e8e3a0953f732b11b376
6
+ metadata.gz: c86cd15261e654d70d97994d71fc9d56f440d351d9e75da8b85e28b2821548c0679d8b6f08ab48d6f5d0aff402b811f17ec43a3de80e753aaa496d9470a4b9da
7
+ data.tar.gz: fdf1787db3ee54d7167f5785babd549df3dbc8f846bab7b768edb89d9d04ea1caaa57bfb9fd21123a1caffb9d0afaa4cbc894eb4ba16a634216475c48041399f
data/RELEASING.md CHANGED
@@ -1,3 +1,4 @@
1
+ * Checkout the master branch.
1
2
  * Bump version number in `lib/curation_concerns/version.rb`
2
- * Commit and push your change to the master branch
3
- * Release the gem to rubygems.org: `rake build` then `rake release`
3
+ * Commit your change with a message such as: `Bumped version to x.y.z`
4
+ * Release the gem to rubygems.org: `rake release` This also pushes the code to github.
@@ -160,9 +160,7 @@ module CurationConcerns
160
160
  end
161
161
 
162
162
  def collection_search_builder
163
- collection_search_builder_class.new(self).with(params.except(:q, :page)).tap do |builder|
164
- builder.current_ability = current_ability
165
- end
163
+ collection_search_builder_class.new(self).with(params.except(:q, :page))
166
164
  end
167
165
 
168
166
  def collection_search_builder_class
@@ -203,9 +201,7 @@ module CurationConcerns
203
201
  end
204
202
 
205
203
  def collection_member_search_builder
206
- @collection_member_search_builder ||= collection_member_search_builder_class.new(self).tap do |builder|
207
- builder.current_ability = current_ability
208
- end
204
+ @collection_member_search_builder ||= collection_member_search_builder_class.new(self)
209
205
  end
210
206
 
211
207
  def process_member_changes
@@ -58,7 +58,6 @@ module CurationConcerns::SelectsCollections
58
58
 
59
59
  def collections_search_builder(access_level = nil)
60
60
  collections_search_builder_class.new(self).tap do |builder|
61
- builder.current_ability = current_ability
62
61
  builder.discovery_perms = access_levels[access_level] if access_level
63
62
  end
64
63
  end
@@ -13,13 +13,6 @@ module CurationConcerns
13
13
 
14
14
  self.required_fields = [:title]
15
15
 
16
- # Test to see if the given field is required
17
- # @param [Symbol] key a field
18
- # @return [Boolean] is it required or not
19
- def required?(key)
20
- model_class.validators_on(key).any? { |v| v.is_a? ActiveModel::Validations::PresenceValidator }
21
- end
22
-
23
16
  # @return [Hash] All FileSets in the collection, file.to_s is the key, file.id is the value
24
17
  def select_files
25
18
  Hash[all_files]
@@ -12,36 +12,47 @@ module CurationConcerns
12
12
  if thumb.audio?
13
13
  audio_image
14
14
  elsif thumbnail?(thumb)
15
- Rails.application.routes.url_helpers.download_path(object.thumbnail_id, file: 'thumbnail')
15
+ thumbnail_path(thumb)
16
16
  else
17
17
  default_image
18
18
  end
19
19
  end
20
20
 
21
- def fetch_thumbnail(object)
22
- return object if object.thumbnail_id == object.id
23
- ::ActiveFedora::Base.find(object.thumbnail_id)
24
- rescue ActiveFedora::ObjectNotFoundError
25
- Rails.logger.error("Couldn't find thumbnail #{object.thumbnail_id} for #{object.id}")
26
- nil
27
- end
21
+ protected
28
22
 
29
- def default_image
30
- ActionController::Base.helpers.image_path 'default.png'
31
- end
23
+ def fetch_thumbnail(object)
24
+ return object if object.thumbnail_id == object.id
25
+ ::ActiveFedora::Base.find(object.thumbnail_id)
26
+ rescue ActiveFedora::ObjectNotFoundError
27
+ Rails.logger.error("Couldn't find thumbnail #{object.thumbnail_id} for #{object.id}")
28
+ nil
29
+ end
32
30
 
33
- def audio_image
34
- ActionController::Base.helpers.image_path 'audio.png'
35
- end
31
+ # @return the network path to the thumbnail
32
+ # @param [FileSet] thumbnail the object that is the thumbnail
33
+ def thumbnail_path(thumbnail)
34
+ Rails.application.routes.url_helpers.download_path(thumbnail.id,
35
+ file: 'thumbnail')
36
+ end
36
37
 
37
- # @return true if there a file on disk for this object, otherwise false
38
- def thumbnail?(thumb)
39
- File.exist?(thumbnail_filepath(thumb))
40
- end
38
+ def default_image
39
+ ActionController::Base.helpers.image_path 'default.png'
40
+ end
41
41
 
42
- def thumbnail_filepath(thumb)
43
- CurationConcerns::DerivativePath.derivative_path_for_reference(thumb, 'thumbnail')
44
- end
42
+ def audio_image
43
+ ActionController::Base.helpers.image_path 'audio.png'
44
+ end
45
+
46
+ # @return true if there a file on disk for this object, otherwise false
47
+ # @param [FileSet] thumbnail the object that is the thumbnail
48
+ def thumbnail?(thumb)
49
+ File.exist?(thumbnail_filepath(thumb))
50
+ end
51
+
52
+ # @param [FileSet] thumbnail the object that is the thumbnail
53
+ def thumbnail_filepath(thumb)
54
+ CurationConcerns::DerivativePath.derivative_path_for_reference(thumb, 'thumbnail')
55
+ end
45
56
  end
46
57
  end
47
58
  end
@@ -1,7 +1,7 @@
1
1
  <% if CurationConcerns.config.display_media_download_link %>
2
2
  <%= link_to main_app.download_path(file_set), target: "_new", title: "Download the full-sized image" do %>
3
3
  <figure>
4
- <%= image_tag main_app.download_path(file_set, file: 'thumbnail'),
4
+ <%= image_tag thumbnail_url(file_set),
5
5
  class: "img-responsive",
6
6
  alt: "Download the full-sized image of #{file_set.to_s}" %>
7
7
  <figcaption>Download the full-sized image</figcaption>
@@ -9,7 +9,7 @@
9
9
  <% end %>
10
10
  <% else %>
11
11
  <figure>
12
- <%= image_tag main_app.download_path(file_set, file: 'thumbnail'),
12
+ <%= image_tag thumbnail_url(file_set),
13
13
  class: "img-responsive",
14
14
  alt: "Thumbnail of #{file_set.to_s}" %>
15
15
  </figure>
@@ -1,7 +1,7 @@
1
1
  <% if CurationConcerns.config.display_media_download_link %>
2
2
  <%= link_to main_app.download_path(file_set), target: "_new", title: "Download the document" do %>
3
3
  <figure>
4
- <%= image_tag main_app.download_path(file_set, file: 'thumbnail'),
4
+ <%= image_tag thumbnail_url(file_set),
5
5
  class: "img-responsive",
6
6
  alt: "Download the document #{file_set.to_s}" %>
7
7
  <figcaption>Download the document</figcaption>
@@ -9,7 +9,7 @@
9
9
  <% end %>
10
10
  <% else %>
11
11
  <figure>
12
- <%= image_tag main_app.download_path(file_set, file: 'thumbnail'),
12
+ <%= image_tag thumbnail_url(file_set),
13
13
  class: "img-responsive",
14
14
  alt: "Thumbnail of #{file_set.to_s}" %>
15
15
  </figure>
@@ -1,7 +1,7 @@
1
1
  <% if CurationConcerns.config.display_media_download_link %>
2
2
  <%= link_to main_app.download_path(file_set), target: "_new", title: "Download the full-sized PDF" do %>
3
3
  <figure>
4
- <%= image_tag main_app.download_path(file_set, file: 'thumbnail'),
4
+ <%= image_tag thumbnail_url(file_set),
5
5
  class: "img-responsive",
6
6
  alt: "Download the full-sized PDF of #{file_set.to_s}" %>
7
7
  <figcaption>Download the full-sized PDF</figcaption>
@@ -9,7 +9,7 @@
9
9
  <% end %>
10
10
  <% else %>
11
11
  <figure>
12
- <%= image_tag main_app.download_path(file_set, file: 'thumbnail'),
12
+ <%= image_tag thumbnail_url(file_set),
13
13
  class: "img-responsive",
14
14
  alt: "Thumbnail of #{file_set.to_s}" %>
15
15
  </figure>
@@ -1,3 +1,3 @@
1
1
  module CurationConcerns
2
- VERSION = "1.0.0.beta8".freeze
2
+ VERSION = "1.0.0.beta9".freeze
3
3
  end
@@ -13,6 +13,11 @@ describe CurationConcerns::Forms::CollectionEditForm do
13
13
  end
14
14
  end
15
15
 
16
+ describe "#required?" do
17
+ subject { form.required?(:title) }
18
+ it { is_expected.to be true }
19
+ end
20
+
16
21
  describe "#human_readable_type" do
17
22
  subject { form.human_readable_type }
18
23
  it { is_expected.to eq 'Collection' }
@@ -28,7 +28,7 @@ describe CurationConcerns::ThumbnailPathService do
28
28
  context "with a Work" do
29
29
  context "that has a thumbnail" do
30
30
  let(:object) { GenericWork.new(thumbnail_id: '999') }
31
- let(:representative) { build(:file_set, id: '777') }
31
+ let(:representative) { build(:file_set, id: '999') }
32
32
  let(:original_file) { mock_file_factory(mime_type: 'image/jpeg') }
33
33
  before do
34
34
  allow(File).to receive(:exist?).and_return(true)
@@ -3,6 +3,8 @@ require 'spec_helper'
3
3
  describe 'curation_concerns/file_sets/show.html.erb', type: :view do
4
4
  before do
5
5
  allow(view).to receive(:parent).and_return(parent)
6
+ allow(view).to receive_messages(blacklight_config: CatalogController.blacklight_config,
7
+ blacklight_configuration_context: Blacklight::Configuration::Context.new(controller))
6
8
  end
7
9
 
8
10
  let(:parent) { stub_model(GenericWork) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: curation_concerns
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta8
4
+ version: 1.0.0.beta9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Zumwalt
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-06-08 00:00:00.000000000 Z
13
+ date: 2016-06-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: hydra-head
@@ -1243,7 +1243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1243
1243
  version: 1.3.1
1244
1244
  requirements: []
1245
1245
  rubyforge_project:
1246
- rubygems_version: 2.5.1
1246
+ rubygems_version: 2.6.4
1247
1247
  signing_key:
1248
1248
  specification_version: 4
1249
1249
  summary: A Rails Engine that allows an application to CRUD CurationConcern objects