fcrepo_admin 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -46,7 +46,7 @@ See https://github.com/projecthydra/hydra-head/wiki/Installation-Prerequisites.
46
46
 
47
47
  * Customize catalog search results (optional)
48
48
 
49
- If you would like items from the catalog search results list to the object admin view
49
+ If you would like catalog search results items to link to the object admin view
50
50
  instead of the catalog show view, create app/helpers/blacklight_helper.rb with this content:
51
51
 
52
52
  module BlacklightHelper
@@ -3,6 +3,8 @@ require 'mime/types'
3
3
  module FcrepoAdmin
4
4
  class DatastreamsController < ApplicationController
5
5
 
6
+ include FcrepoAdmin::ControllerBehavior
7
+
6
8
  layout 'fcrepo_admin/datastreams'
7
9
 
8
10
  # Additional types of content that should be displayed inline
@@ -69,8 +71,7 @@ module FcrepoAdmin
69
71
  protected
70
72
 
71
73
  def inline_filter
72
- @inline = @datastream.mimeType.start_with?('text/') || TEXT_MIME_TYPES.include?(@datastream.mimeType)
73
- # @inline &&= @datastream.dsSize <= MAX_INLINE_SIZE
74
+ @inline = (@datastream.mimeType.start_with?('text/') || TEXT_MIME_TYPES.include?(@datastream.mimeType)) && @datastream.dsSize <= MAX_INLINE_SIZE
74
75
  end
75
76
 
76
77
  end
@@ -1,6 +1,8 @@
1
1
  module FcrepoAdmin
2
2
  class ObjectsController < ApplicationController
3
3
 
4
+ include FcrepoAdmin::ControllerBehavior
5
+
4
6
  layout 'fcrepo_admin/objects'
5
7
 
6
8
  PROPERTIES = [:owner_id, :state, :create_date, :modified_date, :label]
@@ -14,10 +16,12 @@ module FcrepoAdmin
14
16
  end
15
17
 
16
18
  def audit_trail
17
- # XXX Update when new version of ActiveFedora released
18
- @audit_trail = @object.respond_to?(:audit_trail) ? @object.audit_trail : @object.inner_object.audit_trail
19
- if params[:download]
20
- send_data @audit_trail.to_xml, :disposition => 'inline', :type => 'text/xml'
19
+ if object_is_auditable?
20
+ if params[:download]
21
+ send_data @object.audit_trail.to_xml, :disposition => 'inline', :type => 'text/xml'
22
+ end
23
+ else
24
+ render :text => I18n.t("fcrepo_admin.object.audit_trail.not_implemented"), :status => 404
21
25
  end
22
26
  end
23
27
 
@@ -40,11 +44,7 @@ module FcrepoAdmin
40
44
  protected
41
45
 
42
46
  def object_properties
43
- unless @object_properties
44
- @object_properties = {}
45
- PROPERTIES.each { |p| @object_properties[p] = @object.send(p) }
46
- end
47
- @object_properties
47
+ @object_properties ||= PROPERTIES.inject(Hash.new) { |h, p| h[p] = @object.send(p); h }
48
48
  end
49
49
 
50
50
  def apo_relationship_name
@@ -4,6 +4,8 @@
4
4
  <li>
5
5
  <%= link_to_unless_current t("fcrepo_admin.object.nav.items.summary"), fcrepo_admin.object_path(object) %>
6
6
  </li>
7
+ <% if object_is_auditable? %>
7
8
  <li>
8
9
  <%= link_to_unless_current t("fcrepo_admin.object.nav.items.audit_trail"), fcrepo_admin.audit_trail_object_path(object) %>
9
10
  </li>
11
+ <% end %>
@@ -17,7 +17,7 @@
17
17
  </tr>
18
18
  </thead>
19
19
  <tbody>
20
- <% @audit_trail.records.each do |record| %>
20
+ <% @object.audit_trail.records.each do |record| %>
21
21
  <tr>
22
22
  <td><%= record.id %></td>
23
23
  <td><%= record.process_type %></td>
@@ -31,6 +31,7 @@ en:
31
31
  enforcement_disabled: 'Admin policy access control enforcement is disabled'
32
32
  relationship_undefined: 'This object type does not define an admin policy relationship'
33
33
  audit_trail:
34
+ not_implemented: 'This object does implement access to the Fedora audit trail (ActiveFedora::Auditable)'
34
35
  title: 'Audit Trail'
35
36
  download: 'Download'
36
37
  record:
@@ -0,0 +1,18 @@
1
+ module FcrepoAdmin
2
+ module ControllerBehavior
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ helper_method :object_is_auditable?
7
+ end
8
+
9
+ def object_is_auditable?
10
+ begin
11
+ @object && @object.is_a?(ActiveFedora::Auditable)
12
+ rescue
13
+ false
14
+ end
15
+ end
16
+
17
+ end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module FcrepoAdmin
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
@@ -9,5 +9,6 @@ class ContentModel < ActiveFedora::Base
9
9
  belongs_to :admin_policy, :property => :is_governed_by
10
10
 
11
11
  include Hydra::ModelMixins::RightsMetadata
12
+ include ActiveFedora::Auditable
12
13
 
13
14
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fcrepo_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-04-19 00:00:00.000000000 Z
15
+ date: 2013-04-25 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: hydra-head
@@ -289,6 +289,7 @@ files:
289
289
  - lib/assets/.gitkeep
290
290
  - lib/fcrepo_admin.rb
291
291
  - lib/fcrepo_admin/blacklight_helper_behavior.rb
292
+ - lib/fcrepo_admin/controller_behavior.rb
292
293
  - lib/fcrepo_admin/datastream_ability.rb
293
294
  - lib/fcrepo_admin/engine.rb
294
295
  - lib/fcrepo_admin/solr_document_extension.rb
@@ -376,7 +377,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
376
377
  version: '0'
377
378
  segments:
378
379
  - 0
379
- hash: 1491170108417626237
380
+ hash: -492490096386514261
380
381
  requirements: []
381
382
  rubyforge_project:
382
383
  rubygems_version: 1.8.25