formize 0.0.17 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -83,7 +83,7 @@ or:
83
83
  =formize_form :lines
84
84
 
85
85
 
86
- == Contributing to Formize http://travis-ci.org/burisu/formize.png
86
+ == Contributing to Formize {<img src="https://secure.travis-ci.org/burisu/formize.png"/>}[http://travis-ci.org/burisu/formize]
87
87
 
88
88
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
89
89
  * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.17
1
+ 0.0.18
@@ -191,18 +191,24 @@ var Formize = {};
191
191
 
192
192
  Formize.refreshDependents = function (event) {
193
193
  var element = $(this);
194
- var dependents = element.attr('data-dependents');
195
194
  var params = {};
196
195
  if (element.val() !== null && element.val() !== undefined) {
197
- params[element.attr('id')] = element.val();
196
+ var dependents = element.attr('data-dependents');
197
+ var paramName = element.attr('data-parameter-name') || element.attr('id') || 'value';
198
+ params[paramName] = element.val();
198
199
  $(dependents).each(function(index, item) {
199
200
  // Replaces element
200
201
  var url = $(item).attr('data-refresh');
202
+ var mode = $(item).attr('data-refresh-mode') || 'replace';
201
203
  if (url !== null) {
202
204
  $.ajax(url, {
203
205
  data: params,
204
206
  success: function(data, textStatus, response) {
205
- $(item).replaceWith(response.responseText);
207
+ if (mode == 'update') {
208
+ $(item).html(response.responseText);
209
+ } else {
210
+ $(item).replaceWith(response.responseText);
211
+ }
206
212
  },
207
213
  error: function(jqXHR, textStatus, errorThrown) {
208
214
  alert("FAILURE (Error "+textStatus+"): "+errorThrown);
@@ -135,18 +135,24 @@ var Formize = {};
135
135
 
136
136
  Formize.refreshDependents = function (event) {
137
137
  var element = $(this);
138
- var dependents = element.attr('data-dependents');
139
138
  var params = {};
140
139
  if (element.val() !== null && element.val() !== undefined) {
141
- params[element.attr('id')] = element.val();
140
+ var dependents = element.attr('data-dependents');
141
+ var paramName = element.attr('data-parameter-name') || element.attr('id') || 'value';
142
+ params[paramName] = element.val();
142
143
  $(dependents).each(function(index, item) {
143
144
  // Replaces element
144
145
  var url = $(item).attr('data-refresh');
146
+ var mode = $(item).attr('data-refresh-mode') || 'replace';
145
147
  if (url !== null) {
146
148
  $.ajax(url, {
147
149
  data: params,
148
150
  success: function(data, textStatus, response) {
149
- $(item).replaceWith(response.responseText);
151
+ if (mode == 'update') {
152
+ $(item).html(response.responseText);
153
+ } else {
154
+ $(item).replaceWith(response.responseText);
155
+ }
150
156
  },
151
157
  error: function(jqXHR, textStatus, errorThrown) {
152
158
  alert("FAILURE (Error "+textStatus+"): "+errorThrown);
@@ -92,7 +92,7 @@ module Formize
92
92
  html = ""
93
93
  html << hidden_field(object_name, method)
94
94
  html << tag(:input, :type=>:text, "data-datepicker"=>"#{object_name}_#{method}", "data-date-format"=>format, :value=>localized_value, "data-locale"=>::I18n.locale, :size=>options.delete(:size)||10)
95
- return html
95
+ return html.html_safe
96
96
  end
97
97
 
98
98
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.18
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-16 00:00:00.000000000Z
12
+ date: 2011-09-18 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &19944640 !ruby/object:Gem::Requirement
16
+ requirement: &14170620 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '3'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *19944640
24
+ version_requirements: *14170620
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: jquery-rails
27
- requirement: &19942320 !ruby/object:Gem::Requirement
27
+ requirement: &14169920 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *19942320
35
+ version_requirements: *14169920
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: fastercsv
38
- requirement: &19940700 !ruby/object:Gem::Requirement
38
+ requirement: &14169240 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *19940700
46
+ version_requirements: *14169240
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jeweler
49
- requirement: &19939820 !ruby/object:Gem::Requirement
49
+ requirement: &14168460 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.6.4
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *19939820
57
+ version_requirements: *14168460
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rcov
60
- requirement: &19939180 !ruby/object:Gem::Requirement
60
+ requirement: &14167860 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *19939180
68
+ version_requirements: *14167860
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rdoc
71
- requirement: &19938520 !ruby/object:Gem::Requirement
71
+ requirement: &14167300 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: 2.4.2
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *19938520
79
+ version_requirements: *14167300
80
80
  description: Like simple_form or formtastic, it aims to handle easily forms but taking
81
81
  in account AJAX and HTML5 on depending fields mainly.
82
82
  email: brice.texier@ekylibre.org
@@ -209,7 +209,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
209
209
  version: '0'
210
210
  segments:
211
211
  - 0
212
- hash: 4502632806187008995
212
+ hash: -2578488485569496795
213
213
  required_rubygems_version: !ruby/object:Gem::Requirement
214
214
  none: false
215
215
  requirements:
@@ -218,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
218
218
  version: '0'
219
219
  requirements: []
220
220
  rubyforge_project:
221
- rubygems_version: 1.8.7
221
+ rubygems_version: 1.8.10
222
222
  signing_key:
223
223
  specification_version: 3
224
224
  summary: Simple form DSL with dynamic interactions for Rails