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
data/db/schema.rb
ADDED
@@ -0,0 +1,260 @@
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead
|
2
|
+
# of editing this file, please use the migrations feature of Active Record to
|
3
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
4
|
+
#
|
5
|
+
# This file is the source Rails uses to define your schema when running `bin/rails
|
6
|
+
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
7
|
+
# be faster and is potentially less error prone than running all of your
|
8
|
+
# migrations from scratch. Old migrations may fail to apply correctly if those
|
9
|
+
# migrations use external dependencies or application code.
|
10
|
+
#
|
11
|
+
# It's strongly recommended that you check this file into your version control system.
|
12
|
+
|
13
|
+
ActiveRecord::Schema.define(version: 2022_04_19_062119) do
|
14
|
+
|
15
|
+
create_table "app_views", force: :cascade do |t|
|
16
|
+
t.integer "app_id", null: false
|
17
|
+
t.string "type", null: false
|
18
|
+
t.integer "default_order_column_id"
|
19
|
+
t.integer "default_order_kind"
|
20
|
+
t.datetime "created_at", precision: 6, null: false
|
21
|
+
t.datetime "updated_at", precision: 6, null: false
|
22
|
+
t.index ["app_id"], name: "index_app_views_on_app_id"
|
23
|
+
end
|
24
|
+
|
25
|
+
create_table "apps", force: :cascade do |t|
|
26
|
+
t.string "name", null: false
|
27
|
+
t.integer "model_id", null: false
|
28
|
+
t.datetime "created_at", precision: 6, null: false
|
29
|
+
t.datetime "updated_at", precision: 6, null: false
|
30
|
+
t.index ["model_id"], name: "index_apps_on_model_id"
|
31
|
+
end
|
32
|
+
|
33
|
+
create_table "attachment_fields", force: :cascade do |t|
|
34
|
+
t.integer "model_id", null: false
|
35
|
+
t.string "name", null: false
|
36
|
+
t.string "locale"
|
37
|
+
t.integer "kind", null: false
|
38
|
+
t.integer "thumbnail", default: 0
|
39
|
+
t.integer "thumb_width"
|
40
|
+
t.integer "thumb_height"
|
41
|
+
t.datetime "created_at", precision: 6, null: false
|
42
|
+
t.datetime "updated_at", precision: 6, null: false
|
43
|
+
t.index ["model_id"], name: "index_attachment_fields_on_model_id"
|
44
|
+
end
|
45
|
+
|
46
|
+
create_table "csv_columns", force: :cascade do |t|
|
47
|
+
t.integer "app_view_id", null: false
|
48
|
+
t.integer "seq"
|
49
|
+
t.integer "model_column_id", null: false
|
50
|
+
t.boolean "display"
|
51
|
+
t.datetime "created_at", precision: 6, null: false
|
52
|
+
t.datetime "updated_at", precision: 6, null: false
|
53
|
+
t.index ["app_view_id"], name: "index_csv_columns_on_app_view_id"
|
54
|
+
t.index ["model_column_id"], name: "index_csv_columns_on_model_column_id"
|
55
|
+
end
|
56
|
+
|
57
|
+
create_table "enums", force: :cascade do |t|
|
58
|
+
t.integer "model_column_id", null: false
|
59
|
+
t.string "key", null: false
|
60
|
+
t.string "value", null: false
|
61
|
+
t.string "locale"
|
62
|
+
t.integer "color"
|
63
|
+
t.datetime "created_at", precision: 6, null: false
|
64
|
+
t.datetime "updated_at", precision: 6, null: false
|
65
|
+
t.index ["model_column_id", "key"], name: "index_enums_on_model_column_id_and_key", unique: true
|
66
|
+
t.index ["model_column_id", "value"], name: "index_enums_on_model_column_id_and_value", unique: true
|
67
|
+
t.index ["model_column_id"], name: "index_enums_on_model_column_id"
|
68
|
+
end
|
69
|
+
|
70
|
+
create_table "form_association_fields", force: :cascade do |t|
|
71
|
+
t.integer "form_association_id", null: false
|
72
|
+
t.string "type", null: false
|
73
|
+
t.integer "model_column_id"
|
74
|
+
t.integer "attachment_field_id"
|
75
|
+
t.integer "seq", null: false
|
76
|
+
t.integer "form_kind"
|
77
|
+
t.boolean "display", default: false, null: false
|
78
|
+
t.datetime "created_at", precision: 6, null: false
|
79
|
+
t.datetime "updated_at", precision: 6, null: false
|
80
|
+
t.index ["attachment_field_id"], name: "index_form_association_fields_on_attachment_field_id"
|
81
|
+
t.index ["model_column_id"], name: "index_form_association_fields_on_model_column_id"
|
82
|
+
end
|
83
|
+
|
84
|
+
create_table "form_fields", force: :cascade do |t|
|
85
|
+
t.integer "app_view_id", null: false
|
86
|
+
t.string "type"
|
87
|
+
t.integer "seq"
|
88
|
+
t.integer "model_column_id"
|
89
|
+
t.integer "model_association_id"
|
90
|
+
t.integer "attachment_field_id"
|
91
|
+
t.integer "form_association_id"
|
92
|
+
t.integer "form_kind"
|
93
|
+
t.boolean "display"
|
94
|
+
t.datetime "created_at", precision: 6, null: false
|
95
|
+
t.datetime "updated_at", precision: 6, null: false
|
96
|
+
t.index ["app_view_id"], name: "index_form_fields_on_app_view_id"
|
97
|
+
t.index ["attachment_field_id"], name: "index_form_fields_on_attachment_field_id"
|
98
|
+
t.index ["model_association_id"], name: "index_form_fields_on_model_association_id"
|
99
|
+
t.index ["model_column_id"], name: "index_form_fields_on_model_column_id"
|
100
|
+
end
|
101
|
+
|
102
|
+
create_table "menu_items", force: :cascade do |t|
|
103
|
+
t.integer "project_id", null: false
|
104
|
+
t.integer "seq", null: false
|
105
|
+
t.integer "kind", null: false
|
106
|
+
t.integer "app_id"
|
107
|
+
t.integer "directory_id"
|
108
|
+
t.string "name"
|
109
|
+
t.datetime "created_at", precision: 6, null: false
|
110
|
+
t.datetime "updated_at", precision: 6, null: false
|
111
|
+
t.index ["app_id"], name: "index_menu_items_on_app_id"
|
112
|
+
t.index ["project_id"], name: "index_menu_items_on_project_id"
|
113
|
+
end
|
114
|
+
|
115
|
+
create_table "model_associations", force: :cascade do |t|
|
116
|
+
t.integer "model_id", null: false
|
117
|
+
t.integer "model_column_id", null: false
|
118
|
+
t.integer "parent_model_id", null: false
|
119
|
+
t.integer "has_kind", null: false
|
120
|
+
t.integer "dependent_kind"
|
121
|
+
t.string "locale"
|
122
|
+
t.datetime "created_at", precision: 6, null: false
|
123
|
+
t.datetime "updated_at", precision: 6, null: false
|
124
|
+
t.index ["model_column_id"], name: "index_model_associations_on_model_column_id"
|
125
|
+
t.index ["model_id"], name: "index_model_associations_on_model_id"
|
126
|
+
end
|
127
|
+
|
128
|
+
create_table "model_columns", force: :cascade do |t|
|
129
|
+
t.integer "model_id", null: false
|
130
|
+
t.integer "seq"
|
131
|
+
t.string "name", null: false
|
132
|
+
t.integer "kind"
|
133
|
+
t.string "locale"
|
134
|
+
t.integer "number_kind"
|
135
|
+
t.boolean "delimited"
|
136
|
+
t.string "unit"
|
137
|
+
t.integer "unit_position"
|
138
|
+
t.integer "not_null", default: 0, null: false
|
139
|
+
t.integer "unique", default: 0, null: false
|
140
|
+
t.integer "minimum_value"
|
141
|
+
t.integer "maximum_value"
|
142
|
+
t.integer "minimum_length"
|
143
|
+
t.integer "maximum_length"
|
144
|
+
t.datetime "created_at", precision: 6, null: false
|
145
|
+
t.datetime "updated_at", precision: 6, null: false
|
146
|
+
t.index ["model_id"], name: "index_model_columns_on_model_id"
|
147
|
+
end
|
148
|
+
|
149
|
+
create_table "models", force: :cascade do |t|
|
150
|
+
t.string "name"
|
151
|
+
t.string "table_name"
|
152
|
+
t.string "locale"
|
153
|
+
t.integer "pk_column_id"
|
154
|
+
t.integer "create_timestamp_column_id"
|
155
|
+
t.integer "update_timestamp_column_id"
|
156
|
+
t.integer "label_column_id"
|
157
|
+
t.datetime "created_at", precision: 6, null: false
|
158
|
+
t.datetime "updated_at", precision: 6, null: false
|
159
|
+
end
|
160
|
+
|
161
|
+
create_table "projects", force: :cascade do |t|
|
162
|
+
t.string "namespace", null: false
|
163
|
+
t.datetime "created_at", precision: 6, null: false
|
164
|
+
t.datetime "updated_at", precision: 6, null: false
|
165
|
+
end
|
166
|
+
|
167
|
+
create_table "search_conditions", force: :cascade do |t|
|
168
|
+
t.integer "app_view_id", null: false
|
169
|
+
t.integer "seq", null: false
|
170
|
+
t.integer "model_column_id", null: false
|
171
|
+
t.integer "form_kind", null: false
|
172
|
+
t.integer "sign"
|
173
|
+
t.string "label"
|
174
|
+
t.datetime "created_at", precision: 6, null: false
|
175
|
+
t.datetime "updated_at", precision: 6, null: false
|
176
|
+
t.index ["app_view_id"], name: "index_search_conditions_on_app_view_id"
|
177
|
+
t.index ["model_column_id"], name: "index_search_conditions_on_model_column_id"
|
178
|
+
end
|
179
|
+
|
180
|
+
create_table "search_result_fields", force: :cascade do |t|
|
181
|
+
t.integer "app_view_index_id"
|
182
|
+
t.integer "app_view_modal_id"
|
183
|
+
t.string "type", null: false
|
184
|
+
t.integer "seq", null: false
|
185
|
+
t.integer "model_column_id"
|
186
|
+
t.integer "attachment_field_id"
|
187
|
+
t.boolean "display", default: false, null: false
|
188
|
+
t.datetime "created_at", precision: 6, null: false
|
189
|
+
t.datetime "updated_at", precision: 6, null: false
|
190
|
+
t.index ["attachment_field_id"], name: "index_search_result_fields_on_attachment_field_id"
|
191
|
+
t.index ["model_column_id"], name: "index_search_result_fields_on_model_column_id"
|
192
|
+
end
|
193
|
+
|
194
|
+
create_table "show_association_fields", force: :cascade do |t|
|
195
|
+
t.integer "show_association_id", null: false
|
196
|
+
t.string "type", null: false
|
197
|
+
t.integer "model_column_id"
|
198
|
+
t.integer "attachment_field_id"
|
199
|
+
t.integer "seq", null: false
|
200
|
+
t.boolean "display", default: false, null: false
|
201
|
+
t.datetime "created_at", precision: 6, null: false
|
202
|
+
t.datetime "updated_at", precision: 6, null: false
|
203
|
+
t.index ["attachment_field_id"], name: "index_show_association_fields_on_attachment_field_id"
|
204
|
+
t.index ["model_column_id"], name: "index_show_association_fields_on_model_column_id"
|
205
|
+
end
|
206
|
+
|
207
|
+
create_table "show_fields", force: :cascade do |t|
|
208
|
+
t.integer "app_view_id", null: false
|
209
|
+
t.string "type", null: false
|
210
|
+
t.integer "seq", null: false
|
211
|
+
t.integer "model_column_id"
|
212
|
+
t.integer "model_association_id"
|
213
|
+
t.integer "attachment_field_id"
|
214
|
+
t.integer "show_association_id"
|
215
|
+
t.boolean "display", default: false, null: false
|
216
|
+
t.datetime "created_at", precision: 6, null: false
|
217
|
+
t.datetime "updated_at", precision: 6, null: false
|
218
|
+
t.index ["app_view_id"], name: "index_show_fields_on_app_view_id"
|
219
|
+
t.index ["attachment_field_id"], name: "index_show_fields_on_attachment_field_id"
|
220
|
+
t.index ["model_association_id"], name: "index_show_fields_on_model_association_id"
|
221
|
+
t.index ["model_column_id"], name: "index_show_fields_on_model_column_id"
|
222
|
+
end
|
223
|
+
|
224
|
+
add_foreign_key "app_views", "apps"
|
225
|
+
add_foreign_key "app_views", "model_columns", column: "default_order_column_id"
|
226
|
+
add_foreign_key "apps", "models"
|
227
|
+
add_foreign_key "attachment_fields", "models"
|
228
|
+
add_foreign_key "csv_columns", "app_views"
|
229
|
+
add_foreign_key "csv_columns", "model_columns"
|
230
|
+
add_foreign_key "enums", "model_columns"
|
231
|
+
add_foreign_key "form_association_fields", "attachment_fields"
|
232
|
+
add_foreign_key "form_association_fields", "form_fields", column: "form_association_id"
|
233
|
+
add_foreign_key "form_association_fields", "model_columns"
|
234
|
+
add_foreign_key "form_fields", "app_views"
|
235
|
+
add_foreign_key "form_fields", "attachment_fields"
|
236
|
+
add_foreign_key "form_fields", "form_fields", column: "form_association_id"
|
237
|
+
add_foreign_key "form_fields", "model_associations"
|
238
|
+
add_foreign_key "form_fields", "model_columns"
|
239
|
+
add_foreign_key "menu_items", "apps"
|
240
|
+
add_foreign_key "menu_items", "menu_items", column: "directory_id"
|
241
|
+
add_foreign_key "menu_items", "projects"
|
242
|
+
add_foreign_key "model_associations", "model_columns"
|
243
|
+
add_foreign_key "model_associations", "models"
|
244
|
+
add_foreign_key "model_associations", "models", column: "parent_model_id"
|
245
|
+
add_foreign_key "model_columns", "models"
|
246
|
+
add_foreign_key "search_conditions", "app_views"
|
247
|
+
add_foreign_key "search_conditions", "model_columns"
|
248
|
+
add_foreign_key "search_result_fields", "app_views", column: "app_view_index_id"
|
249
|
+
add_foreign_key "search_result_fields", "app_views", column: "app_view_modal_id"
|
250
|
+
add_foreign_key "search_result_fields", "attachment_fields"
|
251
|
+
add_foreign_key "search_result_fields", "model_columns"
|
252
|
+
add_foreign_key "show_association_fields", "attachment_fields"
|
253
|
+
add_foreign_key "show_association_fields", "model_columns"
|
254
|
+
add_foreign_key "show_association_fields", "show_fields", column: "show_association_id"
|
255
|
+
add_foreign_key "show_fields", "app_views"
|
256
|
+
add_foreign_key "show_fields", "attachment_fields"
|
257
|
+
add_foreign_key "show_fields", "model_associations"
|
258
|
+
add_foreign_key "show_fields", "model_columns"
|
259
|
+
add_foreign_key "show_fields", "show_fields", column: "show_association_id"
|
260
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
module Infold
|
2
|
+
class AppGenerator < Rails::Generators::NamedBase
|
3
|
+
source_root File.expand_path('templates', __dir__)
|
4
|
+
|
5
|
+
def setup
|
6
|
+
raise '' if name.to_i == -1
|
7
|
+
@app = App.includes(
|
8
|
+
:model,
|
9
|
+
app_view_index: [search_result_columns: [:model_column],
|
10
|
+
search_result_attachment_fields: [:attachment_field],
|
11
|
+
csv_columns: [:model_column],
|
12
|
+
search_conditions: :model_column],
|
13
|
+
app_view_show: [show_columns: :model_column,
|
14
|
+
show_associations: [show_association_columns: :model_column]],
|
15
|
+
app_view_form: [form_columns: :model_column,
|
16
|
+
form_associations: [form_association_columns: :model_column]],
|
17
|
+
app_view_modal: [search_result_columns: [:model_column],
|
18
|
+
search_result_attachment_fields: [:attachment_field],
|
19
|
+
search_conditions: :model_column]
|
20
|
+
).find_by(id: name.to_i)
|
21
|
+
raise "#{t('infold.no_app')}: #{name}" if @app.blank?
|
22
|
+
@app = ActiveDecorator::Decorator.instance.decorate(@app)
|
23
|
+
@dist_path = Rails.root
|
24
|
+
ns = Project.first.namespace
|
25
|
+
@ns_camel = ns.camelize
|
26
|
+
@ns_snake = ns.underscore
|
27
|
+
end
|
28
|
+
|
29
|
+
def create_controller_file
|
30
|
+
base_path = "#{@dist_path}/app/controllers/#{@ns_snake}"
|
31
|
+
controller_file_path = File.join(base_path, "#{@app.model.name_pluralize}_controller.rb")
|
32
|
+
File.delete(controller_file_path) if File.exist?(controller_file_path)
|
33
|
+
template "controller.rb", controller_file_path
|
34
|
+
end
|
35
|
+
|
36
|
+
def create_view_index_file
|
37
|
+
@view = @app.app_view_index
|
38
|
+
base_path = "#{@dist_path}/app/views/#{@ns_snake}"
|
39
|
+
|
40
|
+
view_path = File.join(base_path, "#{@app.model.name_pluralize}/index.html.haml")
|
41
|
+
File.delete(view_path) if File.exist?(view_path)
|
42
|
+
template "views/index.haml", view_path
|
43
|
+
|
44
|
+
view_path = File.join(base_path, "#{@app.model.name_pluralize}/_index_row.html.haml")
|
45
|
+
File.delete(view_path) if File.exist?(view_path)
|
46
|
+
template "views/_index_row.haml", view_path
|
47
|
+
|
48
|
+
view_path = File.join(base_path, "#{@app.model.name_pluralize}/index.csv.ruby")
|
49
|
+
File.delete(view_path) if File.exist?(view_path)
|
50
|
+
template "views/index.csv.ruby", view_path
|
51
|
+
end
|
52
|
+
|
53
|
+
def create_search_form_file
|
54
|
+
@view = @app.app_view_index
|
55
|
+
@view_modal = @app.app_view_modal
|
56
|
+
return if @view.blank? && @view_modal.blank?
|
57
|
+
base_path = "#{@dist_path}/app/forms/#{@ns_snake}"
|
58
|
+
form_file_path = File.join(base_path, "#{@app.model.name.underscore}_search_form.rb")
|
59
|
+
File.delete(form_file_path) if File.exist?(form_file_path)
|
60
|
+
template "search_form.rb", form_file_path
|
61
|
+
end
|
62
|
+
|
63
|
+
def create_view_form_file
|
64
|
+
@view = @app.app_view_form
|
65
|
+
return if @view.blank?
|
66
|
+
base_path = "#{@dist_path}/app/views/#{@ns_snake}"
|
67
|
+
%w(new edit _form).each do |v|
|
68
|
+
view_path = File.join(base_path, "#{@app.model.name_pluralize}/#{v}.html.haml")
|
69
|
+
File.delete(view_path) if File.exist?(view_path)
|
70
|
+
template "views/#{v}.haml", view_path
|
71
|
+
end
|
72
|
+
|
73
|
+
view_path = File.join(base_path, "#{@app.model.name_pluralize}/new.html+turbo_frame.haml")
|
74
|
+
File.delete(view_path) if File.exist?(view_path)
|
75
|
+
template "views/new+turbo_frame.haml", view_path
|
76
|
+
|
77
|
+
view_path = File.join(base_path, "#{@app.model.name_pluralize}/edit.html+turbo_frame.haml")
|
78
|
+
File.delete(view_path) if File.exist?(view_path)
|
79
|
+
template "views/edit+turbo_frame.haml", view_path
|
80
|
+
|
81
|
+
view_path = File.join(base_path, "#{@app.model.name_pluralize}/form.turbo_stream.haml")
|
82
|
+
File.delete(view_path) if File.exist?(view_path)
|
83
|
+
template "views/form.turbo_stream.haml", view_path
|
84
|
+
end
|
85
|
+
|
86
|
+
def create_association_view_form_file
|
87
|
+
@view = @app.app_view_form
|
88
|
+
return if @view.blank?
|
89
|
+
base_path = "#{@dist_path}/app/views/#{@ns_snake}"
|
90
|
+
@view.form_associations.select(&:display?).each do |form_association|
|
91
|
+
@form_association = form_association
|
92
|
+
view_path = File.join(base_path, "#{@app.model.name_pluralize}/_#{form_association.model_association.model.name.underscore}_fields.html.haml")
|
93
|
+
File.delete(view_path) if File.exist?(view_path)
|
94
|
+
template("views/_association_fields.haml", view_path) unless File.exist?(view_path)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def create_view_show_file
|
99
|
+
@view = @app.app_view_show
|
100
|
+
return if @view.blank?
|
101
|
+
|
102
|
+
base_path = "#{@dist_path}/app/views/#{@ns_snake}"
|
103
|
+
view_path = File.join(base_path, "#{@app.model.name_pluralize}/show.html.haml")
|
104
|
+
File.delete(view_path) if File.exist?(view_path)
|
105
|
+
template "views/show.haml", view_path
|
106
|
+
|
107
|
+
view_path = File.join(base_path, "#{@app.model.name_pluralize}/show.html+turbo_frame.haml")
|
108
|
+
File.delete(view_path) if File.exist?(view_path)
|
109
|
+
template "views/show+turbo_frame.haml", view_path
|
110
|
+
|
111
|
+
view_path = File.join(base_path, "#{@app.model.name_pluralize}/_detail.html.haml")
|
112
|
+
File.delete(view_path) if File.exist?(view_path)
|
113
|
+
template "views/_detail.haml", view_path
|
114
|
+
|
115
|
+
view_path = File.join(base_path, "#{@app.model.name_pluralize}/_detail_modal_wrapper.html.haml")
|
116
|
+
File.delete(view_path) if File.exist?(view_path)
|
117
|
+
template "views/_detail_modal_wrapper.haml", view_path
|
118
|
+
|
119
|
+
view_path = File.join(base_path, "#{@app.model.name_pluralize}/_show_operation.html.haml")
|
120
|
+
File.delete(view_path) if File.exist?(view_path)
|
121
|
+
template "views/_show_operation.haml", view_path
|
122
|
+
end
|
123
|
+
|
124
|
+
def create_view_modal_search_file
|
125
|
+
@view = @app.app_view_modal
|
126
|
+
return if @view.blank?
|
127
|
+
base_path = "#{@dist_path}/app/views/#{@ns_snake}"
|
128
|
+
view_path = File.join(base_path, "#{@app.model.name_pluralize}/index.html+turbo_frame.haml")
|
129
|
+
File.delete(view_path) if File.exist?(view_path)
|
130
|
+
template "views/index+turbo_frame.haml", view_path
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
@@ -0,0 +1,100 @@
|
|
1
|
+
<%# encoding: utf-8 -%>
|
2
|
+
module <%= @ns_camel %>
|
3
|
+
class <%= @app.model.name_pluralize.camelize %>Controller < BaseController
|
4
|
+
before_action { @page_title = '<%= @app.name %>' }
|
5
|
+
|
6
|
+
def index
|
7
|
+
@search = <%= @app.model.name %>SearchForm.new(search_params)
|
8
|
+
@<%= @app.model.name_pluralize %> = @search.perform(params[:page], limit: params[:limit], csv: request.format == :csv)
|
9
|
+
end
|
10
|
+
|
11
|
+
def show
|
12
|
+
@<%= @app.model.name.underscore %> = <%= @app.model.name %>.find(params[:id])
|
13
|
+
<%- @app.app_view_show.show_associations.select { |show_association| show_association.display? && show_association.model_association.has_kind_many? }.each do |show_association| -%>
|
14
|
+
@<%= show_association.has_name %> = @<%= @app.model.name.underscore %>.<%= show_association.has_name %>.page(params[:<%= show_association.has_name %>_page])
|
15
|
+
<%- end -%>
|
16
|
+
end
|
17
|
+
|
18
|
+
<%- if @app.app_view_form.present? -%>
|
19
|
+
def new
|
20
|
+
@<%= @app.model.name.underscore %> = <%= @app.model.name %>.new
|
21
|
+
<%- @app.app_view_form.form_associations.select{ |form_association| form_association.display? }.each do |form_association| -%>
|
22
|
+
<%- if form_association.model_association.has_kind_one? -%>
|
23
|
+
@<%= @app.model.name.underscore %>.build_<%= form_association.has_name %>
|
24
|
+
<%- else -%>
|
25
|
+
@<%= @app.model.name.underscore %>.<%= form_association.has_name %>.build
|
26
|
+
<%- end -%>
|
27
|
+
<%- end -%>
|
28
|
+
end
|
29
|
+
|
30
|
+
def create
|
31
|
+
@<%= @app.model.name.underscore %> = <%= @app.model.name %>.new
|
32
|
+
@<%= @app.model.name.underscore %>.assign_attributes(post_params)
|
33
|
+
if @<%= @app.model.name.underscore %>.save
|
34
|
+
flash.now[:notice] = t('infold.flash.created')
|
35
|
+
<%- @app.app_view_show.show_associations.select { |show_association| show_association.display? && show_association.model_association.has_kind_many? }.each do |show_association| -%>
|
36
|
+
@<%= show_association.has_name %> = @<%= @app.model.name.underscore %>.<%= show_association.has_name %>.page(1)
|
37
|
+
<%- end -%>
|
38
|
+
render :form
|
39
|
+
else
|
40
|
+
flash.now[:alert] = t('infold.flash.invalid')
|
41
|
+
<%- @app.app_view_form.form_associations.select{ |form_association| form_association.display? }.each do |form_association| -%>
|
42
|
+
<%- if form_association.model_association.has_kind_one? -%>
|
43
|
+
@<%= @app.model.name.underscore %>.build_<%= form_association.has_name %> if @<%= @app.model.name.underscore %>.<%= form_association.has_name %>.blank?
|
44
|
+
<%- else -%>
|
45
|
+
@<%= @app.model.name.underscore %>.<%= form_association.has_name %>.build if @<%= @app.model.name.underscore %>.<%= form_association.has_name %>.blank?
|
46
|
+
<%- end -%>
|
47
|
+
<%- end -%>
|
48
|
+
render :form, status: :unprocessable_entity
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def edit
|
53
|
+
@<%= @app.model.name.underscore %> = <%= @app.model.name %>.find(params[:id])
|
54
|
+
<%- @app.app_view_form.form_associations.select { |form_association| form_association.display? && form_association.model_association.has_kind_one? }.each do |form_association| -%>
|
55
|
+
@<%= @app.model.name.underscore %>.build_<%= form_association.has_name %> if @<%= @app.model.name.underscore %>.<%= form_association.has_name %>.blank?
|
56
|
+
<%- end -%>
|
57
|
+
end
|
58
|
+
|
59
|
+
def update
|
60
|
+
@<%= @app.model.name.underscore %> = <%= @app.model.name %>.find(params[:id])
|
61
|
+
@<%= @app.model.name.underscore %>.assign_attributes(post_params)
|
62
|
+
if @<%= @app.model.name.underscore %>.save
|
63
|
+
flash.now[:notice] = t('infold.flash.updated')
|
64
|
+
<%- @app.app_view_show.show_associations.select { |show_association| show_association.display? && show_association.model_association.has_kind_many? }.each do |show_association| -%>
|
65
|
+
@<%= show_association.has_name %> = @<%= @app.model.name.underscore %>.<%= show_association.has_name %>.page(1)
|
66
|
+
<%- end -%>
|
67
|
+
render :form
|
68
|
+
else
|
69
|
+
<%- @app.app_view_form.form_associations.select { |form_association| form_association.display? && form_association.model_association.has_kind_one? }.each do |form_association| -%>
|
70
|
+
@<%= @app.model.name.underscore %>.build_<%= form_association.has_name %> if @<%= @app.model.name.underscore %>.<%= form_association.has_name %>.blank?
|
71
|
+
<%- end -%>
|
72
|
+
flash.now[:alert] = t('infold.flash.invalid')
|
73
|
+
render :form, status: :unprocessable_entity
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def destroy
|
78
|
+
@<%= @app.model.name.underscore %> = <%= @app.model.name %>.find(params[:id])
|
79
|
+
if @<%= @app.model.name.underscore %>.destroy
|
80
|
+
redirect_to request.referer || <%= @app.app_view_index.index_path(@ns_snake) %>, status: :see_other, flash: { notice: t('infold.flash.destroyed') }
|
81
|
+
else
|
82
|
+
flash.now[:alert] = t('flash.invalid_destroy')
|
83
|
+
render :show, status: :unprocessable_entity
|
84
|
+
end
|
85
|
+
end
|
86
|
+
<%- end -%>
|
87
|
+
|
88
|
+
private
|
89
|
+
|
90
|
+
def search_params
|
91
|
+
<%= @app.app_view_index.code_search_permit_params -%>
|
92
|
+
end
|
93
|
+
|
94
|
+
<%- if @app.app_view_form.present? -%>
|
95
|
+
def post_params
|
96
|
+
<%= @app.app_view_form.code_post_permit_params(@ns_snake) -%>
|
97
|
+
end
|
98
|
+
<%- end -%>
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<%# encoding: utf-8 -%>
|
2
|
+
module <%= @ns_camel %>
|
3
|
+
class <%= @app.model.name %>SearchForm < SearchFormBase
|
4
|
+
|
5
|
+
<%= @view.code_set_conditions %>
|
6
|
+
<%= @view_modal&.code_only_modal_search_conditions %>
|
7
|
+
|
8
|
+
def perform(page = nil, limit: nil, csv: false)
|
9
|
+
records = <%= @app.model.name %><%= @view.code_includes_associations %>.distinct
|
10
|
+
records = apply_conditions(records,page,limit,csv)
|
11
|
+
<%- if @view.default_order_column_id.present? -%>
|
12
|
+
@sort_field ||= :<%= @view.default_order_column.name %>
|
13
|
+
@sort_kind ||= :<%= @view.default_order_kind %>
|
14
|
+
<%- end -%>
|
15
|
+
apply_sort(records, <%= @app.model.name %>.primary_key)
|
16
|
+
end
|
17
|
+
|
18
|
+
<%- @view.search_conditions.each do |c| -%>
|
19
|
+
<%- method = c.method_condition_label_name -%>
|
20
|
+
<%- if method.present? -%>
|
21
|
+
<%= method %>
|
22
|
+
<%- end -%>
|
23
|
+
<%- end -%>
|
24
|
+
<%- @view_modal&.modal_only_search_conditions&.each do |c| -%>
|
25
|
+
<%- method = c.method_condition_label_name -%>
|
26
|
+
<%- if method.present? -%>
|
27
|
+
<%= method %>
|
28
|
+
<%- end -%>
|
29
|
+
<%- end -%>
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<%# encoding: utf-8 -%>
|
2
|
+
%tr.nested-fields{ class: "#{'d-none' if form.object._destroy}", data: { new_record: form.object.new_record?.to_s } }
|
3
|
+
<%- @form_association.form_association_fields.select(&:display?).sort_by(&:seq).each do |field| -%>
|
4
|
+
%td
|
5
|
+
<%- if field.is_a?(Infold::FormAssociationColumn) -%>
|
6
|
+
.nested_<%= 'datetime_' if field.form_kind_datetime? %>form
|
7
|
+
<%= field.code_form_object(@ns_camel, nested_form: true) %>
|
8
|
+
<%- elsif field.is_a?(Infold::FormAssociationAttachmentField) -%>
|
9
|
+
.nested_form
|
10
|
+
<%= field.attachment_field.form_file_upload_code(@ns_camel, nested_form: true) %>
|
11
|
+
<%- end -%>
|
12
|
+
<%- end -%>
|
13
|
+
%td.tac.vam
|
14
|
+
= link_to "#", class: 'd-block', data: { action: "click->nested-form#remove_association" } do
|
15
|
+
%i.bi.bi-trash{ style: 'font-size: 1rem' }
|
16
|
+
= form.hidden_field :_destroy
|
@@ -0,0 +1,100 @@
|
|
1
|
+
<%# encoding: utf-8 -%>
|
2
|
+
<%- current_seq = -1 -%>
|
3
|
+
<%- @view.show_fields.select(&:display?).sort_by(&:seq).each_with_index do |field, i| -%>
|
4
|
+
<%- next if i <= current_seq -%>
|
5
|
+
<%- if field.is_a?(Infold::ShowColumn) || field.is_a?(Infold::ShowAttachmentField) -%>
|
6
|
+
<%- _first = true -%>
|
7
|
+
<%- @view.show_fields.select(&:display?).sort_by(&:seq).each_with_index do |_field, _i| -%>
|
8
|
+
<%- next if _i <= current_seq -%>
|
9
|
+
<%- break if !_field.is_a?(Infold::ShowColumn) && !_field.is_a?(Infold::ShowAttachmentField) -%>
|
10
|
+
<%- if _first -%>
|
11
|
+
.card<%= '.mt-3' if i > 0 %>
|
12
|
+
%ul.list-group.list-group-flush.list_show
|
13
|
+
<%- _first = false -%>
|
14
|
+
<%- end -%>
|
15
|
+
%li.list-group-item
|
16
|
+
.row.gx-2
|
17
|
+
.col-md-3.col-xl-2
|
18
|
+
<%- if _field.is_a?(Infold::ShowColumn) -%>
|
19
|
+
%h5 <%= _field.model_column.locale_or_name_with_foreign_key %>
|
20
|
+
<%- else -%>
|
21
|
+
%h5 <%= _field.attachment_field.locale_or_name %>
|
22
|
+
<%- end -%>
|
23
|
+
.col-md-9.col-xl-10
|
24
|
+
<%- if _field.is_a?(Infold::ShowColumn) -%>
|
25
|
+
= <%= _field.code_flash_display(@ns_snake, @app.model.name.underscore, detail: true) %>
|
26
|
+
<%- else -%>
|
27
|
+
<%= _field.attachment_field.file_display_code(@app.model.name.underscore, ' ') %>
|
28
|
+
<%- end -%>
|
29
|
+
<%- current_seq = _i -%>
|
30
|
+
<%- end -%>
|
31
|
+
<%- else -%>
|
32
|
+
<%- if field.model_association.has_kind_one? -%>
|
33
|
+
%h4.mt-3.mb-2.fw-bold <%= field.model_association.locale_or_has_name %>
|
34
|
+
- if <%= field.has_name %>.blank?
|
35
|
+
.alert= t('infold.no_data')
|
36
|
+
- else
|
37
|
+
.card
|
38
|
+
<%- field.show_association_fields.select(&:display?).sort_by(&:seq).each_with_index do |association_field, _j| -%>
|
39
|
+
<%- if _j == 0 -%>
|
40
|
+
%ul.list-group.list-group-flush.list_show
|
41
|
+
<%- end -%>
|
42
|
+
%li.list-group-item
|
43
|
+
.row.gx-2
|
44
|
+
.col-md-3.col-xl-2
|
45
|
+
<%- if association_field.is_a?(Infold::ShowAssociationColumn) -%>
|
46
|
+
%h5 <%= association_field.model_column.locale_or_name_with_foreign_key %>
|
47
|
+
<%- elsif association_field.is_a?(Infold::ShowAssociationAttachmentField) -%>
|
48
|
+
%h5 <%= association_field.attachment_field.locale_or_name %>
|
49
|
+
<%- end -%>
|
50
|
+
.col-md-9.col-xl-10
|
51
|
+
<%- if association_field.is_a?(Infold::ShowAssociationColumn) -%>
|
52
|
+
= <%= association_field.code_flash_display(@ns_snake, field.has_name.singularize, detail: true) %>
|
53
|
+
<%- elsif association_field.is_a?(Infold::ShowAssociationAttachmentField) -%>
|
54
|
+
<%= association_field.attachment_field.file_display_code(field.has_name.singularize, ' ') %>
|
55
|
+
<%- end -%>
|
56
|
+
<%- end -%>
|
57
|
+
<%- else -%>
|
58
|
+
= turbo_frame_tag "<%= @app.model.name.underscore %>_<%= field.has_name %>" do
|
59
|
+
.mt-3
|
60
|
+
%h4 <%= field.model.locale_or_name %>
|
61
|
+
- if <%= field.has_name %>.blank?
|
62
|
+
.alert= t('infold.no_data')
|
63
|
+
- else
|
64
|
+
<%- child_app = Infold::App.find_by(model: field.model_association.model) -%>
|
65
|
+
.card.mb-2
|
66
|
+
.table_wrapper.table-responsive
|
67
|
+
%table.table.table-bordered.table-hover.mb-0
|
68
|
+
%thead
|
69
|
+
%tr
|
70
|
+
<%- if child_app -%>
|
71
|
+
%th.icon_cell
|
72
|
+
<%- end -%>
|
73
|
+
<%- field.show_association_fields.select(&:display?).sort_by(&:seq).each do |association_field| -%>
|
74
|
+
<%- if association_field.is_a?(Infold::ShowAssociationColumn) -%>
|
75
|
+
%th <%= association_field.model_column.locale_or_name_with_foreign_key %>
|
76
|
+
<%- elsif association_field.is_a?(Infold::ShowAssociationAttachmentField) -%>
|
77
|
+
%th <%= association_field.attachment_field.locale_or_name %>
|
78
|
+
<%- end -%>
|
79
|
+
<%- end -%>
|
80
|
+
%tbody
|
81
|
+
- <%= field.has_name %>.each do |<%= field.has_name.singularize %>|
|
82
|
+
%tr
|
83
|
+
<%- if child_app -%>
|
84
|
+
%td.tac
|
85
|
+
= link_to <%= @ns_snake %>_<%= child_app.model.name.underscore %>_path(<%= field.has_name.singularize %>, optional_window: true), data: { turbo_frame: 'modal_optional' } do
|
86
|
+
%i.bi-file-text
|
87
|
+
<%- end -%>
|
88
|
+
<%- field.show_association_fields.select(&:display?).sort_by(&:seq).each do |association_field| -%>
|
89
|
+
%td
|
90
|
+
<%- if association_field.is_a?(Infold::ShowAssociationColumn) -%>
|
91
|
+
= <%= association_field.code_flash_display(@ns_snake, field.has_name.singularize) %>
|
92
|
+
<%- elsif association_field.is_a?(Infold::ShowAssociationAttachmentField) -%>
|
93
|
+
<%= association_field.attachment_field.file_display_code(field.has_name.singularize, ' ') %>
|
94
|
+
<%- end -%>
|
95
|
+
<%- end -%>
|
96
|
+
= paginate(<%= field.has_name %>, param_name: "<%= field.has_name %>_page", views_prefix: "<%= @ns_snake %>")
|
97
|
+
<%- current_seq = i -%>
|
98
|
+
<%- end -%>
|
99
|
+
<%- end -%>
|
100
|
+
<%- end -%>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
= modal.with :title do
|
2
|
+
= "<%= @app.name %> / ##{<%= @app.model.name.underscore %>.<%= @app.model.pk_column.name %>}"
|
3
|
+
= modal.with :body do
|
4
|
+
.modal-body
|
5
|
+
<%= @view.render_detail_code.gsub('@', '') %>
|
6
|
+
- unless <%= @ns_snake %>_optional_window?
|
7
|
+
= modal.with :footer do
|
8
|
+
.modal-footer
|
9
|
+
= render 'show_operation', <%= @app.model.name.underscore %>: <%= @app.model.name.underscore %>
|