hydra-editor 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/concerns/records_helper_behavior.rb +20 -22
- data/lib/hydra_editor/version.rb +1 -1
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5887fe8d0012e6771f7692ab1283824295e18dc
|
4
|
+
data.tar.gz: 0979ec4106adb726337eeb071a818c434b05cb09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 945c22ff3dccfbe2b50c3fdd5a190e31f5cce9175b3c8856f09c091aa1eaedaaeda8695c5fe12ecddabac744e8fc27770f7c5536d0185fe4c05293aba9539f83
|
7
|
+
data.tar.gz: 2462a7e7d9e270a5d396e6069ffce9649ecf9a2be11a1449f77b875f54c9f18c849b4cf684700164166e6a4a13331d93698de96480de061d1adc7359bdb8e891
|
@@ -1,6 +1,4 @@
|
|
1
|
-
require 'deprecation'
|
2
1
|
module RecordsHelperBehavior
|
3
|
-
extend Deprecation
|
4
2
|
|
5
3
|
def metadata_help(key)
|
6
4
|
I18n.t("hydra_editor.form.metadata_help.#{key}", default: key.to_s.humanize)
|
@@ -22,9 +20,9 @@ module RecordsHelperBehavior
|
|
22
20
|
end
|
23
21
|
end
|
24
22
|
|
25
|
-
def render_edit_field_partial(
|
23
|
+
def render_edit_field_partial(field_name, locals)
|
26
24
|
collection = ActiveSupport::Inflector.tableize(locals[:f].object.class)
|
27
|
-
render_edit_field_partial_with_action(collection,
|
25
|
+
render_edit_field_partial_with_action(collection, field_name, locals)
|
28
26
|
end
|
29
27
|
|
30
28
|
def add_field (key)
|
@@ -52,34 +50,34 @@ module RecordsHelperBehavior
|
|
52
50
|
Array(resource.title).first
|
53
51
|
end
|
54
52
|
|
55
|
-
protected
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
53
|
+
protected
|
54
|
+
|
55
|
+
# This finds a partial based on the record_type and field_name
|
56
|
+
# if no partial exists for the record_type it tries using "records" as a default
|
57
|
+
def render_edit_field_partial_with_action(record_type, field_name, locals)
|
58
|
+
partial = find_edit_field_partial(record_type, field_name)
|
59
|
+
render partial: partial, locals: locals.merge({key: field_name})
|
60
|
+
end
|
61
|
+
|
62
|
+
def find_edit_field_partial(record_type, field_name)
|
63
|
+
["#{record_type}/edit_fields/_#{field_name}", "records/edit_fields/_#{field_name}",
|
64
|
+
"#{record_type}/edit_fields/_default", "records/edit_fields/_default"].find do |partial|
|
65
|
+
logger.debug "Looking for edit field partial #{partial}"
|
66
|
+
return partial.sub(/\/_/, '/') if partial_exists?(partial)
|
67
67
|
end
|
68
|
-
render partial: path, locals: locals.merge({key: key})
|
69
68
|
end
|
70
69
|
|
71
|
-
def partial_exists?(
|
72
|
-
lookup_context.find_all(
|
70
|
+
def partial_exists?(partial)
|
71
|
+
lookup_context.find_all(partial).any?
|
73
72
|
end
|
74
|
-
|
73
|
+
|
75
74
|
def more_or_less_button(key, html_class, symbol)
|
76
75
|
# TODO, there could be more than one element with this id on the page, but the fuctionality doesn't work without it.
|
77
76
|
content_tag('button', class: "#{html_class} btn btn-default", id: "additional_#{key}_submit", name: "additional_#{key}") do
|
78
|
-
(symbol +
|
77
|
+
(symbol +
|
79
78
|
content_tag('span', class: 'sr-only') do
|
80
79
|
"add another #{key.to_s}"
|
81
80
|
end).html_safe
|
82
81
|
end
|
83
82
|
end
|
84
|
-
|
85
83
|
end
|
data/lib/hydra_editor/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hydra-editor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-11-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -59,20 +59,6 @@ dependencies:
|
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 6.3.0
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: deprecation
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
type: :runtime
|
70
|
-
prerelease: false
|
71
|
-
version_requirements: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
62
|
- !ruby/object:Gem::Dependency
|
77
63
|
name: cancancan
|
78
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -238,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
238
224
|
version: '0'
|
239
225
|
requirements: []
|
240
226
|
rubyforge_project:
|
241
|
-
rubygems_version: 2.
|
227
|
+
rubygems_version: 2.2.2
|
242
228
|
signing_key:
|
243
229
|
specification_version: 4
|
244
230
|
summary: A basic metadata editor for hydra-head
|