dynaspan 0.0.7 → 0.0.8

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: 50cc54aff7feafb72ee47120cf69fd7fef487184
4
- data.tar.gz: 958e7bed78526b02eb04564d2ed3a38a20b5882c
3
+ metadata.gz: 1019cf38fd7e1d2eb0cfa56fb22404bedca8b65e
4
+ data.tar.gz: 6ebc3ca05907ed90ce486a744ac1120e21ac1e11
5
5
  SHA512:
6
- metadata.gz: 9ad0569db146c7b183b9884f0347d9c4088ba5e9bb9262a27e889732fc814bb74c013e07c578354deca02bb15039668c85e83b42945f18174a67bbc69c007b3d
7
- data.tar.gz: bc424e98e28c85f82615f38f6cc3cd5badf78952e0173f03b94d3b5686f4351fd1b179541f36733a018c0bf86338ece63d15b4fed47003b7a4d0f9809871bd02
6
+ metadata.gz: b773f546b093324d1259e15c859b2084c70232ae58eb9487ad472dc5de5d0e5f227413de6b7e355a885c0b27d5e2046e4e3e7921565656c585ab74fa8b6629bd
7
+ data.tar.gz: 4aee57e7c6e147fd4d0890007c8b2cef73f05b35b82f308cb45c36e7aad487693586f46f8846ad6565a550140bf2202fe0f1e3cf8fdc6e85ae78fbfdb23b12f8
data/README.md CHANGED
@@ -50,8 +50,7 @@ That class is "ds-content-present". The purpose of this class is to allow CSS c
50
50
  whether your text exists or not. The '[edit]' text you can use as a parameter normally drops below the input
51
51
  box. If you don't want it to drop you can style it with the proper CSS selector for content present. E.G.
52
52
  `.ds-content-present > dyna-span-edit-text { margin-top:-18px; }` You can set the height to whatever your input
53
- field height is to maintain the position of the edit text. With jQuery you can also set style for
54
- hidden and visible changes.
53
+ field height is to maintain the position of the edit text.
55
54
 
56
55
  In version 0.0.7 I've added a class to the parent div object for when the text field dialog is open. The class
57
56
  is "ds-dialog-open". This is also to use in CSS styles. This feature was added since CSS doesn't support
@@ -67,6 +66,22 @@ calling parents with selectors. Example usage:
67
66
  }
68
67
  ```
69
68
 
69
+ ###What's New
70
+
71
+ ####Version 0.0.8
72
+
73
+ You can now provide an option hash as a last parameter. Current
74
+ valid options only include:
75
+
76
+ {
77
+ hidden_fields: { label: "value" }
78
+ }
79
+
80
+ You can add as many hidden fields to your Dynaspan objects as you'd like.
81
+
82
+ Also the id parameter will only be passed to the server if it exists. (No more empty
83
+ string for id.) This allows you to create "new" polymorphic child objects with Dynaspan.
84
+
70
85
  ###License
71
86
 
72
87
  The MIT License (MIT)
@@ -27,6 +27,8 @@ module Dynaspan
27
27
  else
28
28
  raise 'You did not provide a symbol for the form field.'
29
29
  end
30
+ edit_text = nil unless edit_text.is_a? String
31
+ options = (parameters[-1].is_a?(Hash) ? parameters[-1] : {})
30
32
  render(
31
33
  partial: "dynaspan/dynaspan_text_#{kind}",
32
34
  locals: {
@@ -34,7 +36,8 @@ module Dynaspan
34
36
  attr_object: attr_object,
35
37
  attrib: attrib,
36
38
  unique_ref_id: dynaspan_counter,
37
- dyna_span_edit_text: edit_text
39
+ dyna_span_edit_text: edit_text,
40
+ hidden_fields: options[:hidden_fields]
38
41
  }
39
42
  )
40
43
  end
@@ -5,7 +5,10 @@
5
5
  <%= form_for(master_ds_object, method: :patch, remote: true, authenticity_token: true) do |f| %>
6
6
  <% if master_ds_object.nested_attributes_options.keys.any? {|i| i.to_s.=~(/#{attr_object.class.try(:model_name).try(:i18n_key).to_s}/) || i.to_s.=~(/#{attr_object.class.try(:table_name)}/) } and !attr_object.nil? %>
7
7
  <%= f.fields_for master_ds_object.nested_attributes_options.keys.select {|i| i.to_s.=~(/#{attr_object.class.model_name.i18n_key.to_s}/) || i.to_s.=~(/#{attr_object.class.table_name}/) }.first, attr_object do |a|%>
8
- <%= a.hidden_field :id, value: attr_object.id %>
8
+ <%= a.hidden_field(:id, value: attr_object.id) if attr_object.id.present? %>
9
+ <% hidden_fields.each do |hkey, hval| %>
10
+ <%= a.hidden_field hkey.to_sym, value: hval %>
11
+ <% end if hidden_fields %>
9
12
  <%= a.text_area attrib, id: "dyna_span_field_val_#{unique_ref_id}", class: 'dyna-span form-control dyna-span-input', onfocus: "$().dynaspan.upLast('#{unique_ref_id}');", onblur: "$().dynaspan.upHide('#{unique_ref_id}');" %>
10
13
  <% end %>
11
14
  <% else %>
@@ -5,7 +5,10 @@
5
5
  <%= form_for(master_ds_object, method: :patch, remote: true, authenticity_token: true) do |f| %>
6
6
  <% if master_ds_object.nested_attributes_options.keys.any? {|i| i.to_s.=~(/#{attr_object.class.try(:model_name).try(:i18n_key).to_s}/) || i.to_s.=~(/#{attr_object.class.try(:table_name)}/) } and !attr_object.nil? %>
7
7
  <%= f.fields_for master_ds_object.nested_attributes_options.keys.select {|i| i.to_s.=~(/#{attr_object.class.model_name.i18n_key.to_s}/) || i.to_s.=~(/#{attr_object.class.table_name}/) }.first, attr_object do |a|%>
8
- <%= a.hidden_field :id, value: attr_object.id %>
8
+ <%= a.hidden_field(:id, value: attr_object.id) if attr_object.id.present? %>
9
+ <% hidden_fields.each do |hkey, hval| %>
10
+ <%= a.hidden_field hkey.to_sym, value: hval %>
11
+ <% end if hidden_fields %>
9
12
  <%= a.text_field attrib, id: "dyna_span_field_val_#{unique_ref_id}", class: 'dyna-span form-control dyna-span-input', onfocus: "$().dynaspan.upLast('#{unique_ref_id}');", onblur: "$().dynaspan.upHide('#{unique_ref_id}');" %>
10
13
  <% end %>
11
14
  <% else %>
@@ -1,3 +1,3 @@
1
1
  module Dynaspan
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynaspan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel P. Clark
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-22 00:00:00.000000000 Z
11
+ date: 2014-12-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: In place text editing with AJAX substituting text to input field.
14
14
  email:
@@ -56,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  version: '0'
57
57
  requirements: []
58
58
  rubyforge_project:
59
- rubygems_version: 2.3.0
59
+ rubygems_version: 2.4.5
60
60
  signing_key:
61
61
  specification_version: 4
62
62
  summary: Text to AJAX editing in place.