inline_forms 7.11.0 → 7.13.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/.ruby-version +1 -1
- data/CHANGELOG.md +70 -0
- data/app/controllers/inline_forms_controller.rb +21 -0
- data/app/helpers/inline_forms_helper.rb +1 -6
- data/app/views/inline_forms/_versions_list.html.erb +16 -5
- data/archived/form_elements/README.md +1 -7
- data/inline_forms.gemspec +3 -3
- data/lib/generators/inline_forms_generator.rb +1 -1
- data/lib/inline_forms/form_element_registry.rb +46 -0
- data/lib/inline_forms/form_elements/audio_field_helper.rb +36 -0
- data/lib/inline_forms/form_elements/check_box_helper.rb +23 -0
- data/lib/inline_forms/form_elements/check_list_helper.rb +45 -0
- data/lib/inline_forms/form_elements/ckeditor_helper.rb +23 -0
- data/lib/inline_forms/form_elements/date_helper.rb +28 -0
- data/lib/inline_forms/form_elements/decimal_field_helper.rb +22 -0
- data/lib/inline_forms/form_elements/devise_password_field_helper.rb +26 -0
- data/lib/inline_forms/form_elements/dns_records_helper.rb +23 -0
- data/lib/inline_forms/form_elements/dropdown_helper.rb +58 -0
- data/lib/inline_forms/form_elements/dropdown_with_integers_helper.rb +29 -0
- data/lib/inline_forms/form_elements/dropdown_with_other_helper.rb +160 -0
- data/lib/inline_forms/form_elements/dropdown_with_values_helper.rb +40 -0
- data/lib/inline_forms/form_elements/dropdown_with_values_with_stars_helper.rb +24 -0
- data/lib/inline_forms/form_elements/file_field_helper.rb +27 -0
- data/lib/inline_forms/form_elements/header_helper.rb +24 -0
- data/lib/inline_forms/form_elements/helper_includes.rb +15 -0
- data/lib/inline_forms/form_elements/image_field_helper.rb +31 -0
- data/lib/inline_forms/form_elements/info_helper.rb +52 -0
- data/lib/inline_forms/form_elements/info_list_helper.rb +30 -0
- data/lib/inline_forms/form_elements/integer_field_helper.rb +22 -0
- data/lib/inline_forms/form_elements/money_field_helper.rb +22 -0
- data/lib/inline_forms/form_elements/month_select_helper.rb +24 -0
- data/lib/inline_forms/form_elements/month_year_picker_helper.rb +27 -0
- data/lib/inline_forms/form_elements/multi_image_field_helper.rb +31 -0
- data/lib/inline_forms/form_elements/pdf_link_helper.rb +41 -0
- data/lib/inline_forms/form_elements/plain_text_area_helper.rb +26 -0
- data/lib/inline_forms/form_elements/plain_text_helper.rb +31 -0
- data/lib/inline_forms/form_elements/question_list_helper.rb +52 -0
- data/lib/inline_forms/form_elements/radio_button_helper.rb +34 -0
- data/lib/inline_forms/form_elements/rich_text_helper.rb +44 -0
- data/lib/inline_forms/form_elements/scale_with_integers_helper.rb +30 -0
- data/lib/inline_forms/form_elements/scale_with_values_helper.rb +29 -0
- data/lib/inline_forms/form_elements/simple_file_field_helper.rb +36 -0
- data/lib/inline_forms/form_elements/slider_with_values_helper.rb +99 -0
- data/lib/inline_forms/form_elements/text_area_helper.rb +26 -0
- data/lib/inline_forms/form_elements/text_area_without_ckeditor_helper.rb +27 -0
- data/lib/inline_forms/form_elements/text_field_helper.rb +26 -0
- data/lib/inline_forms/form_elements/time_helper.rb +28 -0
- data/lib/inline_forms/form_elements.rb +27 -0
- data/lib/inline_forms/version.rb +1 -1
- data/lib/inline_forms.rb +19 -3
- data/script/migrate_form_elements.rb +62 -0
- metadata +52 -48
- data/app/helpers/form_elements/audio_field.rb +0 -28
- data/app/helpers/form_elements/check_box.rb +0 -16
- data/app/helpers/form_elements/check_list.rb +0 -37
- data/app/helpers/form_elements/ckeditor.rb +0 -15
- data/app/helpers/form_elements/date.rb +0 -20
- data/app/helpers/form_elements/decimal_field.rb +0 -15
- data/app/helpers/form_elements/devise_password_field.rb +0 -19
- data/app/helpers/form_elements/dns_records.rb +0 -15
- data/app/helpers/form_elements/dropdown.rb +0 -50
- data/app/helpers/form_elements/dropdown_with_integers.rb +0 -21
- data/app/helpers/form_elements/dropdown_with_other.rb +0 -153
- data/app/helpers/form_elements/dropdown_with_values.rb +0 -32
- data/app/helpers/form_elements/dropdown_with_values_with_stars.rb +0 -16
- data/app/helpers/form_elements/file_field.rb +0 -20
- data/app/helpers/form_elements/header.rb +0 -17
- data/app/helpers/form_elements/image_field.rb +0 -24
- data/app/helpers/form_elements/info.rb +0 -44
- data/app/helpers/form_elements/info_list.rb +0 -22
- data/app/helpers/form_elements/integer_field.rb +0 -15
- data/app/helpers/form_elements/money_field.rb +0 -15
- data/app/helpers/form_elements/month_select.rb +0 -16
- data/app/helpers/form_elements/month_year_picker.rb +0 -19
- data/app/helpers/form_elements/multi_image_field.rb +0 -24
- data/app/helpers/form_elements/pdf_link.rb +0 -33
- data/app/helpers/form_elements/plain_text.rb +0 -23
- data/app/helpers/form_elements/plain_text_area.rb +0 -18
- data/app/helpers/form_elements/question_list.rb +0 -44
- data/app/helpers/form_elements/radio_button.rb +0 -27
- data/app/helpers/form_elements/rich_text.rb +0 -36
- data/app/helpers/form_elements/scale_with_integers.rb +0 -23
- data/app/helpers/form_elements/scale_with_values.rb +0 -22
- data/app/helpers/form_elements/simple_file_field.rb +0 -28
- data/app/helpers/form_elements/slider_with_values.rb +0 -91
- data/app/helpers/form_elements/text_area.rb +0 -18
- data/app/helpers/form_elements/text_area_without_ckeditor.rb +0 -19
- data/app/helpers/form_elements/text_field.rb +0 -18
- data/app/helpers/form_elements/time.rb +0 -21
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: 7.
|
|
4
|
+
version: 7.13.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ace Suares
|
|
@@ -17,40 +17,40 @@ dependencies:
|
|
|
17
17
|
requirements:
|
|
18
18
|
- - ">="
|
|
19
19
|
- !ruby/object:Gem::Version
|
|
20
|
-
version: '
|
|
20
|
+
version: '7.13'
|
|
21
21
|
- - "<"
|
|
22
22
|
- !ruby/object:Gem::Version
|
|
23
|
-
version: '
|
|
23
|
+
version: '8.0'
|
|
24
24
|
type: :runtime
|
|
25
25
|
prerelease: false
|
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
|
27
27
|
requirements:
|
|
28
28
|
- - ">="
|
|
29
29
|
- !ruby/object:Gem::Version
|
|
30
|
-
version: '
|
|
30
|
+
version: '7.13'
|
|
31
31
|
- - "<"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
33
|
+
version: '8.0'
|
|
34
34
|
- !ruby/object:Gem::Dependency
|
|
35
35
|
name: rails
|
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - ">="
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 7.1
|
|
40
|
+
version: 7.2.3.1
|
|
41
41
|
- - "<"
|
|
42
42
|
- !ruby/object:Gem::Version
|
|
43
|
-
version: '7.
|
|
43
|
+
version: '7.3'
|
|
44
44
|
type: :runtime
|
|
45
45
|
prerelease: false
|
|
46
46
|
version_requirements: !ruby/object:Gem::Requirement
|
|
47
47
|
requirements:
|
|
48
48
|
- - ">="
|
|
49
49
|
- !ruby/object:Gem::Version
|
|
50
|
-
version: 7.1
|
|
50
|
+
version: 7.2.3.1
|
|
51
51
|
- - "<"
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '7.
|
|
53
|
+
version: '7.3'
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
55
|
name: rails-i18n
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -432,43 +432,6 @@ files:
|
|
|
432
432
|
- app/controllers/concerns/versions_concern.rb
|
|
433
433
|
- app/controllers/inline_forms_application_controller.rb
|
|
434
434
|
- app/controllers/inline_forms_controller.rb
|
|
435
|
-
- app/helpers/form_elements/audio_field.rb
|
|
436
|
-
- app/helpers/form_elements/check_box.rb
|
|
437
|
-
- app/helpers/form_elements/check_list.rb
|
|
438
|
-
- app/helpers/form_elements/ckeditor.rb
|
|
439
|
-
- app/helpers/form_elements/date.rb
|
|
440
|
-
- app/helpers/form_elements/decimal_field.rb
|
|
441
|
-
- app/helpers/form_elements/devise_password_field.rb
|
|
442
|
-
- app/helpers/form_elements/dns_records.rb
|
|
443
|
-
- app/helpers/form_elements/dropdown.rb
|
|
444
|
-
- app/helpers/form_elements/dropdown_with_integers.rb
|
|
445
|
-
- app/helpers/form_elements/dropdown_with_other.rb
|
|
446
|
-
- app/helpers/form_elements/dropdown_with_values.rb
|
|
447
|
-
- app/helpers/form_elements/dropdown_with_values_with_stars.rb
|
|
448
|
-
- app/helpers/form_elements/file_field.rb
|
|
449
|
-
- app/helpers/form_elements/header.rb
|
|
450
|
-
- app/helpers/form_elements/image_field.rb
|
|
451
|
-
- app/helpers/form_elements/info.rb
|
|
452
|
-
- app/helpers/form_elements/info_list.rb
|
|
453
|
-
- app/helpers/form_elements/integer_field.rb
|
|
454
|
-
- app/helpers/form_elements/money_field.rb
|
|
455
|
-
- app/helpers/form_elements/month_select.rb
|
|
456
|
-
- app/helpers/form_elements/month_year_picker.rb
|
|
457
|
-
- app/helpers/form_elements/multi_image_field.rb
|
|
458
|
-
- app/helpers/form_elements/pdf_link.rb
|
|
459
|
-
- app/helpers/form_elements/plain_text.rb
|
|
460
|
-
- app/helpers/form_elements/plain_text_area.rb
|
|
461
|
-
- app/helpers/form_elements/question_list.rb
|
|
462
|
-
- app/helpers/form_elements/radio_button.rb
|
|
463
|
-
- app/helpers/form_elements/rich_text.rb
|
|
464
|
-
- app/helpers/form_elements/scale_with_integers.rb
|
|
465
|
-
- app/helpers/form_elements/scale_with_values.rb
|
|
466
|
-
- app/helpers/form_elements/simple_file_field.rb
|
|
467
|
-
- app/helpers/form_elements/slider_with_values.rb
|
|
468
|
-
- app/helpers/form_elements/text_area.rb
|
|
469
|
-
- app/helpers/form_elements/text_area_without_ckeditor.rb
|
|
470
|
-
- app/helpers/form_elements/text_field.rb
|
|
471
|
-
- app/helpers/form_elements/time.rb
|
|
472
435
|
- app/helpers/inline_forms_helper.rb
|
|
473
436
|
- app/models/concerns/inline_forms/soft_deletable.rb
|
|
474
437
|
- app/validators/curacao_id_number_validator.rb
|
|
@@ -549,6 +512,46 @@ files:
|
|
|
549
512
|
- lib/inline_forms.rb
|
|
550
513
|
- lib/inline_forms/archived_form_elements.rb
|
|
551
514
|
- lib/inline_forms/form_element_from_callee.rb
|
|
515
|
+
- lib/inline_forms/form_element_registry.rb
|
|
516
|
+
- lib/inline_forms/form_elements.rb
|
|
517
|
+
- lib/inline_forms/form_elements/audio_field_helper.rb
|
|
518
|
+
- lib/inline_forms/form_elements/check_box_helper.rb
|
|
519
|
+
- lib/inline_forms/form_elements/check_list_helper.rb
|
|
520
|
+
- lib/inline_forms/form_elements/ckeditor_helper.rb
|
|
521
|
+
- lib/inline_forms/form_elements/date_helper.rb
|
|
522
|
+
- lib/inline_forms/form_elements/decimal_field_helper.rb
|
|
523
|
+
- lib/inline_forms/form_elements/devise_password_field_helper.rb
|
|
524
|
+
- lib/inline_forms/form_elements/dns_records_helper.rb
|
|
525
|
+
- lib/inline_forms/form_elements/dropdown_helper.rb
|
|
526
|
+
- lib/inline_forms/form_elements/dropdown_with_integers_helper.rb
|
|
527
|
+
- lib/inline_forms/form_elements/dropdown_with_other_helper.rb
|
|
528
|
+
- lib/inline_forms/form_elements/dropdown_with_values_helper.rb
|
|
529
|
+
- lib/inline_forms/form_elements/dropdown_with_values_with_stars_helper.rb
|
|
530
|
+
- lib/inline_forms/form_elements/file_field_helper.rb
|
|
531
|
+
- lib/inline_forms/form_elements/header_helper.rb
|
|
532
|
+
- lib/inline_forms/form_elements/helper_includes.rb
|
|
533
|
+
- lib/inline_forms/form_elements/image_field_helper.rb
|
|
534
|
+
- lib/inline_forms/form_elements/info_helper.rb
|
|
535
|
+
- lib/inline_forms/form_elements/info_list_helper.rb
|
|
536
|
+
- lib/inline_forms/form_elements/integer_field_helper.rb
|
|
537
|
+
- lib/inline_forms/form_elements/money_field_helper.rb
|
|
538
|
+
- lib/inline_forms/form_elements/month_select_helper.rb
|
|
539
|
+
- lib/inline_forms/form_elements/month_year_picker_helper.rb
|
|
540
|
+
- lib/inline_forms/form_elements/multi_image_field_helper.rb
|
|
541
|
+
- lib/inline_forms/form_elements/pdf_link_helper.rb
|
|
542
|
+
- lib/inline_forms/form_elements/plain_text_area_helper.rb
|
|
543
|
+
- lib/inline_forms/form_elements/plain_text_helper.rb
|
|
544
|
+
- lib/inline_forms/form_elements/question_list_helper.rb
|
|
545
|
+
- lib/inline_forms/form_elements/radio_button_helper.rb
|
|
546
|
+
- lib/inline_forms/form_elements/rich_text_helper.rb
|
|
547
|
+
- lib/inline_forms/form_elements/scale_with_integers_helper.rb
|
|
548
|
+
- lib/inline_forms/form_elements/scale_with_values_helper.rb
|
|
549
|
+
- lib/inline_forms/form_elements/simple_file_field_helper.rb
|
|
550
|
+
- lib/inline_forms/form_elements/slider_with_values_helper.rb
|
|
551
|
+
- lib/inline_forms/form_elements/text_area_helper.rb
|
|
552
|
+
- lib/inline_forms/form_elements/text_area_without_ckeditor_helper.rb
|
|
553
|
+
- lib/inline_forms/form_elements/text_field_helper.rb
|
|
554
|
+
- lib/inline_forms/form_elements/time_helper.rb
|
|
552
555
|
- lib/inline_forms/gem_files.rb
|
|
553
556
|
- lib/inline_forms/version.rb
|
|
554
557
|
- lib/locales/inline_forms.en.yml
|
|
@@ -559,6 +562,7 @@ files:
|
|
|
559
562
|
- lib/otherstuff/mkrole
|
|
560
563
|
- lib/otherstuff/roles_users.sql
|
|
561
564
|
- lib/vagrant/vagrantbox-inline_forms.zip
|
|
565
|
+
- script/migrate_form_elements.rb
|
|
562
566
|
- test/archived_form_elements_test.rb
|
|
563
567
|
- test/form_element_from_callee_test.rb
|
|
564
568
|
- test/inline_edit_polymorphic_path_test.rb
|
|
@@ -579,14 +583,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
579
583
|
requirements:
|
|
580
584
|
- - ">="
|
|
581
585
|
- !ruby/object:Gem::Version
|
|
582
|
-
version:
|
|
586
|
+
version: 4.0.0
|
|
583
587
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
584
588
|
requirements:
|
|
585
589
|
- - ">="
|
|
586
590
|
- !ruby/object:Gem::Version
|
|
587
591
|
version: '0'
|
|
588
592
|
requirements: []
|
|
589
|
-
rubygems_version:
|
|
593
|
+
rubygems_version: 4.0.10
|
|
590
594
|
specification_version: 4
|
|
591
595
|
summary: Inline editing of forms. Versions after 6.2.14 are currently broken.
|
|
592
596
|
test_files:
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
|
2
|
-
InlineForms::SPECIAL_COLUMN_TYPES[:audio_field]=:string
|
|
3
|
-
|
|
4
|
-
def audio_field_show(object, attribute)
|
|
5
|
-
o = object.send(attribute)
|
|
6
|
-
msg = "<i class='fi-pencil' title='Edit #{attribute.to_s}'></i>".html_safe
|
|
7
|
-
if o.send(:present?)
|
|
8
|
-
if o.respond_to? :palm
|
|
9
|
-
audio_html = audio_tag(o.send(:palm).send(:url), autoplay: false, controls: true)
|
|
10
|
-
else
|
|
11
|
-
audio_html = audio_tag(o.send(:url), autoplay: false, controls: true)
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
link_to_edit = link_to_inline_edit object, attribute, msg, from_callee: __callee__
|
|
15
|
-
if cancan_disabled? || ( can? :update, object, attribute )
|
|
16
|
-
"#{audio_html} #{link_to_edit}".html_safe
|
|
17
|
-
else
|
|
18
|
-
audio_html.html_safe
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def audio_field_edit(object, attribute)
|
|
23
|
-
file_field_tag attribute, class: 'input_text_field'
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def audio_field_update(object, attribute)
|
|
27
|
-
object.send(attribute.to_s + '=', params[attribute.to_sym])
|
|
28
|
-
end
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
|
2
|
-
InlineForms::SPECIAL_COLUMN_TYPES[:check_box]=:boolean
|
|
3
|
-
# boolean, bit unaptly named check_box
|
|
4
|
-
def check_box_show(object, attribute)
|
|
5
|
-
values = attribute_values(object, attribute)
|
|
6
|
-
link_to_inline_edit object, attribute, values[object.send(attribute) ? 1 : 0 ][1], from_callee: __callee__
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def check_box_edit(object, attribute)
|
|
10
|
-
check_box_tag attribute.to_s, 1, object.send(attribute)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def check_box_update(object, attribute)
|
|
14
|
-
object[attribute.to_s.to_sym] = params[attribute.to_s.to_sym].nil? ? 0 : 1
|
|
15
|
-
end
|
|
16
|
-
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
|
2
|
-
InlineForms::SPECIAL_COLUMN_TYPES[:check_list]=:no_migration
|
|
3
|
-
|
|
4
|
-
# checklist
|
|
5
|
-
def check_list_show(object, attribute)
|
|
6
|
-
out = ''
|
|
7
|
-
out = link_to_inline_edit(object, attribute, "<i class='fi-plus'></i>".html_safe, from_callee: __callee__) if object.send(attribute).empty?
|
|
8
|
-
object.send(attribute).sort.each do | item |
|
|
9
|
-
out << "<div class='row #{cycle('odd', 'even')}'>"
|
|
10
|
-
out << link_to_inline_edit(object, attribute, item._presentation, from_callee: __callee__ )
|
|
11
|
-
out << '</div>'
|
|
12
|
-
end
|
|
13
|
-
out.html_safe
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def check_list_edit(object, attribute)
|
|
17
|
-
object.send(attribute).build if object.send(attribute).empty?
|
|
18
|
-
if cancan_enabled?
|
|
19
|
-
values = object.send(attribute).first.class.name.constantize.accessible_by(current_ability).order(attribute.to_s.singularize.camelcase.constantize.order_by_clause)
|
|
20
|
-
else
|
|
21
|
-
values = object.send(attribute).first.class.name.constantize.order(attribute.to_s.singularize.camelcase.constantize.order_by_clause)
|
|
22
|
-
end
|
|
23
|
-
out = ''
|
|
24
|
-
values.each do | item |
|
|
25
|
-
out << "<div class='row #{cycle('odd', 'even')}'>"
|
|
26
|
-
out << check_box_tag( attribute.to_s + '[' + item.id.to_s + ']', 1, object.send(attribute.to_s.singularize + "_ids").include?(item.id) )
|
|
27
|
-
out << "<label for=#{attribute.to_s + '[' + item.id.to_s + ']'}>#{h(item._presentation)}</label>"
|
|
28
|
-
out << '</div>'
|
|
29
|
-
end
|
|
30
|
-
out.html_safe
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def check_list_update(object, attribute)
|
|
34
|
-
params[attribute] ||= {}
|
|
35
|
-
object.send(attribute.to_s.singularize + '_ids=', params[attribute].keys)
|
|
36
|
-
object.touch unless object.new_record? # Check for new_record needed for Rails > 3; TODO we should have a flag to turn this on or of.
|
|
37
|
-
end
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
|
2
|
-
# Legacy type name: CKEditor is removed; behaves like :rich_text.
|
|
3
|
-
InlineForms::SPECIAL_COLUMN_TYPES[:ckeditor]=:text
|
|
4
|
-
|
|
5
|
-
def ckeditor_show(object, attribute)
|
|
6
|
-
rich_text_show(object, attribute)
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def ckeditor_edit(object, attribute)
|
|
10
|
-
rich_text_edit(object, attribute)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def ckeditor_update(object, attribute)
|
|
14
|
-
rich_text_update(object, attribute)
|
|
15
|
-
end
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
|
2
|
-
InlineForms::SPECIAL_COLUMN_TYPES[:date_select]=:date
|
|
3
|
-
|
|
4
|
-
# date
|
|
5
|
-
def date_select_show(object, attribute)
|
|
6
|
-
link_to_inline_edit object, attribute, object.send(attribute).nil? ? "<i class='fi-plus'></i>".html_safe : object.send(attribute).to_date.strftime("%d-%m-%Y"), from_callee: __callee__
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def date_select_edit(object, attribute)
|
|
10
|
-
css_id = 'datepicker_' + object.class.to_s.underscore + '_' + object.id.to_s + '_' + attribute.to_s
|
|
11
|
-
out = text_field_tag attribute, ( object.send(attribute).nil? ? "" : object.send(attribute).to_date.strftime("%d-%m-%Y") ), :id => css_id, :class =>'datepicker'
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def date_select_update(object, attribute)
|
|
15
|
-
object[attribute.to_sym] = params[attribute.to_sym]
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def date_select_info(object, attribute)
|
|
19
|
-
object.send(attribute).nil? ? "-" : object.send(attribute).to_date
|
|
20
|
-
end
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
|
2
|
-
InlineForms::SPECIAL_COLUMN_TYPES[:decimal_field]=:string
|
|
3
|
-
|
|
4
|
-
def decimal_field_show(object, attribute)
|
|
5
|
-
link_to_inline_edit object, attribute, object[attribute].nil? ? "<i class='fi-plus'></i>".html_safe : object[attribute], from_callee: __callee__
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def decimal_field_edit(object, attribute)
|
|
9
|
-
text_field_tag attribute, (object.send attribute.to_sym), :class => 'input_decimal_field' # for abide: , :required => true
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def decimal_field_update(object, attribute)
|
|
13
|
-
object.send :write_attribute, attribute.to_sym, params[attribute.to_sym]
|
|
14
|
-
end
|
|
15
|
-
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
|
2
|
-
InlineForms::SPECIAL_COLUMN_TYPES[:devise_password_field]=:string
|
|
3
|
-
|
|
4
|
-
def devise_password_field_show(object, attribute)
|
|
5
|
-
link_to_inline_edit object, attribute, '', from_callee: __callee__
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def devise_password_field_edit(object, attribute)
|
|
9
|
-
password_field_tag attribute, '', :class => 'input_devise_password_field'
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def devise_password_field_update(object, attribute)
|
|
13
|
-
if params[attribute.to_sym].blank?
|
|
14
|
-
# nothing happens
|
|
15
|
-
else
|
|
16
|
-
object.password = params[attribute.to_sym]
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
|
2
|
-
def dnsrecords_show(object, attribute)
|
|
3
|
-
out = ""
|
|
4
|
-
[object.a_records,object.template_a_records].flatten.collect do |r|
|
|
5
|
-
out << r.djbdns_line(object.name) + "<br/>"
|
|
6
|
-
end
|
|
7
|
-
raw out
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def dnsrecords_edit(object, attribute)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def dnsrecords_update(object, attribute)
|
|
14
|
-
end
|
|
15
|
-
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
|
2
|
-
InlineForms::SPECIAL_COLUMN_TYPES[:dropdown]=:belongs_to
|
|
3
|
-
|
|
4
|
-
# dropdown
|
|
5
|
-
def dropdown_show(object, attribute)
|
|
6
|
-
attr = object.send attribute
|
|
7
|
-
presentation = "_presentation"
|
|
8
|
-
presentation = "_dropdown_presentation" if attr.respond_to? "_dropdown_presentation"
|
|
9
|
-
attribute_value = object.send(attribute).send(presentation) rescue "<i class='fi-plus'></i>".html_safe
|
|
10
|
-
link_to_inline_edit object, attribute, attribute_value, from_callee: __callee__
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def dropdown_edit(object, attribute)
|
|
14
|
-
object.send('build_' + attribute.to_s) unless object.send(attribute) # we really need this!
|
|
15
|
-
attr = object.send attribute
|
|
16
|
-
presentation = "_presentation"
|
|
17
|
-
presentation = "_dropdown_presentation" if attr.respond_to? "_dropdown_presentation"
|
|
18
|
-
klass = object.send(attribute).class
|
|
19
|
-
if cancan_enabled?
|
|
20
|
-
values = klass.accessible_by(current_ability)
|
|
21
|
-
else
|
|
22
|
-
values = klass.all
|
|
23
|
-
end
|
|
24
|
-
options_disabled = nil
|
|
25
|
-
if klass.method_defined? :disabled_for_dropdown?
|
|
26
|
-
options_disabled = values.map{|v| v.id if v.disabled_for_dropdown?}.compact
|
|
27
|
-
end
|
|
28
|
-
values.sort_by {|v|v.send presentation}
|
|
29
|
-
# 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!
|
|
30
|
-
collection_select( ('_' + object.class.to_s.underscore).to_sym,
|
|
31
|
-
attribute.to_s.foreign_key.to_sym,
|
|
32
|
-
values,
|
|
33
|
-
'id',
|
|
34
|
-
presentation,
|
|
35
|
-
selected: (object.send(attribute).id rescue nil),
|
|
36
|
-
disabled: options_disabled,
|
|
37
|
-
)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def dropdown_update(object, attribute)
|
|
41
|
-
foreign_key = object.class.reflect_on_association(attribute.to_sym).options[:foreign_key] || attribute.to_s.foreign_key.to_sym
|
|
42
|
-
object[foreign_key] = params[('_' + object.class.to_s.underscore).to_sym][attribute.to_s.foreign_key.to_sym]
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def dropdown_info(object, attribute)
|
|
46
|
-
attr = object.send attribute
|
|
47
|
-
presentation = "_presentation"
|
|
48
|
-
presentation = "_dropdown_presentation" if attr.respond_to? "_dropdown_presentation"
|
|
49
|
-
object.send(attribute).send(presentation) rescue "-"
|
|
50
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
|
2
|
-
InlineForms::SPECIAL_COLUMN_TYPES[:dropdown_with_integers]=:integer
|
|
3
|
-
|
|
4
|
-
# dropdown_with_integers generates a dropdown menu
|
|
5
|
-
# with the given list of integers as options
|
|
6
|
-
#
|
|
7
|
-
# values must be a Range or a one-dimensional array of Integers
|
|
8
|
-
def dropdown_with_integers_show(object, attribute)
|
|
9
|
-
values = attribute_values(object, attribute)
|
|
10
|
-
link_to_inline_edit object, attribute, values[object.send(attribute)][1], from_callee: __callee__
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def dropdown_with_integers_edit(object, attribute)
|
|
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
|
-
values = attribute_values(object, attribute)
|
|
16
|
-
collection_select( ('_' + object.class.to_s.underscore).to_sym, attribute.to_sym, values, 'first', 'last', :selected => object.send(attribute))
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def dropdown_with_integers_update(object, attribute)
|
|
20
|
-
object[attribute.to_sym] = params[('_' + object.class.to_s.underscore).to_sym][attribute.to_sym]
|
|
21
|
-
end
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
|
2
|
-
InlineForms::SPECIAL_COLUMN_TYPES[:dropdown_with_other]=:belongs_to
|
|
3
|
-
|
|
4
|
-
# dropdown
|
|
5
|
-
def dropdown_with_other_show(object, attribute)
|
|
6
|
-
attribute = attribute.to_s
|
|
7
|
-
foreign_key = object.class.reflect_on_association(attribute.to_sym).options[:foreign_key] || attribute.foreign_key.to_sym
|
|
8
|
-
id = object[foreign_key]
|
|
9
|
-
if id == 0
|
|
10
|
-
attribute_value = object[attribute + '_other']
|
|
11
|
-
attribute_value = "<i class='fi-plus'></i>".html_safe if attribute_value.nil? || attribute_value.empty?
|
|
12
|
-
else
|
|
13
|
-
attribute_value = object.send(attribute)._presentation rescue "<i class='fi-plus'></i>".html_safe
|
|
14
|
-
end
|
|
15
|
-
link_to_inline_edit object, attribute, attribute_value, from_callee: __callee__
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def dropdown_with_other_edit(object, attribute)
|
|
19
|
-
attribute = attribute.to_s
|
|
20
|
-
foreign_key = object.class.reflect_on_association(attribute.to_sym).options[:foreign_key] || attribute.foreign_key.to_sym
|
|
21
|
-
o = attribute.camelcase.constantize
|
|
22
|
-
values = o.all
|
|
23
|
-
values = o.accessible_by(current_ability) if cancan_enabled?
|
|
24
|
-
values.each do |v|
|
|
25
|
-
v.name = v._presentation
|
|
26
|
-
end
|
|
27
|
-
# values.sort_by(&:name)
|
|
28
|
-
|
|
29
|
-
collection = values.map {|v|[v.name, v.id]}
|
|
30
|
-
collection << [object[attribute + '_other'], 0] unless object[attribute + '_other'].nil? || object[attribute + '_other'].empty?
|
|
31
|
-
out = '<div class="ui-widget">'
|
|
32
|
-
out << select('_' + object.class.to_s.underscore, foreign_key.to_sym, collection, {selected: object[foreign_key.to_sym]}, {id: '_' + object.class.to_s.underscore + '_' + object.id.to_s + '_' + foreign_key.to_s})
|
|
33
|
-
out << '</div>
|
|
34
|
-
<script>
|
|
35
|
-
(function( $ ) {
|
|
36
|
-
$.widget( "custom.combobox", {
|
|
37
|
-
_create: function() {
|
|
38
|
-
this.wrapper = $( "<span>" )
|
|
39
|
-
.addClass( "custom-combobox" )
|
|
40
|
-
.insertAfter( this.element );
|
|
41
|
-
|
|
42
|
-
this.element.hide();
|
|
43
|
-
this._createAutocomplete();
|
|
44
|
-
this._createShowAllButton();
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
_createAutocomplete: function() {
|
|
48
|
-
var selected = this.element.children( ":selected" ),
|
|
49
|
-
value = selected.val() ? selected.text() : "";
|
|
50
|
-
|
|
51
|
-
this.input = $( "<input name=\''
|
|
52
|
-
|
|
53
|
-
out << '_' + object.class.to_s.underscore + '[' + attribute + '_other]'
|
|
54
|
-
|
|
55
|
-
out << '\'>" )
|
|
56
|
-
.appendTo( this.wrapper )
|
|
57
|
-
.val( value )
|
|
58
|
-
.attr( "title", "" )
|
|
59
|
-
.addClass( "custom-combobox-input ui-widget ui-widget-content ui-state-default ui-corner-left" )
|
|
60
|
-
.autocomplete({
|
|
61
|
-
delay: 0,
|
|
62
|
-
minLength: 0,
|
|
63
|
-
source: $.proxy( this, "_source" )
|
|
64
|
-
})
|
|
65
|
-
.tooltip({
|
|
66
|
-
tooltipClass: "ui-state-highlight"
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
this._on( this.input, {
|
|
70
|
-
autocompleteselect: function( event, ui ) {
|
|
71
|
-
ui.item.option.selected = true;
|
|
72
|
-
this._trigger( "select", event, {
|
|
73
|
-
item: ui.item.option
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
_createShowAllButton: function() {
|
|
80
|
-
var input = this.input,
|
|
81
|
-
wasOpen = false;
|
|
82
|
-
|
|
83
|
-
$( "<a>" )
|
|
84
|
-
.attr( "tabIndex", -1 )
|
|
85
|
-
.attr( "title", "Show All Items" )
|
|
86
|
-
.tooltip()
|
|
87
|
-
.appendTo( this.wrapper )
|
|
88
|
-
.button({
|
|
89
|
-
icons: {
|
|
90
|
-
primary: "ui-icon-triangle-1-s"
|
|
91
|
-
},
|
|
92
|
-
text: false
|
|
93
|
-
})
|
|
94
|
-
.removeClass( "ui-corner-all" )
|
|
95
|
-
.addClass( "custom-combobox-toggle ui-corner-right" )
|
|
96
|
-
.mousedown(function() {
|
|
97
|
-
wasOpen = input.autocomplete( "widget" ).is( ":visible" );
|
|
98
|
-
})
|
|
99
|
-
.click(function() {
|
|
100
|
-
input.focus();
|
|
101
|
-
|
|
102
|
-
// Close if already visible
|
|
103
|
-
if ( wasOpen ) {
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// Pass empty string as value to search for, displaying all results
|
|
108
|
-
input.autocomplete( "search", "" );
|
|
109
|
-
});
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
_source: function( request, response ) {
|
|
113
|
-
var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" );
|
|
114
|
-
response( this.element.children( "option" ).map(function() {
|
|
115
|
-
var text = $( this ).text();
|
|
116
|
-
if ( this.value && ( !request.term || matcher.test(text) ) )
|
|
117
|
-
return {
|
|
118
|
-
label: text,
|
|
119
|
-
value: text,
|
|
120
|
-
option: this
|
|
121
|
-
};
|
|
122
|
-
}) );
|
|
123
|
-
},
|
|
124
|
-
});
|
|
125
|
-
})( jQuery );
|
|
126
|
-
|
|
127
|
-
$(function() {
|
|
128
|
-
$( "'
|
|
129
|
-
out << '#_' + object.class.to_s.underscore + '_' + object.id.to_s + '_' + attribute.foreign_key.to_s
|
|
130
|
-
out << '" ).combobox();
|
|
131
|
-
});
|
|
132
|
-
</script>'
|
|
133
|
-
out.html_safe
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
def dropdown_with_other_update(object, attribute)
|
|
139
|
-
attribute = attribute.to_s
|
|
140
|
-
foreign_key = object.class.reflect_on_association(attribute.to_sym).options[:foreign_key] || attribute.foreign_key.to_sym
|
|
141
|
-
# if there is an attribute attr, then there must be an attribute attr_other
|
|
142
|
-
other = params[('_' + object.class.to_s.underscore).to_sym][(attribute + "_other").to_sym]
|
|
143
|
-
# see if it matches anything (but we need to look at I18n too!
|
|
144
|
-
lookup_model = attribute.camelcase.constantize
|
|
145
|
-
name_field = 'name_' + I18n.locale.to_s
|
|
146
|
-
name_field = 'name' unless lookup_model.new.respond_to? name_field
|
|
147
|
-
puts 'XXXXXXXXXXXXXXXXXXXX ' + name_field.inspect
|
|
148
|
-
match = lookup_model.where(name_field.to_sym => other).first # problem if there are dupes!
|
|
149
|
-
puts 'XXXXXXXXXXXXXXXXXXXX ' + match.inspect
|
|
150
|
-
match.nil? ? object[foreign_key] = 0 : object[foreign_key] = match.id # problem if there is a record with id: 0 !
|
|
151
|
-
match.nil? ? object[attribute + '_other'] = other : object[attribute + '_other'] = nil
|
|
152
|
-
end
|
|
153
|
-
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
|
2
|
-
InlineForms::SPECIAL_COLUMN_TYPES[:dropdown_with_values]=:integer
|
|
3
|
-
|
|
4
|
-
# dropdown_with_values
|
|
5
|
-
def dropdown_with_values_show(object, attribute)
|
|
6
|
-
values = attribute_values(object, attribute)
|
|
7
|
-
link_to_inline_edit object, attribute, object.send(attribute) ? t(values.assoc(object.send(attribute))[1]) : "<i class='fi-plus'></i>".html_safe, from_callee: __callee__
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def dropdown_with_values_edit(object, attribute)
|
|
11
|
-
# 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!
|
|
12
|
-
values = attribute_values(object, attribute)
|
|
13
|
-
|
|
14
|
-
attributes = @inline_forms_attribute_list || object.inline_forms_attribute_list
|
|
15
|
-
options_disabled = attributes.assoc(attribute.to_sym)[4]
|
|
16
|
-
|
|
17
|
-
collection_select( ('_' + object.class.to_s.underscore).to_sym,
|
|
18
|
-
attribute.to_sym,
|
|
19
|
-
values, 'first', 'last',
|
|
20
|
-
:selected => object.send(attribute),
|
|
21
|
-
disabled: options_disabled,
|
|
22
|
-
)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def dropdown_with_values_update(object, attribute)
|
|
26
|
-
object[attribute.to_sym] = params[('_' + object.class.to_s.underscore).to_sym][attribute.to_sym]
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def dropdown_with_values_info(object, attribute)
|
|
30
|
-
values = attribute_values(object, attribute)
|
|
31
|
-
t(values.assoc(object.send(attribute))[1]) rescue '-'
|
|
32
|
-
end
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
|
2
|
-
InlineForms::SPECIAL_COLUMN_TYPES[:dropdown_with_values_with_stars]=:integer
|
|
3
|
-
|
|
4
|
-
# dropdown_with_values_with_stars
|
|
5
|
-
def dropdown_with_values_with_stars_show(object, attribute)
|
|
6
|
-
values = attribute_values(object, attribute)
|
|
7
|
-
link_to_inline_edit object, attribute, (object[attribute].nil? || object[attribute] == 0) ? "<i class='fi-plus'></i>".html_safe : image_tag(object[attribute].to_s + 'stars.png'), from_callee: __callee__
|
|
8
|
-
end
|
|
9
|
-
def dropdown_with_values_with_stars_edit(object, attribute)
|
|
10
|
-
# 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!
|
|
11
|
-
values = attribute_values(object, attribute)
|
|
12
|
-
collection_select( ('_' + object.class.to_s.underscore).to_sym, attribute.to_sym, values, 'first', 'last', :selected => object.send(attribute))
|
|
13
|
-
end
|
|
14
|
-
def dropdown_with_values_with_stars_update(object, attribute)
|
|
15
|
-
object[attribute.to_sym] = params[('_' + object.class.to_s.underscore).to_sym][attribute.to_sym]
|
|
16
|
-
end
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
|
2
|
-
InlineForms::SPECIAL_COLUMN_TYPES[:file_field]=:string
|
|
3
|
-
|
|
4
|
-
def file_field_show(object, attribute)
|
|
5
|
-
o = object.send(attribute)
|
|
6
|
-
msg = o.to_s
|
|
7
|
-
if o.send(:present?)
|
|
8
|
-
msg = "replace | <a href='#{o.send(:url)}'>#{o.send(:path).gsub(/^.*\//,'')}</a>".html_safe
|
|
9
|
-
end
|
|
10
|
-
link_to_inline_edit object, attribute, msg, from_callee: __callee__
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def file_field_edit(object, attribute)
|
|
14
|
-
file_field_tag attribute, :class => 'input_text_field'
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def file_field_update(object, attribute)
|
|
18
|
-
object.send(attribute.to_s + '=', params[attribute.to_sym])
|
|
19
|
-
end
|
|
20
|
-
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
|
2
|
-
# not needed here, since this is only used in the views InlineForms::SPECIAL_COLUMN_TYPES[:header]=:string
|
|
3
|
-
|
|
4
|
-
def header_show(object, attribute)
|
|
5
|
-
# show the header which is the translated fake attribute
|
|
6
|
-
attribute
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def header_edit(object, attribute)
|
|
10
|
-
# just show the header
|
|
11
|
-
attribute
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def header_update(object, attribute)
|
|
15
|
-
# do absolutely nothing
|
|
16
|
-
end
|
|
17
|
-
|