inline_forms 6.0.6 → 6.0.7

This diff has not been reviewed by any users.
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
- SHA1:
3
- metadata.gz: 54a5764d56a4e64abf5430fd36f3775b81948572
4
- data.tar.gz: 8905f7da726c3130ad6b2be767447b6570e4a48d
2
+ SHA256:
3
+ metadata.gz: e7267f675ac24a67ee56986b7d2f85500b1f194ee15f395a87b076b4f5a7a7aa
4
+ data.tar.gz: 8d7a638344ccbb689a0acee88b87c12a6121823cc23753ee8c02d943366ccc60
5
5
  SHA512:
6
- metadata.gz: 73efb75e7a5b9ca0d63925e903036201d4cbffa788dd39d81aff02ecc39ded8cdee0e5f6e5eab0754f8a37927b6b3d7169a9300fbc40c52d22c8670acf2bdde1
7
- data.tar.gz: d5fac7a763a91cb96e9be78b83a97d8976b026ff8e38c6ead30c5acd680fa58ef2248a6011d1b600ecdd12b7e69e9b7171e680891baefcefb39a1849d6888e4b
6
+ metadata.gz: 4e4cb6691bf8ce4eb74ea1b598fa6c83c5a7bbd115ae5f40a5f51b24ad82be7567f26fb36db7c61d41383b9d9c42b3bc141a571f90e5b3baabbfa762c749d269
7
+ data.tar.gz: 426095cd3c2fb78a117e90a0743bbd8723f4e735249b8fd1af15ec221b10edb3e8fe923f26794e4e9aeef9323b8d727d2d1fd11c63986e99f6d1a588c2c6c231
@@ -180,29 +180,41 @@ class InlineFormsController < ApplicationController
180
180
  end
181
181
  end
182
182
 
183
- # :destroy destroys the record, but also shows an undo link (with paper_trail)
183
+ # :soft_delete
184
+ def soft_delete
185
+ @update_span = params[:update]
186
+ @object = referenced_object
187
+ # destroy the object
188
+ @object.soft_delete(current_user)
189
+ respond_to do |format|
190
+ format.html { } unless @Klass.not_accessible_through_html?
191
+ format.js { render :close }
192
+ end
193
+ end
194
+
195
+ # :soft_restore
196
+ def soft_restore
197
+ @update_span = params[:update]
198
+ @object = referenced_object
199
+ # restore the object
200
+ @object.soft_restore
201
+ respond_to do |format|
202
+ format.html { } unless @Klass.not_accessible_through_html?
203
+ format.js { render :close }
204
+ end
205
+ end
206
+
207
+ # :destroy destroys the record. There is no undo!
184
208
  def destroy
185
209
  @update_span = params[:update]
186
210
  @object = referenced_object
187
211
  if current_user.role? :superadmin
188
- if (@object.soft_deletable? rescue false)
189
- @object.soft_delete(current_user)
190
- respond_to do |format|
191
- format.html { } unless @Klass.not_accessible_through_html?
192
- format.js { render :close }
193
- end
194
- elsif
195
- @object.destroy
196
- respond_to do |format|
197
- format.html { } unless @Klass.not_accessible_through_html?
198
- format.js { render :show_undo }
199
- end
200
- end
201
- elsif (@object.soft_deletable? rescue false)
202
- @object.soft_delete(current_user)
212
+ # destroy the object
213
+ @undo_object = @object.versions.last
214
+ @object.destroy
203
215
  respond_to do |format|
204
216
  format.html { } unless @Klass.not_accessible_through_html?
205
- format.js { render :close }
217
+ format.js { render :record_destroyed }
206
218
  end
207
219
  end
208
220
  end
@@ -211,27 +223,12 @@ class InlineFormsController < ApplicationController
211
223
  # Thanks Ryan Bates: http://railscasts.com/episodes/255-undo-with-paper-trail
212
224
  def revert
213
225
  @update_span = params[:update]
226
+ @object = referenced_object
214
227
  if current_user.role? :superadmin
215
- if (@object.soft_deletable? rescue false)
216
- @object = referenced_object
217
- @object.soft_restore
218
- respond_to do |format|
219
- format.html { } unless @Klass.not_accessible_through_html?
220
- format.js { render :close }
221
- end
222
- elsif
223
- @version = PaperTrail::Version.find(params[:id])
224
- @version.reify.save!
225
- @object = @Klass.find(@version.item_id)
226
- authorize!(:revert, @object) if cancan_enabled?
227
- respond_to do |format|
228
- format.html { } unless @Klass.not_accessible_through_html?
229
- format.js { render :close }
230
- end
231
- end
232
- elsif (@object.soft_deletable? rescue false)
233
- @object = referenced_object
234
- @object.soft_restore
228
+ @version = PaperTrail::Version.find(params[:id])
229
+ @version.reify.save!
230
+ @object = @Klass.find(@version.item_id)
231
+ authorize!(:revert, @object) if cancan_enabled?
235
232
  respond_to do |format|
