inline_forms 8.1.21 → 8.1.42
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/.forgejo/workflows/ci.yml +63 -0
- data/.forgejo/workflows/full-gate.yml +77 -0
- data/.gitignore +10 -5
- data/.rubocop.yml +31 -0
- data/.rubocop_todo.yml +151 -0
- data/CHANGELOG.md +305 -0
- data/CLAUDE.md +68 -0
- data/Gemfile +18 -2
- data/README.rdoc +23 -6
- data/Rakefile +53 -12
- data/app/assets/fonts/opensans-v44-latin-italic.woff2 +0 -0
- data/app/assets/fonts/opensans-v44-latin-regular.woff2 +0 -0
- data/app/assets/javascripts/inline_forms/inline_forms.js +30 -43
- data/app/assets/stylesheets/inline_forms/_foundation_icons.scss +6 -12
- data/app/assets/stylesheets/inline_forms/_theme.scss +134 -0
- data/app/assets/stylesheets/inline_forms/devise.scss +14 -13
- data/app/assets/stylesheets/inline_forms/foundation_and_overrides.scss +4 -0
- data/app/assets/stylesheets/inline_forms/inline_forms.scss +59 -68
- data/app/assets/stylesheets/inline_forms_fonts.css.erb +39 -0
- data/app/controllers/inline_forms_application_controller.rb +8 -4
- data/app/controllers/inline_forms_controller.rb +88 -14
- data/app/helpers/inline_forms_helper.rb +58 -15
- data/app/models/concerns/inline_forms/soft_deletable.rb +11 -12
- data/app/validators/curacao_id_number_validator.rb +5 -6
- data/app/validators/is_curacao_phone_validator.rb +2 -3
- data/app/validators/is_email_address_validator.rb +3 -3
- data/app/validators/must_be_a_value_validator.rb +6 -6
- data/app/views/inline_forms/_new.html.erb +4 -1
- data/app/views/inline_forms/_pending_migration_row.html.erb +15 -0
- data/app/views/inline_forms/_show.html.erb +5 -2
- data/app/views/inline_forms/field_pending.html.erb +10 -0
- data/app/views/layouts/application.html.erb +6 -3
- data/app/views/layouts/devise.html.erb +1 -0
- data/app/views/layouts/inline_forms.html.erb +7 -4
- data/archived/README.md +2 -0
- data/archived/form_elements/dns_records/README.md +25 -0
- data/archived/form_elements/question_list/README.md +25 -0
- data/inline_forms.gemspec +8 -7
- data/lib/generators/inline_forms_addto/USAGE +31 -0
- data/lib/generators/inline_forms_addto_generator.rb +198 -26
- data/lib/generators/inline_forms_attribute_overrides.rb +3 -2
- data/lib/generators/templates/application_record.rb +1 -1
- data/lib/inline_forms/archived_form_elements.rb +23 -10
- data/lib/inline_forms/attribute_list.rb +191 -0
- data/lib/inline_forms/form_element_from_callee.rb +1 -0
- data/lib/inline_forms/form_element_registry.rb +32 -32
- data/lib/inline_forms/form_elements/color_field_helper.rb +44 -0
- data/lib/inline_forms/form_elements/date_helper.rb +4 -1
- data/lib/inline_forms/form_elements/dropdown_with_other_helper.rb +25 -113
- data/lib/inline_forms/form_elements/month_year_picker_helper.rb +13 -2
- data/lib/inline_forms/form_elements/multi_image_field_helper.rb +18 -6
- data/lib/inline_forms/form_elements/slider_with_values_helper.rb +31 -64
- data/lib/inline_forms/form_elements/time_helper.rb +3 -1
- data/lib/inline_forms/gem_files.rb +27 -0
- data/lib/inline_forms/schema_apply.rb +85 -0
- data/lib/inline_forms/schema_intent.rb +76 -0
- data/lib/inline_forms/schema_label.rb +65 -0
- data/lib/inline_forms/schema_preview.rb +135 -0
- data/lib/inline_forms/tabs.rb +175 -0
- data/lib/inline_forms/turbo_tabs_builder.rb +20 -13
- data/lib/inline_forms/version.rb +2 -1
- data/lib/inline_forms.rb +145 -45
- data/lib/locales/inline_forms.en.yml +2 -0
- data/lib/locales/inline_forms.nl.yml +2 -0
- data/test/archived_form_elements_test.rb +34 -4
- data/test/attribute_list_test.rb +165 -0
- data/test/dummy/app/controllers/application_controller.rb +24 -0
- data/test/dummy/app/controllers/gizmos_controller.rb +4 -0
- data/test/dummy/app/controllers/machines_controller.rb +4 -0
- data/test/dummy/app/controllers/parts_controller.rb +4 -0
- data/test/dummy/app/controllers/widgets_controller.rb +4 -0
- data/test/dummy/app/helpers/application_helper.rb +13 -0
- data/test/dummy/app/models/application_record.rb +26 -0
- data/test/dummy/app/models/gizmo.rb +25 -0
- data/test/dummy/app/models/kind.rb +8 -0
- data/test/dummy/app/models/machine.rb +23 -0
- data/test/dummy/app/models/part.rb +16 -0
- data/test/dummy/app/models/widget.rb +39 -0
- data/test/dummy/app/views/_inline_forms_tabs.html.erb +40 -0
- data/test/dummy/config/application.rb +37 -0
- data/test/dummy/config/database.yml +3 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/initializers/inline_forms.rb +6 -0
- data/test/dummy/config/initializers/paper_trail_yaml_safe_load.rb +28 -0
- data/test/dummy/config/routes.rb +31 -0
- data/test/inline_forms_addto_generator_test.rb +220 -0
- data/test/integration/inline_forms_crud_test.rb +141 -0
- data/test/integration/legacy_elements_test.rb +42 -0
- data/test/integration/native_inputs_test.rb +138 -0
- data/test/integration/open_after_create_test.rb +85 -0
- data/test/integration/pending_migration_gate_test.rb +75 -0
- data/test/integration/schema_batch_pipeline_test.rb +189 -0
- data/test/integration/schema_edit_test.rb +141 -0
- data/test/integration/schema_preview_test.rb +65 -0
- data/test/integration_test_helper.rb +121 -0
- data/test/plain_text_configuration_test.rb +3 -3
- data/test/schema_apply_test.rb +73 -0
- data/test/schema_intent_test.rb +53 -0
- data/test/schema_label_test.rb +61 -0
- data/test/tabs_test.rb +98 -0
- data/test/user_model_config_test.rb +1 -0
- data/vendor/assets/javascripts/trix.min.js +7 -0
- data/vendor/assets/stylesheets/trix.css +470 -0
- metadata +91 -320
- data/app/assets/images/jquery-ui/animated-overlay.gif +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diagonal-maze_20_6e4f1c_10x10.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diagonal-maze_40_000000_10x10.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diagonals-medium_20_d34d17_40x40.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diagonals-small_0_aaaaaa_40x40.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diagonals-small_25_c5ddfc_40x40.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diagonals-small_40_db4865_40x40.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diagonals-small_50_262626_40x40.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diagonals-small_50_93c3cd_40x40.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diagonals-small_50_ff3853_40x40.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diagonals-small_75_ccd232_40x40.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diagonals-thick_15_0b3e6f_40x40.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diagonals-thick_15_444444_40x40.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diagonals-thick_20_e69700_40x40.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diagonals-thick_22_1484e6_40x40.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diagonals-thick_26_2293f7_40x40.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diagonals-thick_75_f3d8d8_40x40.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diagonals-thick_8_333333_40x40.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diagonals-thick_90_eeeeee_40x40.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diagonals-thick_95_ffdc2e_40x40.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diamond_10_4f4221_10x8.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diamond_20_372806_10x8.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diamond_25_675423_10x8.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diamond_25_d5ac5d_10x8.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diamond_8_261803_10x8.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_diamond_8_443113_10x8.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_dots-medium_30_0b58a2_4x4.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_dots-medium_80_ffff38_4x4.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_dots-small_20_333333_2x2.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_dots-small_30_a32d00_2x2.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_dots-small_35_35414f_2x2.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_dots-small_40_00498f_2x2.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_dots-small_65_a6a6a6_2x2.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_fine-grain_10_eceadf_60x60.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_fine-grain_10_f8f7f6_60x60.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_fine-grain_15_eceadf_60x60.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_fine-grain_15_f7f3de_60x60.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_fine-grain_15_ffffff_60x60.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_fine-grain_65_654b24_60x60.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_fine-grain_68_b83400_60x60.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_0_303030_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_0_333333_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_0_4c4c4c_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_0_e69700_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_0_e6b900_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_0_eeeeee_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_10_000000_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_15_cd0a0a_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_30_cccccc_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_40_292929_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_50_5c5c5c_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_55_994d53_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_55_999999_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_55_c0402a_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_55_eeeeee_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_55_fafafa_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_55_fbec88_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_55_ffffff_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_65_ffffff_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_75_aaaaaa_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_75_ba9217_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_75_ddd4b0_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_100_e4f1fb_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_100_f5f0e5_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_100_f8f8f8_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_15_5f391b_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_20_555555_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_25_cb842e_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_35_dddddd_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_40_0078a3_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_40_0a0a0a_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_40_111111_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_40_ffc73d_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_45_0078ae_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_50_3baae3_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_55_1c1c1c_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_55_f1fbe5_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_55_f8da4e_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_55_fbf5d0_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_55_fbf8ee_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_55_fcf0ba_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_60_000000_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_60_eeeeee_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_70_ede4d4_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_75_79c9ec_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_80_d7ebf9_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_85_dfeffc_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_gloss-wave_100_ece8da_500x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_gloss-wave_16_121212_500x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_gloss-wave_20_111111_500x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_gloss-wave_20_1c160d_500x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_gloss-wave_25_333333_500x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_gloss-wave_25_453326_500x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_gloss-wave_30_3d3644_500x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_gloss-wave_30_44372c_500x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_gloss-wave_45_817865_500x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_gloss-wave_45_e14f1c_500x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_gloss-wave_50_6eac2c_500x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_gloss-wave_55_000000_500x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_gloss-wave_60_fece2f_500x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_gloss-wave_70_ffdd57_500x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_gloss-wave_75_2191c0_500x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_gloss-wave_85_9fda58_500x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_gloss-wave_90_fff9e5_500x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_gloss-wave_95_f6ecd5_500x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-hard_100_eeeeee_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-hard_100_f2f5f7_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-hard_100_f4f0ec_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-hard_100_f5f3e5_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-hard_100_f6f6f6_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-hard_100_f9f9f9_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-hard_100_fafaf4_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-hard_15_459e00_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-hard_15_888888_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-hard_20_0972a5_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-hard_30_285c00_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-hard_40_aaaaaa_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-hard_55_555555_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-hard_65_fee4bd_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-hard_70_000000_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-hard_75_f5f5b5_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-hard_95_cccccc_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_100_dcd9de_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_100_deedf7_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_100_eae6ea_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_100_f6f6f6_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_100_f9f9f9_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_100_feeebd_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_15_cc0000_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_20_201913_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_20_619226_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_25_0073ea_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_25_30273a_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_25_67b021_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_25_ffef8f_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_33_003147_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_33_3a8104_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_35_222222_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_35_adadad_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_44_444444_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_45_5f5964_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_50_4eb305_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_50_aaaaaa_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_50_dddddd_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_60_4ca20b_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_60_dddddd_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_80_eeeeee_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_95_ffedad_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_inset-hard_100_eeeeee_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_inset-hard_45_cd0a0a_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_inset-hard_55_ffeb80_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_inset-hard_75_999999_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_inset-soft_100_f4f0ec_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_inset-soft_10_201913_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_inset-soft_10_285c00_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_inset-soft_15_121212_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_inset-soft_15_2b2922_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_inset-soft_25_000000_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_inset-soft_30_f58400_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_inset-soft_30_ffffff_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_inset-soft_50_c9c9c9_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_loop_25_000000_21x21.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_white-lines_85_f7f7ba_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_000000_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_004276_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_00498f_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_0073ea_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_0078ae_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_056b93_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_070603_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_0a82eb_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_0b54d5_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_1f1f1f_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_217bc0_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_222222_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_228ef1_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_2694e8_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_2e83ff_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_3383bb_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_3572ac_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_3d3d3d_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_3d80b3_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_454545_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_469bdd_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_4b8e0b_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_4ca300_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_4eb305_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_5fa5e3_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_666666_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_6da8d5_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_70b2e1_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_72a7cf_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_72b42d_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_734d99_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_808080_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_847e71_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_888888_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_88a206_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_8DC262_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_8c291d_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_8d78a5_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_98d2fb_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_999999_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_9bcc60_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_9ccdfc_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_9fda58_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_a83300_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_a8a3ae_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_aaaaaa_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_add978_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_b83400_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_b8ec79_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_bbbbbb_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_bd7b00_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_c02669_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_c47a23_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_c98000_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_cb672b_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_cc0000_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_cccccc_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_cd0a0a_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_d19405_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_d8e7f3_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_e0fdff_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_e1e463_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_e3ddc9_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_e8e2b5_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_e9cd86_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_eb990f_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_ebccce_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_ed9f26_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_ededed_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_eeeeee_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_ef8c08_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_efec9f_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_f08000_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_f1fd86_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_f29a00_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_f2ec64_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_f35f07_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_f5e175_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_f7a50d_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_f9bd01_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_f9f2bd_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_fadc7a_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_fbc856_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_fbdb93_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_fcd113_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_fcdd4a_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_ff0084_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_ff7519_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_ffcf29_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_ffd27a_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_ffe180_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_ffeb33_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_ffffff_256x240.png +0 -0
- data/app/assets/stylesheets/jquery_ui/jquery.ui.accordion.css.scss +0 -39
- data/app/assets/stylesheets/jquery_ui/jquery.ui.all.css.scss +0 -14
- data/app/assets/stylesheets/jquery_ui/jquery.ui.autocomplete.css.scss +0 -17
- data/app/assets/stylesheets/jquery_ui/jquery.ui.base.css.scss +0 -27
- data/app/assets/stylesheets/jquery_ui/jquery.ui.button.css.scss +0 -115
- data/app/assets/stylesheets/jquery_ui/jquery.ui.core.css.scss +0 -92
- data/app/assets/stylesheets/jquery_ui/jquery.ui.datepicker.css.scss +0 -179
- data/app/assets/stylesheets/jquery_ui/jquery.ui.dialog.css.scss +0 -70
- data/app/assets/stylesheets/jquery_ui/jquery.ui.menu.css.scss +0 -80
- data/app/assets/stylesheets/jquery_ui/jquery.ui.progressbar.css.scss +0 -29
- data/app/assets/stylesheets/jquery_ui/jquery.ui.resizable.css.scss +0 -79
- data/app/assets/stylesheets/jquery_ui/jquery.ui.selectable.css.scss +0 -16
- data/app/assets/stylesheets/jquery_ui/jquery.ui.slider.css.scss +0 -74
- data/app/assets/stylesheets/jquery_ui/jquery.ui.spinner.css.scss +0 -66
- data/app/assets/stylesheets/jquery_ui/jquery.ui.tabs.css.scss +0 -53
- data/app/assets/stylesheets/jquery_ui/jquery.ui.theme.css.scss +0 -408
- data/app/assets/stylesheets/jquery_ui/jquery.ui.tooltip.css.scss +0 -20
- data/app/assets/stylesheets/jquery_ui/themes/_jquery.ui.base.css.scss +0 -78
- data/app/assets/stylesheets/jquery_ui/themes/_jquery.ui.black-tie.css.scss +0 -80
- data/app/assets/stylesheets/jquery_ui/themes/_jquery.ui.blitzer.css.scss +0 -80
- data/app/assets/stylesheets/jquery_ui/themes/_jquery.ui.cupertino.css.scss +0 -80
- data/app/assets/stylesheets/jquery_ui/themes/_jquery.ui.dark-hive.css.scss +0 -80
- data/app/assets/stylesheets/jquery_ui/themes/_jquery.ui.dot-luv.css.scss +0 -80
- data/app/assets/stylesheets/jquery_ui/themes/_jquery.ui.eggplant.css.scss +0 -80
- data/app/assets/stylesheets/jquery_ui/themes/_jquery.ui.excite-bike.css.scss +0 -80
- data/app/assets/stylesheets/jquery_ui/themes/_jquery.ui.flick.css.scss +0 -80
- data/app/assets/stylesheets/jquery_ui/themes/_jquery.ui.hot-sneaks.css.scss +0 -80
- data/app/assets/stylesheets/jquery_ui/themes/_jquery.ui.humanity.css.scss +0 -80
- data/app/assets/stylesheets/jquery_ui/themes/_jquery.ui.le-frog.css.scss +0 -80
- data/app/assets/stylesheets/jquery_ui/themes/_jquery.ui.mint-choc.css.scss +0 -80
- data/app/assets/stylesheets/jquery_ui/themes/_jquery.ui.overcast.css.scss +0 -80
- data/app/assets/stylesheets/jquery_ui/themes/_jquery.ui.pepper-grinder.css.scss +0 -80
- data/app/assets/stylesheets/jquery_ui/themes/_jquery.ui.redmond.css.scss +0 -80
- data/app/assets/stylesheets/jquery_ui/themes/_jquery.ui.smoothness.css.scss +0 -80
- data/app/assets/stylesheets/jquery_ui/themes/_jquery.ui.south-street.css.scss +0 -80
- data/app/assets/stylesheets/jquery_ui/themes/_jquery.ui.start.css.scss +0 -80
- data/app/assets/stylesheets/jquery_ui/themes/_jquery.ui.sunny.css.scss +0 -80
- data/app/assets/stylesheets/jquery_ui/themes/_jquery.ui.swanky-purse.css.scss +0 -80
- data/app/assets/stylesheets/jquery_ui/themes/_jquery.ui.trontastic.css.scss +0 -80
- data/app/assets/stylesheets/jquery_ui/themes/_jquery.ui.ui-darkness.css.scss +0 -80
- data/app/assets/stylesheets/jquery_ui/themes/_jquery.ui.ui-lightness.css.scss +0 -80
- data/app/assets/stylesheets/jquery_ui/themes/_jquery.ui.vader.css.scss +0 -80
- /data/{lib → archived/form_elements/dns_records/lib}/inline_forms/form_elements/dns_records_helper.rb +0 -0
- /data/{lib → archived/form_elements/question_list/lib}/inline_forms/form_elements/question_list_helper.rb +0 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "test_helper"
|
|
4
|
+
|
|
5
|
+
class AttributeListTest < Minitest::Test
|
|
6
|
+
def build_sample
|
|
7
|
+
InlineForms::AttributeList.build do
|
|
8
|
+
header :basics
|
|
9
|
+
field :name, :text_field
|
|
10
|
+
field :priority, :dropdown_with_values, values: { 1 => "low", 2 => "high" }
|
|
11
|
+
field :flag, :dropdown_with_values, values: { 1 => "a", 2 => "b" }, disabled: [ 2 ]
|
|
12
|
+
info :created_at, :updated_at
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# -- array compatibility (the whole point) -----------------------------
|
|
17
|
+
|
|
18
|
+
def test_is_an_array
|
|
19
|
+
assert_kind_of Array, build_sample
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def test_destructures_like_the_legacy_literal
|
|
23
|
+
seen = []
|
|
24
|
+
build_sample.each { |attribute, form_element| seen << [ attribute, form_element ] }
|
|
25
|
+
assert_includes seen, [ :name, :text_field ]
|
|
26
|
+
assert_includes seen, [ :priority, :dropdown_with_values ]
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def test_assoc_positional_values_hash_still_works
|
|
30
|
+
list = build_sample
|
|
31
|
+
# Consumers fetch the values hash as list.assoc(attr)[2].
|
|
32
|
+
assert_equal({ 1 => "low", 2 => "high" }, list.assoc(:priority)[2])
|
|
33
|
+
assert_equal([ 2 ], list.assoc(:flag)[3])
|
|
34
|
+
assert_nil list.assoc(:name)[2]
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def test_build_produces_expected_rows
|
|
38
|
+
list = build_sample
|
|
39
|
+
assert_equal(
|
|
40
|
+
[
|
|
41
|
+
[ :basics, :header ],
|
|
42
|
+
[ :name, :text_field ],
|
|
43
|
+
[ :priority, :dropdown_with_values, { 1 => "low", 2 => "high" } ],
|
|
44
|
+
[ :flag, :dropdown_with_values, { 1 => "a", 2 => "b" }, [ 2 ] ],
|
|
45
|
+
[ :created_at, :info ],
|
|
46
|
+
[ :updated_at, :info ]
|
|
47
|
+
],
|
|
48
|
+
list.to_a
|
|
49
|
+
)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# -- append -------------------------------------------------------------
|
|
53
|
+
|
|
54
|
+
def test_field_appends_and_returns_self_for_chaining
|
|
55
|
+
list = InlineForms::AttributeList.new
|
|
56
|
+
result = list.field(:a, :text_field).field(:b, :check_box)
|
|
57
|
+
assert_same list, result
|
|
58
|
+
assert_equal %i[a b], list.names
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def test_disabled_without_values_raises
|
|
62
|
+
assert_raises(ArgumentError) do
|
|
63
|
+
InlineForms::AttributeList.new.field(:x, :dropdown_with_values, disabled: [ 1 ])
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# -- insertion ----------------------------------------------------------
|
|
68
|
+
|
|
69
|
+
def test_insert_after
|
|
70
|
+
list = build_sample.insert_after(:name, :nickname, :text_field)
|
|
71
|
+
assert_equal :nickname, list.names[list.index_of(:name) + 1]
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def test_insert_before
|
|
75
|
+
list = build_sample.insert_before(:priority, :urgent, :check_box)
|
|
76
|
+
assert_equal :urgent, list.names[list.index_of(:priority) - 1]
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def test_insert_after_missing_anchor_raises
|
|
80
|
+
assert_raises(ArgumentError) { build_sample.insert_after(:nope, :x, :text_field) }
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# -- removal ------------------------------------------------------------
|
|
84
|
+
|
|
85
|
+
def test_remove_present
|
|
86
|
+
list = build_sample.remove(:priority)
|
|
87
|
+
refute list.include_attribute?(:priority)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def test_remove_absent_is_noop
|
|
91
|
+
list = build_sample
|
|
92
|
+
before = list.dup
|
|
93
|
+
list.remove(:does_not_exist)
|
|
94
|
+
assert_equal before.to_a, list.to_a
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# -- reordering ---------------------------------------------------------
|
|
98
|
+
|
|
99
|
+
def test_move_after
|
|
100
|
+
list = build_sample.move_after(:name, :updated_at)
|
|
101
|
+
assert_equal :name, list.names.last
|
|
102
|
+
assert_equal 1, list.names.count(:name)
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def test_move_before
|
|
106
|
+
list = build_sample.move_before(:updated_at, :basics)
|
|
107
|
+
assert_equal 0, list.index_of(:updated_at)
|
|
108
|
+
assert_equal 1, list.names.count(:updated_at)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def test_move_relative_to_itself_raises
|
|
112
|
+
assert_raises(ArgumentError) { build_sample.move_after(:name, :name) }
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# -- replacement --------------------------------------------------------
|
|
116
|
+
|
|
117
|
+
def test_replace_element_preserves_position
|
|
118
|
+
list = build_sample
|
|
119
|
+
pos = list.index_of(:priority)
|
|
120
|
+
list.replace_element(:priority, :radio_button, values: { 1 => "x" })
|
|
121
|
+
assert_equal pos, list.index_of(:priority)
|
|
122
|
+
assert_equal :radio_button, list.form_element_for(:priority)
|
|
123
|
+
assert_equal({ 1 => "x" }, list.values_for(:priority))
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def test_replace_element_absent_is_noop
|
|
127
|
+
list = build_sample
|
|
128
|
+
before = list.dup
|
|
129
|
+
list.replace_element(:nope, :text_field)
|
|
130
|
+
assert_equal before.to_a, list.to_a
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# -- queries ------------------------------------------------------------
|
|
134
|
+
|
|
135
|
+
def test_query_helpers
|
|
136
|
+
list = build_sample
|
|
137
|
+
assert_equal 1, list.index_of(:name)
|
|
138
|
+
assert list.include_attribute?(:flag)
|
|
139
|
+
refute list.include_attribute?(:ghost)
|
|
140
|
+
assert_equal :dropdown_with_values, list.form_element_for(:priority)
|
|
141
|
+
assert_equal({ 1 => "low", 2 => "high" }, list.values_for(:priority))
|
|
142
|
+
assert_equal [ :name, :text_field ], list.row_for(:name)
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# -- wrap ---------------------------------------------------------------
|
|
146
|
+
|
|
147
|
+
def test_wrap_existing_array_enables_editing
|
|
148
|
+
legacy = [ [ :name, :text_field ], [ :email, :text_field ] ]
|
|
149
|
+
list = InlineForms::AttributeList.wrap(legacy)
|
|
150
|
+
assert_kind_of InlineForms::AttributeList, list
|
|
151
|
+
list.insert_after(:name, :phone, :text_field)
|
|
152
|
+
assert_equal %i[name phone email], list.names
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def test_wrap_is_idempotent_for_attribute_list
|
|
156
|
+
list = build_sample
|
|
157
|
+
assert_same list, InlineForms::AttributeList.wrap(list)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def test_module_level_builder
|
|
161
|
+
list = InlineForms.attribute_list { field :a, :text_field }
|
|
162
|
+
assert_kind_of InlineForms::AttributeList, list
|
|
163
|
+
assert_equal %i[a], list.names
|
|
164
|
+
end
|
|
165
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class ApplicationController < ActionController::Base
|
|
4
|
+
# Devise/role stand-in. The full `layouts/inline_forms` chrome (rendered by
|
|
5
|
+
# create/new HTML responses) calls `current_user.name` and
|
|
6
|
+
# `current_user.role?`, so a nil current_user cannot render it. The stub is
|
|
7
|
+
# superadmin so `destroy_permitted?` allows hard destroy, matching the
|
|
8
|
+
# generated apps' test user.
|
|
9
|
+
DummyUser = Struct.new(:id, :name) do
|
|
10
|
+
def role?(role)
|
|
11
|
+
role.to_sym == :superadmin
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
helper_method :current_user
|
|
16
|
+
|
|
17
|
+
def current_user
|
|
18
|
+
@current_user ||= DummyUser.new(1, "Dummy User")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def devise_controller?
|
|
22
|
+
false
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Mirrors the helper the installer writes into host apps (installer_core.rb);
|
|
4
|
+
# the full `layouts/inline_forms` chrome needs it.
|
|
5
|
+
module ApplicationHelper
|
|
6
|
+
def application_name
|
|
7
|
+
"Dummy"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def application_title
|
|
11
|
+
"Dummy"
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Mirrors the host-app contract the installer's application_record.rb template
|
|
4
|
+
# establishes (lib/generators/templates/application_record.rb): paper_trail on
|
|
5
|
+
# every model, will_paginate per_page, inline_forms list/search scopes, and
|
|
6
|
+
# the not_accessible_through_html? default the engine controller consults.
|
|
7
|
+
class ApplicationRecord < ActiveRecord::Base
|
|
8
|
+
self.abstract_class = true
|
|
9
|
+
|
|
10
|
+
has_paper_trail on: [ :create, :update, :destroy ]
|
|
11
|
+
|
|
12
|
+
attr_writer :inline_forms_attribute_list
|
|
13
|
+
|
|
14
|
+
self.per_page = 7
|
|
15
|
+
|
|
16
|
+
scope :inline_forms_list, -> { all }
|
|
17
|
+
scope :inline_forms_search, ->(_q) { all }
|
|
18
|
+
|
|
19
|
+
def human_attribute_name(*args)
|
|
20
|
+
self.class.human_attribute_name(*args)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def self.not_accessible_through_html?
|
|
24
|
+
false
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Models the `inline_forms_addto` pre-migrate window: the attribute_list has a
|
|
4
|
+
# row (`:pending_note`) whose column does NOT exist on the gizmos table yet, so
|
|
5
|
+
# it exercises InlineForms.attribute_pending_migration? end to end. `:name` and
|
|
6
|
+
# `:created_at` are real columns; `:section` is a header. See
|
|
7
|
+
# test/integration/pending_migration_gate_test.rb.
|
|
8
|
+
class Gizmo < ApplicationRecord
|
|
9
|
+
validates :name, presence: true
|
|
10
|
+
|
|
11
|
+
scope :inline_forms_list, -> { order(:name, :id) }
|
|
12
|
+
|
|
13
|
+
def _presentation
|
|
14
|
+
"#{name}"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def inline_forms_attribute_list
|
|
18
|
+
@inline_forms_attribute_list ||= [
|
|
19
|
+
[ :name, :text_field ],
|
|
20
|
+
[ :section, :header ],
|
|
21
|
+
[ :pending_note, :text_field ],
|
|
22
|
+
[ :created_at, :info ]
|
|
23
|
+
]
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Parent with an :associated (has_many) panel, shaped like the example app's
|
|
4
|
+
# Apartment (photos:has_many photos:associated). Exercises the
|
|
5
|
+
# open-after-create flow (InlineFormsController#render_created_row_open_streams).
|
|
6
|
+
class Machine < ApplicationRecord
|
|
7
|
+
has_many :parts
|
|
8
|
+
|
|
9
|
+
validates :name, presence: true
|
|
10
|
+
|
|
11
|
+
scope :inline_forms_list, -> { order(:name, :id) }
|
|
12
|
+
|
|
13
|
+
def _presentation
|
|
14
|
+
"#{name}"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def inline_forms_attribute_list
|
|
18
|
+
@inline_forms_attribute_list ||= [
|
|
19
|
+
[ :name, :text_field ],
|
|
20
|
+
[ :parts, :associated ]
|
|
21
|
+
]
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Child of Machine (see machine.rb); shaped like the example app's Photo.
|
|
4
|
+
class Part < ApplicationRecord
|
|
5
|
+
belongs_to :machine, optional: true
|
|
6
|
+
|
|
7
|
+
def _presentation
|
|
8
|
+
"#{name}"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def inline_forms_attribute_list
|
|
12
|
+
@inline_forms_attribute_list ||= [
|
|
13
|
+
[ :name, :text_field ]
|
|
14
|
+
]
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Exercises one representative of each form-element family the integration
|
|
4
|
+
# tests cover; shaped exactly like a `rails g inline_forms` model.
|
|
5
|
+
class Widget < ApplicationRecord
|
|
6
|
+
belongs_to :kind, optional: true
|
|
7
|
+
|
|
8
|
+
validates :name, presence: true
|
|
9
|
+
|
|
10
|
+
scope :inline_forms_list, -> { order(:name, :id) }
|
|
11
|
+
scope :inline_forms_search, ->(q) { where("name LIKE ?", "%#{q}%") }
|
|
12
|
+
|
|
13
|
+
def _presentation
|
|
14
|
+
"#{name}"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def inline_forms_attribute_list
|
|
18
|
+
@inline_forms_attribute_list ||= [
|
|
19
|
+
[ :name, :text_field ],
|
|
20
|
+
[ :notes, :plain_text_area ],
|
|
21
|
+
[ :released_on, :date_select ],
|
|
22
|
+
[ :meeting_at, :time_select ],
|
|
23
|
+
[ :start_month, :month_year_picker ],
|
|
24
|
+
[ :priority, :dropdown_with_values, { 1 => "low", 2 => "mid", 3 => "high" } ],
|
|
25
|
+
[ :active, :check_box, { 0 => "no", 1 => "yes" } ],
|
|
26
|
+
[ :kind, :dropdown_with_other ],
|
|
27
|
+
[ :rating, :slider_with_values, { 1 => "one", 2 => "two", 3 => "three", 4 => "four", 5 => "five" } ],
|
|
28
|
+
# simple_file_field's values entry names the host download route method
|
|
29
|
+
# (attribute_values(...)[0][1]); only used when a file is present.
|
|
30
|
+
[ :manual, :simple_file_field, { 0 => "download" } ],
|
|
31
|
+
[ :accent, :color_field ],
|
|
32
|
+
[ :report, :pdf_link ]
|
|
33
|
+
]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def <=>(other)
|
|
37
|
+
name <=> other.name
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<div class="contain-to-grid fixed" id="inline_forms_model_top_bar_container">
|
|
2
|
+
<nav id="inline_forms_model_top_bar" class="top-bar">
|
|
3
|
+
<div class="top-bar-left">
|
|
4
|
+
<ul class="menu">
|
|
5
|
+
<li class="menu-text" id="inline_forms_menu">
|
|
6
|
+
<h1 style="margin: 0; font-size: inherit;">
|
|
7
|
+
<a>
|
|
8
|
+
<%= t(controller_name) %>
|
|
9
|
+
</a>
|
|
10
|
+
</h1>
|
|
11
|
+
</li>
|
|
12
|
+
</ul>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="top-bar-right">
|
|
15
|
+
<ul class="menu">
|
|
16
|
+
<li>
|
|
17
|
+
<%= form_tag request.path, :method => 'get' do %>
|
|
18
|
+
<div class="row collapse">
|
|
19
|
+
<div class="large-1 small-1 columns">
|
|
20
|
+
<%= link_to "<i class='fi-x'></i>".html_safe, request.path, :title => 'reset', :class => "button expanded inline_forms_model_top_bar_buttons" %>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="large-6 small-6 columns">
|
|
23
|
+
<%= text_field_tag :search, params[:search], :placeholder => 'zoek op naam...', :id => 'input_search' %>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="large-3 small-3 columns">
|
|
26
|
+
<%= submit_tag 'zoek', :class => "button expanded inline_forms_model_top_bar_buttons" %>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="large-2 small-2 columns">
|
|
29
|
+
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
<% end %>
|
|
33
|
+
</li>
|
|
34
|
+
<li>
|
|
35
|
+
<%= link_to_new_record(@Klass, "new_#{@Klass.to_s.singularize.underscore}_path", @Klass.to_s.pluralize.downcase + '_list') %>
|
|
36
|
+
</li>
|
|
37
|
+
</ul>
|
|
38
|
+
</div>
|
|
39
|
+
</nav>
|
|
40
|
+
</div>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Minimal host app for the engine's integration tests (test/integration/).
|
|
4
|
+
# Boots the inline_forms engine against an in-memory SQLite database with the
|
|
5
|
+
# host-side gems the engine expects (will_paginate, paper_trail, turbo-rails)
|
|
6
|
+
# but without Devise, CanCanCan, Sprockets or ActionText: authorization is
|
|
7
|
+
# optional in the engine (cancan_enabled? rescues NameError), tests drive the
|
|
8
|
+
# UI through Turbo-Frame requests (the frame layout never renders the
|
|
9
|
+
# current_user header), and the asset-precompile initializer skips hosts
|
|
10
|
+
# without a pipeline.
|
|
11
|
+
require "rails"
|
|
12
|
+
require "active_record/railtie"
|
|
13
|
+
require "action_controller/railtie"
|
|
14
|
+
require "action_view/railtie"
|
|
15
|
+
|
|
16
|
+
Bundler.require(*Rails.groups)
|
|
17
|
+
|
|
18
|
+
require "inline_forms"
|
|
19
|
+
# The schema-GUI engine (separate gem, same repo; on the load path via the
|
|
20
|
+
# Gemfile's test group). Its integration tests live in test/integration/.
|
|
21
|
+
require "inline_forms_schema_edit"
|
|
22
|
+
|
|
23
|
+
module Dummy
|
|
24
|
+
class Application < Rails::Application
|
|
25
|
+
config.load_defaults 8.1
|
|
26
|
+
config.root = File.expand_path("..", __dir__)
|
|
27
|
+
config.eager_load = false
|
|
28
|
+
config.secret_key_base = "inline_forms_dummy_test_secret"
|
|
29
|
+
config.logger = ActiveSupport::Logger.new(File::NULL)
|
|
30
|
+
config.active_support.deprecation = :stderr
|
|
31
|
+
config.action_controller.allow_forgery_protection = false
|
|
32
|
+
# Schema is defined by test/integration_test_helper.rb on the in-memory DB.
|
|
33
|
+
config.active_record.maintain_test_schema = false
|
|
34
|
+
# Raise in-place so integration failures carry the real backtrace.
|
|
35
|
+
config.action_dispatch.show_exceptions = :none
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Mirrors the initializer the installer seeds in host apps; the header
|
|
4
|
+
# (`inline_forms/_header`) iterates MODEL_TABS for admin users. Kept empty so
|
|
5
|
+
# the dummy needs no CanCan (`can?` is only called per entry).
|
|
6
|
+
MODEL_TABS = %w[].freeze
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Mirrors the initializer the installer writes into generated apps
|
|
4
|
+
# (installer_core.rb): PaperTrail serializes object/object_changes as YAML,
|
|
5
|
+
# and Psych safe-loading needs these classes permitted or version.changeset /
|
|
6
|
+
# version.reify silently degrade (empty changeset) or raise.
|
|
7
|
+
permitted = [
|
|
8
|
+
Symbol,
|
|
9
|
+
Date,
|
|
10
|
+
Time,
|
|
11
|
+
BigDecimal,
|
|
12
|
+
ActiveSupport::TimeWithZone,
|
|
13
|
+
ActiveSupport::TimeZone,
|
|
14
|
+
ActiveSupport::HashWithIndifferentAccess
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
%w[
|
|
18
|
+
ActiveRecord::Type::Time::Value
|
|
19
|
+
ActiveRecord::Type::Date::Value
|
|
20
|
+
ActiveRecord::Type::DateTime::Value
|
|
21
|
+
].each do |const_name|
|
|
22
|
+
klass = const_name.safe_constantize
|
|
23
|
+
permitted << klass if klass
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
Rails.application.config.active_record.yaml_column_permitted_classes ||= []
|
|
27
|
+
Rails.application.config.active_record.yaml_column_permitted_classes |= permitted
|
|
28
|
+
ActiveRecord.yaml_column_permitted_classes |= Rails.application.config.active_record.yaml_column_permitted_classes
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Mirrors the routes `rails g inline_forms` injects for each resource.
|
|
4
|
+
Rails.application.routes.draw do
|
|
5
|
+
# Devise stand-in: the inline_forms header links destroy_user_session_path.
|
|
6
|
+
delete "logout", to: proc { [ 204, {}, [] ] }, as: :destroy_user_session
|
|
7
|
+
|
|
8
|
+
resources :widgets do
|
|
9
|
+
post "revert", on: :member
|
|
10
|
+
get "list_versions", on: :member
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
resources :machines do
|
|
14
|
+
post "revert", on: :member
|
|
15
|
+
get "list_versions", on: :member
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
resources :parts do
|
|
19
|
+
post "revert", on: :member
|
|
20
|
+
get "list_versions", on: :member
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
resources :gizmos do
|
|
24
|
+
post "revert", on: :member
|
|
25
|
+
get "list_versions", on: :member
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Schema-change GUI (opt-in in real installs; routed here for the engine's
|
|
29
|
+
# fast test suite). One line, so gem upgrades can add routes freely.
|
|
30
|
+
InlineFormsSchemaEdit.draw_routes(self)
|
|
31
|
+
end
|