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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e13d04fb7d553e2d66e5538ebd6054e933931ad4
4
- data.tar.gz: 681e9ffd1617588564df21a05eae6eabe1855c7a
3
+ metadata.gz: 818278550cbf9bca1fadbcbfbdf51e8a0553a61a
4
+ data.tar.gz: 0a771b5118b90ee3262ddd786a41fcc806906f10
5
5
  SHA512:
6
- metadata.gz: a2152c1d9832c663837ff1a6557687f9da5ec6e64d67ceff7f7f468889986d054188ab3ad526687f2321c476a4a99aaf4f6e726f2e4965179f05000e095b0000
7
- data.tar.gz: 7e2e17951f65cedf25304598a7490c6fefe4524018eaed97a1aca9ff4b20fe75dabe8e152073ec412499334891900dcd9a8e2216c532a894e6d9fe01f437a377
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
- query = ActiveFedora::SolrService.construct_query_for_pids([@object.pid])
35
- @document = SolrDocument.new(ActiveFedora::SolrService.query(query).first, nil)
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
@@ -1,6 +1,3 @@
1
- <div class="document">
2
- <%= render_document_partial @document, :show %>
3
- </div>
4
1
  <div class="row">
5
2
  <div class="span5">
6
3
  <%= render :partial => 'datastreams', :locals => {:object => @object} %>
@@ -2,7 +2,7 @@ en:
2
2
  fcrepo_admin:
3
3
  object:
4
4
  nav:
5
- header: 'Object Admin'
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: 'Create Date'
19
- modified_date: 'Modified Date'
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 Admin'
83
+ header: 'Datastream'
82
84
  items:
83
85
  current_version: 'Current Version'
84
86
  summary: 'Profile'
@@ -7,6 +7,7 @@ FcrepoAdmin::Engine.routes.draw do
7
7
  resources :objects, :only => :show do
8
8
  member do
9
9
  get 'audit_trail'
10
+ get 'solr'
10
11
  get 'permissions'
11
12
  end
12
13
  resources :associations, :only => [:index, :show]
@@ -3,16 +3,15 @@ module FcrepoAdmin
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  included do
6
- self.ability_logic += [:fcrepo_admin_aliases]
6
+ self.ability_logic += [:fcrepo_admin_object_permissions]
7
7
  end
8
8
 
9
- def fcrepo_admin_aliases
10
- alias_action :download, :to => :read
11
- alias_action :audit_trail, :to => :read
12
- alias_action :permissions, :to => :read
13
- alias_action :content, :to => :read
14
- alias_action :history, :to => :read
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 then render_datastream_dsid_label
39
- when item == :version then render_datastream_version unless @datastream.current_version?
40
- when item == :current_version then link_to_datastream item, !@datastream.current_version?, false
41
- when item == :summary then link_to_datastream item
42
- when item == :content then link_to_datastream item, @datastream.content_is_text?
43
- when item == :download then link_to_datastream item, @datastream.content_is_downloadable?, false
44
- when item == :edit then link_to_datastream item, @datastream.content_is_editable? && can?(:edit, @object)
45
- when item == :upload then link_to_datastream item, @datastream.content_is_uploadable? && can?(:upload, @object)
46
- when item == :history then link_to_datastream item, !@datastream.new?
47
- else custom_datastream_nav_item item
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 then fcrepo_admin.object_datastream_path(@object, @datastream)
55
- when view == :summary then fcrepo_admin.object_datastream_path(@object, @datastream, datastream_params)
56
- when view == :content then fcrepo_admin.content_object_datastream_path(@object, @datastream, datastream_params)
57
- when view == :download then fcrepo_admin.download_object_datastream_path(@object, @datastream, datastream_params)
58
- when view == :edit then fcrepo_admin.edit_object_datastream_path(@object, @datastream)
59
- when view == :upload then fcrepo_admin.upload_object_datastream_path(@object, @datastream)
60
- when view == :history then fcrepo_admin.history_object_datastream_path(@object, @datastream)
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 :span, @datastream.dsid, :class => "label"
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 prop == :create_date then object_date(@object.create_date)
20
- when prop == :modified_date then object_date(@object.modified_date)
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 :span, @object.pid, :class => "label"
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
@@ -1,3 +1,3 @@
1
1
  module FcrepoAdmin
2
- VERSION = "0.5.5"
2
+ VERSION = "0.6.0"
3
3
  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.5.5
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-07 00:00:00.000000000 Z
14
+ date: 2013-06-27 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rubydora