hydra-editor 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef71ded0d1bc1ff49e2532decb6d4c9c5154151f
|
4
|
+
data.tar.gz: b3ec457db08eefcf939a2887514922727693fe80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32d9db8b9c5f6f4d956e42455cffc1064e3b92bc4dadf37d4c8be01454be03dc95b389eaf80f5cd7735eccab1dfcadfeab67a2bcfe4f244ec01899e6c2297220
|
7
|
+
data.tar.gz: 5a25a6e826b9e3fbaa2992bf9af345218a78b21e6b8557fc1083b863bf629edc0fbf9e22b6836aeb410734b2933d550a83003f2eee39a08db626b4c870673906
|
@@ -37,7 +37,7 @@ module RecordsControllerBehavior
|
|
37
37
|
format.html { redirect_to redirect_after_create, notice: 'Object was successfully created.' }
|
38
38
|
format.json { render json: object_as_json, status: :created, location: redirect_after_create }
|
39
39
|
else
|
40
|
-
format.html { render
|
40
|
+
format.html { render 'records/new' }
|
41
41
|
format.json { render json: resource.errors, status: :unprocessable_entity }
|
42
42
|
end
|
43
43
|
end
|
@@ -51,7 +51,7 @@ module RecordsControllerBehavior
|
|
51
51
|
format.html { redirect_to redirect_after_update, notice: 'Object was successfully updated.' }
|
52
52
|
format.json { head :no_content }
|
53
53
|
else
|
54
|
-
format.html { render
|
54
|
+
format.html { render 'records/edit' }
|
55
55
|
format.json { render json: resource.errors, status: :unprocessable_entity }
|
56
56
|
end
|
57
57
|
end
|
@@ -1,4 +1,6 @@
|
|
1
|
+
require 'deprecation'
|
1
2
|
module RecordsHelperBehavior
|
3
|
+
extend Deprecation
|
2
4
|
|
3
5
|
def metadata_help(key)
|
4
6
|
I18n.t("hydra_editor.form.metadata_help.#{key}", default: key.to_s.humanize)
|
@@ -21,7 +23,8 @@ module RecordsHelperBehavior
|
|
21
23
|
end
|
22
24
|
|
23
25
|
def render_edit_field_partial(key, locals)
|
24
|
-
|
26
|
+
collection = ActiveSupport::Inflector.tableize(locals[:f].object.class)
|
27
|
+
render_edit_field_partial_with_action(collection, key, locals)
|
25
28
|
end
|
26
29
|
|
27
30
|
def add_field (key)
|
@@ -49,14 +52,24 @@ module RecordsHelperBehavior
|
|
49
52
|
Array(resource.title).first
|
50
53
|
end
|
51
54
|
|
52
|
-
|
55
|
+
protected
|
53
56
|
|
54
|
-
def render_edit_field_partial_with_action(
|
55
|
-
if
|
56
|
-
|
57
|
+
def render_edit_field_partial_with_action(requested_path, key, locals)
|
58
|
+
path = if partial_exists?("#{requested_path}/edit_fields", key)
|
59
|
+
"#{requested_path}/edit_fields/#{key}"
|
60
|
+
elsif partial_exists?("records/edit_fields", key) # for backwards compatibility
|
61
|
+
Deprecation.warn RecordsHelperBehavior, "Rendering view from `records/edit_fields/#{key}`. Move to #{requested_path}/edit_fields/#{key}. This will be removed in 1.0.0"
|
62
|
+
"records/edit_fields/#{key}"
|
63
|
+
elsif partial_exists?("#{requested_path}/edit_fields", 'default')
|
64
|
+
"#{requested_path}/edit_fields/default"
|
57
65
|
else
|
58
|
-
|
66
|
+
"records/edit_fields/default"
|
59
67
|
end
|
68
|
+
render partial: path, locals: locals.merge({key: key})
|
69
|
+
end
|
70
|
+
|
71
|
+
def partial_exists?(path, file)
|
72
|
+
lookup_context.find_all("#{path}/_#{file}").any?
|
60
73
|
end
|
61
74
|
|
62
75
|
def more_or_less_button(key, html_class, symbol)
|
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.2.
|
4
|
+
version: 0.2.2
|
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-01-
|
12
|
+
date: 2014-01-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -59,6 +59,20 @@ 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'
|
62
76
|
- !ruby/object:Gem::Dependency
|
63
77
|
name: sqlite3
|
64
78
|
requirement: !ruby/object:Gem::Requirement
|