inline_forms 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/controllers/inline_forms_controller.rb +3 -3
- data/app/helpers/form_elements/dropdown.rb +2 -2
- data/app/helpers/form_elements/dropdown_with_integers.rb +2 -2
- data/app/helpers/form_elements/dropdown_with_values.rb +2 -2
- data/app/helpers/form_elements/image.rb +1 -1
- data/app/helpers/form_elements/scale_with_integers.rb +2 -2
- data/app/helpers/form_elements/scale_with_values.rb +2 -2
- data/app/views/inline_forms/_show.html.erb +2 -0
- data/inline_forms.gemspec +2 -2
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.5
|
@@ -90,13 +90,13 @@ class InlineFormsController < ApplicationController
|
|
90
90
|
@update_span = params[:update]
|
91
91
|
# update each field of the record
|
92
92
|
attributes = object.inline_forms_attribute_list
|
93
|
-
attributes.each do |
|
93
|
+
attributes.each do | attribute, name, form_element |
|
94
94
|
send("#{form_element.to_s}_update", object, attribute) unless form_element == :associated
|
95
95
|
end
|
96
96
|
if object.save
|
97
|
-
flash.now[:success] = "Successfully created #{object.class.to_s.
|
97
|
+
flash.now[:success] = "Successfully created #{object.class.to_s.underscore}."
|
98
98
|
else
|
99
|
-
flash.now[:error] = "Failed to create #{object.class.to_s.
|
99
|
+
flash.now[:error] = "Failed to create #{object.class.to_s.underscore}."
|
100
100
|
end
|
101
101
|
@parent_class = params[:parent_class]
|
102
102
|
if @parent_class.nil?
|
@@ -10,10 +10,10 @@ def dropdown_edit(object, attribute)
|
|
10
10
|
object.send('build_' + attribute.to_s) unless object.send(attribute)
|
11
11
|
values = object.send(attribute).class.name.constantize.find(:all) # TODO bring order!
|
12
12
|
# the leading underscore is to avoid name conflicts, like 'email' and 'email_type' will result in 'email' and 'email[email_type_id]' in the form!
|
13
|
-
collection_select( ('_' + object.class.to_s.
|
13
|
+
collection_select( ('_' + object.class.to_s.underscore).to_sym, attribute.to_s.foreign_key.to_sym, values, 'id', '_presentation', :selected => object.send(attribute).id)
|
14
14
|
end
|
15
15
|
|
16
16
|
def dropdown_update(object, attribute)
|
17
|
-
object[attribute.to_s.foreign_key.to_sym] = params[('_' + object.class.to_s.
|
17
|
+
object[attribute.to_s.foreign_key.to_sym] = params[('_' + object.class.to_s.underscore).to_sym][attribute.to_s.foreign_key.to_sym]
|
18
18
|
end
|
19
19
|
|
@@ -12,9 +12,9 @@ end
|
|
12
12
|
def dropdown_with_integers_edit(object, attribute)
|
13
13
|
# the leading underscore is to avoid name conflicts, like 'email' and 'email_type' will result in 'email' and 'email[email_type_id]' in the form!
|
14
14
|
values = attribute_values(object, attribute)
|
15
|
-
collection_select( ('_' + object.class.to_s.
|
15
|
+
collection_select( ('_' + object.class.to_s.underscore).to_sym, attribute.to_sym, values, 'first', 'last', :selected => object.send(attribute))
|
16
16
|
end
|
17
17
|
|
18
18
|
def dropdown_with_integers_update(object, attribute)
|
19
|
-
object[attribute.to_sym] = params[('_' + object.class.to_s.
|
19
|
+
object[attribute.to_sym] = params[('_' + object.class.to_s.underscore).to_sym][attribute.to_sym]
|
20
20
|
end
|
@@ -8,9 +8,9 @@ end
|
|
8
8
|
def dropdown_with_values_edit(object, attribute)
|
9
9
|
# the leading underscore is to avoid name conflicts, like 'email' and 'email_type' will result in 'email' and 'email[email_type_id]' in the form!
|
10
10
|
values = attribute_values(object, attribute)
|
11
|
-
collection_select( ('_' + object.class.to_s.
|
11
|
+
collection_select( ('_' + object.class.to_s.underscore).to_sym, attribute.to_sym, values, 'first', 'last', :selected => object.send(attribute))
|
12
12
|
end
|
13
13
|
def dropdown_with_values_update(object, attribute)
|
14
|
-
object[attribute.to_sym] = params[('_' + object.class.to_s.
|
14
|
+
object[attribute.to_sym] = params[('_' + object.class.to_s.underscore).to_sym][attribute.to_sym]
|
15
15
|
end
|
16
16
|
|
@@ -13,10 +13,10 @@ end
|
|
13
13
|
def scale_with_integers_edit(object, attribute)
|
14
14
|
# the leading underscore is to avoid name conflicts, like 'email' and 'email_type' will result in 'email' and 'email[email_type_id]' in the form!
|
15
15
|
values = attribute_values(object, attribute)
|
16
|
-
collection_select( ('_' + object.class.to_s.
|
16
|
+
collection_select( ('_' + object.class.to_s.underscore).to_sym, attribute.to_sym, values, 'first', 'last', :selected => object.send(attribute))
|
17
17
|
end
|
18
18
|
|
19
19
|
def scale_with_integers_update(object, attribute)
|
20
|
-
object[attribute.to_sym] = params[('_' + object.class.to_s.
|
20
|
+
object[attribute.to_sym] = params[('_' + object.class.to_s.underscore).to_sym][attribute.to_sym]
|
21
21
|
end
|
22
22
|
|
@@ -12,10 +12,10 @@ end
|
|
12
12
|
def scale_with_values_edit(object, attribute)
|
13
13
|
# the leading underscore is to avoid name conflicts, like 'email' and 'email_type' will result in 'email' and 'email[email_type_id]' in the form!
|
14
14
|
values = attribute_values(object, attribute)
|
15
|
-
collection_select( ('_' + object.class.to_s.
|
15
|
+
collection_select( ('_' + object.class.to_s.underscore).to_sym, attribute.to_sym, values, 'first', 'last', :selected => object.send(attribute))
|
16
16
|
end
|
17
17
|
|
18
18
|
def scale_with_values_update(object, attribute)
|
19
|
-
object[attribute.to_sym] = params[('_' + object.class.to_s.
|
19
|
+
object[attribute.to_sym] = params[('_' + object.class.to_s.underscore).to_sym][attribute.to_sym]
|
20
20
|
end
|
21
21
|
|
@@ -24,11 +24,13 @@
|
|
24
24
|
<div class='<%= "attribute_value attribute_#{attribute} form_element_#{form_element}" -%>' >
|
25
25
|
<span id="<%= css_class_id -%>" >
|
26
26
|
<% if form_element == :associated -%>
|
27
|
+
<% logger.info 'aso' %>
|
27
28
|
<%= render :partial => "inline_forms/list",
|
28
29
|
:locals => { :parent_class => @object.class,
|
29
30
|
:parent_id => @object.id,
|
30
31
|
:attribute => attribute } %>
|
31
32
|
<% else -%>
|
33
|
+
<% logger.info 'noaso' %>
|
32
34
|
<%= send("#{form_element}_show", @object, attribute) -%>
|
33
35
|
<% end -%>
|
34
36
|
</span>
|
data/inline_forms.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{inline_forms}
|
8
|
-
s.version = "0.9.
|
8
|
+
s.version = "0.9.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ace Suares"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-04-23}
|
13
13
|
s.description = %q{Inline Forms aims to ease the setup of forms that provide inline editing. The field list can be specified in the model.}
|
14
14
|
s.email = %q{ace@suares.an}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inline_forms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 49
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 5
|
10
|
+
version: 0.9.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ace Suares
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-04-23 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|