hydra-core 6.0.0.pre3 → 6.0.0.pre4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/hydra-head/version.rb +1 -1
- data/lib/hydra/controller.rb +0 -19
- data/lib/hydra/controller/upload_behavior.rb +0 -2
- data/lib/hydra/model_methods.rb +0 -49
- metadata +40 -44
- data/lib/hydra/controller/repository_controller_behavior.rb +0 -90
- data/lib/hydra/repository_controller.rb +0 -28
- data/spec/lib/repository_controller_behavior_spec.rb +0 -30
data/lib/hydra-head/version.rb
CHANGED
data/lib/hydra/controller.rb
CHANGED
@@ -1,25 +1,6 @@
|
|
1
|
-
# Include this module into any of your Controller classes to add Hydra functionality
|
2
|
-
#
|
3
|
-
# The primary function of this module is to mix in a number of other Hydra Modules, including
|
4
|
-
# Hydra::AccessControlsEnforcement
|
5
|
-
#
|
6
|
-
# @example
|
7
|
-
# class CustomHydraController < ApplicationController
|
8
|
-
# include Hydra::Controller
|
9
|
-
# end
|
10
|
-
#
|
11
|
-
# will move to lib/hydra/controller/controller_behavior in release 5.x
|
12
1
|
module Hydra::Controller
|
13
2
|
autoload :AssetsControllerBehavior, 'hydra/controller/assets_controller_behavior'
|
14
3
|
autoload :ControllerBehavior, 'hydra/controller/controller_behavior'
|
15
|
-
autoload :RepositoryControllerBehavior, 'hydra/controller/repository_controller_behavior'
|
16
4
|
autoload :UploadBehavior, 'hydra/controller/upload_behavior'
|
17
5
|
autoload :FileAssetsBehavior, 'hydra/controller/file_assets_behavior'
|
18
|
-
|
19
|
-
extend ActiveSupport::Concern
|
20
|
-
|
21
|
-
included do
|
22
|
-
ActiveSupport::Deprecation.warn("Hydra::Controller has been renamed Hydra::Controller::ControllerBehavior.")
|
23
|
-
include Hydra::Controller::ControllerBehavior
|
24
|
-
end
|
25
6
|
end
|
data/lib/hydra/model_methods.rb
CHANGED
@@ -1,13 +1,4 @@
|
|
1
|
-
# will move to lib/hydra/model/model_behavior.rb (with appropriate namespace changes) in release 5.x
|
2
1
|
module Hydra::ModelMethods
|
3
|
-
extend ActiveSupport::Concern
|
4
|
-
extend Deprecation
|
5
|
-
|
6
|
-
included do
|
7
|
-
unless self.class == Module
|
8
|
-
self.has_many :parts, :class_name=>'ActiveFedora::Base', :property=>:is_part_of
|
9
|
-
end
|
10
|
-
end
|
11
2
|
|
12
3
|
#
|
13
4
|
# Adds metadata about the depositor to the asset
|
@@ -42,16 +33,6 @@ module Hydra::ModelMethods
|
|
42
33
|
end
|
43
34
|
|
44
35
|
|
45
|
-
#
|
46
|
-
# Set the collection type (e.g. hydrangea_article) for the asset
|
47
|
-
#
|
48
|
-
def set_collection_type(collection)
|
49
|
-
prop_ds = self.datastreams["properties"]
|
50
|
-
if !prop_ds.nil? && prop_ds.respond_to?(:collection_values)
|
51
|
-
prop_ds.collection_values = collection
|
52
|
-
end
|
53
|
-
end
|
54
|
-
deprecation_deprecate :set_collection_type
|
55
36
|
|
56
37
|
# Set the title and label on the current object
|
57
38
|
#
|
@@ -87,34 +68,4 @@ module Hydra::ModelMethods
|
|
87
68
|
end
|
88
69
|
end
|
89
70
|
|
90
|
-
# Call to remove file objects
|
91
|
-
def destroy_child_assets
|
92
|
-
destroyable_child_assets.each.inject([]) do |destroyed,fo|
|
93
|
-
destroyed << fo.pid
|
94
|
-
fo.delete
|
95
|
-
destroyed
|
96
|
-
end
|
97
|
-
|
98
|
-
end
|
99
|
-
deprecation_deprecate :destroy_child_assets
|
100
|
-
|
101
|
-
|
102
|
-
def destroyable_child_assets
|
103
|
-
return [] unless self.parts
|
104
|
-
self.parts.each.inject([]) do |file_assets, fo|
|
105
|
-
parents = fo.ids_for_outbound(:is_part_of)
|
106
|
-
if parents.length == 1 && parents.first.match(/#{self.pid}$/)
|
107
|
-
file_assets << fo
|
108
|
-
end
|
109
|
-
file_assets
|
110
|
-
end
|
111
|
-
end
|
112
|
-
deprecation_deprecate :destroyable_child_assets
|
113
|
-
|
114
|
-
def file_asset_count
|
115
|
-
### TODO switch to AF::Base.count
|
116
|
-
parts.length
|
117
|
-
end
|
118
|
-
deprecation_deprecate :file_asset_count
|
119
|
-
|
120
71
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hydra-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.0.
|
4
|
+
version: 6.0.0.pre4
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,14 +10,14 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-01-
|
13
|
+
date: 2013-01-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
|
-
- - ~>
|
20
|
+
- - "~>"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 3.2.3
|
23
23
|
type: :runtime
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
none: false
|
27
27
|
requirements:
|
28
|
-
- - ~>
|
28
|
+
- - "~>"
|
29
29
|
- !ruby/object:Gem::Version
|
30
30
|
version: 3.2.3
|
31
31
|
- !ruby/object:Gem::Dependency
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
34
34
|
none: false
|
35
35
|
requirements:
|
36
|
-
- - ~>
|
36
|
+
- - "~>"
|
37
37
|
- !ruby/object:Gem::Version
|
38
38
|
version: '4.0'
|
39
39
|
type: :runtime
|
@@ -41,7 +41,7 @@ dependencies:
|
|
41
41
|
version_requirements: !ruby/object:Gem::Requirement
|
42
42
|
none: false
|
43
43
|
requirements:
|
44
|
-
- - ~>
|
44
|
+
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '4.0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
@@ -49,7 +49,7 @@ dependencies:
|
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
@@ -57,7 +57,7 @@ dependencies:
|
|
57
57
|
version_requirements: !ruby/object:Gem::Requirement
|
58
58
|
none: false
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0'
|
63
63
|
- !ruby/object:Gem::Dependency
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
requirement: !ruby/object:Gem::Requirement
|
66
66
|
none: false
|
67
67
|
requirements:
|
68
|
-
- -
|
68
|
+
- - ">="
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: 6.0.0.pre2
|
71
71
|
type: :runtime
|
@@ -73,7 +73,7 @@ dependencies:
|
|
73
73
|
version_requirements: !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
76
|
-
- -
|
76
|
+
- - ">="
|
77
77
|
- !ruby/object:Gem::Version
|
78
78
|
version: 6.0.0.pre2
|
79
79
|
- !ruby/object:Gem::Dependency
|
@@ -97,7 +97,7 @@ dependencies:
|
|
97
97
|
requirement: !ruby/object:Gem::Requirement
|
98
98
|
none: false
|
99
99
|
requirements:
|
100
|
-
- -
|
100
|
+
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '0'
|
103
103
|
type: :runtime
|
@@ -105,7 +105,7 @@ dependencies:
|
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
106
|
none: false
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
@@ -113,7 +113,7 @@ dependencies:
|
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
none: false
|
115
115
|
requirements:
|
116
|
-
- -
|
116
|
+
- - ">="
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: '0'
|
119
119
|
type: :runtime
|
@@ -121,7 +121,7 @@ dependencies:
|
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
122
122
|
none: false
|
123
123
|
requirements:
|
124
|
-
- -
|
124
|
+
- - ">="
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: '0'
|
127
127
|
- !ruby/object:Gem::Dependency
|
@@ -129,7 +129,7 @@ dependencies:
|
|
129
129
|
requirement: !ruby/object:Gem::Requirement
|
130
130
|
none: false
|
131
131
|
requirements:
|
132
|
-
- -
|
132
|
+
- - ">="
|
133
133
|
- !ruby/object:Gem::Version
|
134
134
|
version: 0.0.6
|
135
135
|
type: :runtime
|
@@ -137,7 +137,7 @@ dependencies:
|
|
137
137
|
version_requirements: !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|
140
|
-
- -
|
140
|
+
- - ">="
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: 0.0.6
|
143
143
|
- !ruby/object:Gem::Dependency
|
@@ -145,7 +145,7 @@ dependencies:
|
|
145
145
|
requirement: !ruby/object:Gem::Requirement
|
146
146
|
none: false
|
147
147
|
requirements:
|
148
|
-
- -
|
148
|
+
- - ">="
|
149
149
|
- !ruby/object:Gem::Version
|
150
150
|
version: 0.0.5
|
151
151
|
type: :runtime
|
@@ -153,7 +153,7 @@ dependencies:
|
|
153
153
|
version_requirements: !ruby/object:Gem::Requirement
|
154
154
|
none: false
|
155
155
|
requirements:
|
156
|
-
- -
|
156
|
+
- - ">="
|
157
157
|
- !ruby/object:Gem::Version
|
158
158
|
version: 0.0.5
|
159
159
|
- !ruby/object:Gem::Dependency
|
@@ -161,7 +161,7 @@ dependencies:
|
|
161
161
|
requirement: !ruby/object:Gem::Requirement
|
162
162
|
none: false
|
163
163
|
requirements:
|
164
|
-
- -
|
164
|
+
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
type: :runtime
|
@@ -169,7 +169,7 @@ dependencies:
|
|
169
169
|
version_requirements: !ruby/object:Gem::Requirement
|
170
170
|
none: false
|
171
171
|
requirements:
|
172
|
-
- -
|
172
|
+
- - ">="
|
173
173
|
- !ruby/object:Gem::Version
|
174
174
|
version: '0'
|
175
175
|
- !ruby/object:Gem::Dependency
|
@@ -179,7 +179,7 @@ dependencies:
|
|
179
179
|
requirements:
|
180
180
|
- - '='
|
181
181
|
- !ruby/object:Gem::Version
|
182
|
-
version: 6.0.0.
|
182
|
+
version: 6.0.0.pre4
|
183
183
|
type: :runtime
|
184
184
|
prerelease: false
|
185
185
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -187,13 +187,13 @@ dependencies:
|
|
187
187
|
requirements:
|
188
188
|
- - '='
|
189
189
|
- !ruby/object:Gem::Version
|
190
|
-
version: 6.0.0.
|
190
|
+
version: 6.0.0.pre4
|
191
191
|
- !ruby/object:Gem::Dependency
|
192
192
|
name: sqlite3
|
193
193
|
requirement: !ruby/object:Gem::Requirement
|
194
194
|
none: false
|
195
195
|
requirements:
|
196
|
-
- -
|
196
|
+
- - ">="
|
197
197
|
- !ruby/object:Gem::Version
|
198
198
|
version: '0'
|
199
199
|
type: :development
|
@@ -201,7 +201,7 @@ dependencies:
|
|
201
201
|
version_requirements: !ruby/object:Gem::Requirement
|
202
202
|
none: false
|
203
203
|
requirements:
|
204
|
-
- -
|
204
|
+
- - ">="
|
205
205
|
- !ruby/object:Gem::Version
|
206
206
|
version: '0'
|
207
207
|
- !ruby/object:Gem::Dependency
|
@@ -209,7 +209,7 @@ dependencies:
|
|
209
209
|
requirement: !ruby/object:Gem::Requirement
|
210
210
|
none: false
|
211
211
|
requirements:
|
212
|
-
- -
|
212
|
+
- - ">="
|
213
213
|
- !ruby/object:Gem::Version
|
214
214
|
version: '0'
|
215
215
|
type: :development
|
@@ -217,7 +217,7 @@ dependencies:
|
|
217
217
|
version_requirements: !ruby/object:Gem::Requirement
|
218
218
|
none: false
|
219
219
|
requirements:
|
220
|
-
- -
|
220
|
+
- - ">="
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '0'
|
223
223
|
- !ruby/object:Gem::Dependency
|
@@ -225,7 +225,7 @@ dependencies:
|
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|
226
226
|
none: false
|
227
227
|
requirements:
|
228
|
-
- -
|
228
|
+
- - ">="
|
229
229
|
- !ruby/object:Gem::Version
|
230
230
|
version: 1.3.1
|
231
231
|
type: :development
|
@@ -233,7 +233,7 @@ dependencies:
|
|
233
233
|
version_requirements: !ruby/object:Gem::Requirement
|
234
234
|
none: false
|
235
235
|
requirements:
|
236
|
-
- -
|
236
|
+
- - ">="
|
237
237
|
- !ruby/object:Gem::Version
|
238
238
|
version: 1.3.1
|
239
239
|
- !ruby/object:Gem::Dependency
|
@@ -241,7 +241,7 @@ dependencies:
|
|
241
241
|
requirement: !ruby/object:Gem::Requirement
|
242
242
|
none: false
|
243
243
|
requirements:
|
244
|
-
- -
|
244
|
+
- - ">="
|
245
245
|
- !ruby/object:Gem::Version
|
246
246
|
version: '0'
|
247
247
|
type: :development
|
@@ -249,7 +249,7 @@ dependencies:
|
|
249
249
|
version_requirements: !ruby/object:Gem::Requirement
|
250
250
|
none: false
|
251
251
|
requirements:
|
252
|
-
- -
|
252
|
+
- - ">="
|
253
253
|
- !ruby/object:Gem::Version
|
254
254
|
version: '0'
|
255
255
|
- !ruby/object:Gem::Dependency
|
@@ -257,7 +257,7 @@ dependencies:
|
|
257
257
|
requirement: !ruby/object:Gem::Requirement
|
258
258
|
none: false
|
259
259
|
requirements:
|
260
|
-
- -
|
260
|
+
- - ">="
|
261
261
|
- !ruby/object:Gem::Version
|
262
262
|
version: 1.2.0
|
263
263
|
type: :development
|
@@ -265,7 +265,7 @@ dependencies:
|
|
265
265
|
version_requirements: !ruby/object:Gem::Requirement
|
266
266
|
none: false
|
267
267
|
requirements:
|
268
|
-
- -
|
268
|
+
- - ">="
|
269
269
|
- !ruby/object:Gem::Version
|
270
270
|
version: 1.2.0
|
271
271
|
- !ruby/object:Gem::Dependency
|
@@ -273,7 +273,7 @@ dependencies:
|
|
273
273
|
requirement: !ruby/object:Gem::Requirement
|
274
274
|
none: false
|
275
275
|
requirements:
|
276
|
-
- -
|
276
|
+
- - ">="
|
277
277
|
- !ruby/object:Gem::Version
|
278
278
|
version: '0'
|
279
279
|
type: :development
|
@@ -281,7 +281,7 @@ dependencies:
|
|
281
281
|
version_requirements: !ruby/object:Gem::Requirement
|
282
282
|
none: false
|
283
283
|
requirements:
|
284
|
-
- -
|
284
|
+
- - ">="
|
285
285
|
- !ruby/object:Gem::Version
|
286
286
|
version: '0'
|
287
287
|
- !ruby/object:Gem::Dependency
|
@@ -289,7 +289,7 @@ dependencies:
|
|
289
289
|
requirement: !ruby/object:Gem::Requirement
|
290
290
|
none: false
|
291
291
|
requirements:
|
292
|
-
- -
|
292
|
+
- - ">="
|
293
293
|
- !ruby/object:Gem::Version
|
294
294
|
version: 2.1.0
|
295
295
|
type: :development
|
@@ -297,7 +297,7 @@ dependencies:
|
|
297
297
|
version_requirements: !ruby/object:Gem::Requirement
|
298
298
|
none: false
|
299
299
|
requirements:
|
300
|
-
- -
|
300
|
+
- - ">="
|
301
301
|
- !ruby/object:Gem::Version
|
302
302
|
version: 2.1.0
|
303
303
|
description: ! 'Hydra-Head is a Rails Engine containing the core code for a Hydra
|
@@ -309,7 +309,7 @@ executables: []
|
|
309
309
|
extensions: []
|
310
310
|
extra_rdoc_files: []
|
311
311
|
files:
|
312
|
-
- .gitignore
|
312
|
+
- ".gitignore"
|
313
313
|
- Rakefile
|
314
314
|
- app/helpers/blacklight_helper.rb
|
315
315
|
- app/helpers/facets_helper.rb
|
@@ -347,7 +347,6 @@ files:
|
|
347
347
|
- lib/hydra.rb
|
348
348
|
- lib/hydra/controller.rb
|
349
349
|
- lib/hydra/controller/controller_behavior.rb
|
350
|
-
- lib/hydra/controller/repository_controller_behavior.rb
|
351
350
|
- lib/hydra/controller/upload_behavior.rb
|
352
351
|
- lib/hydra/global_configurable.rb
|
353
352
|
- lib/hydra/model_methods.rb
|
@@ -355,7 +354,6 @@ files:
|
|
355
354
|
- lib/hydra/model_mixins/solr_document_extension.rb
|
356
355
|
- lib/hydra/models.rb
|
357
356
|
- lib/hydra/models/file_asset.rb
|
358
|
-
- lib/hydra/repository_controller.rb
|
359
357
|
- lib/hydra/solr.rb
|
360
358
|
- lib/railties/active-fedora.rake
|
361
359
|
- lib/railties/hydra-fixtures.rake
|
@@ -370,7 +368,6 @@ files:
|
|
370
368
|
- spec/lib/catalog_spec.rb
|
371
369
|
- spec/lib/global_configurable_spec.rb
|
372
370
|
- spec/lib/model_methods_spec.rb
|
373
|
-
- spec/lib/repository_controller_behavior_spec.rb
|
374
371
|
- spec/lib/solr_document_extension_spec.rb
|
375
372
|
- spec/models/file_asset_spec.rb
|
376
373
|
- spec/models/mods_asset_spec.rb
|
@@ -404,18 +401,18 @@ require_paths:
|
|
404
401
|
required_ruby_version: !ruby/object:Gem::Requirement
|
405
402
|
none: false
|
406
403
|
requirements:
|
407
|
-
- -
|
404
|
+
- - ">="
|
408
405
|
- !ruby/object:Gem::Version
|
409
406
|
version: 1.9.3
|
410
407
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
411
408
|
none: false
|
412
409
|
requirements:
|
413
|
-
- -
|
410
|
+
- - ">"
|
414
411
|
- !ruby/object:Gem::Version
|
415
412
|
version: 1.3.1
|
416
413
|
requirements: []
|
417
414
|
rubyforge_project:
|
418
|
-
rubygems_version: 1.8.
|
415
|
+
rubygems_version: 1.8.25
|
419
416
|
signing_key:
|
420
417
|
specification_version: 3
|
421
418
|
summary: Hydra-Head Rails Engine (requires Rails3)
|
@@ -430,7 +427,6 @@ test_files:
|
|
430
427
|
- spec/lib/catalog_spec.rb
|
431
428
|
- spec/lib/global_configurable_spec.rb
|
432
429
|
- spec/lib/model_methods_spec.rb
|
433
|
-
- spec/lib/repository_controller_behavior_spec.rb
|
434
430
|
- spec/lib/solr_document_extension_spec.rb
|
435
431
|
- spec/models/file_asset_spec.rb
|
436
432
|
- spec/models/mods_asset_spec.rb
|
@@ -1,90 +0,0 @@
|
|
1
|
-
# Hydra::RepositoryContollerBehavior is a controller layer mixin. It is in the controller scope: request params, session etc.
|
2
|
-
#
|
3
|
-
module Hydra::Controller::RepositoryControllerBehavior
|
4
|
-
extend Deprecation
|
5
|
-
self.deprecation_horizon = "hydra-core 6.0"
|
6
|
-
|
7
|
-
# TODO, move these to a helper file.
|
8
|
-
def self.included(c)
|
9
|
-
if c.respond_to?(:helper_method)
|
10
|
-
c.helper_method :solr_name
|
11
|
-
c.helper_method :format_pid
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
|
16
|
-
#
|
17
|
-
# This method converts pid strings into xhtml safe IDs, since xhmlt expects namespaces to be defined.
|
18
|
-
# I.E. hydrus:123 = hydrus_123
|
19
|
-
# @deprecated
|
20
|
-
def format_pid(pid)
|
21
|
-
pid.gsub(":", "_")
|
22
|
-
end
|
23
|
-
deprecation_deprecate :format_pid
|
24
|
-
|
25
|
-
|
26
|
-
# @deprecated
|
27
|
-
def solr_name(field_name, field_type = :text)
|
28
|
-
::ActiveFedora::SolrService.solr_name(field_name, field_type)
|
29
|
-
end
|
30
|
-
deprecation_deprecate :solr_name
|
31
|
-
|
32
|
-
|
33
|
-
# Returns a list of datastreams for download.
|
34
|
-
# Uses user's roles and "mime_type" value in submitted params to decide what to return.
|
35
|
-
# if you pass the optional argument of :canonical=>true, it will return the canonical datastream for this object (a single object not a hash of datastreams)
|
36
|
-
# @deprecated
|
37
|
-
def downloadables(fedora_object=@fedora_object, opts={})
|
38
|
-
if opts[:canonical]
|
39
|
-
mime_type = opts[:mime_type] ? opts[:mime_type] : "application/pdf"
|
40
|
-
result = filter_datastreams_for_mime_type(fedora_object.datastreams, mime_type).sort.first[1]
|
41
|
-
elsif can? :edit, fedora_object
|
42
|
-
if params["mime_type"] == "all"
|
43
|
-
result = fedora_object.datastreams
|
44
|
-
else
|
45
|
-
result = Hash[]
|
46
|
-
fedora_object.datastreams.each_pair do |dsid,ds|
|
47
|
-
if !ds.new_object?
|
48
|
-
mime_type = ds.mimeType ? ds.mimeType : ""
|
49
|
-
if mime_type.include?("pdf") || ds.label.include?("_TEXT.xml") || ds.label.include?("_METS.xml")
|
50
|
-
result[dsid] = ds
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
else
|
56
|
-
result = Hash[]
|
57
|
-
fedora_object.datastreams.each_pair do |dsid,ds|
|
58
|
-
if ds.mimeType.include?("pdf")
|
59
|
-
result[dsid] = ds
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
# puts "downloadables result: #{result}"
|
64
|
-
return result
|
65
|
-
end
|
66
|
-
deprecation_deprecate :downloadables
|
67
|
-
|
68
|
-
protected
|
69
|
-
|
70
|
-
# @deprecated
|
71
|
-
def load_document
|
72
|
-
@document = ActiveFedora::Base.find(params[:id], :cast=>true)
|
73
|
-
end
|
74
|
-
deprecation_deprecate :load_document
|
75
|
-
|
76
|
-
private
|
77
|
-
|
78
|
-
|
79
|
-
# @deprecated
|
80
|
-
def filter_datastreams_for_mime_type(datastreams_hash, mime_type)
|
81
|
-
result = Hash[]
|
82
|
-
datastreams_hash.each_pair do |dsid,ds|
|
83
|
-
ds_mime_type = ds.mimeType ? ds.mimeType : ""
|
84
|
-
if ds_mime_type == mime_type
|
85
|
-
result[dsid] = ds
|
86
|
-
end
|
87
|
-
end
|
88
|
-
return result
|
89
|
-
end
|
90
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# Hydra-repository Contoller is a controller layer mixin. It is in the controller scope: request params, session etc.
|
2
|
-
#
|
3
|
-
# will move to lib/hydra/controller/repository_controller_behavior in release 5.x
|
4
|
-
#
|
5
|
-
# NOTE: Be careful when creating variables here as they may be overriding something that already exists.
|
6
|
-
# The ActionController docs: http://api.rubyonrails.org/classes/ActionController/Base.html
|
7
|
-
#
|
8
|
-
# Override these methods in your own controller for customizations:
|
9
|
-
#
|
10
|
-
# class HomeController < ActionController::Base
|
11
|
-
#
|
12
|
-
# include Stanford::SolrHelper
|
13
|
-
#
|
14
|
-
# def solr_search_params
|
15
|
-
# super.merge :per_page=>10
|
16
|
-
# end
|
17
|
-
#
|
18
|
-
# end
|
19
|
-
#
|
20
|
-
module Hydra::RepositoryController
|
21
|
-
extend ActiveSupport::Concern
|
22
|
-
|
23
|
-
included do
|
24
|
-
ActiveSupport::Deprecation.warn "Hydra::RepositoryController has moved to Hydra::Controller::RepositoryControllerBehavior"
|
25
|
-
include Hydra::Controller::RepositoryControllerBehavior
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Hydra::Controller::RepositoryControllerBehavior do
|
4
|
-
before(:all) do
|
5
|
-
class RepositoryControllerTest < ApplicationController
|
6
|
-
include Hydra::Controller::RepositoryControllerBehavior
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
subject { RepositoryControllerTest.new }
|
11
|
-
|
12
|
-
describe "load_document" do
|
13
|
-
it "should load the model for the pid" do
|
14
|
-
Deprecation.stub(:warn)
|
15
|
-
mock_model = mock("model")
|
16
|
-
subject.stub(:params).and_return( {:id => "object id"} )
|
17
|
-
ActiveFedora::Base.should_receive(:find).with("object id", :cast=>true).and_return(mock_model)
|
18
|
-
subject.send(:load_document).should == mock_model
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe "format_pid" do
|
23
|
-
it "convert pids into XHTML safe strings" do
|
24
|
-
Deprecation.stub(:warn)
|
25
|
-
pid = subject.format_pid("hydra:123")
|
26
|
-
pid.should match(/hydra_123/)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|