fcrepo_admin 0.6.0 → 0.6.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/CONTRIBUTING.md +111 -0
- data/HISTORY.md +9 -0
- data/README.md +6 -16
- data/app/controllers/fcrepo_admin/associations_controller.rb +3 -6
- data/app/views/fcrepo_admin/datastreams/_datastreams_list.html.erb +16 -20
- data/app/views/fcrepo_admin/shared/_context_nav.html.erb +1 -1
- data/config/locales/fcrepo_admin.en.yml +2 -0
- data/lib/fcrepo_admin/decorators/active_fedora/base_decorator.rb +4 -0
- data/lib/fcrepo_admin/decorators/active_fedora/datastream_decorator.rb +4 -0
- data/lib/fcrepo_admin/helpers/datastreams_helper_behavior.rb +74 -39
- data/lib/fcrepo_admin/helpers/objects_helper_behavior.rb +54 -27
- data/lib/fcrepo_admin/version.rb +1 -1
- data/spec/features/datastreams/index.html.erb_spec.rb +16 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 697245ae886c95095ba1eb747a210a45d6adaa7b
|
4
|
+
data.tar.gz: b7357e866a3e6f1f1fb22c221ebce0a6164d1cfd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36a3ce396fc62b3686027e2667b517d52434d0e1d8cc6d13feb9fc72ad80ea64c44de5912ec040f962f9922adacc61cb793bad1df2e93bb5ffb5a443b241298f
|
7
|
+
data.tar.gz: c5b94c71f89e975665a3737ec26170acf904e018df4d8d63af4e036fff8cf09994dcb1489f40e2648f3ec21b5f8b37db61909297fa00004dddb76dc9dc7c8cd3
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
# How to Contribute
|
2
|
+
|
3
|
+
We want your help to make Project Hydra great.
|
4
|
+
There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.
|
5
|
+
|
6
|
+
## Hydra Project Intellectual Property Licensing and Ownership
|
7
|
+
|
8
|
+
All code contributors must have an Individual Contributor License Agreement (iCLA) on file with the Hydra Project Steering Group.
|
9
|
+
If the contributor works for an institution, the institution must have a Corporate Contributor License Agreement (cCLA) on file.
|
10
|
+
|
11
|
+
https://wiki.duraspace.org/display/hydra/Hydra+Project+Intellectual+Property+Licensing+and+Ownership
|
12
|
+
|
13
|
+
You should also add yourself to the `CONTRIBUTORS.md` file in the root of the project.
|
14
|
+
|
15
|
+
## Contribution Tasks
|
16
|
+
|
17
|
+
* Reporting Issues
|
18
|
+
* Making Changes
|
19
|
+
* Submitting Changes
|
20
|
+
* Merging Changes
|
21
|
+
|
22
|
+
### Reporting Issues
|
23
|
+
|
24
|
+
* Make sure you have a [GitHub account](https://github.com/signup/free)
|
25
|
+
* Submit a [Github issue](./issues) by:
|
26
|
+
* Clearly describing the issue
|
27
|
+
* Provide a descriptive summary
|
28
|
+
* Explain the expected behavior
|
29
|
+
* Explain the actual behavior
|
30
|
+
* Provide steps to reproduce the actual behavior
|
31
|
+
|
32
|
+
### Making Changes
|
33
|
+
|
34
|
+
* Fork the repository on GitHub
|
35
|
+
* Create a topic branch from where you want to base your work.
|
36
|
+
* This is usually the master branch.
|
37
|
+
* To quickly create a topic branch based on master; `git branch fix/master/my_contribution master`
|
38
|
+
* Then checkout the new branch with `git checkout fix/master/my_contribution`.
|
39
|
+
* Please avoid working directly on the `master` branch.
|
40
|
+
* You may find the [hub suite of commands](https://github.com/defunkt/hub) helpful
|
41
|
+
* Make commits of logical units.
|
42
|
+
* Your commit should include a high level description of your work in HISTORY.textile
|
43
|
+
* Check for unnecessary whitespace with `git diff --check` before committing.
|
44
|
+
* Make sure your commit messages are [well formed](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
|
45
|
+
* If you created an issue, you can close it by including "Closes #issue" in your commit message. See [Github's blog post for more details](https://github.com/blog/1386-closing-issues-via-commit-messages)
|
46
|
+
|
47
|
+
```
|
48
|
+
Present tense short summary (50 characters or less)
|
49
|
+
|
50
|
+
More detailed description, if necessary. It should be wrapped to 72
|
51
|
+
characters. Try to be as descriptive as you can, even if you think that
|
52
|
+
the commit content is obvious, it may not be obvious to others. You
|
53
|
+
should add such description also if it's already present in bug tracker,
|
54
|
+
it should not be necessary to visit a webpage to check the history.
|
55
|
+
|
56
|
+
Include Closes #<issue-number> when relavent.
|
57
|
+
|
58
|
+
Description can have multiple paragraphs and you can use code examples
|
59
|
+
inside, just indent it with 4 spaces:
|
60
|
+
|
61
|
+
class PostsController
|
62
|
+
def index
|
63
|
+
respond_with Post.limit(10)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
You can also add bullet points:
|
68
|
+
|
69
|
+
- you can use dashes or asterisks
|
70
|
+
|
71
|
+
- also, try to indent next line of a point for readability, if it's too
|
72
|
+
long to fit in 72 characters
|
73
|
+
```
|
74
|
+
|
75
|
+
* Make sure you have added the necessary tests for your changes.
|
76
|
+
* Run _all_ the tests to assure nothing else was accidentally broken.
|
77
|
+
* When you are ready to submit a pull request
|
78
|
+
|
79
|
+
### Submitting Changes
|
80
|
+
|
81
|
+
* Read the article ["Using Pull Requests"](https://help.github.com/articles/using-pull-requests) on GitHub.
|
82
|
+
* Make sure your branch is up to date with its parent branch (i.e. master)
|
83
|
+
* `git checkout master`
|
84
|
+
* `git pull --rebase`
|
85
|
+
* `git checkout <your-branch>`
|
86
|
+
* `git rebase master`
|
87
|
+
* It is likely a good idea to run your tests again.
|
88
|
+
* Squash the commits for your branch into one commit
|
89
|
+
* `git rebase --interactive HEAD~<number-of-commits>` ([See Github help](https://help.github.com/articles/interactive-rebase))
|
90
|
+
* To determine the number of commits on your branch: `git log master..<your-branch> --oneline | wc -l`
|
91
|
+
* Squashing your branch's changes into one commit is "good form" and helps the person merging your request to see everything that is going on.
|
92
|
+
* Push your changes to a topic branch in your fork of the repository.
|
93
|
+
* Submit a pull request from your fork to the project.
|
94
|
+
|
95
|
+
### Merging Changes
|
96
|
+
|
97
|
+
* It is considered "poor from" to merge your own request.
|
98
|
+
* Please take the time to review the changes and get a sense of what is being changed. Things to consider:
|
99
|
+
* Does the commit message explain what is going on?
|
100
|
+
* Does the code changes have tests? _Not all changes need new tests, some changes are refactorings_
|
101
|
+
* Does the commit contain more than it should? Are two separate concerns being addressed in one commit?
|
102
|
+
* Did the Travis tests complete successfully?
|
103
|
+
* If you are uncertain, bring other contributors into the conversation by creating a comment that includes their @username.
|
104
|
+
* If you like the pull request, but want others to chime in, create a +1 comment and tag a user.
|
105
|
+
|
106
|
+
# Additional Resources
|
107
|
+
|
108
|
+
* [General GitHub documentation](http://help.github.com/)
|
109
|
+
* [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
|
110
|
+
* [Pro Git](http://git-scm.com/book) is both a free and excellent book about Git.
|
111
|
+
* [A Git Config for Contributing](http://ndlib.github.io/practices/my-typical-per-project-git-config/)
|
data/HISTORY.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
#### 0.6.1 (2013-07-26)
|
2
|
+
|
3
|
+
* Use `send(:construct_query)` on object association to get query for associated objects (Fixes #21).
|
4
|
+
* Added `CONTRIBUTING.md` for Hydra projects.
|
5
|
+
* Added CSS classes to datastream list table, rows, and columns.
|
6
|
+
* Added I18n key for display when datastream label is blank.
|
7
|
+
* Added #safe_pid methods to ActiveFedora::Base and ActiveFedora::Datastream decorators.
|
8
|
+
* Added tests for datastreams index view.
|
9
|
+
|
1
10
|
### 0.6.0 (2013-06-27)
|
2
11
|
|
3
12
|
* Feature: Display Solr index record for object.
|
data/README.md
CHANGED
@@ -16,6 +16,10 @@ See https://github.com/projecthydra/hydra-head/wiki/Installation-Prerequisites.
|
|
16
16
|
|
17
17
|
### Installation
|
18
18
|
|
19
|
+
**Prerequisite**
|
20
|
+
|
21
|
+
An existing Hydra head. If you are starting from scratch, see https://github.com/projecthydra/hydra-head for instructions on creating a new Hydra head.
|
22
|
+
|
19
23
|
**Add to Gemfile**
|
20
24
|
|
21
25
|
```
|
@@ -24,15 +28,6 @@ gem 'fcrepo_admin'
|
|
24
28
|
|
25
29
|
Then `bundle install`
|
26
30
|
|
27
|
-
**Run the Blacklight and Hydra generators** (if this is a new Rails app, not an existing Hydra head)
|
28
|
-
|
29
|
-
```
|
30
|
-
rails g blacklight --devise
|
31
|
-
rails g hydra:head -f
|
32
|
-
rake db:migrate
|
33
|
-
rails g hydra:jetty # if you need a development copy of jetty with solr and fedora
|
34
|
-
```
|
35
|
-
|
36
31
|
**Mount the engine**
|
37
32
|
|
38
33
|
In `config/routes.rb` add this line:
|
@@ -250,15 +245,10 @@ If Kaminari is suitably patched in the future, we will likely remove `safe_pagin
|
|
250
245
|
|
251
246
|
### Contributing
|
252
247
|
|
253
|
-
|
254
|
-
to the Github issue tracker at https://github.com/projecthydra/fcrepo-admin/issues.
|
255
|
-
* Fork the git repository, create a feature branch, make your changes, and submit a pull request.
|
256
|
-
It is preferable for all changes to be made in one commit, if possible.
|
257
|
-
|
258
|
-
Thanks!
|
248
|
+
See `CONTRIBUTING.md` in the root of the project.
|
259
249
|
|
260
250
|
### License
|
261
251
|
|
262
|
-
See the LICENSE file in the root directory of the project for copyright and license information.
|
252
|
+
See the `LICENSE` file in the root directory of the project for copyright and license information.
|
263
253
|
|
264
254
|
Licenses for code copied from other projects will be included in source files as required.
|
@@ -36,7 +36,7 @@ module FcrepoAdmin
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def get_collection_query_result
|
39
|
-
ActiveFedora::SolrService.query(
|
39
|
+
ActiveFedora::SolrService.query(collection_query, collection_query_args)
|
40
40
|
end
|
41
41
|
|
42
42
|
def collection_query_args
|
@@ -51,11 +51,8 @@ module FcrepoAdmin
|
|
51
51
|
args
|
52
52
|
end
|
53
53
|
|
54
|
-
def
|
55
|
-
|
56
|
-
clauses = {@association.options[:property] => @object.internal_uri}
|
57
|
-
clauses[:has_model] = @association.class_name.constantize.to_class_uri if @association.class_name && @association.class_name != 'ActiveFedora::Base'
|
58
|
-
ActiveFedora::SolrService.construct_query_for_rel(clauses)
|
54
|
+
def collection_query
|
55
|
+
@object.send(params[:id].to_sym).send(:construct_query)
|
59
56
|
end
|
60
57
|
|
61
58
|
def load_association
|
@@ -1,30 +1,26 @@
|
|
1
|
-
<table class="table table-bordered table-condensed table-striped">
|
1
|
+
<table class="table table-bordered table-condensed table-striped <%= ds_list_css_class object %>">
|
2
2
|
<thead>
|
3
3
|
<tr>
|
4
4
|
<th scope="col"><%= t("fcrepo_admin.datastreams.header.id") %></th>
|
5
|
-
<% columns.each do |col|
|
5
|
+
<% columns.each do |col| -%>
|
6
6
|
<th scope="col"><%= t("fcrepo_admin.datastream.profile.keys.#{col}") %></th>
|
7
|
-
<% end
|
7
|
+
<% end -%>
|
8
8
|
</tr>
|
9
9
|
</thead>
|
10
10
|
<tbody>
|
11
|
-
<% object.datastreams.each do |dsid, ds|
|
12
|
-
<tr>
|
13
|
-
<td>
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
<%
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
<%= content_tag :td, :colspan => columns.size do %>
|
24
|
-
<em><%= t("fcrepo_admin.datastream.not_persisted") %></em>
|
25
|
-
<% end %>
|
26
|
-
<% end %>
|
11
|
+
<% object.datastreams.each do |dsid, ds| -%>
|
12
|
+
<tr class="<%= ds_css_class ds %>">
|
13
|
+
<td><%= link_to dsid, fcrepo_admin.object_datastream_path(object, ds) %></td>
|
14
|
+
<% unless ds.new? -%>
|
15
|
+
<% columns.each do |col| -%>
|
16
|
+
<td class="<%= ds_profile_css_class ds, col %>"><%= format_datastream_profile_value ds, col %></td>
|
17
|
+
<% end -%>
|
18
|
+
<% else -%>
|
19
|
+
<td class="<%= ds_profile_css_class ds, 'not-persisted' %>" colspan="<%= columns.size %>">
|
20
|
+
<em><%= t("fcrepo_admin.datastream.not_persisted") %></em>
|
21
|
+
</td>
|
22
|
+
<% end -%>
|
27
23
|
</tr>
|
28
|
-
<% end
|
24
|
+
<% end -%>
|
29
25
|
</tbody>
|
30
26
|
</table>
|
@@ -11,6 +11,7 @@ en:
|
|
11
11
|
associations: 'Associations'
|
12
12
|
object_xml: 'Object XML'
|
13
13
|
solr: 'Solr Record'
|
14
|
+
catalog: 'Catalog View'
|
14
15
|
properties:
|
15
16
|
title: 'Properties'
|
16
17
|
keys:
|
@@ -94,6 +95,7 @@ en:
|
|
94
95
|
content_not_text: 'The datastream content is not text'
|
95
96
|
profile:
|
96
97
|
title: 'Profile'
|
98
|
+
no_label: 'No label'
|
97
99
|
keys:
|
98
100
|
dsLabel: 'Label'
|
99
101
|
dsMIME: 'MIME Type'
|
@@ -34,24 +34,24 @@ module FcrepoAdmin::Helpers
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def datastream_nav_item(item)
|
37
|
-
case
|
38
|
-
when
|
37
|
+
case item
|
38
|
+
when :dsid
|
39
39
|
render_datastream_dsid_label
|
40
|
-
when
|
40
|
+
when :version
|
41
41
|
render_datastream_version unless @datastream.current_version?
|
42
|
-
when
|
42
|
+
when :current_version
|
43
43
|
link_to_datastream item, !@datastream.current_version?, false
|
44
|
-
when
|
44
|
+
when :summary
|
45
45
|
link_to_datastream item
|
46
|
-
when
|
46
|
+
when :content
|
47
47
|
link_to_datastream item, @datastream.content_is_text?
|
48
|
-
when
|
48
|
+
when :download
|
49
49
|
link_to_datastream item, @datastream.content_is_downloadable?, false
|
50
|
-
when
|
50
|
+
when :edit
|
51
51
|
link_to_datastream item, @datastream.content_is_editable? && can?(:edit, @object)
|
52
|
-
when
|
52
|
+
when :upload
|
53
53
|
link_to_datastream item, @datastream.content_is_uploadable? && can?(:upload, @object)
|
54
|
-
when
|
54
|
+
when :history
|
55
55
|
link_to_datastream item, !@datastream.new?
|
56
56
|
else
|
57
57
|
custom_datastream_nav_item item
|
@@ -60,20 +60,20 @@ module FcrepoAdmin::Helpers
|
|
60
60
|
|
61
61
|
def link_to_datastream(view, condition=true, unless_current=true)
|
62
62
|
return nil unless condition
|
63
|
-
path = case
|
64
|
-
when
|
63
|
+
path = case view
|
64
|
+
when :current_version
|
65
65
|
fcrepo_admin.object_datastream_path(@object, @datastream)
|
66
|
-
when
|
66
|
+
when :summary
|
67
67
|
fcrepo_admin.object_datastream_path(@object, @datastream, datastream_params)
|
68
|
-
when
|
68
|
+
when :content
|
69
69
|
fcrepo_admin.content_object_datastream_path(@object, @datastream, datastream_params)
|
70
|
-
when
|
70
|
+
when :download
|
71
71
|
fcrepo_admin.download_object_datastream_path(@object, @datastream, datastream_params)
|
72
|
-
when
|
72
|
+
when :edit
|
73
73
|
fcrepo_admin.edit_object_datastream_path(@object, @datastream)
|
74
|
-
when
|
74
|
+
when :upload
|
75
75
|
fcrepo_admin.upload_object_datastream_path(@object, @datastream)
|
76
|
-
when
|
76
|
+
when :history
|
77
77
|
fcrepo_admin.history_object_datastream_path(@object, @datastream)
|
78
78
|
end
|
79
79
|
label = t("fcrepo_admin.datastream.nav.items.#{view}")
|
@@ -108,16 +108,16 @@ module FcrepoAdmin::Helpers
|
|
108
108
|
end
|
109
109
|
|
110
110
|
def datastream_alert(alert)
|
111
|
-
case
|
112
|
-
when
|
111
|
+
case alert
|
112
|
+
when :system_managed
|
113
113
|
if ["DC", "RELS-EXT", "rightsMetadata", "defaultRights"].include?(@datastream.dsid)
|
114
114
|
render_datastream_alert(alert, :caution => true)
|
115
115
|
end
|
116
|
-
when
|
116
|
+
when :not_versionable
|
117
117
|
render_datastream_alert(alert, :caution => true) unless @datastream.versionable
|
118
|
-
when
|
118
|
+
when :inactive
|
119
119
|
render_datastream_alert(alert) if @datastream.inactive?
|
120
|
-
when
|
120
|
+
when :deleted
|
121
121
|
render_datastream_alert(alert, :css_class => "alert alert-error") if @datastream.deleted?
|
122
122
|
end
|
123
123
|
end
|
@@ -128,21 +128,28 @@ module FcrepoAdmin::Helpers
|
|
128
128
|
|
129
129
|
def format_datastream_state(ds)
|
130
130
|
state = ds.dsState
|
131
|
-
formatted = case
|
132
|
-
when
|
133
|
-
|
134
|
-
when
|
131
|
+
formatted = case state
|
132
|
+
when 'A'
|
133
|
+
"A (Active)"
|
134
|
+
when 'I'
|
135
|
+
"I (Inactive)"
|
136
|
+
when 'D'
|
137
|
+
"D (Deleted)"
|
135
138
|
end
|
136
139
|
formatted
|
137
140
|
end
|
138
141
|
|
139
142
|
def format_datastream_control_group(ds)
|
140
143
|
control_group = ds.controlGroup
|
141
|
-
formatted = case
|
142
|
-
when
|
143
|
-
|
144
|
-
when
|
145
|
-
|
144
|
+
formatted = case control_group
|
145
|
+
when 'M'
|
146
|
+
"M (Managed)"
|
147
|
+
when 'X'
|
148
|
+
"X (Inline XML)"
|
149
|
+
when 'E'
|
150
|
+
"E (External Referenced)"
|
151
|
+
when 'R'
|
152
|
+
"R (Redirect)"
|
146
153
|
end
|
147
154
|
formatted
|
148
155
|
end
|
@@ -153,17 +160,45 @@ module FcrepoAdmin::Helpers
|
|
153
160
|
version_id
|
154
161
|
end
|
155
162
|
|
163
|
+
def format_datastream_label(ds)
|
164
|
+
if ds.dsLabel.blank?
|
165
|
+
content_tag(:em, I18n.t('fcrepo_admin.datastream.profile.no_label'))
|
166
|
+
else
|
167
|
+
ds.dsLabel
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
156
171
|
def format_datastream_profile_value(ds, key)
|
157
|
-
case
|
158
|
-
when
|
159
|
-
|
160
|
-
when
|
161
|
-
|
162
|
-
when
|
163
|
-
|
172
|
+
case key
|
173
|
+
when "dsSize"
|
174
|
+
number_to_human_size(ds.dsSize)
|
175
|
+
when "dsCreateDate"
|
176
|
+
ds.dsCreateDate.localtime
|
177
|
+
when "dsLabel"
|
178
|
+
format_datastream_label(ds)
|
179
|
+
when "dsLocation" && ds.content_is_url?
|
180
|
+
link_to(ds.dsLocation, ds.dsLocation)
|
181
|
+
when "dsState"
|
182
|
+
format_datastream_state(ds)
|
183
|
+
when "dsControlGroup"
|
184
|
+
format_datastream_control_group(ds)
|
185
|
+
when "dsVersionID"
|
186
|
+
format_datastream_version_id(ds)
|
164
187
|
else ds.profile[key]
|
165
188
|
end
|
166
189
|
end
|
167
190
|
|
191
|
+
def ds_list_css_class(object_or_ds)
|
192
|
+
[object_or_ds.safe_pid, "datastreams"].join("-")
|
193
|
+
end
|
194
|
+
|
195
|
+
def ds_css_class(ds)
|
196
|
+
[ds_list_css_class(ds), ds.dsid].join("-")
|
197
|
+
end
|
198
|
+
|
199
|
+
def ds_profile_css_class(ds, attr)
|
200
|
+
[ds_css_class(ds), attr].join("-")
|
201
|
+
end
|
202
|
+
|
168
203
|
end
|
169
204
|
end
|
@@ -14,11 +14,15 @@ module FcrepoAdmin::Helpers
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def object_property(prop)
|
17
|
-
case
|
18
|
-
when
|
19
|
-
|
20
|
-
when
|
21
|
-
|
17
|
+
case prop
|
18
|
+
when :state
|
19
|
+
object_state
|
20
|
+
when :create_date, :modified_date
|
21
|
+
object_date(@object.send(prop))
|
22
|
+
when :models
|
23
|
+
@object.models.join("<br/>").html_safe
|
24
|
+
else
|
25
|
+
@object.send(prop)
|
22
26
|
end
|
23
27
|
end
|
24
28
|
|
@@ -28,10 +32,13 @@ module FcrepoAdmin::Helpers
|
|
28
32
|
|
29
33
|
def object_state
|
30
34
|
state = @object.state
|
31
|
-
value = case
|
32
|
-
when
|
33
|
-
|
34
|
-
when
|
35
|
+
value = case state
|
36
|
+
when 'A'
|
37
|
+
"A (Active)"
|
38
|
+
when 'I'
|
39
|
+
"I (Inactive)"
|
40
|
+
when 'D'
|
41
|
+
"D (Deleted)"
|
35
42
|
end
|
36
43
|
value
|
37
44
|
end
|
@@ -53,16 +60,27 @@ module FcrepoAdmin::Helpers
|
|
53
60
|
end
|
54
61
|
|
55
62
|
def object_nav_item(item)
|
56
|
-
case
|
57
|
-
when
|
58
|
-
|
59
|
-
when
|
60
|
-
|
61
|
-
when
|
62
|
-
|
63
|
-
when
|
64
|
-
|
65
|
-
|
63
|
+
case item
|
64
|
+
when :pid
|
65
|
+
render_object_pid_label
|
66
|
+
when :summary
|
67
|
+
link_to_object item
|
68
|
+
when :datastreams
|
69
|
+
link_to_object item
|
70
|
+
when :permissions
|
71
|
+
link_to_object item, @object.has_permissions? && can?(:permissions, @object)
|
72
|
+
when :associations
|
73
|
+
link_to_object item
|
74
|
+
when :audit_trail
|
75
|
+
link_to_object item, @object.auditable? && can?(:audit_trail, @object)
|
76
|
+
when :object_xml
|
77
|
+
link_to_object item
|
78
|
+
when :solr
|
79
|
+
link_to_object item
|
80
|
+
when :catalog
|
81
|
+
link_to_object item
|
82
|
+
else
|
83
|
+
custom_object_nav_item item
|
66
84
|
end
|
67
85
|
end
|
68
86
|
|
@@ -73,14 +91,23 @@ module FcrepoAdmin::Helpers
|
|
73
91
|
def link_to_object(view, condition=true)
|
74
92
|
return nil unless condition
|
75
93
|
label = t("fcrepo_admin.object.nav.items.#{view}")
|
76
|
-
path = case
|
77
|
-
when
|
78
|
-
|
79
|
-
when
|
80
|
-
|
81
|
-
when
|
82
|
-
|
83
|
-
when
|
94
|
+
path = case view
|
95
|
+
when :summary
|
96
|
+
fcrepo_admin.object_path(@object)
|
97
|
+
when :datastreams
|
98
|
+
fcrepo_admin.object_datastreams_path(@object)
|
99
|
+
when :permissions
|
100
|
+
fcrepo_admin.permissions_object_path(@object)
|
101
|
+
when :associations
|
102
|
+
fcrepo_admin.object_associations_path(@object)
|
103
|
+
when :audit_trail
|
104
|
+
fcrepo_admin.audit_trail_object_path(@object)
|
105
|
+
when :object_xml
|
106
|
+
fcrepo_admin.object_path(@object, :format => 'xml')
|
107
|
+
when :solr
|
108
|
+
fcrepo_admin.solr_object_path(@object)
|
109
|
+
when :catalog
|
110
|
+
catalog_path(@object)
|
84
111
|
end
|
85
112
|
link_to_unless_current label, path
|
86
113
|
end
|
data/lib/fcrepo_admin/version.rb
CHANGED
@@ -8,5 +8,20 @@ describe "datastreams/index.html.erb" do
|
|
8
8
|
object.datastreams.each do |dsid, ds|
|
9
9
|
page.should have_link(dsid, :href => fcrepo_admin.object_datastream_path(object, ds))
|
10
10
|
end
|
11
|
-
end
|
11
|
+
end
|
12
|
+
context "datastream is not persisted to Fedora" do
|
13
|
+
it "should display a 'not used' label" do
|
14
|
+
page.should have_xpath("//td[@class = \"#{object.safe_pid}-datastreams-content-not-persisted\" and contains(., \"#{I18n.t('fcrepo_admin.datastream.not_persisted')}\")]")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
context "datastream label is blank" do
|
18
|
+
it "should display a 'no label' label" do
|
19
|
+
page.should have_xpath("//em[contains(., \"#{I18n.t('fcrepo_admin.datastream.profile.no_label')}\")]")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
context "datastream label is not blank" do
|
23
|
+
it "should display the datastream label" do
|
24
|
+
page.should have_xpath("//td[@class = \"#{object.safe_pid}-datastreams-RELS-EXT-dsLabel\" and contains(., \"Fedora Object-to-Object Relationship Metadata\")]")
|
25
|
+
end
|
26
|
+
end
|
12
27
|
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.6.
|
4
|
+
version: 0.6.1
|
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-
|
14
|
+
date: 2013-07-26 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rubydora
|
@@ -251,6 +251,7 @@ files:
|
|
251
251
|
- .gitignore
|
252
252
|
- .rspec
|
253
253
|
- .travis.yml
|
254
|
+
- CONTRIBUTING.md
|
254
255
|
- Gemfile
|
255
256
|
- HISTORY.md
|
256
257
|
- LICENSE
|