infold 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +33 -0
- data/Rakefile +8 -0
- data/app/assets/builds/infold.css +17147 -0
- data/app/assets/builds/infold.css.map +7 -0
- data/app/assets/builds/infold.js +17202 -0
- data/app/assets/builds/infold.js.map +7 -0
- data/app/assets/config/infold_manifest.js +0 -0
- data/app/assets/stylesheets/infold.custom.css +76 -0
- data/app/assets/stylesheets/infold.custom.css.map +1 -0
- data/app/components/infold/input_fieldset_component.html.haml +14 -0
- data/app/components/infold/input_fieldset_component.rb +22 -0
- data/app/components/infold/radio_fieldset_component.html.haml +11 -0
- data/app/components/infold/radio_fieldset_component.rb +14 -0
- data/app/components/infold/select_fieldset_component.html.haml +7 -0
- data/app/components/infold/select_fieldset_component.rb +15 -0
- data/app/controllers/infold/app_view_forms_controller.rb +64 -0
- data/app/controllers/infold/app_view_shows_controller.rb +60 -0
- data/app/controllers/infold/application_controller.rb +17 -0
- data/app/controllers/infold/apps_controller.rb +68 -0
- data/app/controllers/infold/attachment_fields_controller.rb +59 -0
- data/app/controllers/infold/builds_controller.rb +21 -0
- data/app/controllers/infold/columns_controller.rb +89 -0
- data/app/controllers/infold/csv_columns_controller.rb +43 -0
- data/app/controllers/infold/form_associations_controller.rb +57 -0
- data/app/controllers/infold/menu_directories_controller.rb +19 -0
- data/app/controllers/infold/menus_controller.rb +35 -0
- data/app/controllers/infold/models_controller.rb +28 -0
- data/app/controllers/infold/pages_controller.rb +8 -0
- data/app/controllers/infold/search_conditions_controller.rb +63 -0
- data/app/controllers/infold/search_result_fields_controller.rb +62 -0
- data/app/controllers/infold/show_associations_controller.rb +54 -0
- data/app/controllers/infold/sync_dbs_controller.rb +13 -0
- data/app/decorators/infold/app_view_form_decorator.rb +56 -0
- data/app/decorators/infold/app_view_index_decorator.rb +53 -0
- data/app/decorators/infold/app_view_modal_decorator.rb +13 -0
- data/app/decorators/infold/app_view_show_decorator.rb +26 -0
- data/app/decorators/infold/attachment_field_decorator.rb +40 -0
- data/app/decorators/infold/build_decorator.rb +15 -0
- data/app/decorators/infold/column_display_decorator.rb +59 -0
- data/app/decorators/infold/csv_column_decorator.rb +5 -0
- data/app/decorators/infold/form_association_column_decorator.rb +5 -0
- data/app/decorators/infold/form_column_decorator.rb +57 -0
- data/app/decorators/infold/model_association_decorator.rb +39 -0
- data/app/decorators/infold/model_column_decorator.rb +201 -0
- data/app/decorators/infold/model_decorator.rb +27 -0
- data/app/decorators/infold/search_condition_decorator.rb +101 -0
- data/app/decorators/infold/search_result_column_decorator.rb +5 -0
- data/app/decorators/infold/show_association_column_decorator.rb +5 -0
- data/app/decorators/infold/show_association_decorator.rb +13 -0
- data/app/decorators/infold/show_field_decorator.rb +5 -0
- data/app/helpers/infold/application_helper.rb +29 -0
- data/app/javascript/admin.scss +5 -0
- data/app/javascript/controllers/application.js +9 -0
- data/app/javascript/controllers/attachment_field_controller.js +19 -0
- data/app/javascript/controllers/column_controller.js +20 -0
- data/app/javascript/controllers/flash_controller.js +10 -0
- data/app/javascript/controllers/index.js +32 -0
- data/app/javascript/controllers/menu_controller.js +26 -0
- data/app/javascript/controllers/menu_directory_controller.js +16 -0
- data/app/javascript/controllers/modal_controller.js +15 -0
- data/app/javascript/controllers/nested_form_controller.js +32 -0
- data/app/javascript/controllers/search_condition_controller.js +41 -0
- data/app/javascript/controllers/sortable_controller.js +19 -0
- data/app/javascript/infold.js +22 -0
- data/app/javascript/infold.scss +68 -0
- data/app/javascript/stylesheets/admin/common.scss +112 -0
- data/app/javascript/stylesheets/admin/form.scss +52 -0
- data/app/javascript/stylesheets/admin/index.scss +93 -0
- data/app/javascript/stylesheets/admin/modal.scss +37 -0
- data/app/javascript/stylesheets/admin/show.scss +16 -0
- data/app/jobs/infold/application_job.rb +4 -0
- data/app/mailers/infold/application_mailer.rb +6 -0
- data/app/models/concerns/infold/app_view_search_concern.rb +72 -0
- data/app/models/concerns/infold/form_column_concern.rb +63 -0
- data/app/models/infold/app.rb +41 -0
- data/app/models/infold/app_view.rb +27 -0
- data/app/models/infold/app_view_form.rb +43 -0
- data/app/models/infold/app_view_index.rb +36 -0
- data/app/models/infold/app_view_modal.rb +21 -0
- data/app/models/infold/app_view_show.rb +47 -0
- data/app/models/infold/application_record.rb +7 -0
- data/app/models/infold/attachment_field.rb +35 -0
- data/app/models/infold/build.rb +35 -0
- data/app/models/infold/csv_column.rb +9 -0
- data/app/models/infold/enum.rb +12 -0
- data/app/models/infold/form_association.rb +41 -0
- data/app/models/infold/form_association_attachment_field.rb +5 -0
- data/app/models/infold/form_association_column.rb +5 -0
- data/app/models/infold/form_association_field.rb +7 -0
- data/app/models/infold/form_attachment_field.rb +5 -0
- data/app/models/infold/form_column.rb +5 -0
- data/app/models/infold/form_field.rb +7 -0
- data/app/models/infold/menu_item.rb +45 -0
- data/app/models/infold/model.rb +40 -0
- data/app/models/infold/model_association.rb +51 -0
- data/app/models/infold/model_column.rb +127 -0
- data/app/models/infold/project.rb +29 -0
- data/app/models/infold/schema_rb.rb +177 -0
- data/app/models/infold/search_condition.rb +62 -0
- data/app/models/infold/search_result_attachment_field.rb +5 -0
- data/app/models/infold/search_result_column.rb +6 -0
- data/app/models/infold/search_result_field.rb +12 -0
- data/app/models/infold/show_association.rb +42 -0
- data/app/models/infold/show_association_attachment_field.rb +5 -0
- data/app/models/infold/show_association_column.rb +5 -0
- data/app/models/infold/show_association_field.rb +8 -0
- data/app/models/infold/show_attachment_field.rb +7 -0
- data/app/models/infold/show_column.rb +7 -0
- data/app/models/infold/show_field.rb +11 -0
- data/app/validators/infold/ruby_code_validator.rb +9 -0
- data/app/views/infold/app_view_forms/_bulk_form.html.haml +16 -0
- data/app/views/infold/app_view_forms/_tab.html.haml +12 -0
- data/app/views/infold/app_view_forms/show.html.haml +7 -0
- data/app/views/infold/app_view_shows/_bulk_form.html.haml +15 -0
- data/app/views/infold/app_view_shows/_tab.html.haml +12 -0
- data/app/views/infold/app_view_shows/show.html.haml +7 -0
- data/app/views/infold/app_view_shows/update.turbo_stream.haml +1 -0
- data/app/views/infold/application/_flash.html.haml +6 -0
- data/app/views/infold/apps/_form.html.haml +30 -0
- data/app/views/infold/apps/_page_header.html.haml +5 -0
- data/app/views/infold/apps/_tab.html.haml +13 -0
- data/app/views/infold/apps/create.turbo_stream.haml +3 -0
- data/app/views/infold/apps/edit.html.haml +6 -0
- data/app/views/infold/apps/new.html.haml +8 -0
- data/app/views/infold/apps/update.turbo_stream.haml +3 -0
- data/app/views/infold/associations/_form.html.haml +18 -0
- data/app/views/infold/associations/edit.html.haml +5 -0
- data/app/views/infold/attachment_fields/_form.html.haml +51 -0
- data/app/views/infold/attachment_fields/edit.html.haml +7 -0
- data/app/views/infold/attachment_fields/form.turbo_stream.haml +4 -0
- data/app/views/infold/attachment_fields/index.html.haml +28 -0
- data/app/views/infold/attachment_fields/new.html.haml +7 -0
- data/app/views/infold/builds/create.turbo_stream.haml +8 -0
- data/app/views/infold/builds/new.html.haml +23 -0
- data/app/views/infold/columns/_bulk_form.html.haml +18 -0
- data/app/views/infold/columns/_row.html.haml +26 -0
- data/app/views/infold/columns/_setting.html.haml +42 -0
- data/app/views/infold/columns/bulk.turbo_stream.haml +3 -0
- data/app/views/infold/columns/edit.html.haml +5 -0
- data/app/views/infold/columns/index.html.haml +9 -0
- data/app/views/infold/columns/update.turbo_stream.haml +8 -0
- data/app/views/infold/csv_columns/_bulk_form.html.haml +14 -0
- data/app/views/infold/csv_columns/_row.html.haml +10 -0
- data/app/views/infold/csv_columns/bulk.turbo_stream.haml +3 -0
- data/app/views/infold/csv_columns/index.html.haml +7 -0
- data/app/views/infold/enums/_form.html.haml +13 -0
- data/app/views/infold/enums/_index.html.haml +27 -0
- data/app/views/infold/enums/index.html.haml +5 -0
- data/app/views/infold/form_association_attachment_fields/_form.html.haml +13 -0
- data/app/views/infold/form_association_columns/_form.html.haml +20 -0
- data/app/views/infold/form_associations/_bulk_form.html.haml +16 -0
- data/app/views/infold/form_associations/_form.html.haml +19 -0
- data/app/views/infold/form_associations/show.html.haml +7 -0
- data/app/views/infold/form_associations/update.turbo_stream.haml +1 -0
- data/app/views/infold/form_attachment_fields/_form.html.haml +14 -0
- data/app/views/infold/form_columns/_form.html.haml +21 -0
- data/app/views/infold/menu_directories/_item.html.haml +20 -0
- data/app/views/infold/menu_directories/create.turbo_stream.haml +2 -0
- data/app/views/infold/menu_directories/destroy.turbo_stream.haml +5 -0
- data/app/views/infold/menus/_app.html.haml +10 -0
- data/app/views/infold/menus/_items.html.haml +7 -0
- data/app/views/infold/menus/edit.html.haml +23 -0
- data/app/views/infold/menus/update.turbo_stream.haml +3 -0
- data/app/views/infold/models/_form.html.haml +12 -0
- data/app/views/infold/models/_tab.html.haml +7 -0
- data/app/views/infold/models/edit.html.haml +9 -0
- data/app/views/infold/models/update.turbo_stream.haml +3 -0
- data/app/views/infold/search_conditions/_bulk_form.html.haml +24 -0
- data/app/views/infold/search_conditions/_column_options.html.haml +3 -0
- data/app/views/infold/search_conditions/_form_kind_options.html.haml +3 -0
- data/app/views/infold/search_conditions/_row.html.haml +31 -0
- data/app/views/infold/search_conditions/_sign_options.html.haml +3 -0
- data/app/views/infold/search_conditions/_tab.html.haml +12 -0
- data/app/views/infold/search_conditions/bulk.turbo_stream.haml +3 -0
- data/app/views/infold/search_conditions/index.html.haml +7 -0
- data/app/views/infold/search_conditions/refresh_columns.turbo_stream.haml +6 -0
- data/app/views/infold/search_conditions/refresh_form_kinds.turbo_stream.haml +4 -0
- data/app/views/infold/search_conditions/refresh_signs.turbo_stream.haml +2 -0
- data/app/views/infold/search_result_attachment_fields/_form.html.haml +12 -0
- data/app/views/infold/search_result_columns/_form.html.haml +12 -0
- data/app/views/infold/search_result_fields/_bulk_form.html.haml +23 -0
- data/app/views/infold/search_result_fields/_row.html.haml +12 -0
- data/app/views/infold/search_result_fields/bulk.turbo_stream.haml +3 -0
- data/app/views/infold/search_result_fields/index.html.haml +7 -0
- data/app/views/infold/show_association_attachment_fields/_form.html.haml +12 -0
- data/app/views/infold/show_association_columns/_form.html.haml +12 -0
- data/app/views/infold/show_associations/_bulk_form.html.haml +15 -0
- data/app/views/infold/show_associations/_form.html.haml +14 -0
- data/app/views/infold/show_associations/show.html.haml +7 -0
- data/app/views/infold/show_associations/update.turbo_stream.haml +1 -0
- data/app/views/infold/show_attachment_fields/_form.html.haml +12 -0
- data/app/views/infold/show_columns/_form.html.haml +12 -0
- data/app/views/infold/sync_dbs/create.turbo_stream.haml +1 -0
- data/app/views/infold/sync_dbs/show.html.haml +11 -0
- data/app/views/layouts/infold/application.html.haml +112 -0
- data/config/database.yml +11 -0
- data/config/initializers/infold_assets.rb +12 -0
- data/config/initializers/infold_locale.rb +1 -0
- data/config/locales/infold/ar/app/en.yml +6 -0
- data/config/locales/infold/ar/app/ja.yml +6 -0
- data/config/locales/infold/ar/app_view/en.yml +4 -0
- data/config/locales/infold/ar/app_view/ja.yml +4 -0
- data/config/locales/infold/ar/app_view_form/en.yml +10 -0
- data/config/locales/infold/ar/app_view_form/ja.yml +10 -0
- data/config/locales/infold/ar/app_view_index/en.yml +12 -0
- data/config/locales/infold/ar/app_view_index/ja.yml +12 -0
- data/config/locales/infold/ar/app_view_modal/en.yml +6 -0
- data/config/locales/infold/ar/app_view_modal/ja.yml +6 -0
- data/config/locales/infold/ar/app_view_show/en.yml +9 -0
- data/config/locales/infold/ar/app_view_show/ja.yml +9 -0
- data/config/locales/infold/ar/csv_column/en.yml +8 -0
- data/config/locales/infold/ar/csv_column/ja.yml +8 -0
- data/config/locales/infold/ar/form_association_column/ja.yml +15 -0
- data/config/locales/infold/ar/form_column/ja.yml +15 -0
- data/config/locales/infold/ar/menu_item/ja.yml +6 -0
- data/config/locales/infold/ar/model/ja.yml +11 -0
- data/config/locales/infold/ar/model_association/en.yml +6 -0
- data/config/locales/infold/ar/model_association/ja.yml +10 -0
- data/config/locales/infold/ar/model_column/en.yml +34 -0
- data/config/locales/infold/ar/model_column/ja.yml +34 -0
- data/config/locales/infold/ar/search_condition/en.yml +30 -0
- data/config/locales/infold/ar/search_condition/ja.yml +30 -0
- data/config/locales/infold/ar/search_result_field/en.yml +9 -0
- data/config/locales/infold/ar/search_result_field/ja.yml +9 -0
- data/config/locales/infold/en.yml +40 -0
- data/config/locales/infold/ja.yml +41 -0
- data/config/routes.rb +40 -0
- data/db/infold_test.sqlite3 +0 -0
- data/db/migrate/20220419050641_create_infold_projects.rb +9 -0
- data/db/migrate/20220419051049_create_infold_models.rb +15 -0
- data/db/migrate/20220419051601_create_infold_columns.rb +23 -0
- data/db/migrate/20220419051718_create_infold_attachment_fields.rb +15 -0
- data/db/migrate/20220419052017_create_infold_model_associations.rb +16 -0
- data/db/migrate/20220419052154_create_infold_apps.rb +10 -0
- data/db/migrate/20220419052320_create_infold_app_views.rb +14 -0
- data/db/migrate/20220419052450_create_infold_search_conditions.rb +14 -0
- data/db/migrate/20220419052707_create_infold_search_result_fields.rb +18 -0
- data/db/migrate/20220419053338_create_infold_show_fields.rb +18 -0
- data/db/migrate/20220419053425_create_infold_show_association_fields.rb +15 -0
- data/db/migrate/20220419060937_create_infold_form_fields.rb +19 -0
- data/db/migrate/20220419061148_create_infold_form_association_fields.rb +16 -0
- data/db/migrate/20220419061725_create_infold_enums.rb +16 -0
- data/db/migrate/20220419062020_create_infold_menu_items.rb +16 -0
- data/db/migrate/20220419062119_create_infold_csv_columns.rb +12 -0
- data/db/schema.rb +260 -0
- data/lib/generators/infold/app/app_generator.rb +134 -0
- data/lib/generators/infold/app/templates/controller.rb.tt +100 -0
- data/lib/generators/infold/app/templates/search_form.rb.tt +31 -0
- data/lib/generators/infold/app/templates/views/_association_fields.haml.tt +16 -0
- data/lib/generators/infold/app/templates/views/_detail.haml.tt +100 -0
- data/lib/generators/infold/app/templates/views/_detail_modal_wrapper.haml.tt +9 -0
- data/lib/generators/infold/app/templates/views/_form.haml.tt +66 -0
- data/lib/generators/infold/app/templates/views/_index_row.haml.tt +17 -0
- data/lib/generators/infold/app/templates/views/_show_operation.haml.tt +5 -0
- data/lib/generators/infold/app/templates/views/edit+turbo_frame.haml.tt +13 -0
- data/lib/generators/infold/app/templates/views/edit.haml.tt +10 -0
- data/lib/generators/infold/app/templates/views/form.turbo_stream.haml.tt +17 -0
- data/lib/generators/infold/app/templates/views/index+turbo_frame.haml.tt +43 -0
- data/lib/generators/infold/app/templates/views/index.csv.ruby.tt +18 -0
- data/lib/generators/infold/app/templates/views/index.haml.tt +49 -0
- data/lib/generators/infold/app/templates/views/new+turbo_frame.haml.tt +14 -0
- data/lib/generators/infold/app/templates/views/new.haml.tt +12 -0
- data/lib/generators/infold/app/templates/views/show+turbo_frame.haml.tt +4 -0
- data/lib/generators/infold/app/templates/views/show.haml.tt +9 -0
- data/lib/generators/infold/install/install_generator.rb +151 -0
- data/lib/generators/infold/install/templates/app/components/admin/enum_badge_component.html.haml +4 -0
- data/lib/generators/infold/install/templates/app/components/admin/enum_badge_component.rb +11 -0
- data/lib/generators/infold/install/templates/app/components/admin/form/checkbox_fieldset_component.html.haml +11 -0
- data/lib/generators/infold/install/templates/app/components/admin/form/checkbox_fieldset_component.rb +15 -0
- data/lib/generators/infold/install/templates/app/components/admin/form/datetime_fieldset_component.html.haml +20 -0
- data/lib/generators/infold/install/templates/app/components/admin/form/datetime_fieldset_component.rb +13 -0
- data/lib/generators/infold/install/templates/app/components/admin/form/file_upload_component.html.haml +12 -0
- data/lib/generators/infold/install/templates/app/components/admin/form/file_upload_component.rb +12 -0
- data/lib/generators/infold/install/templates/app/components/admin/form/input_fieldset_component.html.haml +14 -0
- data/lib/generators/infold/install/templates/app/components/admin/form/input_fieldset_component.rb +24 -0
- data/lib/generators/infold/install/templates/app/components/admin/form/radio_fieldset_component.html.haml +11 -0
- data/lib/generators/infold/install/templates/app/components/admin/form/radio_fieldset_component.rb +15 -0
- data/lib/generators/infold/install/templates/app/components/admin/form/relation_fieldset_component.html.haml +17 -0
- data/lib/generators/infold/install/templates/app/components/admin/form/relation_fieldset_component.rb +21 -0
- data/lib/generators/infold/install/templates/app/components/admin/form/select_fieldset_component.html.haml +7 -0
- data/lib/generators/infold/install/templates/app/components/admin/form/select_fieldset_component.rb +16 -0
- data/lib/generators/infold/install/templates/app/components/admin/form/switch_element_component.html.haml +4 -0
- data/lib/generators/infold/install/templates/app/components/admin/form/switch_element_component.rb +12 -0
- data/lib/generators/infold/install/templates/app/components/admin/remote_modal_component.html.haml +8 -0
- data/lib/generators/infold/install/templates/app/components/admin/remote_modal_component.rb +21 -0
- data/lib/generators/infold/install/templates/app/components/admin/sortable_th_component.html.haml +4 -0
- data/lib/generators/infold/install/templates/app/components/admin/sortable_th_component.rb +27 -0
- data/lib/generators/infold/install/templates/app/controllers/admin/admin_users/registrations_controller.rb +71 -0
- data/lib/generators/infold/install/templates/app/controllers/admin/admin_users/sessions_controller.rb +39 -0
- data/lib/generators/infold/install/templates/app/controllers/admin/admin_users_controller.rb +62 -0
- data/lib/generators/infold/install/templates/app/controllers/admin/base_controller.rb +17 -0
- data/lib/generators/infold/install/templates/app/controllers/admin/errors_controller.rb +8 -0
- data/lib/generators/infold/install/templates/app/controllers/admin/turbo_devise_controller.rb +21 -0
- data/lib/generators/infold/install/templates/app/controllers/concerns/admin/error_handlers.rb +40 -0
- data/lib/generators/infold/install/templates/app/forms/admin/search_form_base.rb +48 -0
- data/lib/generators/infold/install/templates/app/helpers/admin_helper.rb +37 -0
- data/lib/generators/infold/install/templates/app/models/concerns/admin/datetime_field_concern.rb +57 -0
- data/lib/generators/infold/install/templates/app/views/admin/admin_users/_detail.html.haml +14 -0
- data/lib/generators/infold/install/templates/app/views/admin/admin_users/_form.html.haml +6 -0
- data/lib/generators/infold/install/templates/app/views/admin/admin_users/_index_row.html.haml +9 -0
- data/lib/generators/infold/install/templates/app/views/admin/admin_users/_show_operation.html.haml +4 -0
- data/lib/generators/infold/install/templates/app/views/admin/admin_users/edit.html+turbo_frame.haml +11 -0
- data/lib/generators/infold/install/templates/app/views/admin/admin_users/edit.html.haml +10 -0
- data/lib/generators/infold/install/templates/app/views/admin/admin_users/form.turbo_stream.haml +4 -0
- data/lib/generators/infold/install/templates/app/views/admin/admin_users/index.html.haml +21 -0
- data/lib/generators/infold/install/templates/app/views/admin/admin_users/new.html+turbo_frame.haml +11 -0
- data/lib/generators/infold/install/templates/app/views/admin/admin_users/new.html.haml +10 -0
- data/lib/generators/infold/install/templates/app/views/admin/admin_users/registrations/edit.html.haml +15 -0
- data/lib/generators/infold/install/templates/app/views/admin/admin_users/sessions/new.html.haml +19 -0
- data/lib/generators/infold/install/templates/app/views/admin/admin_users/show.html+turbo_frame.haml +11 -0
- data/lib/generators/infold/install/templates/app/views/admin/admin_users/show.html.haml +8 -0
- data/lib/generators/infold/install/templates/app/views/admin/common/_flash.html.haml +6 -0
- data/lib/generators/infold/install/templates/app/views/admin/common/_header_menu.html.haml +0 -0
- data/lib/generators/infold/install/templates/app/views/admin/errors/bad_request.html.haml +11 -0
- data/lib/generators/infold/install/templates/app/views/admin/errors/forbidden.html.haml +11 -0
- data/lib/generators/infold/install/templates/app/views/admin/errors/internal_server_error.html.haml +11 -0
- data/lib/generators/infold/install/templates/app/views/admin/errors/not_found.html.haml +11 -0
- data/lib/generators/infold/install/templates/app/views/admin/kaminari/_first_page.html.haml +2 -0
- data/lib/generators/infold/install/templates/app/views/admin/kaminari/_gap.html.haml +2 -0
- data/lib/generators/infold/install/templates/app/views/admin/kaminari/_last_page.html.haml +2 -0
- data/lib/generators/infold/install/templates/app/views/admin/kaminari/_next_page.html.haml +2 -0
- data/lib/generators/infold/install/templates/app/views/admin/kaminari/_page.html.haml +6 -0
- data/lib/generators/infold/install/templates/app/views/admin/kaminari/_paginator.html.haml +12 -0
- data/lib/generators/infold/install/templates/app/views/admin/kaminari/_prev_page.html.haml +2 -0
- data/lib/generators/infold/install/templates/app/views/layouts/admin.haml.tt +49 -0
- data/lib/generators/infold/install/templates/config/locales/infold.en.yml +28 -0
- data/lib/generators/infold/install/templates/config/locales/infold.ja.yml +28 -0
- data/lib/generators/infold/install/templates/config/routes/admin.rb +13 -0
- data/lib/generators/infold/install/templates/javascript/admin/controllers/application.js +9 -0
- data/lib/generators/infold/install/templates/javascript/admin/controllers/datepicker_controller.js +8 -0
- data/lib/generators/infold/install/templates/javascript/admin/controllers/flash_controller.js +10 -0
- data/lib/generators/infold/install/templates/javascript/admin/controllers/index.js +26 -0
- data/lib/generators/infold/install/templates/javascript/admin/controllers/index_page_controller.js +33 -0
- data/lib/generators/infold/install/templates/javascript/admin/controllers/nested_form_controller.js +33 -0
- data/lib/generators/infold/install/templates/javascript/admin/controllers/relation_search_controller.js +21 -0
- data/lib/generators/infold/install/templates/javascript/admin/controllers/remote_modal_controller.js +37 -0
- data/lib/generators/infold/install/templates/javascript/admin/controllers/timepicker_controller.js +8 -0
- data/lib/generators/infold/install/templates/javascript/admin/stylesheets/custom.css +290 -0
- data/lib/generators/infold/install/templates/javascript/admin/stylesheets/custom.css.map +1 -0
- data/lib/generators/infold/install/templates/javascript/esbuild/admin.js +10 -0
- data/lib/generators/infold/install/templates/javascript/webpacker/admin.js +9 -0
- data/lib/generators/infold/model/model_generator.rb +50 -0
- data/lib/generators/infold/model/templates/decorator.rb.tt +10 -0
- data/lib/generators/infold/model/templates/model.rb.tt +59 -0
- data/lib/generators/infold/project/project_generator.rb +66 -0
- data/lib/generators/infold/project/templates/_header_menu.haml.tt +17 -0
- data/lib/generators/infold/project/templates/locales/form.yml.tt +11 -0
- data/lib/generators/infold/project/templates/locales/model.yml.tt +43 -0
- data/lib/generators/infold/project/templates/relation_fieldset_component.rb.tt +30 -0
- data/lib/infold/engine.rb +15 -0
- data/lib/infold/version.rb +3 -0
- data/lib/infold.rb +6 -0
- data/lib/tasks/infold_tasks.rake +125 -0
- metadata +556 -0
@@ -0,0 +1,68 @@
|
|
1
|
+
body {
|
2
|
+
font-family: -apple-system, BlinkMacSystemFont, Roboto, "Segoe UI", "Helvetica Neue", HelveticaNeue, Verdana, Meiryo, sans-serif;
|
3
|
+
font-weight: 400;
|
4
|
+
line-height: 1.5;
|
5
|
+
color: #6c757d;
|
6
|
+
}
|
7
|
+
.font-weight-bold {
|
8
|
+
font-weight: bold;
|
9
|
+
}
|
10
|
+
.tac {
|
11
|
+
text-align: center;
|
12
|
+
}
|
13
|
+
.vam {
|
14
|
+
vertical-align: middle;
|
15
|
+
}
|
16
|
+
.invalid_message {
|
17
|
+
font-size: 0.75rem;
|
18
|
+
color: #d63939;
|
19
|
+
}
|
20
|
+
|
21
|
+
#flashes {
|
22
|
+
position: fixed;
|
23
|
+
bottom: 4px;
|
24
|
+
left: 0;
|
25
|
+
right: 0;
|
26
|
+
z-index: 9999;
|
27
|
+
@keyframes hideop {
|
28
|
+
0% {
|
29
|
+
opacity: 1;
|
30
|
+
}
|
31
|
+
100% {
|
32
|
+
opacity: 0;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
.alert {
|
36
|
+
animation: hideop 0.5s linear 0s;
|
37
|
+
animation-delay: 3s;
|
38
|
+
animation-fill-mode: forwards;
|
39
|
+
padding-top: 8px;
|
40
|
+
padding-bottom: 8px;
|
41
|
+
}
|
42
|
+
.alert-dismissible .btn-close {
|
43
|
+
padding-top: 4px;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
.navbar-expand-md.navbar-vertical ~ #flashes {
|
47
|
+
@media (min-width: 992px) {
|
48
|
+
margin-left: 15rem;
|
49
|
+
}
|
50
|
+
}
|
51
|
+
.nav-tabs {
|
52
|
+
border-bottom: 1px solid rgba(98, 105, 118, 0.16) !important;
|
53
|
+
.nav-item {
|
54
|
+
.active {
|
55
|
+
background-color: #fff !important;
|
56
|
+
border-top: 1px solid rgba(98, 105, 118, 0.16) !important;
|
57
|
+
border-left: 1px solid rgba(98, 105, 118, 0.16) !important;
|
58
|
+
border-right: 1px solid rgba(98, 105, 118, 0.16) !important;
|
59
|
+
border-bottom: 1px solid #fff !important;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
63
|
+
.drag_handle {
|
64
|
+
cursor: -webkit-grab;
|
65
|
+
}
|
66
|
+
.drag_handle:active {
|
67
|
+
cursor: -webkit-grabbing;
|
68
|
+
}
|
@@ -0,0 +1,112 @@
|
|
1
|
+
body {
|
2
|
+
font-family: -apple-system, BlinkMacSystemFont, Roboto, "Segoe UI", "Helvetica Neue", HelveticaNeue, Verdana, Meiryo, sans-serif;
|
3
|
+
font-weight: 400;
|
4
|
+
line-height: 1.5;
|
5
|
+
color: #6c757d;
|
6
|
+
}
|
7
|
+
|
8
|
+
.fw-bold {
|
9
|
+
font-weight: bold !important;
|
10
|
+
}
|
11
|
+
|
12
|
+
.vam {
|
13
|
+
vertical-align: middle !important;
|
14
|
+
}
|
15
|
+
|
16
|
+
.tac {
|
17
|
+
text-align: center !important;
|
18
|
+
}
|
19
|
+
|
20
|
+
.thead-no-border tr th {
|
21
|
+
border-top: none;
|
22
|
+
}
|
23
|
+
|
24
|
+
.enum_badge {
|
25
|
+
font-size: 85%;
|
26
|
+
line-height: initial;
|
27
|
+
}
|
28
|
+
|
29
|
+
i.pointer:hover {
|
30
|
+
cursor: pointer;
|
31
|
+
}
|
32
|
+
|
33
|
+
.cursor_pointer:hover {
|
34
|
+
cursor: pointer;
|
35
|
+
}
|
36
|
+
|
37
|
+
.rounded-left-0 {
|
38
|
+
border-top-left-radius: 0 !important;
|
39
|
+
border-bottom-left-radius: 0 !important;
|
40
|
+
}
|
41
|
+
|
42
|
+
.rounded-right-0 {
|
43
|
+
border-top-right-radius: 0 !important;
|
44
|
+
border-bottom-right-radius: 0 !important;
|
45
|
+
}
|
46
|
+
|
47
|
+
// select2 blank
|
48
|
+
.select2-results__option:empty:after {
|
49
|
+
content: '未選択'
|
50
|
+
}
|
51
|
+
|
52
|
+
.timepicker {
|
53
|
+
.form-control {
|
54
|
+
width: 100px !important;
|
55
|
+
}
|
56
|
+
|
57
|
+
.btn_time_now {
|
58
|
+
border-top-left-radius: 0 !important;
|
59
|
+
border-bottom-left-radius: 0 !important;
|
60
|
+
border-top-right-radius: 0.25rem !important;
|
61
|
+
border-bottom-right-radius: 0.25rem !important;
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
.card_title {
|
66
|
+
font-weight: bold;
|
67
|
+
font-size: 0.9rem;
|
68
|
+
margin: 5px 0;
|
69
|
+
}
|
70
|
+
|
71
|
+
.air-datepicker-global-container {
|
72
|
+
z-index: 10000;
|
73
|
+
}
|
74
|
+
|
75
|
+
.form-control:disabled, .form-control[readonly] {
|
76
|
+
background-color: #eee;
|
77
|
+
}
|
78
|
+
|
79
|
+
#flashes {
|
80
|
+
position: fixed;
|
81
|
+
bottom: 80px;
|
82
|
+
width: 100%;
|
83
|
+
z-index: 2000;
|
84
|
+
@keyframes hideop {
|
85
|
+
0% {
|
86
|
+
opacity: 1;
|
87
|
+
}
|
88
|
+
100% {
|
89
|
+
opacity: 0;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
.alert {
|
94
|
+
animation: hideop 0.5s linear 0s;
|
95
|
+
animation-delay: 3s;
|
96
|
+
animation-fill-mode: forwards;
|
97
|
+
padding-top: 8px;
|
98
|
+
padding-bottom: 8px;
|
99
|
+
}
|
100
|
+
|
101
|
+
.alert-dismissible .btn-close {
|
102
|
+
padding-top: 4px;
|
103
|
+
}
|
104
|
+
}
|
105
|
+
|
106
|
+
.bg-light {
|
107
|
+
color: #626976 !important;
|
108
|
+
}
|
109
|
+
|
110
|
+
h6, .h6, h5, .h5, h4, .h4, h3, .h3, h2, .h2, h1, .h1 {
|
111
|
+
font-weight: bold;
|
112
|
+
}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
.invalid_message {
|
2
|
+
width: 100%;
|
3
|
+
font-size: 85.71428571%;
|
4
|
+
color: #d63939;
|
5
|
+
}
|
6
|
+
|
7
|
+
label.form-check-label:hover {
|
8
|
+
cursor: pointer;
|
9
|
+
}
|
10
|
+
|
11
|
+
.form-control-plaintext:focus {
|
12
|
+
outline: solid transparent;
|
13
|
+
}
|
14
|
+
|
15
|
+
.custom-control {
|
16
|
+
margin-bottom: 0.4rem;
|
17
|
+
}
|
18
|
+
|
19
|
+
.form_divide {
|
20
|
+
border-top: 1px solid #eef2f7;
|
21
|
+
}
|
22
|
+
|
23
|
+
.is-invalid {
|
24
|
+
color: #fa5c7c;
|
25
|
+
border-color: #fa5c7c;
|
26
|
+
}
|
27
|
+
|
28
|
+
.nested_form_table {
|
29
|
+
th {
|
30
|
+
font-size: 0.8rem !important;
|
31
|
+
padding-top: 0.3rem !important;
|
32
|
+
padding-bottom: 0.3rem !important;
|
33
|
+
}
|
34
|
+
|
35
|
+
.nested_form {
|
36
|
+
min-width: 120px;
|
37
|
+
}
|
38
|
+
|
39
|
+
.nested_datetime_form {
|
40
|
+
min-width: 270px;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
.input-group-sm > .form-control,
|
45
|
+
.form-select-sm,
|
46
|
+
.form-control-sm {
|
47
|
+
padding: 0.25rem 0.3rem;
|
48
|
+
}
|
49
|
+
|
50
|
+
input[type="number"].form-control-sm {
|
51
|
+
padding-right: 0.7rem;
|
52
|
+
}
|
@@ -0,0 +1,93 @@
|
|
1
|
+
.index_page {
|
2
|
+
height: 100%;
|
3
|
+
}
|
4
|
+
|
5
|
+
.table_wrapper {
|
6
|
+
overflow-y: auto;
|
7
|
+
display: block;
|
8
|
+
width: 100%;
|
9
|
+
overflow-x: auto;
|
10
|
+
-webkit-overflow-scrolling: touch;
|
11
|
+
border-top: 1px solid rgba(98, 105, 118, 0.16);
|
12
|
+
|
13
|
+
table {
|
14
|
+
margin-bottom: 0;
|
15
|
+
}
|
16
|
+
|
17
|
+
thead {
|
18
|
+
tr {
|
19
|
+
border-width: 0;
|
20
|
+
}
|
21
|
+
|
22
|
+
th {
|
23
|
+
position: -webkit-sticky;
|
24
|
+
position: sticky;
|
25
|
+
top: 0;
|
26
|
+
border-top: 0 !important;
|
27
|
+
font-size: 0.75rem;
|
28
|
+
font-weight: bold;
|
29
|
+
}
|
30
|
+
|
31
|
+
.sortable {
|
32
|
+
text-decoration: underline;
|
33
|
+
}
|
34
|
+
|
35
|
+
.sortable:hover {
|
36
|
+
cursor: pointer;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
tbody {
|
41
|
+
tr {
|
42
|
+
border-top: none;
|
43
|
+
}
|
44
|
+
|
45
|
+
tr:not(:last-child) {
|
46
|
+
border-bottom: none;
|
47
|
+
}
|
48
|
+
|
49
|
+
tr:nth-of-type(even) {
|
50
|
+
background-color: #f1f3fa;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
th, td {
|
55
|
+
word-break: break-all;
|
56
|
+
|
57
|
+
p {
|
58
|
+
margin-bottom: 0.8rem;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
.image_cell img {
|
63
|
+
max-width: 160px;
|
64
|
+
}
|
65
|
+
|
66
|
+
.icon_cell {
|
67
|
+
width: 40px;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
.table-responsive {
|
72
|
+
th, td {
|
73
|
+
white-space: nowrap;
|
74
|
+
}
|
75
|
+
|
76
|
+
select.form-control {
|
77
|
+
width: auto;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
.left_conditions {
|
82
|
+
width: 240px;
|
83
|
+
@media (max-width: 767px) {
|
84
|
+
width: 100%;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
.right_results {
|
89
|
+
width: calc(100% - 250px);
|
90
|
+
@media (max-width: 767px) {
|
91
|
+
width: 100%;
|
92
|
+
}
|
93
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
.modal_h100 {
|
2
|
+
height: 100%;
|
3
|
+
margin-top: 0;
|
4
|
+
margin-bottom: 0;
|
5
|
+
|
6
|
+
.modal-content {
|
7
|
+
height: 100%;
|
8
|
+
}
|
9
|
+
}
|
10
|
+
|
11
|
+
.right_justified {
|
12
|
+
.modal-dialog {
|
13
|
+
margin-left: auto !important;
|
14
|
+
margin-right: 0 !important;
|
15
|
+
//height: 100%;
|
16
|
+
//margin-top: 0;
|
17
|
+
//margin-bottom: 0;
|
18
|
+
//.modal-content {
|
19
|
+
// height: 100%;
|
20
|
+
//}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
.modal-header,
|
25
|
+
.modal-body,
|
26
|
+
.modal-footer {
|
27
|
+
padding: 1rem;
|
28
|
+
}
|
29
|
+
|
30
|
+
.modal-backdrop.show {
|
31
|
+
opacity: 0.15;
|
32
|
+
}
|
33
|
+
|
34
|
+
.modal-content {
|
35
|
+
border-color: #ccc;
|
36
|
+
box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15) !important;
|
37
|
+
}
|
@@ -0,0 +1,72 @@
|
|
1
|
+
module Infold
|
2
|
+
module AppViewSearchConcern
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
before_create :build_default_conditions
|
7
|
+
before_create :build_default_results
|
8
|
+
end
|
9
|
+
|
10
|
+
def save_search_conditions
|
11
|
+
seq = -1
|
12
|
+
search_conditions.sort_by(&:seq).each do |cond|
|
13
|
+
cond.seq = seq += 1
|
14
|
+
end
|
15
|
+
self.save
|
16
|
+
end
|
17
|
+
|
18
|
+
def save_search_result_fields
|
19
|
+
seq = -1
|
20
|
+
search_result_fields.sort_by(&:seq).each do |result|
|
21
|
+
result.seq = seq += 1
|
22
|
+
end
|
23
|
+
self.save
|
24
|
+
end
|
25
|
+
|
26
|
+
def save_csv_columns
|
27
|
+
seq = -1
|
28
|
+
csv_columns.sort_by(&:seq).each do |result|
|
29
|
+
result.seq = seq += 1
|
30
|
+
end
|
31
|
+
self.save
|
32
|
+
end
|
33
|
+
|
34
|
+
def build_default_conditions
|
35
|
+
if model.pk_column
|
36
|
+
search_condition = search_conditions.build
|
37
|
+
search_condition.seq = 0
|
38
|
+
search_condition.model_column = model.pk_column
|
39
|
+
search_condition.form_kind = :text
|
40
|
+
search_condition.sign = :eq
|
41
|
+
search_condition.label = 'ID'
|
42
|
+
end
|
43
|
+
|
44
|
+
if model.label_column&.is_a?(ModelColumn)
|
45
|
+
search_condition = search_conditions.build
|
46
|
+
search_condition.seq = 1
|
47
|
+
search_condition.model_column = model.label_column
|
48
|
+
search_condition.form_kind = :text
|
49
|
+
search_condition.sign = :like
|
50
|
+
search_condition.label = model.label_column.locale
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def build_default_results
|
55
|
+
seq = -1
|
56
|
+
model.columns.sort_by(&:seq).each do |column|
|
57
|
+
break if search_result_columns.size > 4
|
58
|
+
next if view_type == :modal && column != model.pk_column && column != model.label_column
|
59
|
+
search_result = search_result_columns.build
|
60
|
+
search_result.app_view_index = self if view_type == :index
|
61
|
+
search_result.app_view_modal = self if view_type == :modal
|
62
|
+
search_result.seq = seq += 1
|
63
|
+
search_result.model_column = column
|
64
|
+
search_result.display = true
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def view_type
|
69
|
+
self.class.name == AppViewIndex.name ? :index : :modal
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Infold
|
2
|
+
module FormColumnConcern
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
belongs_to :model_column
|
7
|
+
|
8
|
+
delegate :model, :model_association, :name, to: :model_column
|
9
|
+
delegate :name, to: :model_column, prefix: true
|
10
|
+
|
11
|
+
enum form_kind: { text: 10, reference: 20, select: 30, check: 40, radio: 50, textarea: 60, datetime: 70, image: 80, file: 90 }, _prefix: true
|
12
|
+
enum size: { sm: 1, md: 2, lg: 3 }, _prefix: true
|
13
|
+
end
|
14
|
+
|
15
|
+
def enable_form_kinds
|
16
|
+
return [] if model_column.blank?
|
17
|
+
|
18
|
+
if model_column.kind_reference?
|
19
|
+
{ self.class.form_kinds_i18n["reference"] => "reference" }
|
20
|
+
else
|
21
|
+
_kinds = case model_column.kind.to_sym
|
22
|
+
when :enum
|
23
|
+
[:select, :radio]
|
24
|
+
when :boolean
|
25
|
+
[:check]
|
26
|
+
when :image
|
27
|
+
[:image]
|
28
|
+
when :file
|
29
|
+
[:file]
|
30
|
+
when :datetime
|
31
|
+
[:datetime]
|
32
|
+
when :string
|
33
|
+
[:text, :textarea]
|
34
|
+
when :text
|
35
|
+
[:textarea, :text]
|
36
|
+
else
|
37
|
+
[:text]
|
38
|
+
end
|
39
|
+
self.class.form_kinds_i18n.invert.select{ |k,v| _kinds.include?(v.to_sym) }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def sizing_form?
|
44
|
+
%w(text reference select textarea).include?(form_kind)
|
45
|
+
end
|
46
|
+
|
47
|
+
def default_size
|
48
|
+
return nil unless sizing_form?
|
49
|
+
|
50
|
+
return :md if form_kind_select? || form_kind_reference?
|
51
|
+
return :lg if form_kind_textarea?
|
52
|
+
return :md if model_column.blank?
|
53
|
+
case model_column.kind.to_sym
|
54
|
+
when :date, :datetime, :number
|
55
|
+
:sm
|
56
|
+
when :string
|
57
|
+
:md
|
58
|
+
else
|
59
|
+
:lg
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Infold
|
2
|
+
class App < ApplicationRecord
|
3
|
+
self.table_name = name.gsub('Infold::', '').underscore.pluralize
|
4
|
+
|
5
|
+
belongs_to :model
|
6
|
+
|
7
|
+
has_many :app_views, dependent: :destroy
|
8
|
+
has_one :app_view_form
|
9
|
+
has_one :app_view_index
|
10
|
+
has_one :app_view_modal
|
11
|
+
has_one :app_view_show
|
12
|
+
has_one :menu_item, dependent: :destroy
|
13
|
+
|
14
|
+
accepts_nested_attributes_for :app_view_form, allow_destroy: true
|
15
|
+
accepts_nested_attributes_for :app_view_index, allow_destroy: true
|
16
|
+
accepts_nested_attributes_for :app_view_show, allow_destroy: true
|
17
|
+
accepts_nested_attributes_for :app_view_modal, allow_destroy: true
|
18
|
+
|
19
|
+
validates :name, presence: true, uniqueness: true
|
20
|
+
validates :model_id, presence: true, uniqueness: { message: :registered_other_app }
|
21
|
+
|
22
|
+
def build_views
|
23
|
+
build_app_view_index(checked: !persisted?) unless app_view_index
|
24
|
+
build_app_view_show(checked: !persisted?) unless app_view_show
|
25
|
+
build_app_view_form(checked: !persisted?) unless app_view_form
|
26
|
+
build_app_view_modal unless app_view_modal
|
27
|
+
end
|
28
|
+
|
29
|
+
def app_views
|
30
|
+
[app_view_index, app_view_show, app_view_form, app_view_modal]
|
31
|
+
end
|
32
|
+
|
33
|
+
def disabled_action?(kind)
|
34
|
+
kind = kind.to_sym
|
35
|
+
app_view_show.nil? && kind == :show ||
|
36
|
+
app_view_form.nil? && %i(create update destroy).include?(kind) ||
|
37
|
+
!%i(index show create update destroy).include?(kind)
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Infold
|
2
|
+
class AppView < ApplicationRecord
|
3
|
+
self.table_name = name.gsub('Infold::', '').underscore.pluralize
|
4
|
+
|
5
|
+
attribute :checked, :boolean, default: false
|
6
|
+
|
7
|
+
belongs_to :app, optional: true
|
8
|
+
|
9
|
+
after_find :set_checked
|
10
|
+
|
11
|
+
delegate :model, to: :app
|
12
|
+
|
13
|
+
def reject_unchecked
|
14
|
+
if is_a?(AppViewIndex) || is_a?(AppViewShow)
|
15
|
+
set_checked
|
16
|
+
else
|
17
|
+
self.mark_for_destruction unless checked
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def set_checked
|
24
|
+
self.checked = true
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Infold
|
2
|
+
class AppViewForm < AppView
|
3
|
+
has_many :form_fields, foreign_key: :app_view_id, dependent: :destroy
|
4
|
+
has_many :form_columns, foreign_key: :app_view_id
|
5
|
+
has_many :form_attachment_fields, foreign_key: :app_view_id
|
6
|
+
has_many :form_associations, foreign_key: :app_view_id
|
7
|
+
|
8
|
+
accepts_nested_attributes_for :form_fields, allow_destroy: true
|
9
|
+
|
10
|
+
before_create :build_default_form_fields
|
11
|
+
|
12
|
+
# def save_with_associations
|
13
|
+
# seq = -1
|
14
|
+
# form_columns.sort_by(&:seq).each do |column|
|
15
|
+
# column.seq = seq += 1
|
16
|
+
# end
|
17
|
+
# seq = -1
|
18
|
+
# form_associations.sort_by(&:seq).each do |ass|
|
19
|
+
# ass.seq = seq += 1
|
20
|
+
# end
|
21
|
+
# self.save
|
22
|
+
# end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def build_default_form_fields
|
27
|
+
model.columns.sort_by(&:seq).each_with_index do |column, i|
|
28
|
+
form_column = form_columns.build
|
29
|
+
form_column.seq = i
|
30
|
+
form_column.model_column = column
|
31
|
+
form_column.form_kind = form_column.enable_form_kinds&.first[1]
|
32
|
+
form_column.size = form_column.default_size
|
33
|
+
form_column.display = column.view_form_default_display?
|
34
|
+
end
|
35
|
+
model.attachment_fields.each.with_index(form_columns.size) do |attachment_field, i|
|
36
|
+
form_field = form_attachment_fields.build
|
37
|
+
form_field.seq = i
|
38
|
+
form_field.attachment_field_id = attachment_field.id
|
39
|
+
form_field.display = true
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Infold
|
2
|
+
class AppViewIndex < AppView
|
3
|
+
include AppViewSearchConcern
|
4
|
+
|
5
|
+
attribute :on_csv, :boolean, default: false
|
6
|
+
|
7
|
+
belongs_to :default_order_column, class_name: ModelColumn.name, optional: true
|
8
|
+
|
9
|
+
has_many :search_conditions, foreign_key: :app_view_id, dependent: :destroy
|
10
|
+
has_many :search_result_fields, dependent: :destroy
|
11
|
+
has_many :search_result_columns
|
12
|
+
has_many :search_result_attachment_fields
|
13
|
+
|
14
|
+
has_many :csv_columns, foreign_key: :app_view_id, dependent: :destroy
|
15
|
+
|
16
|
+
accepts_nested_attributes_for :search_conditions, allow_destroy: true
|
17
|
+
accepts_nested_attributes_for :search_result_fields, allow_destroy: true
|
18
|
+
accepts_nested_attributes_for :csv_columns, allow_destroy: true
|
19
|
+
|
20
|
+
before_create :build_default_csv_columns
|
21
|
+
|
22
|
+
enum default_order_kind: { asc: 1, desc: 2 }
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def build_default_csv_columns
|
27
|
+
seq = -1
|
28
|
+
model.columns.sort_by(&:seq).each do |column|
|
29
|
+
csv_column = csv_columns.build
|
30
|
+
csv_column.seq = seq += 1
|
31
|
+
csv_column.model_column = column
|
32
|
+
csv_column.display = true
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Infold
|
2
|
+
class AppViewModal < AppView
|
3
|
+
include AppViewSearchConcern
|
4
|
+
|
5
|
+
has_many :search_conditions, class_name: SearchCondition.name, foreign_key: :app_view_id, dependent: :destroy
|
6
|
+
has_many :search_result_fields, dependent: :destroy
|
7
|
+
has_many :search_result_columns
|
8
|
+
has_many :search_result_attachment_fields
|
9
|
+
|
10
|
+
accepts_nested_attributes_for :search_conditions, allow_destroy: true
|
11
|
+
accepts_nested_attributes_for :search_result_fields, allow_destroy: true
|
12
|
+
|
13
|
+
def modal_only_search_conditions
|
14
|
+
index_conditions = app.app_view_index.search_conditions
|
15
|
+
search_conditions.reject do |sc|
|
16
|
+
same_column_index_conditions = index_conditions&.select { |ic| ic.model_column_id == sc.model_column_id }
|
17
|
+
same_column_index_conditions&.any? { |sic| sic.sign == sc.sign }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|