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,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Self-hosted fonts for inline_forms, served through Sprockets (ERB) so
|
|
3
|
+
* asset_path emits correct digested URLs in every environment.
|
|
4
|
+
*
|
|
5
|
+
* - Open Sans v44 latin 400 / 400 italic: replaces the external
|
|
6
|
+
* `@import url(http://fonts.googleapis.com/...)` that lived in
|
|
7
|
+
* inline_forms.scss / devise.scss (insecure scheme + runtime third-party
|
|
8
|
+
* dependency). Files live in app/assets/fonts/.
|
|
9
|
+
* - Foundation Icons v3 (MIT, ZURB): the @font-face moved here from
|
|
10
|
+
* _foundation_icons.scss because the Dart Sass-built CSS is served from
|
|
11
|
+
* /assets/inline_forms/inline_forms.css, so its relative font reference
|
|
12
|
+
* resolved to /assets/inline_forms/foundation-icons.woff and 404'd; the
|
|
13
|
+
* fonts' real logical paths are flat (/assets/foundation-icons.*).
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
@font-face {
|
|
17
|
+
font-family: "Open Sans";
|
|
18
|
+
font-style: normal;
|
|
19
|
+
font-weight: 400;
|
|
20
|
+
font-display: swap;
|
|
21
|
+
src: url(<%= asset_path("opensans-v44-latin-regular.woff2") %>) format("woff2");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@font-face {
|
|
25
|
+
font-family: "Open Sans";
|
|
26
|
+
font-style: italic;
|
|
27
|
+
font-weight: 400;
|
|
28
|
+
font-display: swap;
|
|
29
|
+
src: url(<%= asset_path("opensans-v44-latin-italic.woff2") %>) format("woff2");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@font-face {
|
|
33
|
+
font-family: "foundation-icons";
|
|
34
|
+
src: url(<%= asset_path("foundation-icons.woff") %>) format("woff"),
|
|
35
|
+
url(<%= asset_path("foundation-icons.ttf") %>) format("truetype"),
|
|
36
|
+
url(<%= asset_path("foundation-icons.svg") %>#fontcustom) format("svg");
|
|
37
|
+
font-weight: normal;
|
|
38
|
+
font-style: normal;
|
|
39
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
|
2
|
+
|
|
2
3
|
class InlineFormsApplicationController < ActionController::Base
|
|
3
4
|
protect_from_forgery
|
|
4
5
|
# `layout 'devise' if :devise_controller?` was wrong: `:devise_controller?` is a
|
|
@@ -7,10 +8,14 @@ class InlineFormsApplicationController < ActionController::Base
|
|
|
7
8
|
# defaults to `layouts/inline_forms` (actions may still override via `render`).
|
|
8
9
|
layout ->(controller) { controller.devise_controller? ? "devise" : "inline_forms" }
|
|
9
10
|
|
|
10
|
-
#
|
|
11
|
-
|
|
11
|
+
# NOTE (8.1.31): this class no longer clobbers I18n.available_locales.
|
|
12
|
+
# It used to hard-assign `[ :en, :nl, :pp ]` at class-load time, which ran
|
|
13
|
+
# *after* the host app's initializers in development (classes load lazily)
|
|
14
|
+
# and silently stomped any `config.i18n.available_locales` the app set.
|
|
15
|
+
# Configure available locales in the app: config/application.rb
|
|
16
|
+
# config.i18n.available_locales = [:en, :nl, :pp]
|
|
12
17
|
|
|
13
|
-
#set the locale based on the subdomain
|
|
18
|
+
# set the locale based on the subdomain
|
|
14
19
|
def set_locale
|
|
15
20
|
I18n.locale = extract_locale_from_subdomain || I18n.default_locale
|
|
16
21
|
end
|
|
@@ -21,5 +26,4 @@ class InlineFormsApplicationController < ActionController::Base
|
|
|
21
26
|
return nil if locale.nil?
|
|
22
27
|
I18n.available_locales.include?(locale.to_sym) ? locale.to_s : nil
|
|
23
28
|
end
|
|
24
|
-
|
|
25
29
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
|
2
|
+
|
|
2
3
|
# == Generic controller for the inline_forms plugin.
|
|
3
4
|
# === Usage
|
|
4
5
|
# If you have an Example class, make an ExampleController
|
|
@@ -28,7 +29,7 @@ class InlineFormsController < ApplicationController
|
|
|
28
29
|
|
|
29
30
|
before_action :getKlass
|
|
30
31
|
|
|
31
|
-
load_and_authorize_resource :
|
|
32
|
+
load_and_authorize_resource except: :revert, no_params: true if cancan_enabled?
|
|
32
33
|
# :index shows a list of all objects from class @Klass, using will_paginate,
|
|
33
34
|
# including a link to 'new', that allows you to create a new record.
|
|
34
35
|
def index
|
|
@@ -56,7 +57,7 @@ class InlineFormsController < ApplicationController
|
|
|
56
57
|
@objects = @objects.merge(@Klass.inline_forms_search(params[:search]))
|
|
57
58
|
end
|
|
58
59
|
@objects = @objects.where(fk_conditions) if fk_conditions
|
|
59
|
-
@objects = @objects.paginate(:
|
|
60
|
+
@objects = @objects.paginate(page: params[:page])
|
|
60
61
|
respond_to do |format|
|
|
61
62
|
# `not_accessible_through_html?` is about preventing direct top-level
|
|
62
63
|
# HTML CRUD on this resource (e.g. /photos when only Apartment is the
|
|
@@ -136,8 +137,13 @@ class InlineFormsController < ApplicationController
|
|
|
136
137
|
@update_span = params[:update]
|
|
137
138
|
attributes = @inline_forms_attribute_list || @object.inline_forms_attribute_list
|
|
138
139
|
attributes.each do | attribute, form_element |
|
|
140
|
+
# Skip a row whose column is not migrated yet (model edited, migration
|
|
141
|
+
# not run). Writing it would raise; the new form shows it as a pending
|
|
142
|
+
# placeholder and does not submit a value for it.
|
|
143
|
+
next if InlineForms.attribute_pending_migration?(@object, attribute, form_element)
|
|
144
|
+
|
|
139
145
|
InlineForms.assert_plain_text_column!(object: @object, attribute: attribute, form_element: form_element)
|
|
140
|
-
send("#{form_element
|
|
146
|
+
send("#{form_element}_update", @object, attribute) unless form_element == :associated || (cancan_enabled? && cannot?(:read, @object, attribute))
|
|
141
147
|
end
|
|
142
148
|
@parent_class = params[:parent_class]
|
|
143
149
|
@parent_id = params[:parent_id]
|
|
@@ -150,20 +156,26 @@ class InlineFormsController < ApplicationController
|
|
|
150
156
|
end
|
|
151
157
|
|
|
152
158
|
if @object.save
|
|
153
|
-
flash.now[:success] = t(
|
|
159
|
+
flash.now[:success] = t("success", message: @object.class.model_name.human)
|
|
154
160
|
@objects = cancan_enabled? ? @Klass.accessible_by(current_ability) : @Klass.all
|
|
155
161
|
@objects = @objects.merge(@Klass.inline_forms_list) if @Klass.respond_to?(:inline_forms_list)
|
|
156
162
|
if fk_conditions.nil? && params[:search].present? && @Klass.respond_to?(:inline_forms_search)
|
|
157
163
|
@objects = @objects.merge(@Klass.inline_forms_search(params[:search]))
|
|
158
164
|
end
|
|
159
165
|
@objects = @objects.where(fk_conditions) if fk_conditions
|
|
160
|
-
@objects = @objects.paginate(:
|
|
166
|
+
@objects = @objects.paginate(page: params[:page])
|
|
167
|
+
created_object = @object
|
|
161
168
|
@object = nil
|
|
162
169
|
respond_to do |format|
|
|
163
|
-
|
|
170
|
+
if html_list_flow_allowed?
|
|
171
|
+
if open_created_row?(created_object, attributes)
|
|
172
|
+
format.turbo_stream { render_created_row_open_streams(created_object) }
|
|
173
|
+
end
|
|
174
|
+
format.html { render_list_frame_after_save }
|
|
175
|
+
end
|
|
164
176
|
end
|
|
165
177
|
else
|
|
166
|
-
flash.now[:header] = ["Kan #{@object.class.to_s.underscore} niet aanmaken."]
|
|
178
|
+
flash.now[:header] = [ "Kan #{@object.class.to_s.underscore} niet aanmaken." ]
|
|
167
179
|
flash.now[:error] = @object.errors.to_a
|
|
168
180
|
respond_to do |format|
|
|
169
181
|
@object.inline_forms_attribute_list = attributes
|
|
@@ -179,8 +191,18 @@ class InlineFormsController < ApplicationController
|
|
|
179
191
|
@form_element = params[:form_element]
|
|
180
192
|
@sub_id = params[:sub_id]
|
|
181
193
|
@update_span = params[:update]
|
|
194
|
+
# Defense-in-depth: the UI renders a pending field as a read-only
|
|
195
|
+
# placeholder (never links to edit/update), but a hand-crafted request
|
|
196
|
+
# could still target a column that is not migrated yet. Refuse cleanly
|
|
197
|
+
# instead of 500ing on the missing column.
|
|
198
|
+
if InlineForms.attribute_pending_migration?(@object, @attribute, @form_element)
|
|
199
|
+
respond_to do |format|
|
|
200
|
+
format.html { render "inline_forms/field_pending", layout: "turbo_rails/frame", status: :unprocessable_entity }
|
|
201
|
+
end
|
|
202
|
+
return
|
|
203
|
+
end
|
|
182
204
|
InlineForms.assert_plain_text_column!(object: @object, attribute: @attribute, form_element: @form_element)
|
|
183
|
-
send("#{@form_element
|
|
205
|
+
send("#{@form_element}_update", @object, @attribute)
|
|
184
206
|
# Branch on the actual save result. Previously the return value of
|
|
185
207
|
# `@object.save` was ignored and `field_show` was rendered
|
|
186
208
|
# unconditionally from the in-memory `@object`. When a save failed
|
|
@@ -262,7 +284,7 @@ class InlineFormsController < ApplicationController
|
|
|
262
284
|
def destroy
|
|
263
285
|
@update_span = params[:update]
|
|
264
286
|
@object = referenced_object
|
|
265
|
-
if
|
|
287
|
+
if destroy_permitted?
|
|
266
288
|
@object.destroy
|
|
267
289
|
# Capture after destroy: `.last` before destroy was the latest *update*
|
|
268
290
|
# (e.g. a plain_text_area edit), so undo reified the pre-edit state.
|
|
@@ -291,7 +313,9 @@ class InlineFormsController < ApplicationController
|
|
|
291
313
|
@version = PaperTrail::Version.find(params[:id])
|
|
292
314
|
@parent = revert_authorization_subject(@version)
|
|
293
315
|
authorize!(:revert, @parent || @Klass) if cancan_enabled?
|
|
294
|
-
|
|
316
|
+
# Same gate as :destroy (see destroy_permitted?): superadmin when the host
|
|
317
|
+
# has the Devise+roles system, otherwise no extra gate beyond CanCan.
|
|
318
|
+
return head :forbidden unless destroy_permitted?
|
|
295
319
|
return head :not_found unless @parent
|
|
296
320
|
|
|
297
321
|
@object = @version.reify(
|
|
@@ -343,6 +367,19 @@ class InlineFormsController < ApplicationController
|
|
|
343
367
|
|
|
344
368
|
private
|
|
345
369
|
|
|
370
|
+
# Hard-destroy gate. Generated apps restrict destroy to a Devise user with
|
|
371
|
+
# `role?(:superadmin)` (Role model + roles HABTM). Hosts without that role
|
|
372
|
+
# system (e.g. the engine's test/dummy harness, or apps using a different
|
|
373
|
+
# auth stack) have no gatekeeper here beyond CanCan's
|
|
374
|
+
# `load_and_authorize_resource`; pre-8.1.27 this crashed with
|
|
375
|
+
# `NoMethodError` on `nil.role?` instead of deciding either way.
|
|
376
|
+
def destroy_permitted?
|
|
377
|
+
user = respond_to?(:current_user, true) ? current_user : nil
|
|
378
|
+
return true unless user.respond_to?(:role?)
|
|
379
|
+
|
|
380
|
+
user.role?(:superadmin)
|
|
381
|
+
end
|
|
382
|
+
|
|
346
383
|
# Persist a reified *primary* record (Apartment, Photo, ...) for +revert+.
|
|
347
384
|
#
|
|
348
385
|
# +reify+ on a +destroy+ version returns a record with +new_record? == true+
|
|
@@ -459,13 +496,13 @@ class InlineFormsController < ApplicationController
|
|
|
459
496
|
row_html = render_to_string(
|
|
460
497
|
"inline_forms/row_close",
|
|
461
498
|
layout: false,
|
|
462
|
-
formats: [:html],
|
|
499
|
+
formats: [ :html ],
|
|
463
500
|
locals: { update_span: row_id, object: @parent, inline_forms_turbo_row: true }
|
|
464
501
|
)
|
|
465
502
|
versions_html = render_to_string(
|
|
466
503
|
"inline_forms/versions_panel",
|
|
467
504
|
layout: false,
|
|
468
|
-
formats: [:html],
|
|
505
|
+
formats: [ :html ],
|
|
469
506
|
locals: { update_span: versions_id, object: @parent, inline_forms_turbo_row: true }
|
|
470
507
|
)
|
|
471
508
|
render turbo_stream: [
|
|
@@ -523,6 +560,44 @@ class InlineFormsController < ApplicationController
|
|
|
523
560
|
render "inline_forms/create_list_frame", layout: associated_list_frame_layout
|
|
524
561
|
end
|
|
525
562
|
|
|
563
|
+
# "Open after create" (stuff/2026-07-10-nested-creation-options.md, Option A).
|
|
564
|
+
#
|
|
565
|
+
# An `:associated` (has_many) panel only exists on a persisted record, so the
|
|
566
|
+
# new form hides it and the user historically had to find and reopen the
|
|
567
|
+
# record to add children. When a *top-level* create succeeds for a class
|
|
568
|
+
# whose attribute list has an `:associated` panel, respond with Turbo
|
|
569
|
+
# Streams that refresh the list *and* open the new record's row, landing the
|
|
570
|
+
# user where the nested panel (and its "new" link) is immediately usable.
|
|
571
|
+
#
|
|
572
|
+
# Nested creates are excluded (they already return to the parent's panel),
|
|
573
|
+
# and requests without a turbo-stream Accept header fall through to the
|
|
574
|
+
# plain list-frame response.
|
|
575
|
+
def open_created_row?(created_object, attributes)
|
|
576
|
+
return false if @parent_class.present?
|
|
577
|
+
attributes.any? { |_attribute, form_element, *| form_element.to_sym == :associated }
|
|
578
|
+
end
|
|
579
|
+
|
|
580
|
+
def render_created_row_open_streams(created_object)
|
|
581
|
+
list_frame_id = @update_span
|
|
582
|
+
@ul_needed = true
|
|
583
|
+
list_html = render_to_string(partial: "inline_forms/list", formats: [ :html ])
|
|
584
|
+
|
|
585
|
+
row_id = helpers.inline_forms_row_turbo_frame_id(created_object)
|
|
586
|
+
@object = created_object
|
|
587
|
+
@update_span = row_id
|
|
588
|
+
@inline_forms_turbo_row = true
|
|
589
|
+
row_html = render_to_string("inline_forms/row_show", layout: false, formats: [ :html ])
|
|
590
|
+
|
|
591
|
+
# Streams apply in order: the first inserts the fresh list (containing the
|
|
592
|
+
# new record's closed row frame), the second swaps that row open. If the
|
|
593
|
+
# new record sorted onto another page, the second replace finds no target
|
|
594
|
+
# and degrades silently to today's list-refresh behavior.
|
|
595
|
+
render turbo_stream: [
|
|
596
|
+
turbo_stream.replace(list_frame_id, list_html),
|
|
597
|
+
turbo_stream.replace(row_id, row_html)
|
|
598
|
+
]
|
|
599
|
+
end
|
|
600
|
+
|
|
526
601
|
def associated_list_frame_layout
|
|
527
602
|
# Use full inline_forms chrome so the swapped frame is styled; Turbo extracts
|
|
528
603
|
# the matching <turbo-frame id="…"> from the response body.
|
|
@@ -579,7 +654,7 @@ class InlineFormsController < ApplicationController
|
|
|
579
654
|
# Get the class from the controller name.
|
|
580
655
|
# CountryController < InlineFormsController, so what class are we?
|
|
581
656
|
# TODO think about this a bit more.
|
|
582
|
-
def getKlass
|
|
657
|
+
def getKlass # :doc:
|
|
583
658
|
@Klass = self.controller_name.classify.constantize
|
|
584
659
|
InlineForms.validate_plain_text_configuration_for!(@Klass)
|
|
585
660
|
@Klass
|
|
@@ -596,5 +671,4 @@ class InlineFormsController < ApplicationController
|
|
|
596
671
|
def revert_params
|
|
597
672
|
params.require(:id).permit(:update)
|
|
598
673
|
end
|
|
599
|
-
|
|
600
674
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
|
2
|
+
|
|
2
3
|
module InlineFormsHelper
|
|
3
4
|
include InlineForms::FormElements::HelperIncludes
|
|
4
5
|
|
|
@@ -6,6 +7,46 @@ module InlineFormsHelper
|
|
|
6
7
|
InlineForms::VERSION
|
|
7
8
|
end
|
|
8
9
|
|
|
10
|
+
# Pattern 1 preset theming (8.1.29; stuff/user-preferences-and-theming.md).
|
|
11
|
+
# Emits the <body> theme class. The host's user model opts in by responding
|
|
12
|
+
# to #inline_forms_theme with one of the preset names shipped in _theme.scss
|
|
13
|
+
# (default | dark | sepia | high-contrast); installer-generated user models
|
|
14
|
+
# store an integer `theme` column and map it. Anonymous users, or hosts
|
|
15
|
+
# without the method, get the default palette.
|
|
16
|
+
def inline_forms_body_theme_class
|
|
17
|
+
user = respond_to?(:current_user) ? current_user : nil
|
|
18
|
+
theme = user.inline_forms_theme.to_s if user.respond_to?(:inline_forms_theme)
|
|
19
|
+
theme = "default" if theme.blank? || !theme.match?(/\A[a-z][a-z-]*\z/)
|
|
20
|
+
"theme-#{theme}"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Pattern 2 theming (8.1.32): per-user color overrides as an inline <style>
|
|
24
|
+
# in <head>. The host's user model opts in by responding to
|
|
25
|
+
# #inline_forms_color_overrides with a hash of `--if-color-` suffix => hex,
|
|
26
|
+
# e.g. { 'primary' => '#2563eb', 'accent' => '#7c3aed' }. Every key and
|
|
27
|
+
# value is re-validated here before interpolation (never trust a column
|
|
28
|
+
# edited outside the app), and the rules are scoped to the current theme
|
|
29
|
+
# class so they win the cascade over the preset palette (same specificity,
|
|
30
|
+
# later in the document).
|
|
31
|
+
def inline_forms_user_color_overrides_style
|
|
32
|
+
user = respond_to?(:current_user) ? current_user : nil
|
|
33
|
+
return unless user.respond_to?(:inline_forms_color_overrides)
|
|
34
|
+
|
|
35
|
+
overrides = user.inline_forms_color_overrides
|
|
36
|
+
return if overrides.blank?
|
|
37
|
+
|
|
38
|
+
rules = overrides.filter_map do |key, value|
|
|
39
|
+
next unless key.to_s.match?(/\A[a-z][a-z-]*\z/)
|
|
40
|
+
next unless value.to_s.match?(/\A#\h{6}\z/i)
|
|
41
|
+
|
|
42
|
+
"--if-color-#{key}: #{value};"
|
|
43
|
+
end
|
|
44
|
+
return if rules.empty?
|
|
45
|
+
|
|
46
|
+
css = "body.#{inline_forms_body_theme_class} { #{rules.join(' ')} }"
|
|
47
|
+
content_tag(:style, css.html_safe, id: "inline_forms_user_color_overrides")
|
|
48
|
+
end
|
|
49
|
+
|
|
9
50
|
# Returns versions for `object`, merged with versions of any associated
|
|
10
51
|
# `ActionText::RichText` records (Rails `has_rich_text :foo` declarations).
|
|
11
52
|
#
|
|
@@ -181,7 +222,7 @@ module InlineFormsHelper
|
|
|
181
222
|
|
|
182
223
|
# link to versions list
|
|
183
224
|
def link_to_versions_list(path_to_versions_list, object, update_span, html_class = "button new_button", turbo_row: true)
|
|
184
|
-
if can?
|
|
225
|
+
if cancan_disabled? || can?(:list_versions, object)
|
|
185
226
|
if defined?(PaperTrail) && object.respond_to?(:versions)
|
|
186
227
|
path = send(path_to_versions_list, object, update: update_span)
|
|
187
228
|
opts = { class: html_class, title: t("inline_forms.view.list_versions") }
|
|
@@ -250,14 +291,14 @@ module InlineFormsHelper
|
|
|
250
291
|
# Pass +from_callee:+ +__callee__+ from the enclosing +*_show+ method so the edit route receives the correct form element name.
|
|
251
292
|
# When +turbo_frame:+ is true the link targets +_self+; otherwise it targets the
|
|
252
293
|
# field frame id (+css_class_id+) so edit works without a surrounding +_show+ wrap.
|
|
253
|
-
def link_to_inline_edit(object, attribute, attribute_value=
|
|
294
|
+
def link_to_inline_edit(object, attribute, attribute_value = "", from_callee:, turbo_frame: false)
|
|
254
295
|
form_element = InlineForms.form_element_string_from_callee(from_callee)
|
|
255
296
|
attribute_value = attribute_value.to_s
|
|
256
297
|
spaces = attribute_value.length > 40 ? 0 : 40 - attribute_value.length
|
|
257
298
|
value = h(attribute_value) + (" " * spaces).html_safe
|
|
258
299
|
css_class_id = "#{object.class.to_s.underscore}_#{object.id}_#{attribute}"
|
|
259
300
|
use_turbo_frame = turbo_frame || (@inline_forms_turbo_field == true)
|
|
260
|
-
if (cancan_disabled? rescue true) || (
|
|
301
|
+
if (cancan_disabled? rescue true) || (can? :update, object, attribute)
|
|
261
302
|
# some problem with concerns makes this function not available when called direct. FIXME
|
|
262
303
|
link_opts = if use_turbo_frame
|
|
263
304
|
{ data: { turbo: true, turbo_frame: "_self" } }
|
|
@@ -267,9 +308,9 @@ module InlineFormsHelper
|
|
|
267
308
|
link_to value,
|
|
268
309
|
edit_polymorphic_path(
|
|
269
310
|
object,
|
|
270
|
-
:
|
|
271
|
-
:
|
|
272
|
-
:
|
|
311
|
+
attribute: attribute.to_s,
|
|
312
|
+
form_element: form_element,
|
|
313
|
+
update: css_class_id),
|
|
273
314
|
link_opts
|
|
274
315
|
else
|
|
275
316
|
h(attribute_value)
|
|
@@ -280,16 +321,16 @@ module InlineFormsHelper
|
|
|
280
321
|
def locale_url(request, locale)
|
|
281
322
|
subdomains = request.subdomains
|
|
282
323
|
# if there are no subdomains, prepend the locale to the domain
|
|
283
|
-
return request.protocol + [ locale, request.domain ].join(
|
|
324
|
+
return request.protocol + [ locale, request.domain ].join(".") + request.port_string if subdomains.empty?
|
|
284
325
|
# if there is a subdomain, find out if it's an available locale and strip it
|
|
285
326
|
subdomains.shift if I18n.available_locales.include?(subdomains.first.to_sym)
|
|
286
327
|
# if there are no subdomains, prepend the locale to the domain
|
|
287
|
-
return request.protocol + [ locale, request.domain ].join(
|
|
328
|
+
return request.protocol + [ locale, request.domain ].join(".") + request.port_string if subdomains.empty?
|
|
288
329
|
# else return the rest
|
|
289
|
-
request.protocol + [ locale, subdomains.join(
|
|
330
|
+
request.protocol + [ locale, subdomains.join("."), request.domain ].join(".") + request.port_string
|
|
290
331
|
end
|
|
291
332
|
|
|
292
|
-
def translated_attribute(object,attribute)
|
|
333
|
+
def translated_attribute(object, attribute)
|
|
293
334
|
t("activerecord.attributes.#{object.class.name.underscore}.#{attribute}")
|
|
294
335
|
# "activerecord.attributes.#{attribute}",
|
|
295
336
|
# "attributes.#{attribute}" ] )
|
|
@@ -333,19 +374,22 @@ module InlineFormsHelper
|
|
|
333
374
|
|
|
334
375
|
attributes = @inline_forms_attribute_list || object.inline_forms_attribute_list # if we do this as a form_element, @inline.. is nil!!!
|
|
335
376
|
values = attributes.assoc(attribute.to_sym)[2]
|
|
336
|
-
raise t("fatal.no_values_defined_in", @Klass, attribute)
|
|
377
|
+
# (was `raise t("fatal.no_values_defined_in", @Klass, attribute)` — Rails'
|
|
378
|
+
# translate takes a key plus keyword interpolations, so the raise itself
|
|
379
|
+
# crashed with ArgumentError instead of reporting the real problem.)
|
|
380
|
+
raise "inline_forms: no values defined in #{object.class} for #{attribute} (add a values hash to the inline_forms_attribute_list row)" if values.nil?
|
|
337
381
|
if values.is_a?(Hash)
|
|
338
382
|
temp = Array.new
|
|
339
|
-
values.to_a.each do |k,v|
|
|
383
|
+
values.to_a.each do |k, v|
|
|
340
384
|
temp << [ k, t(v) ]
|
|
341
385
|
end
|
|
342
|
-
values = temp.sort {|a,b| a[0]<=>b[0]}
|
|
386
|
+
values = temp.sort { |a, b| a[0]<=>b[0] }
|
|
343
387
|
else
|
|
344
388
|
temp = Array.new
|
|
345
389
|
values.to_a.each_index do |i|
|
|
346
390
|
temp << [ i, t(values.to_a[i]) ]
|
|
347
391
|
end
|
|
348
|
-
values = temp.sort {|a,b| a[1]<=>b[1]}
|
|
392
|
+
values = temp.sort { |a, b| a[1]<=>b[1] }
|
|
349
393
|
end
|
|
350
394
|
values
|
|
351
395
|
end
|
|
@@ -359,5 +403,4 @@ module InlineFormsHelper
|
|
|
359
403
|
user = user_class.find_by(id: id)
|
|
360
404
|
user.nil? ? "Unknown" : user.name
|
|
361
405
|
end
|
|
362
|
-
|
|
363
406
|
end
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
module InlineForms::SoftDeletable
|
|
2
2
|
extend ActiveSupport::Concern
|
|
3
3
|
|
|
4
|
-
# you need to put this in the model:
|
|
5
|
-
# include InlineForms::SoftDeletable
|
|
6
|
-
# enum deleted: { active: 1, deleted: 2 }
|
|
4
|
+
# you need to put this in the model:
|
|
5
|
+
# include InlineForms::SoftDeletable
|
|
6
|
+
# enum deleted: { active: 1, deleted: 2 }
|
|
7
7
|
|
|
8
|
-
# you need a migration like this:
|
|
9
|
-
# class AddDeletedAtColumnToUser < ActiveRecord::Migration[6.0]
|
|
10
|
-
# def change
|
|
11
|
-
# add_column :users, :deleted_at, :datetime, default: nil
|
|
12
|
-
# add_column :users, :deleted, :integer, default: 1
|
|
13
|
-
# add_column :users, :deleted_by, :integer, default: nil
|
|
14
|
-
# end
|
|
15
|
-
# end
|
|
8
|
+
# you need a migration like this:
|
|
9
|
+
# class AddDeletedAtColumnToUser < ActiveRecord::Migration[6.0]
|
|
10
|
+
# def change
|
|
11
|
+
# add_column :users, :deleted_at, :datetime, default: nil
|
|
12
|
+
# add_column :users, :deleted, :integer, default: 1
|
|
13
|
+
# add_column :users, :deleted_by, :integer, default: nil
|
|
14
|
+
# end
|
|
15
|
+
# end
|
|
16
16
|
|
|
17
17
|
def soft_deletable?
|
|
18
18
|
true
|
|
@@ -31,5 +31,4 @@ module InlineForms::SoftDeletable
|
|
|
31
31
|
self.deleted_at = nil
|
|
32
32
|
save
|
|
33
33
|
end
|
|
34
|
-
|
|
35
34
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
|
2
|
-
class CuracaoIdNumberValidator < ActiveModel::EachValidator
|
|
3
2
|
|
|
3
|
+
class CuracaoIdNumberValidator < ActiveModel::EachValidator
|
|
4
4
|
def validate_each(record, attribute, value)
|
|
5
5
|
if value =~ /^[0-9]{10}$/
|
|
6
6
|
year = value[0..3].to_i
|
|
@@ -10,14 +10,13 @@ class CuracaoIdNumberValidator < ActiveModel::EachValidator
|
|
|
10
10
|
begin
|
|
11
11
|
DateTime.civil(year, month, day)
|
|
12
12
|
rescue ArgumentError
|
|
13
|
-
record.errors.add(attribute.to_sym, options[:message] || "not a valid date"
|
|
13
|
+
record.errors.add(attribute.to_sym, options[:message] || "not a valid date")
|
|
14
14
|
end
|
|
15
15
|
else
|
|
16
|
-
record.errors.add(attribute.to_sym, options[:message] || "is not a number"
|
|
16
|
+
record.errors.add(attribute.to_sym, options[:message] || "is not a number")
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
|
-
|
|
20
19
|
end
|
|
21
20
|
|
|
22
|
-
#"moet bestaan uit tien cijfers (bijvoorbeeld 1983040812)."
|
|
23
|
-
#"moet een datum zijn."
|
|
21
|
+
# "moet bestaan uit tien cijfers (bijvoorbeeld 1983040812)."
|
|
22
|
+
# "moet een datum zijn."
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
|
2
|
+
|
|
2
3
|
# == usage:
|
|
3
4
|
# in your model, add:
|
|
4
5
|
# validates :email, :presence => true, :is_email_address => true;
|
|
5
6
|
# taken from http://lindsaar.net/2010/1/31/validates_rails_3_awesome_is_true
|
|
6
7
|
# (It's probably a fake regex but hey, it looks legit.)
|
|
7
8
|
class IsCuracaoPhoneValidator < ActiveModel::EachValidator
|
|
8
|
-
|
|
9
9
|
def error_message
|
|
10
10
|
"is geen geldig Curaçao telefoon nummer."
|
|
11
11
|
end
|
|
@@ -16,8 +16,7 @@ class IsCuracaoPhoneValidator < ActiveModel::EachValidator
|
|
|
16
16
|
|
|
17
17
|
def validate_each(record, attribute, value)
|
|
18
18
|
unless value =~ /[4-8][0-9]{6}/
|
|
19
|
-
record.errors[attribute] << (options[:message] || error_message
|
|
19
|
+
record.errors[attribute] << (options[:message] || error_message)
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
|
-
|
|
23
22
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# -*- encoding : binary -*-
|
|
2
|
+
|
|
2
3
|
# == usage:
|
|
3
4
|
# in your model, add:
|
|
4
5
|
# validates :email, :presence => true, :is_email_address => true;
|
|
@@ -25,11 +26,10 @@ class IsEmailAddressValidator < ActiveModel::EachValidator
|
|
|
25
26
|
def error_message
|
|
26
27
|
"is not a valid email address."
|
|
27
28
|
end
|
|
28
|
-
|
|
29
|
+
|
|
29
30
|
def validate_each(record, attribute, value)
|
|
30
31
|
unless value =~ EmailAddress
|
|
31
|
-
record.errors[attribute] << (options[:message] || error_message
|
|
32
|
+
record.errors[attribute] << (options[:message] || error_message)
|
|
32
33
|
end
|
|
33
34
|
end
|
|
34
|
-
|
|
35
35
|
end
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
|
2
|
+
|
|
2
3
|
# == usage:
|
|
3
4
|
# in your model, add:
|
|
4
5
|
# validates :sex, :must_be_a_value => true;
|
|
5
|
-
#
|
|
6
|
+
#
|
|
6
7
|
# this checks against the objects attribute_values
|
|
7
8
|
class MustBeAValueValidator < ActiveModel::EachValidator
|
|
8
|
-
|
|
9
9
|
def error_message
|
|
10
10
|
"is geen geldige keuze."
|
|
11
11
|
end
|
|
@@ -16,7 +16,7 @@ class MustBeAValueValidator < ActiveModel::EachValidator
|
|
|
16
16
|
def validate_each(record, attribute, value)
|
|
17
17
|
values = attribute_values(record, attribute)
|
|
18
18
|
if values.assoc(value).nil?
|
|
19
|
-
record.errors[attribute] << (options[:message] || error_message
|
|
19
|
+
record.errors[attribute] << (options[:message] || error_message)
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
@@ -48,16 +48,16 @@ class MustBeAValueValidator < ActiveModel::EachValidator
|
|
|
48
48
|
raise "No Values defined in #{@Klass}, #{attribute}" if values.nil?
|
|
49
49
|
if values.is_a?(Hash)
|
|
50
50
|
temp = Array.new
|
|
51
|
-
values.to_a.each do |k,v|
|
|
51
|
+
values.to_a.each do |k, v|
|
|
52
52
|
temp << [ k, v ]
|
|
53
53
|
end
|
|
54
|
-
values = temp.sort {|a,b| a[0]<=>b[0]}
|
|
54
|
+
values = temp.sort { |a, b| a[0]<=>b[0] }
|
|
55
55
|
else
|
|
56
56
|
temp = Array.new
|
|
57
57
|
values.to_a.each_index do |i|
|
|
58
58
|
temp << [ i, values.to_a[i] ]
|
|
59
59
|
end
|
|
60
|
-
values = temp.sort {|a,b| a[1]<=>b[1]}
|
|
60
|
+
values = temp.sort { |a, b| a[1]<=>b[1] }
|
|
61
61
|
end
|
|
62
62
|
values
|
|
63
63
|
end
|
|
@@ -42,7 +42,10 @@
|
|
|
42
42
|
<% attributes.each do | attribute, form_element | -%>
|
|
43
43
|
<% unless form_element.to_sym == :associated || (cancan_enabled? && cannot?(:read, @object, attribute)) -%>
|
|
44
44
|
<% css_class_id = "attribute_#{attribute}_#{@object.id}" -%>
|
|
45
|
-
<% if
|
|
45
|
+
<% if InlineForms.attribute_pending_migration?(@object, attribute, form_element) %>
|
|
46
|
+
<%= render partial: "inline_forms/pending_migration_row",
|
|
47
|
+
locals: { object: @object, attribute: attribute } %>
|
|
48
|
+
<% elsif form_element && form_element.to_sym == :header %>
|
|
46
49
|
<div class="row form_element_header" >
|
|
47
50
|
<div class='large-12 column<%= " attribute_name attribute_#{attribute} form_element_#{form_element}" -%>' >
|
|
48
51
|
<%= @object.human_attribute_name(attribute) -%>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<%# Rendered in place of a field whose column does not exist yet (the model
|
|
2
|
+
file has the attribute_list row but its migration has not run). Read-only,
|
|
3
|
+
harmless, self-explanatory — see InlineForms.attribute_pending_migration?. %>
|
|
4
|
+
<div class="row pending_migration_row <%= cycle('odd', 'even') %>">
|
|
5
|
+
<div class='medium-5 large-5 column'>
|
|
6
|
+
<%= render partial: "inline_forms/attribute_label",
|
|
7
|
+
locals: { object: object, attribute: attribute } -%>
|
|
8
|
+
</div>
|
|
9
|
+
<div class='medium-7 large-7 column'>
|
|
10
|
+
<span class="pending_migration_notice">
|
|
11
|
+
<%= t("inline_forms.pending_migration.notice",
|
|
12
|
+
default: "pending migration \u2014 run rails db:migrate") -%>
|
|
13
|
+
</span>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
@@ -23,7 +23,10 @@
|
|
|
23
23
|
<% attributes.each do | attribute, form_element | -%>
|
|
24
24
|
<% if cancan_disabled? || can?(:read, @object, attribute) %>
|
|
25
25
|
<% css_class_id = "#{@object.class.name.underscore}_#{@object.id}_#{attribute}" -%>
|
|
26
|
-
<% if
|
|
26
|
+
<% if InlineForms.attribute_pending_migration?(@object, attribute, form_element) %>
|
|
27
|
+
<%= render partial: "inline_forms/pending_migration_row",
|
|
28
|
+
locals: { object: @object, attribute: attribute } %>
|
|
29
|
+
<% elsif form_element == :header %>
|
|
27
30
|
<div class="row form_element_header">
|
|
28
31
|
<div class='large-12 column' >
|
|
29
32
|
<%= @object.class.human_attribute_name(attribute) -%>
|
|
@@ -86,7 +89,7 @@
|
|
|
86
89
|
<% end %>
|
|
87
90
|
<% end %>
|
|
88
91
|
<% end %>
|
|
89
|
-
<% if can?
|
|
92
|
+
<% if cancan_disabled? || can?(:list_versions, @object) %>
|
|
90
93
|
<% css_class_id = inline_forms_versions_turbo_frame_id(@object) -%>
|
|
91
94
|
<turbo-frame id="<%= css_class_id -%>">
|
|
92
95
|
<%= render "versions" %>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<%# Turbo-frame response for a forced field request (show/edit/update) against
|
|
2
|
+
an attribute whose column does not exist yet. The UI never links here (the
|
|
3
|
+
row renders as a pending placeholder in _show), so this is defense-in-depth
|
|
4
|
+
for a hand-crafted request during the pre-migrate window. %>
|
|
5
|
+
<turbo-frame id="<%= @update_span %>">
|
|
6
|
+
<span class="pending_migration_notice">
|
|
7
|
+
<%= t("inline_forms.pending_migration.notice",
|
|
8
|
+
default: "pending migration \u2014 run rails db:migrate") -%>
|
|
9
|
+
</span>
|
|
10
|
+
</turbo-frame>
|
|
@@ -7,11 +7,13 @@
|
|
|
7
7
|
<%= t('inline_forms.general.application_title') %> v<%= InlineForms::VERSION %>
|
|
8
8
|
</title>
|
|
9
9
|
<%= stylesheet_link_tag "application" %>
|
|
10
|
-
<%= stylesheet_link_tag "
|
|
10
|
+
<%= stylesheet_link_tag "inline_forms_fonts" %>
|
|
11
|
+
<%= stylesheet_link_tag "trix" %>
|
|
12
|
+
<%= inline_forms_user_color_overrides_style %>
|
|
11
13
|
<%= csrf_meta_tags %>
|
|
12
14
|
</head>
|
|
13
15
|
|
|
14
|
-
<body>
|
|
16
|
+
<body class="<%= inline_forms_body_theme_class %>">
|
|
15
17
|
<%= yield %>
|
|
16
18
|
<%= javascript_include_tag "application" %>
|
|
17
19
|
<%# Turbo (Hotwire) is loaded as an ES module so it does not collide with %>
|
|
@@ -21,6 +23,7 @@
|
|
|
21
23
|
import { Turbo } from "<%= asset_path('turbo.min.js') %>"
|
|
22
24
|
window.Turbo = Turbo
|
|
23
25
|
</script>
|
|
24
|
-
|
|
26
|
+
<%# Trix 2 (vendored; no CDN). Self-registers its custom elements on load. %>
|
|
27
|
+
<%= javascript_include_tag "trix.min" %>
|
|
25
28
|
</body>
|
|
26
29
|
</html>
|