236
233
  format.html { } unless @Klass.not_accessible_through_html?
237
234
  format.js { render :close }
@@ -30,37 +30,44 @@ module InlineFormsHelper
30
30
  :title => t('inline_forms.view.close')
31
31
  end
32
32
 
33
- # destroy link
34
- def link_to_destroy( object, update_span )
35
- if current_user.role? :superadmin
36
- if cancan_disabled? || ( can? :delete, object )
37
- link_to "<i class='fi-trash'></i>".html_safe,
38
- send( object.class.to_s.underscore + '_path',
39
- object,
40
- :update => update_span ),
41
- :method => :delete,
42
- :remote => true,
43
- :title => t('inline_forms.view.trash')
44
- end
45
- elsif (object.class.safe_deletable? rescue false)
46
- if object.deleted? && (cancan_disabled? || ( can? :revert, object ))
47
- link_to "undelete".html_safe,
48
- send( 'revert_' + object.class.to_s.underscore + '_path',
33
+ # delete link. Mind the difference between delete and destroy.
34
+ def link_to_soft_delete( object, update_span )
35
+ soft=''
36
+ if (object.soft_deletable? rescue false)
37
+ if object.deleted? && (cancan_disabled? || ( can? :soft_restore, object ))
38
+ soft = link_to "<i class='fi-refresh'></i>".html_safe,
39
+ send( 'soft_restore_' + object.class.to_s.underscore + '_path',
49
40
  object,
50
41
  :update => update_span ),
51
42
  :method => :post,
52
43
  :remote => true,
53
- :title => t('inline_forms.view.trash')
54
- elsif !object.deleted? && (cancan_disabled? || ( can? :delete, object ))
55
- link_to "<i class='fi-trash'></i>".html_safe,
56
- send( object.class.to_s.underscore + '_path',
57
- object,
58
- :update => update_span ),
59
- :method => :delete,
60
- :remote => true,
61
- :title => t('inline_forms.view.trash')
44
+ :title => t('inline_forms.view.undelete')
45
+ elsif !object.deleted? && (cancan_disabled? || ( can? :soft_delete, object ))
46
+ soft = link_to "<i class='fi-trash'></i>".html_safe,
47
+ send( 'soft_delete_' + object.class.to_s.underscore + '_path',
48
+ object,
49
+ :update => update_span ),
50
+ :method => :post,
51
+ :remote => true,
52
+ :title => t('inline_forms.view.trash')
62
53
  end
63
54
  end
55
+ soft.html_safe
56
+ end
57
+
58
+ # destroy link. Mind the difference between delete and destroy.
59
+ def link_to_destroy( object, update_span )
60
+ hard=''
61
+ if cancan_disabled? || ( can? :destroy, object )
62
+ hard = link_to "&nbsp;&nbsp;<font color='FF0000'><i class='fi-x'></i></font>".html_safe,
63
+ send( object.class.to_s.underscore + '_path',
64
+ object,
65
+ :update => update_span ),
66
+ :method => :delete,
67
+ :remote => true,
68
+ :title => t('inline_forms.view.trash')
69
+ end
70
+ hard.html_safe
64
71
  end
65
72
 
66
73
  # new link
@@ -1,5 +1,6 @@
1
- <% if cancan_disabled? || ( can? :delete, @object ) %>
1
+ <% if cancan_disabled? || ( can? :soft_delete, @object ) %>
2
2
  <div class="small-1 column">
3
+ <%= link_to_soft_delete(@object, @update_span) -%>
3
4
  <%= link_to_destroy(@object, @update_span) -%>
4
5
  </div>
5
6
  <div class="small-11 column">
@@ -53,8 +53,9 @@
53
53
  <% path_to_object = attribute.to_s.singularize.underscore + "_path" %>
54
54
  <% end %>
55
55
  <div class="row <%= cycle('odd', 'even') %><%= " top-level" if parent_class.nil? %>" id="<%= css_class_id -%>">
56
- <% if cancan_disabled? || ( can? :delete, object ) %>
56
+ <% if cancan_disabled? || ( can? :soft_delete, object ) %>
57
57
  <div class="small-1 column">
58
+ <%= link_to_soft_delete(object, css_class_id) -%>
58
59
  <%= link_to_destroy(object, css_class_id) -%>
59
60
  </div>
60
61
  <div class="small-11 column">
@@ -0,0 +1 @@
1
+ $('#<%= @update_span %>').fadeOut("slow")
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module InlineForms
3
- VERSION = "6.0.6"
3
+ VERSION = "6.0.7"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inline_forms
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.6
4
+ version: 6.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Suares
@@ -10,132 +10,132 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-06-10 00:00:00.000000000 Z
13
+ date: 2020-06-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rvm
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - '>='
19
+ - - ">="
20
20
  - !ruby/object:Gem::Version
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - '>='
26
+ - - ">="
27
27
  - !ruby/object:Gem::Version
28
28
  version: '0'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: thor
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - '>='
33
+ - - ">="
34
34
  - !ruby/object:Gem::Version
35
35
  version: '0'
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - '>='
40
+ - - ">="
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: validation_hints
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - '>='
47
+ - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0'
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - '>='
54
+ - - ">="
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: rails
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - '>='
61
+ - - ">="
62
62
  - !ruby/object:Gem::Version
63
63
  version: '6.0'
64
64
  type: :runtime
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - '>='
68
+ - - ">="
69
69
  - !ruby/object:Gem::Version
70
70
  version: '6.0'
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: rails-i18n
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - '>='
75
+ - - ">="
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  type: :runtime
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - '>='
82
+ - - ">="
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: rspec-rails
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - '>='
89
+ - - ">="
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - - '>='
96
+ - - ">="
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: shoulda
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
- - - '>='
103
+ - - ">="
104
104
  - !ruby/object:Gem::Version
105
105
  version: '0'
106
106
  type: :development
107
107
  prerelease: false
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
- - - '>='
110
+ - - ">="
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0'
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: bundler
115
115
  requirement: !ruby/object:Gem::Requirement
116
116
  requirements:
117
- - - '>='
117
+ - - ">="
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  type: :development
121
121
  prerelease: false
122
122
  version_requirements: !ruby/object:Gem::Requirement
123
123
  requirements:
124
- - - '>='
124
+ - - ">="
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0'
127
127
  - !ruby/object:Gem::Dependency
128
128
  name: jeweler
129
129
  requirement: !ruby/object:Gem::Requirement
130
130
  requirements:
131
- - - '>='
131
+ - - ">="
132
132
  - !ruby/object:Gem::Version
133
133
  version: '0'
134
134
  type: :development
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
137
137
  requirements:
138
- - - '>='
138
+ - - ">="
139
139
  - !ruby/object:Gem::Version
140
140
  version: '0'
141
141
  description: Inline Forms aims to ease the setup of forms that provide inline editing.
@@ -149,9 +149,9 @@ executables:
149
149
  extensions: []
150
150
  extra_rdoc_files: []
151
151
  files:
152
- - .document
153
- - .gitignore
154
- - .vscode/settings.json
152
+ - ".document"
153
+ - ".gitignore"
154
+ - ".vscode/settings.json"
155
155
  - Gemfile
156
156
  - LICENSE.txt
157
157
  - README.rdoc
@@ -246,6 +246,7 @@ files:
246
246
  - app/views/inline_forms/extract_translations.erb
247
247
  - app/views/inline_forms/list.js.erb
248
248
  - app/views/inline_forms/new.js.erb
249
+ - app/views/inline_forms/record_destroyed.js.erb
249
250
  - app/views/inline_forms/show.js.erb
250
251
  - app/views/inline_forms/show_element.js.erb
251
252
  - app/views/inline_forms/show_undo.js.erb
@@ -299,17 +300,16 @@ require_paths:
299
300
  - lib
300
301
  required_ruby_version: !ruby/object:Gem::Requirement
301
302
  requirements:
302
- - - '>='
303
+ - - ">="
303
304
  - !ruby/object:Gem::Version
304
305
  version: '0'
305
306
  required_rubygems_version: !ruby/object:Gem::Requirement
306
307
  requirements:
307
- - - '>='
308
+ - - ">="
308
309
  - !ruby/object:Gem::Version
309
310
  version: '0'
310
311
  requirements: []
311
- rubyforge_project: inline_forms
312
- rubygems_version: 2.6.14
312
+ rubygems_version: 3.0.1
313
313
  signing_key:
314
314
  specification_version: 4
315
315
  summary: Inline editing of forms.