hydra-editor 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 04c5fb944277294ad7c68f7c47000c80618df2e5
4
- data.tar.gz: fdd50431f94480d6b0478bb8baf61023a7008607
3
+ metadata.gz: eeed336d625411d0c07f9d84ff6b2359410cd215
4
+ data.tar.gz: afde272d3a78787077f23555cdae1ece97bca230
5
5
  SHA512:
6
- metadata.gz: 41c5f95fb5063b9a9bf5104f687e922dbecb503401446d40a828c3463edb8728d464c58066e56a8b42f4bb723c698b2718b6064d31ec79c69d26783579f3973d
7
- data.tar.gz: 4a689b42e096053eb2a4897c0c826206b1cda8deb3c3d8b5829ce4547f6346a5d29342d9c346d29e8f08a8cc83b16ba93f40677ae53371d45d1112ec7c5a2ceb
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.multiple?(field)
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.unique?(field)
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)
@@ -1,3 +1,3 @@
1
1
  module HydraEditor
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
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.2
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-03-11 00:00:00.000000000 Z
12
+ date: 2015-04-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails