hydra-editor 3.3.1 → 3.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/hydra-editor/field_manager.es6 +37 -8
- data/lib/hydra_editor/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf1742bb171c18f225eafe23a40a84f28ce88588
|
4
|
+
data.tar.gz: f7eba9637334928973ea1a2c9615e9e51dbfe697
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3f11286ab8251e7ac992ec0eb97c6a2d5ee9c0b60dda759f1aae9059400e16cc581bcdffecc6170d2eacd4bec2fd3224508d60551d2c5b58ce43e93a4f99c2f
|
7
|
+
data.tar.gz: 47695067e2ced57b919bfe9e889bd92f4fa2caecc6626b863b337b46a6ecec931403b0411922a6af218e2ca113b64dfd6e5a08288198bf4a220c0f6d0b7752e8
|
@@ -1,12 +1,16 @@
|
|
1
1
|
export class FieldManager {
|
2
2
|
constructor(element, options) {
|
3
3
|
this.element = $(element);
|
4
|
+
|
4
5
|
this.options = options;
|
5
6
|
|
6
7
|
this.options.label = this.getFieldLabel(this.element, options)
|
7
8
|
|
8
|
-
this.
|
9
|
-
this.
|
9
|
+
this.addSelector = '.add'
|
10
|
+
this.removeSelector = '.remove'
|
11
|
+
|
12
|
+
this.adder = this.createAddHtml(this.options)
|
13
|
+
this.remover = this.createRemoveHtml(this.options)
|
10
14
|
|
11
15
|
this.controls = $(options.controlsHtml);
|
12
16
|
|
@@ -35,18 +39,43 @@ export class FieldManager {
|
|
35
39
|
$(this.element).find('.listing').attr('aria-live', 'polite')
|
36
40
|
}
|
37
41
|
|
42
|
+
// Add the "Add another" and "Remove" controls to the DOM
|
38
43
|
_appendControls() {
|
39
|
-
|
40
|
-
|
44
|
+
// We want to make these DOM additions idempotently, so exit if it's
|
45
|
+
// already set up.
|
46
|
+
if (!this._hasRemoveControl()) {
|
47
|
+
this._createRemoveWrapper()
|
48
|
+
this._createRemoveControl()
|
49
|
+
}
|
41
50
|
|
42
|
-
if (
|
43
|
-
|
51
|
+
if (!this._hasAddControl()) {
|
52
|
+
this._createAddControl()
|
44
53
|
}
|
45
54
|
}
|
46
55
|
|
56
|
+
_createRemoveWrapper() {
|
57
|
+
$(this.fieldWrapperClass, this.element).append(this.controls);
|
58
|
+
}
|
59
|
+
|
60
|
+
_createRemoveControl() {
|
61
|
+
$(this.fieldWrapperClass + ' .field-controls', this.element).append(this.remover)
|
62
|
+
}
|
63
|
+
|
64
|
+
_createAddControl() {
|
65
|
+
this.element.find(this.listClass).after(this.adder)
|
66
|
+
}
|
67
|
+
|
68
|
+
_hasRemoveControl() {
|
69
|
+
return this.element.find(this.removeSelector).length > 0
|
70
|
+
}
|
71
|
+
|
72
|
+
_hasAddControl() {
|
73
|
+
return this.element.find(this.addSelector).length > 0
|
74
|
+
}
|
75
|
+
|
47
76
|
_attachEvents() {
|
48
|
-
this.element.on('click',
|
49
|
-
this.element.on('click',
|
77
|
+
this.element.on('click', this.removeSelector, (e) => this.removeFromList(e))
|
78
|
+
this.element.on('click', this.addSelector, (e) => this.addToList(e))
|
50
79
|
}
|
51
80
|
|
52
81
|
_addCallbacks() {
|
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: 3.3.
|
4
|
+
version: 3.3.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: 2017-05-
|
12
|
+
date: 2017-05-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -129,6 +129,20 @@ dependencies:
|
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '3.1'
|
132
|
+
- !ruby/object:Gem::Dependency
|
133
|
+
name: rails-controller-testing
|
134
|
+
requirement: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
type: :development
|
140
|
+
prerelease: false
|
141
|
+
version_requirements: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
132
146
|
- !ruby/object:Gem::Dependency
|
133
147
|
name: factory_girl_rails
|
134
148
|
requirement: !ruby/object:Gem::Requirement
|