inline_forms 0.6.5 → 0.7.0
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.
- data/VERSION +1 -1
- data/app/controllers/inline_forms_controller.rb +4 -1
- data/app/helpers/form_elements/image.rb +13 -0
- data/app/helpers/inline_forms_helper.rb +12 -0
- data/app/views/inline_forms/_index.html.erb +1 -0
- data/app/views/inline_forms/index.html.erb +1 -0
- data/app/views/layouts/inline_forms.rhtml +1 -1
- data/inline_forms.gemspec +3 -2
- metadata +6 -5
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.7.0
|
|
@@ -21,7 +21,9 @@ class InlineFormsController < ApplicationController
|
|
|
21
21
|
# GET /examples
|
|
22
22
|
#
|
|
23
23
|
def index
|
|
24
|
-
|
|
24
|
+
#@objects = @Klass.all
|
|
25
|
+
@objects = @Klass.paginate :page => params[:page], :order => 'created_at DESC'
|
|
26
|
+
|
|
25
27
|
update_span = params[:update]
|
|
26
28
|
respond_to do |format|
|
|
27
29
|
# found this here: http://www.ruby-forum.com/topic/211467
|
|
@@ -96,6 +98,7 @@ class InlineFormsController < ApplicationController
|
|
|
96
98
|
@values = params[:values]
|
|
97
99
|
@sub_id = params[:sub_id]
|
|
98
100
|
@update_span = params[:update]
|
|
101
|
+
@values = params[@Klass.to_s.downcase][@field.to_sym]
|
|
99
102
|
send("#{@form_element.to_s}_update", @object, @field, @values)
|
|
100
103
|
@object.save
|
|
101
104
|
respond_to do |format|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module InlineFormsHelper
|
|
2
|
+
InlineForms::SPECIAL_MIGRATION_TYPES[:image]=:image
|
|
3
|
+
# image via paperclip
|
|
4
|
+
def image_show(object, attribute, values)
|
|
5
|
+
link_to_inline_image_edit object, attribute
|
|
6
|
+
end
|
|
7
|
+
def image_edit(object, attribute, values)
|
|
8
|
+
file_field object.class.to_s.downcase, attribute
|
|
9
|
+
end
|
|
10
|
+
def image_update(object, attribute, values)
|
|
11
|
+
object.send(attribute+'=',values)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -88,6 +88,18 @@ module InlineFormsHelper
|
|
|
88
88
|
:update => 'field_' + attribute.to_s + '_' + object.id.to_s ),
|
|
89
89
|
:remote => true
|
|
90
90
|
end
|
|
91
|
+
|
|
92
|
+
def link_to_inline_image_edit(object, attribute)
|
|
93
|
+
text= image_tag object.send(attribute.to_s).send('url', :thumb)
|
|
94
|
+
|
|
95
|
+
link_to text, send('edit_' + @Klass.to_s.underscore + '_path',
|
|
96
|
+
object,
|
|
97
|
+
:field => attribute.to_s,
|
|
98
|
+
:form_element => calling_method.sub(/_[a-z]+$/,''),
|
|
99
|
+
:update => 'field_' + attribute.to_s + '_' + object.id.to_s ),
|
|
100
|
+
:remote => true
|
|
101
|
+
end
|
|
102
|
+
|
|
91
103
|
end
|
|
92
104
|
|
|
93
105
|
# make the current method and the calling method available
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<title><%= h(yield(:title) || "xyxyxyx") %></title>
|
|
6
6
|
<%= csrf_meta_tag %>
|
|
7
7
|
<%= stylesheet_link_tag 'inline_forms' %>
|
|
8
|
-
<%= javascript_include_tag :defaults %>
|
|
8
|
+
<%= javascript_include_tag :defaults, 'jquery.form', 'jquery.remotipart' %>
|
|
9
9
|
<%= yield(:head) %>
|
|
10
10
|
</head>
|
|
11
11
|
<%#= calendar_date_select_includes "red" %>
|
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.
|
|
8
|
+
s.version = "0.7.0"
|
|
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-02-
|
|
12
|
+
s.date = %q{2011-02-28}
|
|
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 = [
|
|
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
|
|
|
32
32
|
"app/helpers/form_elements/dropdown.rb",
|
|
33
33
|
"app/helpers/form_elements/dropdown_with_values.rb",
|
|
34
34
|
"app/helpers/form_elements/geo_code_curacao.rb",
|
|
35
|
+
"app/helpers/form_elements/image.rb",
|
|
35
36
|
"app/helpers/form_elements/range.rb",
|
|
36
37
|
"app/helpers/form_elements/text_area.rb",
|
|
37
38
|
"app/helpers/form_elements/text_field.rb",
|
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: 3
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
version: 0.
|
|
8
|
+
- 7
|
|
9
|
+
- 0
|
|
10
|
+
version: 0.7.0
|
|
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-02-
|
|
18
|
+
date: 2011-02-28 00:00:00 -04:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|
|
@@ -103,6 +103,7 @@ files:
|
|
|
103
103
|
- app/helpers/form_elements/dropdown.rb
|
|
104
104
|
- app/helpers/form_elements/dropdown_with_values.rb
|
|
105
105
|
- app/helpers/form_elements/geo_code_curacao.rb
|
|
106
|
+
- app/helpers/form_elements/image.rb
|
|
106
107
|
- app/helpers/form_elements/range.rb
|
|
107
108
|
- app/helpers/form_elements/text_area.rb
|
|
108
109
|
- app/helpers/form_elements/text_field.rb
|