hydra-editor 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +5 -0
- data/README.md +5 -4
- data/app/forms/hydra_editor/form.rb +6 -0
- data/app/presenters/hydra/presenter.rb +10 -2
- data/lib/hydra_editor/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eeed336d625411d0c07f9d84ff6b2359410cd215
|
4
|
+
data.tar.gz: afde272d3a78787077f23555cdae1ece97bca230
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd2d650f3a1854d7e8d579f202f9bdf59c82e12cae6c277960d0954e9cf191c6d7557c59fe49b73a92594e4284f979cace91676ef170a93116191984f318f194
|
7
|
+
data.tar.gz: f0dacfad4569aca4a8fcc37305fae3a605ecd979eba9b953d2c4dc0c3b7cf20b9242fb1cf428e66bf91dd3cabfe21ee65d3fa0fb16e70bf9bdc571b12f5c2e25
|
data/History.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# History of hydra-editor releases
|
2
2
|
|
3
|
+
## 1.0.3
|
4
|
+
* 2015-04-02: Updated README with info on how to set form labels [val99erie]
|
5
|
+
* 2015-03-30: Add documentation to Form#model_attributes. (ci skip) [Justin Coyne]
|
6
|
+
* 2015-03-30: Presenter should be able to know the cardinality of associations [Justin Coyne]
|
7
|
+
|
3
8
|
## 1.0.2
|
4
9
|
* Update javascript to be more selective about which fields cause an error when blank
|
5
10
|
|
data/README.md
CHANGED
@@ -29,14 +29,15 @@ You can customize the names of your fields/models by adding to your translation
|
|
29
29
|
en:
|
30
30
|
hydra_editor:
|
31
31
|
form:
|
32
|
-
field_label:
|
33
|
-
source2: "Alternate Source"
|
34
|
-
dateCreated: "Date Created"
|
35
|
-
dateAvailable: "Date Available"
|
36
32
|
model_label:
|
37
33
|
PdfModel: "PDF"
|
38
34
|
RecordedAudio: "audio"
|
39
35
|
|
36
|
+
simple_form:
|
37
|
+
labels:
|
38
|
+
image:
|
39
|
+
dateCreated: "Date Created"
|
40
|
+
sub_location: "Holding Sub-location"
|
40
41
|
```
|
41
42
|
|
42
43
|
Create a form object for each of your models.
|
@@ -45,6 +45,12 @@ module HydraEditor
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
+
# Return a hash of all the parameters from the form as a hash.
|
49
|
+
# This is typically used by the controller as the main read interface to the form.
|
50
|
+
# This hash can then be used to create or update an object in the data store.
|
51
|
+
# example:
|
52
|
+
# ImageForm.model_attributes(params[:image])
|
53
|
+
# # => { title: 'My new image' }
|
48
54
|
def model_attributes(form_params)
|
49
55
|
clean_params = sanitize_params(form_params)
|
50
56
|
terms.each do |key|
|
@@ -53,11 +53,19 @@ module Hydra
|
|
53
53
|
|
54
54
|
module ClassMethods
|
55
55
|
def multiple?(field)
|
56
|
-
model_class.
|
56
|
+
if reflection = model_class.reflect_on_association(field)
|
57
|
+
reflection.collection?
|
58
|
+
else
|
59
|
+
model_class.multiple?(field)
|
60
|
+
end
|
57
61
|
end
|
58
62
|
|
59
63
|
def unique?(field)
|
60
|
-
model_class.
|
64
|
+
if reflection = model_class.reflect_on_association(field)
|
65
|
+
!reflection.collection?
|
66
|
+
else
|
67
|
+
model_class.unique?(field)
|
68
|
+
end
|
61
69
|
end
|
62
70
|
|
63
71
|
def terms=(terms)
|
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: 1.0.
|
4
|
+
version: 1.0.3
|
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: 2015-
|
12
|
+
date: 2015-04-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|