inline_forms 7.2.10 → 7.5.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +187 -0
- data/README.rdoc +10 -2
- data/app/assets/javascripts/inline_forms/inline_forms.js +23 -0
- data/app/assets/stylesheets/inline_forms/inline_forms.scss +34 -18
- data/app/assets/stylesheets/jquery_ui/jquery.ui.all.css.scss +2 -2
- data/app/assets/stylesheets/jquery_ui/jquery.ui.base.css.scss +14 -14
- data/app/assets/stylesheets/jquery_ui/jquery.ui.theme.css.scss +1 -1
- data/app/controllers/concerns/versions_concern.rb +2 -1
- data/app/controllers/inline_forms_application_controller.rb +5 -1
- data/app/controllers/inline_forms_controller.rb +120 -24
- data/app/helpers/form_elements/ckeditor.rb +4 -30
- data/app/helpers/form_elements/plain_text.rb +23 -0
- data/app/helpers/form_elements/plain_text_area.rb +7 -3
- data/app/helpers/form_elements/text_area.rb +4 -44
- data/app/helpers/form_elements/text_area_without_ckeditor.rb +5 -4
- data/app/helpers/form_elements/text_field.rb +2 -2
- data/app/helpers/inline_forms_helper.rb +127 -71
- data/app/views/devise/sessions/_form.html.erb +4 -1
- data/app/views/inline_forms/_close.html.erb +6 -4
- data/app/views/inline_forms/_edit.html.erb +7 -40
- data/app/views/inline_forms/_list.html.erb +52 -39
- data/app/views/inline_forms/_new.html.erb +23 -11
- data/app/views/inline_forms/_show.html.erb +13 -11
- data/app/views/inline_forms/_versions_list.html.erb +4 -8
- data/app/views/inline_forms/create_list_frame.html.erb +3 -0
- data/app/views/inline_forms/field_edit.html.erb +3 -0
- data/app/views/inline_forms/field_show.html.erb +3 -0
- data/app/views/inline_forms/new_record.html.erb +3 -0
- data/app/views/inline_forms/row_close.html.erb +5 -0
- data/app/views/inline_forms/row_destroyed.html.erb +9 -0
- data/app/views/inline_forms/row_show.html.erb +3 -0
- data/app/views/inline_forms/versions_list_panel.html.erb +3 -0
- data/app/views/inline_forms/versions_panel.html.erb +3 -0
- data/app/views/layouts/application.html.erb +0 -1
- data/app/views/layouts/inline_forms.html.erb +10 -1
- data/bin/inline_forms +22 -1
- data/bin/inline_forms_installer_core.rb +43 -4
- data/docs/ujs-to-turbo.md +193 -0
- data/inline_forms.gemspec +22 -11
- data/lib/generators/USAGE +2 -2
- data/lib/generators/assets/stylesheets/inline_forms.scss +34 -18
- data/lib/inline_forms/version.rb +1 -1
- data/lib/inline_forms.rb +58 -2
- data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_field_turbo_test.rb +74 -0
- data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_name_list_test.rb +73 -0
- data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_photos_pagination_test.rb +199 -15
- data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_row_turbo_test.rb +94 -0
- data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_top_level_new_test.rb +100 -0
- data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_versions_turbo_test.rb +27 -0
- data/lib/installer_templates/example_app_tests/test/models/example_app_plain_text_rich_text_edge_cases_test.rb +46 -0
- data/lib/installer_templates/example_app_views/apartments/name_list.html.erb +26 -0
- data/lib/installer_templates/example_app_views/inline_forms/_header.html.erb +45 -0
- data/test/inline_forms_generator_test.rb +10 -0
- data/test/plain_text_configuration_test.rb +90 -0
- metadata +57 -18
- data/app/views/inline_forms/edit.js.erb +0 -1
- data/app/views/inline_forms/show_element.js.erb +0 -1
- data/app/views/inline_forms/update.js.erb +0 -1
- data/lib/generators/assets/javascripts/ckeditor/config.js +0 -72
|
@@ -72,12 +72,17 @@ class InlineFormsController < ApplicationController
|
|
|
72
72
|
if @Klass.not_accessible_through_html?
|
|
73
73
|
format.html do
|
|
74
74
|
if @parent_class.present?
|
|
75
|
-
|
|
76
|
-
render "inline_forms/_list", layout: frame_layout
|
|
75
|
+
render_nested_associated_list_html
|
|
77
76
|
end
|
|
78
77
|
end
|
|
79
78
|
else
|
|
80
|
-
format.html
|
|
79
|
+
format.html do
|
|
80
|
+
if @parent_class.present?
|
|
81
|
+
render_nested_associated_list_html
|
|
82
|
+
else
|
|
83
|
+
render "inline_forms/_list", layout: "inline_forms"
|
|
84
|
+
end
|
|
85
|
+
end
|
|
81
86
|
end
|
|
82
87
|
format.js { render :list }
|
|
83
88
|
end
|
|
@@ -98,7 +103,7 @@ class InlineFormsController < ApplicationController
|
|
|
98
103
|
|
|
99
104
|
@object.inline_forms_attribute_list = @inline_forms_attribute_list if @inline_forms_attribute_list
|
|
100
105
|
respond_to do |format|
|
|
101
|
-
format.html {
|
|
106
|
+
format.html { render_turbo_new } if associated_list_html_allowed? || !@Klass.not_accessible_through_html?
|
|
102
107
|
format.js { }
|
|
103
108
|
end
|
|
104
109
|
end
|
|
@@ -111,8 +116,7 @@ class InlineFormsController < ApplicationController
|
|
|
111
116
|
@sub_id = params[:sub_id]
|
|
112
117
|
@update_span = params[:update]
|
|
113
118
|
respond_to do |format|
|
|
114
|
-
format.html { }
|
|
115
|
-
format.js { }
|
|
119
|
+
format.html { render_turbo_field(:field_edit) }
|
|
116
120
|
end
|
|
117
121
|
end
|
|
118
122
|
|
|
@@ -123,6 +127,7 @@ class InlineFormsController < ApplicationController
|
|
|
123
127
|
@update_span = params[:update]
|
|
124
128
|
attributes = @inline_forms_attribute_list || @object.inline_forms_attribute_list
|
|
125
129
|
attributes.each do | attribute, name, form_element |
|
|
130
|
+
InlineForms.assert_plain_text_column!(object: @object, attribute: attribute, form_element: form_element)
|
|
126
131
|
send("#{form_element.to_s}_update", @object, attribute) unless form_element == :tree || form_element == :associated || (cancan_enabled? && cannot?(:read, @object, attribute))
|
|
127
132
|
end
|
|
128
133
|
@parent_class = params[:parent_class]
|
|
@@ -145,14 +150,16 @@ class InlineFormsController < ApplicationController
|
|
|
145
150
|
@objects = @objects.where(conditions).paginate(:page => params[:page])
|
|
146
151
|
@object = nil
|
|
147
152
|
respond_to do |format|
|
|
148
|
-
format.
|
|
153
|
+
format.html { render_associated_list_frame } if associated_list_html_allowed?
|
|
154
|
+
format.js { render :list }
|
|
149
155
|
end
|
|
150
156
|
else
|
|
151
157
|
flash.now[:header] = ["Kan #{@object.class.to_s.underscore} niet aanmaken."]
|
|
152
158
|
flash.now[:error] = @object.errors.to_a
|
|
153
159
|
respond_to do |format|
|
|
154
160
|
@object.inline_forms_attribute_list = attributes
|
|
155
|
-
format.
|
|
161
|
+
format.html { render_turbo_new } if associated_list_html_allowed? || !@Klass.not_accessible_through_html?
|
|
162
|
+
format.js { render :new }
|
|
156
163
|
end
|
|
157
164
|
end
|
|
158
165
|
end
|
|
@@ -164,11 +171,11 @@ class InlineFormsController < ApplicationController
|
|
|
164
171
|
@form_element = params[:form_element]
|
|
165
172
|
@sub_id = params[:sub_id]
|
|
166
173
|
@update_span = params[:update]
|
|
174
|
+
InlineForms.assert_plain_text_column!(object: @object, attribute: @attribute, form_element: @form_element)
|
|
167
175
|
send("#{@form_element.to_s}_update", @object, @attribute)
|
|
168
176
|
@object.save
|
|
169
177
|
respond_to do |format|
|
|
170
|
-
format.html {
|
|
171
|
-
format.js { }
|
|
178
|
+
format.html { render_turbo_field(:field_show, turbo_field_show: true) }
|
|
172
179
|
end
|
|
173
180
|
end
|
|
174
181
|
|
|
@@ -195,15 +202,16 @@ class InlineFormsController < ApplicationController
|
|
|
195
202
|
respond_to do |format|
|
|
196
203
|
@attributes = @object.inline_forms_attribute_list
|
|
197
204
|
if close
|
|
205
|
+
format.html { render_row_turbo(:close) } if row_html_turbo_allowed?
|
|
198
206
|
format.js { render :close }
|
|
199
207
|
else
|
|
200
|
-
format.
|
|
208
|
+
format.html { render_row_turbo(:show) } if row_html_turbo_allowed?
|
|
209
|
+
format.js { render :show }
|
|
201
210
|
end
|
|
202
211
|
end
|
|
203
212
|
else
|
|
204
213
|
respond_to do |format|
|
|
205
|
-
format.html {
|
|
206
|
-
format.js { render :show_element }
|
|
214
|
+
format.html { render_turbo_field(:field_show, turbo_field_show: true) }
|
|
207
215
|
end
|
|
208
216
|
end
|
|
209
217
|
end
|
|
@@ -212,10 +220,9 @@ class InlineFormsController < ApplicationController
|
|
|
212
220
|
def soft_delete
|
|
213
221
|
@update_span = params[:update]
|
|
214
222
|
@object = referenced_object
|
|
215
|
-
# destroy the object
|
|
216
223
|
@object.soft_delete(current_user)
|
|
217
224
|
respond_to do |format|
|
|
218
|
-
format.html { }
|
|
225
|
+
format.html { render_row_turbo(:close) } if row_html_turbo_allowed?
|
|
219
226
|
format.js { render :close }
|
|
220
227
|
end
|
|
221
228
|
end
|
|
@@ -224,10 +231,9 @@ class InlineFormsController < ApplicationController
|
|
|
224
231
|
def soft_restore
|
|
225
232
|
@update_span = params[:update]
|
|
226
233
|
@object = referenced_object
|
|
227
|
-
# restore the object
|
|
228
234
|
@object.soft_restore
|
|
229
235
|
respond_to do |format|
|
|
230
|
-
format.html { }
|
|
236
|
+
format.html { render_row_turbo(:close) } if row_html_turbo_allowed?
|
|
231
237
|
format.js { render :close }
|
|
232
238
|
end
|
|
233
239
|
end
|
|
@@ -237,11 +243,10 @@ class InlineFormsController < ApplicationController
|
|
|
237
243
|
@update_span = params[:update]
|
|
238
244
|
@object = referenced_object
|
|
239
245
|
if current_user.role? :superadmin
|
|
240
|
-
|
|
241
|
-
@undo_object = @object.versions.last
|
|
246
|
+
@undo_version = @object.versions.last
|
|
242
247
|
@object.destroy
|
|
243
248
|
respond_to do |format|
|
|
244
|
-
format.html { }
|
|
249
|
+
format.html { render_row_turbo_destroyed } if row_html_turbo_allowed?
|
|
245
250
|
format.js { render :record_destroyed }
|
|
246
251
|
end
|
|
247
252
|
end
|
|
@@ -251,14 +256,13 @@ class InlineFormsController < ApplicationController
|
|
|
251
256
|
# Thanks Ryan Bates: http://railscasts.com/episodes/255-undo-with-paper-trail
|
|
252
257
|
def revert
|
|
253
258
|
@update_span = params[:update]
|
|
254
|
-
@object = referenced_object
|
|
255
259
|
if current_user.role? :superadmin
|
|
256
260
|
@version = PaperTrail::Version.find(params[:id])
|
|
257
|
-
@version.reify
|
|
258
|
-
@object
|
|
261
|
+
@object = @version.reify
|
|
262
|
+
@object.save!
|
|
259
263
|
authorize!(:revert, @object) if cancan_enabled?
|
|
260
264
|
respond_to do |format|
|
|
261
|
-
format.html { }
|
|
265
|
+
format.html { render_row_turbo(:close) } if row_html_turbo_allowed?
|
|
262
266
|
format.js { render :close }
|
|
263
267
|
end
|
|
264
268
|
end
|
|
@@ -277,11 +281,103 @@ class InlineFormsController < ApplicationController
|
|
|
277
281
|
end
|
|
278
282
|
|
|
279
283
|
private
|
|
284
|
+
|
|
285
|
+
# HTML field edit/show inside a +<turbo-frame>+ (Step 3). Scalar fields no longer
|
|
286
|
+
# use UJS; +format.html+ is always registered for edit/update/single-attribute show.
|
|
287
|
+
#
|
|
288
|
+
# +@inline_forms_turbo_field+ tells +link_to_inline_edit+ (and the per-+form_element+
|
|
289
|
+
# +*_show+ helpers it wraps) to emit Turbo data attributes. The flag is set in
|
|
290
|
+
# +_show.html.erb+ when a row first opens, but bare +field_show+ / +field_edit+
|
|
291
|
+
# responses (on +cancel+ / +update+) do not re-render +_show+. Without setting
|
|
292
|
+
# it here the link in the swapped frame falls back to +remote: true+, which the
|
|
293
|
+
# legacy +jquery_ujs+ bundle intercepts as a JS request -- the controller only
|
|
294
|
+
# registers +format.html+, so the click silently fails (no swap, no edit form).
|
|
295
|
+
def render_turbo_field(template, turbo_field_show: false)
|
|
296
|
+
@turbo_frame = true if template == :field_edit
|
|
297
|
+
@turbo_field_show_turbo_frame = turbo_field_show
|
|
298
|
+
@inline_forms_turbo_field = true
|
|
299
|
+
render "inline_forms/#{template}", layout: "turbo_rails/frame"
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
# Top-level list row open/close (Step 3): full `_show` / `_close` inside
|
|
303
|
+
# `<turbo-frame id="…">` matching `params[:update]`.
|
|
304
|
+
def render_row_turbo(mode)
|
|
305
|
+
@inline_forms_turbo_row = true
|
|
306
|
+
template = (mode == :close) ? "inline_forms/row_close" : "inline_forms/row_show"
|
|
307
|
+
layout = turbo_frame_request? ? "turbo_rails/frame" : "inline_forms"
|
|
308
|
+
render template, layout: layout
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
def render_row_turbo_destroyed
|
|
312
|
+
@inline_forms_turbo_row = true
|
|
313
|
+
layout = turbo_frame_request? ? "turbo_rails/frame" : "inline_forms"
|
|
314
|
+
render "inline_forms/row_destroyed", layout: layout
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
# Nested has_many +new+ / cancel / +create+ inside a parent +<turbo-frame>+ (e.g. Apartment → Photo).
|
|
318
|
+
def associated_list_html_allowed?
|
|
319
|
+
@parent_class.present? && params[:update].present?
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
def associated_list_frame_layout
|
|
323
|
+
# Use full inline_forms chrome so the swapped frame is styled; Turbo extracts
|
|
324
|
+
# the matching <turbo-frame id="…"> from the response body.
|
|
325
|
+
"inline_forms"
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
def render_turbo_new
|
|
329
|
+
@turbo_frame = true
|
|
330
|
+
render "inline_forms/new_record", layout: associated_list_frame_layout
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
# Nested +index+ / cancel / +create+ HTML inside a parent-associated +<turbo-frame>+.
|
|
334
|
+
def render_nested_associated_list_html
|
|
335
|
+
if turbo_frame_request? && nested_list_frame_id?(params[:update])
|
|
336
|
+
# Pagination and other swaps targeting the inner +…_photos_list+ frame: minimal layout.
|
|
337
|
+
@ul_needed = true
|
|
338
|
+
render "inline_forms/_list", layout: "turbo_rails/frame"
|
|
339
|
+
elsif turbo_frame_request? && params[:update].present?
|
|
340
|
+
# Cancel / +create+ targeting the outer +apartment_<id>_photos+ frame: styled full layout.
|
|
341
|
+
render_associated_list_frame
|
|
342
|
+
else
|
|
343
|
+
frame_layout = turbo_frame_request? ? "turbo_rails/frame" : "inline_forms"
|
|
344
|
+
render "inline_forms/_list", layout: frame_layout
|
|
345
|
+
end
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
# +apartment_1_photos_list+ (inner list) vs +apartment_1_photos+ (outer associated container).
|
|
349
|
+
def nested_list_frame_id?(update)
|
|
350
|
+
update.to_s.end_with?("_list")
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
# After nested +create+ / cancel; restores list inside the outer associated frame.
|
|
354
|
+
def render_associated_list_frame
|
|
355
|
+
@ul_needed = true
|
|
356
|
+
render "inline_forms/create_list_frame", layout: associated_list_frame_layout
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
# HTML row open/close is allowed for normal models, and for +not_accessible_through_html?+
|
|
360
|
+
# models (e.g. Photo) when the request targets a nested associated list row
|
|
361
|
+
# (+params[:update]+ like +apartment_1_photo_5+), not bare top-level CRUD.
|
|
362
|
+
def row_html_turbo_allowed?
|
|
363
|
+
return true unless @Klass.not_accessible_through_html?
|
|
364
|
+
nested_associated_list_row_update?(params[:update])
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
# +apartment_1_photo_5+ → +["apartment","1","photo","5"]+ (≥4 segments, trailing id).
|
|
368
|
+
# Differs from field spans (+apartment_1_photo_5_name+ ends with letters) and
|
|
369
|
+
# top-level rows (+apartment_1+ — too few segments).
|
|
370
|
+
def nested_associated_list_row_update?(update)
|
|
371
|
+
parts = update.to_s.split("_")
|
|
372
|
+
parts.length >= 4 && parts.last.match?(/\A\d+\z/)
|
|
373
|
+
end
|
|
374
|
+
|
|
280
375
|
# Get the class from the controller name.
|
|
281
376
|
# CountryController < InlineFormsController, so what class are we?
|
|
282
377
|
# TODO think about this a bit more.
|
|
283
378
|
def getKlass #:doc:
|
|
284
379
|
@Klass = self.controller_name.classify.constantize
|
|
380
|
+
InlineForms.validate_plain_text_configuration_for!(@Klass)
|
|
285
381
|
@Klass
|
|
286
382
|
end
|
|
287
383
|
|
|
@@ -1,41 +1,15 @@
|
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
|
2
|
+
# Legacy type name: CKEditor is removed; behaves like :rich_text.
|
|
2
3
|
InlineForms::SPECIAL_COLUMN_TYPES[:ckeditor]=:text
|
|
3
4
|
|
|
4
5
|
def ckeditor_show(object, attribute)
|
|
5
|
-
|
|
6
|
-
attribute,
|
|
7
|
-
'<div class="ckeditor_area">'.html_safe +
|
|
8
|
-
cktext_area_tag(
|
|
9
|
-
attribute,
|
|
10
|
-
object[attribute],
|
|
11
|
-
:id => "textarea_#{object.class.name.underscore}_#{object.id}_#{attribute.to_s}",
|
|
12
|
-
:ckeditor => { :width => '100%',
|
|
13
|
-
:height => '200px',
|
|
14
|
-
:toolbar => "None",
|
|
15
|
-
:readOnly => "true",
|
|
16
|
-
:resize_enabled => "false",
|
|
17
|
-
:toolbarCanCollapse => "false"
|
|
18
|
-
}
|
|
19
|
-
) +
|
|
20
|
-
image_tag( 'inline_forms/glass_plate.gif',
|
|
21
|
-
:class => "glass_plate",
|
|
22
|
-
:title => '' ) +
|
|
23
|
-
"<script>delete CKEDITOR.instances['textarea_#{object.class.name.underscore}_#{object.id}_#{attribute.to_s}']</script>".html_safe +
|
|
24
|
-
'</div>'.html_safe,
|
|
25
|
-
from_callee: __callee__
|
|
6
|
+
rich_text_show(object, attribute)
|
|
26
7
|
end
|
|
27
8
|
|
|
28
9
|
def ckeditor_edit(object, attribute)
|
|
29
|
-
|
|
30
|
-
object[attribute],
|
|
31
|
-
:id => "textarea_#{object.class.name.underscore}_#{object.id}_#{attribute.to_s}",
|
|
32
|
-
:ckeditor => { :width => '100%',
|
|
33
|
-
:height => '200px'
|
|
34
|
-
}
|
|
35
|
-
) +
|
|
36
|
-
"<script>delete CKEDITOR.instances['textarea_#{object.class.name.underscore}_#{object.id}_#{attribute.to_s}']</script>".html_safe
|
|
10
|
+
rich_text_edit(object, attribute)
|
|
37
11
|
end
|
|
38
12
|
|
|
39
13
|
def ckeditor_update(object, attribute)
|
|
40
|
-
object
|
|
14
|
+
rich_text_update(object, attribute)
|
|
41
15
|
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
|
2
|
+
InlineForms::SPECIAL_COLUMN_TYPES[:plain_text]=:text
|
|
3
|
+
|
|
4
|
+
def plain_text_show(object, attribute)
|
|
5
|
+
InlineForms.assert_plain_text_column!(object: object, attribute: attribute, form_element: :plain_text)
|
|
6
|
+
value = object[attribute]
|
|
7
|
+
link_to_inline_edit object, attribute, (value.nil? || value.empty?) ? "<i class='fi-plus'></i>".html_safe : value, from_callee: __callee__
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def plain_text_edit(object, attribute)
|
|
11
|
+
InlineForms.assert_plain_text_column!(object: object, attribute: attribute, form_element: :plain_text)
|
|
12
|
+
text_area_tag attribute, object[attribute], :class => 'attribute_text_area'
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def plain_text_update(object, attribute)
|
|
16
|
+
InlineForms.assert_plain_text_column!(object: object, attribute: attribute, form_element: :plain_text)
|
|
17
|
+
object[attribute.to_sym] = params[attribute.to_sym]
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def plain_text_info(object, attribute)
|
|
21
|
+
InlineForms.assert_plain_text_column!(object: object, attribute: attribute, form_element: :plain_text)
|
|
22
|
+
object[attribute]
|
|
23
|
+
end
|
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
InlineForms::SPECIAL_COLUMN_TYPES[:plain_text_area]=:text
|
|
3
3
|
|
|
4
4
|
def plain_text_area_show(object, attribute)
|
|
5
|
-
|
|
5
|
+
plain_text_show(object, attribute)
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
def plain_text_area_edit(object, attribute)
|
|
9
|
-
|
|
9
|
+
plain_text_edit(object, attribute)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def plain_text_area_update(object, attribute)
|
|
13
|
-
object
|
|
13
|
+
plain_text_update(object, attribute)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def plain_text_area_info(object, attribute)
|
|
17
|
+
plain_text_info(object, attribute)
|
|
14
18
|
end
|
|
@@ -2,57 +2,17 @@
|
|
|
2
2
|
InlineForms::SPECIAL_COLUMN_TYPES[:text_area]=:text
|
|
3
3
|
|
|
4
4
|
def text_area_show(object, attribute)
|
|
5
|
-
|
|
6
|
-
link_to_inline_edit object, attribute, "<i class='fi-plus'></i>".html_safe, from_callee: __callee__
|
|
7
|
-
else
|
|
8
|
-
if defined? Ckeditor
|
|
9
|
-
link_to_inline_edit object,
|
|
10
|
-
attribute,
|
|
11
|
-
'<div class="ckeditor_area">'.html_safe +
|
|
12
|
-
cktext_area_tag(
|
|
13
|
-
attribute,
|
|
14
|
-
object[attribute],
|
|
15
|
-
:id => "textarea_#{object.class.name.underscore}_#{object.id}_#{attribute.to_s}",
|
|
16
|
-
:ckeditor => { :width => '100%',
|
|
17
|
-
:height => '200px',
|
|
18
|
-
:toolbar => "None",
|
|
19
|
-
:readOnly => "true",
|
|
20
|
-
:resize_enabled => "false",
|
|
21
|
-
:toolbarCanCollapse => "false"
|
|
22
|
-
}
|
|
23
|
-
) +
|
|
24
|
-
image_tag( 'inline_forms/glass_plate.gif',
|
|
25
|
-
:class => "glass_plate",
|
|
26
|
-
:title => '' ) +
|
|
27
|
-
"<script>delete CKEDITOR.instances['textarea_#{object.class.name.underscore}_#{object.id}_#{attribute.to_s}']</script>".html_safe +
|
|
28
|
-
'</div>'.html_safe,
|
|
29
|
-
from_callee: __callee__
|
|
30
|
-
else
|
|
31
|
-
link_to_inline_edit object, attribute, object[attribute], from_callee: __callee__
|
|
32
|
-
end
|
|
33
|
-
end
|
|
5
|
+
rich_text_show(object, attribute)
|
|
34
6
|
end
|
|
35
7
|
|
|
36
8
|
def text_area_edit(object, attribute)
|
|
37
|
-
|
|
38
|
-
cktext_area_tag(
|
|
39
|
-
attribute,
|
|
40
|
-
object[attribute],
|
|
41
|
-
:id => "textarea_#{object.class.name.underscore}_#{object.id}_#{attribute.to_s}",
|
|
42
|
-
:ckeditor => { :width => '100%',
|
|
43
|
-
:height => '200px'
|
|
44
|
-
}
|
|
45
|
-
) +
|
|
46
|
-
"<script>delete CKEDITOR.instances['textarea_#{object.class.name.underscore}_#{object.id}_#{attribute.to_s}']</script>".html_safe
|
|
47
|
-
else
|
|
48
|
-
text_area_tag attribute, object[attribute], :class => 'attribute_text_area'
|
|
49
|
-
end
|
|
9
|
+
rich_text_edit(object, attribute)
|
|
50
10
|
end
|
|
51
11
|
|
|
52
12
|
def text_area_update(object, attribute)
|
|
53
|
-
object
|
|
13
|
+
rich_text_update(object, attribute)
|
|
54
14
|
end
|
|
55
15
|
|
|
56
16
|
def text_area_info(object, attribute)
|
|
57
|
-
object
|
|
17
|
+
rich_text_info(object, attribute)
|
|
58
18
|
end
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
|
2
|
+
# Legacy alias for plain :text_area (CKEditor removed).
|
|
2
3
|
InlineForms::SPECIAL_COLUMN_TYPES[:text_area_without_ckeditor]=:text
|
|
3
4
|
|
|
4
5
|
def text_area_without_ckeditor_show(object, attribute)
|
|
5
|
-
|
|
6
|
+
plain_text_show(object, attribute)
|
|
6
7
|
end
|
|
7
8
|
|
|
8
9
|
def text_area_without_ckeditor_edit(object, attribute)
|
|
9
|
-
|
|
10
|
+
plain_text_edit(object, attribute)
|
|
10
11
|
end
|
|
11
12
|
|
|
12
13
|
def text_area_without_ckeditor_update(object, attribute)
|
|
13
|
-
object
|
|
14
|
+
plain_text_update(object, attribute)
|
|
14
15
|
end
|
|
15
16
|
|
|
16
17
|
def text_area_without_ckeditor_info(object, attribute)
|
|
17
|
-
object
|
|
18
|
+
plain_text_info(object, attribute)
|
|
18
19
|
end
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
|
2
2
|
InlineForms::SPECIAL_COLUMN_TYPES[:text_field]=:string
|
|
3
3
|
|
|
4
|
-
def text_field_show(object, attribute)
|
|
5
|
-
link_to_inline_edit object, attribute, object[attribute].blank? ? "<i class='fi-plus'></i>".html_safe : object[attribute], from_callee: __callee__
|
|
4
|
+
def text_field_show(object, attribute, turbo_frame: false)
|
|
5
|
+
link_to_inline_edit object, attribute, object[attribute].blank? ? "<i class='fi-plus'></i>".html_safe : object[attribute], from_callee: __callee__, turbo_frame: turbo_frame
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
def text_field_edit(object, attribute)
|