fcrepo_admin 0.5.5 → 0.6.0
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/HISTORY.md +8 -0
- data/app/controllers/fcrepo_admin/objects_controller.rb +13 -2
- data/app/views/fcrepo_admin/objects/show.html.erb +0 -3
- data/config/locales/fcrepo_admin.en.yml +6 -4
- data/config/routes.rb +1 -0
- data/lib/fcrepo_admin/ability.rb +7 -8
- data/lib/fcrepo_admin/configurable.rb +12 -2
- data/lib/fcrepo_admin/decorators/active_fedora/base_decorator.rb +2 -4
- data/lib/fcrepo_admin/helpers/datastreams_helper_behavior.rb +35 -18
- data/lib/fcrepo_admin/helpers/objects_helper_behavior.rb +5 -3
- data/lib/fcrepo_admin/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 818278550cbf9bca1fadbcbfbdf51e8a0553a61a
|
4
|
+
data.tar.gz: 0a771b5118b90ee3262ddd786a41fcc806906f10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 023c94fb6789a90551eaa827fc72b11cd7f902ff940062116e34901398021f1800cd1690be284545f13d249897a130eb8abbdecd5da2deae52f5550d5f10825d
|
7
|
+
data.tar.gz: 3130d3fe01e7705a496947ea1a75ff069f364580c267e480a95791a2ce492d90fbf00ffbd9c7f407f998aecf94f9bcac89495b396e755c9c28801de59d68cda6
|
data/HISTORY.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
### 0.6.0 (2013-06-27)
|
2
|
+
|
3
|
+
* Feature: Display Solr index record for object.
|
4
|
+
* Removed Blacklight document show partial from object summary view
|
5
|
+
* Added models to object properties partial.
|
6
|
+
* Custom permissions are now set from configuration, not using aliases.
|
7
|
+
* Minor changes to default labels.
|
8
|
+
|
1
9
|
#### 0.5.5 (2013-06-07)
|
2
10
|
|
3
11
|
* Upgraded Rubydora to version 1.6.5 (for Rubydora::DigitalObject#object_xml)
|
@@ -25,14 +25,25 @@ module FcrepoAdmin
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
def solr
|
29
|
+
render :xml => raw_solr_response
|
30
|
+
end
|
31
|
+
|
28
32
|
def permissions
|
29
33
|
end
|
30
34
|
|
31
35
|
protected
|
32
36
|
|
33
37
|
def load_solr_document
|
34
|
-
|
35
|
-
|
38
|
+
@document = SolrDocument.new(ActiveFedora::SolrService.query(solr_document_query).first, nil)
|
39
|
+
end
|
40
|
+
|
41
|
+
def raw_solr_response
|
42
|
+
ActiveFedora::SolrService.query(solr_document_query, raw: true, wt: 'xml')
|
43
|
+
end
|
44
|
+
|
45
|
+
def solr_document_query
|
46
|
+
ActiveFedora::SolrService.construct_query_for_pids([@object.pid])
|
36
47
|
end
|
37
48
|
|
38
49
|
end
|
@@ -2,7 +2,7 @@ en:
|
|
2
2
|
fcrepo_admin:
|
3
3
|
object:
|
4
4
|
nav:
|
5
|
-
header: 'Object
|
5
|
+
header: 'Fcrepo Object'
|
6
6
|
items:
|
7
7
|
summary: 'Summary'
|
8
8
|
audit_trail: 'Audit Trail'
|
@@ -10,14 +10,16 @@ en:
|
|
10
10
|
datastreams: 'Datastreams'
|
11
11
|
associations: 'Associations'
|
12
12
|
object_xml: 'Object XML'
|
13
|
+
solr: 'Solr Record'
|
13
14
|
properties:
|
14
15
|
title: 'Properties'
|
15
16
|
keys:
|
16
17
|
owner_id: 'Owner ID'
|
17
18
|
state: 'State'
|
18
|
-
create_date: '
|
19
|
-
modified_date: 'Modified
|
19
|
+
create_date: 'Created'
|
20
|
+
modified_date: 'Modified'
|
20
21
|
label: 'Label'
|
22
|
+
models: 'Models'
|
21
23
|
permissions:
|
22
24
|
title: 'Permissions'
|
23
25
|
no_permissions: 'No permissions.'
|
@@ -78,7 +80,7 @@ en:
|
|
78
80
|
system_managed: 'This datastream is managed by Fedora and/or Hydra and should be modified only with great care.'
|
79
81
|
not_persisted: 'This datastream has not been persisted to Fedora.'
|
80
82
|
nav:
|
81
|
-
header: 'Datastream
|
83
|
+
header: 'Datastream'
|
82
84
|
items:
|
83
85
|
current_version: 'Current Version'
|
84
86
|
summary: 'Profile'
|
data/config/routes.rb
CHANGED
data/lib/fcrepo_admin/ability.rb
CHANGED
@@ -3,16 +3,15 @@ module FcrepoAdmin
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
5
|
included do
|
6
|
-
self.ability_logic += [:
|
6
|
+
self.ability_logic += [:fcrepo_admin_object_permissions]
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
alias_action :upload, :to => :update
|
9
|
+
def fcrepo_admin_object_permissions
|
10
|
+
FcrepoAdmin.object_permissions.each do |action, permission|
|
11
|
+
can action, ActiveFedora::Base do |obj|
|
12
|
+
send("test_#{permission}".to_sym, obj.pid)
|
13
|
+
end
|
14
|
+
end
|
16
15
|
end
|
17
16
|
|
18
17
|
end
|
@@ -8,6 +8,16 @@ module FcrepoAdmin::Configurable
|
|
8
8
|
mattr_accessor :read_only
|
9
9
|
self.read_only = false
|
10
10
|
|
11
|
+
mattr_accessor :object_permissions
|
12
|
+
self.object_permissions = {
|
13
|
+
:audit_trail => :read,
|
14
|
+
:content => :read,
|
15
|
+
:history => :read,
|
16
|
+
:permissions => :read,
|
17
|
+
:solr => :read,
|
18
|
+
:upload => :edit
|
19
|
+
}
|
20
|
+
|
11
21
|
# MIME types representing text content that do not have "text" media type.
|
12
22
|
mattr_accessor :extra_text_mime_types
|
13
23
|
self.extra_text_mime_types = ['application/xml', 'application/rdf+xml', 'application/json']
|
@@ -37,7 +47,7 @@ module FcrepoAdmin::Configurable
|
|
37
47
|
|
38
48
|
# Object context navigation items
|
39
49
|
mattr_accessor :object_nav_items
|
40
|
-
self.object_nav_items = [:pid, :summary, :datastreams, :permissions, :associations, :audit_trail, :object_xml]
|
50
|
+
self.object_nav_items = [:pid, :summary, :datastreams, :permissions, :associations, :audit_trail, :object_xml, :solr]
|
41
51
|
|
42
52
|
# Datastream profile values to display on object show view
|
43
53
|
mattr_accessor :object_show_datastream_columns
|
@@ -45,7 +55,7 @@ module FcrepoAdmin::Configurable
|
|
45
55
|
|
46
56
|
# Methods on ActiveFedora::Base objects that represent Fcrepo object properties
|
47
57
|
mattr_accessor :object_properties
|
48
|
-
self.object_properties = [:label, :state, :create_date, :modified_date, :owner_id]
|
58
|
+
self.object_properties = [:label, :state, :create_date, :modified_date, :owner_id, :models]
|
49
59
|
|
50
60
|
# Number of documents to display per page on associations show view
|
51
61
|
mattr_accessor :association_show_docs_per_page
|
@@ -1,5 +1,7 @@
|
|
1
1
|
ActiveFedora::Base.class_eval do
|
2
2
|
|
3
|
+
delegate :object_xml, :models, :to => :inner_object
|
4
|
+
|
3
5
|
def active?
|
4
6
|
state == 'A'
|
5
7
|
end
|
@@ -27,9 +29,5 @@ ActiveFedora::Base.class_eval do
|
|
27
29
|
return reflection if reflection.macro == :belongs_to && reflection.options[:property] == :is_governed_by
|
28
30
|
end
|
29
31
|
end
|
30
|
-
|
31
|
-
def object_xml
|
32
|
-
inner_object.object_xml
|
33
|
-
end
|
34
32
|
|
35
33
|
end
|
@@ -35,29 +35,46 @@ module FcrepoAdmin::Helpers
|
|
35
35
|
|
36
36
|
def datastream_nav_item(item)
|
37
37
|
case
|
38
|
-
when item == :dsid
|
39
|
-
|
40
|
-
when item == :
|
41
|
-
|
42
|
-
when item == :
|
43
|
-
|
44
|
-
when item == :
|
45
|
-
|
46
|
-
when item == :
|
47
|
-
|
38
|
+
when item == :dsid
|
39
|
+
render_datastream_dsid_label
|
40
|
+
when item == :version
|
41
|
+
render_datastream_version unless @datastream.current_version?
|
42
|
+
when item == :current_version
|
43
|
+
link_to_datastream item, !@datastream.current_version?, false
|
44
|
+
when item == :summary
|
45
|
+
link_to_datastream item
|
46
|
+
when item == :content
|
47
|
+
link_to_datastream item, @datastream.content_is_text?
|
48
|
+
when item == :download
|
49
|
+
link_to_datastream item, @datastream.content_is_downloadable?, false
|
50
|
+
when item == :edit
|
51
|
+
link_to_datastream item, @datastream.content_is_editable? && can?(:edit, @object)
|
52
|
+
when item == :upload
|
53
|
+
link_to_datastream item, @datastream.content_is_uploadable? && can?(:upload, @object)
|
54
|
+
when item == :history
|
55
|
+
link_to_datastream item, !@datastream.new?
|
56
|
+
else
|
57
|
+
custom_datastream_nav_item item
|
48
58
|
end
|
49
59
|
end
|
50
60
|
|
51
61
|
def link_to_datastream(view, condition=true, unless_current=true)
|
52
62
|
return nil unless condition
|
53
63
|
path = case
|
54
|
-
when view == :current_version
|
55
|
-
|
56
|
-
when view == :
|
57
|
-
|
58
|
-
when view == :
|
59
|
-
|
60
|
-
when view == :
|
64
|
+
when view == :current_version
|
65
|
+
fcrepo_admin.object_datastream_path(@object, @datastream)
|
66
|
+
when view == :summary
|
67
|
+
fcrepo_admin.object_datastream_path(@object, @datastream, datastream_params)
|
68
|
+
when view == :content
|
69
|
+
fcrepo_admin.content_object_datastream_path(@object, @datastream, datastream_params)
|
70
|
+
when view == :download
|
71
|
+
fcrepo_admin.download_object_datastream_path(@object, @datastream, datastream_params)
|
72
|
+
when view == :edit
|
73
|
+
fcrepo_admin.edit_object_datastream_path(@object, @datastream)
|
74
|
+
when view == :upload
|
75
|
+
fcrepo_admin.upload_object_datastream_path(@object, @datastream)
|
76
|
+
when view == :history
|
77
|
+
fcrepo_admin.history_object_datastream_path(@object, @datastream)
|
61
78
|
end
|
62
79
|
label = t("fcrepo_admin.datastream.nav.items.#{view}")
|
63
80
|
unless_current ? link_to_unless_current(label, path) : link_to(label, path)
|
@@ -78,7 +95,7 @@ module FcrepoAdmin::Helpers
|
|
78
95
|
end
|
79
96
|
|
80
97
|
def render_datastream_dsid_label
|
81
|
-
content_tag :
|
98
|
+
content_tag :strong, @datastream.dsid
|
82
99
|
end
|
83
100
|
|
84
101
|
def datastream_alerts(*alerts)
|
@@ -16,8 +16,8 @@ module FcrepoAdmin::Helpers
|
|
16
16
|
def object_property(prop)
|
17
17
|
case
|
18
18
|
when prop == :state then object_state
|
19
|
-
when
|
20
|
-
when prop == :
|
19
|
+
when [:create_date, :modified_date].include?(prop) then object_date(@object.send(prop))
|
20
|
+
when prop == :models then @object.models.join("<br/>").html_safe
|
21
21
|
else @object.send(prop)
|
22
22
|
end
|
23
23
|
end
|
@@ -61,12 +61,13 @@ module FcrepoAdmin::Helpers
|
|
61
61
|
when item == :associations then link_to_object item
|
62
62
|
when item == :audit_trail then link_to_object item, @object.auditable? && can?(:audit_trail, @object)
|
63
63
|
when item == :object_xml then link_to_object item
|
64
|
+
when item == :solr then link_to_object item
|
64
65
|
else custom_object_nav_item item
|
65
66
|
end
|
66
67
|
end
|
67
68
|
|
68
69
|
def render_object_pid_label
|
69
|
-
content_tag :
|
70
|
+
content_tag :strong, @object.pid
|
70
71
|
end
|
71
72
|
|
72
73
|
def link_to_object(view, condition=true)
|
@@ -79,6 +80,7 @@ module FcrepoAdmin::Helpers
|
|
79
80
|
when view == :associations then fcrepo_admin.object_associations_path(@object)
|
80
81
|
when view == :audit_trail then fcrepo_admin.audit_trail_object_path(@object)
|
81
82
|
when view == :object_xml then fcrepo_admin.object_path(@object, :format => 'xml')
|
83
|
+
when view == :solr then fcrepo_admin.solr_object_path(@object)
|
82
84
|
end
|
83
85
|
link_to_unless_current label, path
|
84
86
|
end
|
data/lib/fcrepo_admin/version.rb
CHANGED
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.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Chandek-Stark
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-06-
|
14
|
+
date: 2013-06-27 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rubydora
|