inline_forms 1.0.15 → 1.0.16
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.
@@ -192,6 +192,7 @@ class InlineFormsController < ApplicationController
|
|
192
192
|
end
|
193
193
|
|
194
194
|
def destroy
|
195
|
+
@update_span = params[:update]
|
195
196
|
@object = @Klass.find(params[:id])
|
196
197
|
@object.destroy
|
197
198
|
respond_to do |format|
|
@@ -199,6 +200,25 @@ class InlineFormsController < ApplicationController
|
|
199
200
|
end
|
200
201
|
end
|
201
202
|
|
203
|
+
def revert
|
204
|
+
# http://railscasts.com/episodes/255-undo-with-paper-trail
|
205
|
+
@update_span = params[:update]
|
206
|
+
@version = Version.find(params[:id])
|
207
|
+
@version.reify.save!
|
208
|
+
@object = @Klass.find(@version.item_id)
|
209
|
+
respond_to do |format|
|
210
|
+
format.js { render :close }
|
211
|
+
end
|
212
|
+
|
213
|
+
# if @version.reify
|
214
|
+
# @version.reify.save!
|
215
|
+
# else
|
216
|
+
# @version.item.destroy
|
217
|
+
# end
|
218
|
+
# link_name = params[:redo] == "true" ? "undo" : "redo"
|
219
|
+
# link = view_context.link_to(link_name, revert_version_path(@version.next, :redo => !params[:redo]), :method => :post)
|
220
|
+
# redirect_to :back, :notice => "Undid #{@version.event}. #{link}"
|
221
|
+
end
|
202
222
|
|
203
223
|
private
|
204
224
|
# Get the class from the controller name.
|
@@ -24,17 +24,23 @@ module InlineFormsHelper
|
|
24
24
|
# destroy link
|
25
25
|
def link_to_destroy( msg, object, update_span )
|
26
26
|
if cancan_disabled? || ( can? :destroy, object )
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
27
|
+
link_to image_tag( 'trash.png',
|
28
|
+
:class => "trash_icon",
|
29
|
+
:title => 'trash' ),
|
30
|
+
send( object.class.to_s.underscore + '_path',
|
31
|
+
object,
|
32
|
+
:update => update_span ),
|
33
|
+
:method => :delete,
|
34
|
+
:remote => true
|
35
|
+
end
|
35
36
|
end
|
37
|
+
|
38
|
+
def link_to_undo_destroy(msg, object, update_span )
|
39
|
+
link_to("undo", revert_version_path(object.versions.scoped.last), :method => :post)
|
36
40
|
end
|
37
41
|
|
42
|
+
|
43
|
+
|
38
44
|
# link_to_inline_edit
|
39
45
|
def link_to_inline_edit(object, attribute, attribute_value='')
|
40
46
|
attribute_value = h(attribute_value)
|
@@ -1 +1 @@
|
|
1
|
-
$('#<%= @update_span %>').html('<%= escape_javascript(
|
1
|
+
$('#<%= @update_span %>').html('<%= escape_javascript(render(:partial => 'inline_forms/close' ))%>')
|
@@ -1 +1 @@
|
|
1
|
-
$('#<%= @update_span %>').html('<%= escape_javascript(
|
1
|
+
$('#<%= @update_span %>').html('<%= escape_javascript(link_to 'undo', send('revert_' + @object.class.to_s.underscore + "_path", @object.versions.scoped.last, :update => @update_span), :remote => true, :method => :post)%>')
|
data/lib/inline_forms/version.rb
CHANGED
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: 55
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 16
|
10
|
+
version: 1.0.16
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ace Suares
|
@@ -161,6 +161,7 @@ files:
|
|
161
161
|
- app/helpers/form_elements/text_field.rb
|
162
162
|
- app/helpers/inline_forms_helper.rb
|
163
163
|
- app/models/geo_code_curacao.rb
|
164
|
+
- app/views/_close.html.erb
|
164
165
|
- app/views/inline_forms/_edit.html.erb
|
165
166
|
- app/views/inline_forms/_header.html.erb
|
166
167
|
- app/views/inline_forms/_list.html.erb
|