rails_com 1.2.9 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +20 -165
- data/README.md +45 -22
- data/Rakefile +2 -1
- data/app/apis/ali_dns.rb +66 -0
- data/app/assets/images/avatar.png +0 -0
- data/app/channels/com/session_channel.rb +16 -0
- data/app/channels/rails_com/connection.rb +31 -0
- data/app/controllers/admin_controller.rb +4 -0
- data/app/controllers/application_controller.rb +7 -0
- data/app/controllers/base_controller.rb +2 -0
- data/app/controllers/board/base_controller.rb +3 -0
- data/app/controllers/board/home_controller.rb +6 -0
- data/app/controllers/board_controller.rb +3 -0
- data/app/controllers/com/audios_controller.rb +27 -0
- data/app/controllers/com/base_controller.rb +4 -0
- data/app/controllers/com/common_controller.rb +69 -0
- data/app/controllers/com/controller/admin.rb +114 -0
- data/app/controllers/com/controller/err_handler.rb +13 -0
- data/app/controllers/com/direct_uploads_controller.rb +11 -0
- data/app/controllers/com/log_controller.rb +30 -0
- data/app/controllers/com/nodes_controller.rb +22 -0
- data/app/controllers/com/panel/acme_accounts_controller.rb +12 -0
- data/app/controllers/com/panel/acme_identifiers_controller.rb +31 -0
- data/app/controllers/com/panel/acme_orders_controller.rb +64 -0
- data/app/controllers/com/panel/attachments_controller.rb +31 -0
- data/app/controllers/com/panel/base_controller.rb +5 -0
- data/app/controllers/com/panel/blob_defaults_controller.rb +13 -0
- data/app/controllers/com/panel/blobs_controller.rb +52 -0
- data/app/controllers/com/panel/cache_lists_controller.rb +5 -0
- data/app/controllers/com/panel/csps_controller.rb +18 -0
- data/app/controllers/com/panel/errs_controller.rb +18 -0
- data/app/controllers/com/panel/inbound_emails_controller.rb +15 -0
- data/app/controllers/com/panel/infos_controller.rb +9 -0
- data/app/controllers/com/panel/meta_actions_controller.rb +46 -0
- data/app/controllers/com/panel/meta_businesses_controller.rb +21 -0
- data/app/controllers/com/panel/meta_columns_controller.rb +47 -0
- data/app/controllers/com/panel/meta_controllers_controller.rb +46 -0
- data/app/controllers/com/panel/meta_models_controller.rb +32 -0
- data/app/controllers/com/panel/meta_namespaces_controller.rb +29 -0
- data/app/controllers/com/pdfs_controller.rb +37 -0
- data/app/controllers/com/videos_controller.rb +28 -0
- data/app/controllers/home_controller.rb +6 -0
- data/app/controllers/my/base_controller.rb +4 -0
- data/app/controllers/my/home_controller.rb +8 -0
- data/app/controllers/my_controller.rb +3 -0
- data/app/controllers/panel/base_controller.rb +4 -0
- data/app/controllers/panel/home_controller.rb +8 -0
- data/app/controllers/panel_controller.rb +5 -0
- data/app/controllers/rails_com/application.rb +113 -0
- data/app/helpers/rails_com/active_helper.rb +35 -39
- data/app/helpers/rails_com/form_helper.rb +21 -0
- data/app/helpers/rails_com/format_helper.rb +13 -0
- data/app/helpers/rails_com/frame_helper.rb +13 -0
- data/app/helpers/rails_com/kaminari_helper.rb +9 -0
- data/app/helpers/rails_com/time_helper.rb +23 -0
- data/app/helpers/rails_com/url_helper.rb +12 -0
- data/app/jobs/active_storage/identify_job.rb +9 -0
- data/app/jobs/application_job.rb +2 -0
- data/app/jobs/com/acme_job.rb +9 -0
- data/app/jobs/com/err_job.rb +10 -0
- data/app/mailboxes/application_mailbox.rb +2 -0
- data/app/mailers/application_mailer.rb +3 -0
- data/app/models/com/acme_account.rb +5 -0
- data/app/models/com/acme_identifier.rb +5 -0
- data/app/models/com/acme_order.rb +5 -0
- data/app/models/com/application_record.rb +5 -0
- data/app/models/com/blob_default.rb +5 -0
- data/app/models/com/cache_list.rb +5 -0
- data/app/models/com/csp.rb +5 -0
- data/app/models/com/err.rb +5 -0
- data/app/models/com/ext/debug.rb +71 -0
- data/app/models/com/ext/extra.rb +20 -0
- data/app/models/com/ext/parameter.rb +19 -0
- data/app/models/com/ext/sequence.rb +36 -0
- data/app/models/com/ext/state_machine.rb +82 -0
- data/app/models/com/ext/taxon.rb +81 -0
- data/app/models/com/ext/taxon_prepend.rb +21 -0
- data/app/models/com/info.rb +5 -0
- data/app/models/com/meta_action.rb +5 -0
- data/app/models/com/meta_business.rb +5 -0
- data/app/models/com/meta_column.rb +5 -0
- data/app/models/com/meta_controller.rb +5 -0
- data/app/models/com/meta_model.rb +5 -0
- data/app/models/com/meta_namespace.rb +5 -0
- data/app/models/com/meta_operation.rb +5 -0
- data/app/models/com/meta_route.rb +5 -0
- data/app/models/com/model/acme_account.rb +70 -0
- data/app/models/com/model/acme_identifier.rb +132 -0
- data/app/models/com/model/acme_order.rb +139 -0
- data/app/models/com/model/blob_default.rb +36 -0
- data/app/models/com/model/cache_list.rb +15 -0
- data/app/models/com/model/csp.rb +23 -0
- data/app/models/com/model/err.rb +108 -0
- data/app/models/com/model/info.rb +31 -0
- data/app/models/com/model/meta_action.rb +70 -0
- data/app/models/com/model/meta_business.rb +66 -0
- data/app/models/com/model/meta_column.rb +36 -0
- data/app/models/com/model/meta_controller.rb +115 -0
- data/app/models/com/model/meta_model.rb +58 -0
- data/app/models/com/model/meta_namespace.rb +61 -0
- data/app/models/com/model/meta_operation.rb +18 -0
- data/app/models/com/model/meta_permission.rb +10 -0
- data/app/models/com/model/meta_relation.rb +6 -0
- data/app/models/com/model/meta_route.rb +10 -0
- data/app/models/com.rb +11 -0
- data/app/models/concerns/feishu_bot.rb +15 -0
- data/app/models/concerns/log_record_bot.rb +40 -0
- data/app/models/concerns/work_wechat_bot.rb +18 -0
- data/app/stores/com/env_yaml.rb +96 -0
- data/app/stores/com/yaml.rb +89 -0
- data/app/views/admin/_breadcrumb.html.erb +5 -0
- data/app/views/application/_actionsheet.html.erb +20 -0
- data/app/views/application/_alert.html+phone.erb +6 -0
- data/app/views/application/_alert.html.erb +9 -0
- data/app/views/application/_auth_navbar.html.erb +18 -0
- data/app/views/application/_breadcrumb.html.erb +0 -0
- data/app/views/application/_button.html+phone.erb +3 -0
- data/app/views/application/_button.html.erb +3 -0
- data/app/views/application/_edit_form.html+phone.erb +10 -0
- data/app/views/application/_edit_form.html.erb +4 -0
- data/app/views/application/_error_messages.html.erb +11 -0
- data/app/views/application/_filter_form.html+phone.erb +14 -0
- data/app/views/application/_filter_form.html.erb +9 -0
- data/app/views/application/_filter_table.html.erb +0 -0
- data/app/views/application/_footer.html.erb +8 -0
- data/app/views/application/_form.html.erb +4 -0
- data/app/views/application/_index_sortable_table.html.erb +22 -0
- data/app/views/application/_index_table.html+phone.erb +13 -0
- data/app/views/application/_index_table.html.erb +22 -0
- data/app/views/application/_index_tbody.html.erb +3 -0
- data/app/views/application/_index_thead.html.erb +4 -0
- data/app/views/application/_index_tr.html+phone.erb +4 -0
- data/app/views/application/_index_tr.html.erb +16 -0
- data/app/views/application/_index_tree_table.html.erb +18 -0
- data/app/views/application/_locales.html.erb +11 -0
- data/app/views/application/_modal.html+phone.erb +14 -0
- data/app/views/application/_modal.html.erb +14 -0
- data/app/views/application/_nav.html.erb +0 -0
- data/app/views/application/_nav_bar.html+phone.erb +0 -0
- data/app/views/application/_nav_bar.html.erb +25 -0
- data/app/views/application/_nav_brand.html.erb +3 -0
- data/app/views/application/_nav_with_login.html.erb +0 -0
- data/app/views/application/_nav_without_login.html.erb +0 -0
- data/app/views/application/_new_form.html+phone.erb +10 -0
- data/app/views/application/_new_form.html.erb +4 -0
- data/app/views/application/_pagination.json.jbuilder +7 -0
- data/app/views/application/_show.html+phone.erb +20 -0
- data/app/views/application/_show.html.erb +13 -0
- data/app/views/application/_show_table.html.erb +0 -0
- data/app/views/application/_tab_bar.html.erb +3 -0
- data/app/views/application/_tab_bar_item.erb +4 -0
- data/app/views/application/alert.turbo_stream.erb +1 -0
- data/app/views/application/controller_not_found.json.jbuilder +4 -0
- data/app/views/application/create.json.jbuilder +1 -0
- data/app/views/application/create.turbo_stream.erb +3 -0
- data/app/views/application/destroy.json.jbuilder +0 -0
- data/app/views/application/destroy.turbo_stream.erb +3 -0
- data/app/views/application/edit.html.erb +7 -0
- data/app/views/application/edit.json.jbuilder +2 -0
- data/app/views/{shared/_error_messages.html.erb → application/err.turbo_stream.erb} +4 -4
- data/app/views/application/index.html.erb +5 -0
- data/app/views/application/index.json.jbuilder +1 -0
- data/app/views/application/move_higher.turbo_stream.erb +3 -0
- data/app/views/application/move_lower.turbo_stream.erb +3 -0
- data/app/views/application/new.html.erb +7 -0
- data/app/views/application/new.json.jbuilder +2 -0
- data/app/views/application/show.html.erb +3 -0
- data/app/views/application/show.json.jbuilder +1 -0
- data/app/views/application/update.json.jbuilder +1 -0
- data/app/views/application/update.turbo_stream.erb +3 -0
- data/app/views/board/home/index.html.erb +0 -0
- data/app/views/com/attachments/_file_upload.html.erb +19 -0
- data/app/views/com/attachments/_image_preview.html.erb +9 -0
- data/app/views/com/attachments/_list.html.erb +31 -0
- data/app/views/com/attachments/_list_edit.html.erb +28 -0
- data/app/views/com/attachments/_list_field.html.erb +6 -0
- data/app/views/com/attachments/_list_many.html.erb +17 -0
- data/app/views/com/attachments/_video_item.html.erb +6 -0
- data/app/views/com/audios/show.html.erb +3 -0
- data/app/views/com/common/deploy.html.erb +0 -0
- data/app/views/com/common/info.json.jbuilder +1 -0
- data/app/views/com/extra/_extra_form.html.erb +5 -0
- data/app/views/com/extra/_item.html.erb +15 -0
- data/app/views/com/nodes/_children_options.html.erb +4 -0
- data/app/views/com/nodes/_children_select.html.erb +15 -0
- data/app/views/com/nodes/_outer_children_options.html.erb +4 -0
- data/app/views/com/nodes/_outer_options.html+phone.erb +2 -0
- data/app/views/com/nodes/_outer_options.html.erb +4 -0
- data/app/views/com/nodes/_outer_select.html.erb +12 -0
- data/app/views/com/nodes/_self_and_siblings_options.html.erb +4 -0
- data/app/views/com/nodes/_siblings_options.html.erb +4 -0
- data/app/views/com/nodes/_siblings_select.html.erb +14 -0
- data/app/views/com/nodes/children.turbo_stream.erb +3 -0
- data/app/views/com/nodes/outer.turbo_stream.erb +3 -0
- data/app/views/com/panel/acme_accounts/_filter_form.html.erb +9 -0
- data/app/views/com/panel/acme_accounts/_index_tbody.html.erb +7 -0
- data/app/views/com/panel/acme_accounts/_index_thead.html.erb +4 -0
- data/app/views/com/panel/acme_accounts/_index_tr.html.erb +16 -0
- data/app/views/com/panel/acme_identifiers/_breadcrumb.html.erb +7 -0
- data/app/views/com/panel/acme_identifiers/_button.html.erb +0 -0
- data/app/views/com/panel/acme_identifiers/_filter_form.html.erb +9 -0
- data/app/views/com/panel/acme_identifiers/_form.html.erb +2 -0
- data/app/views/com/panel/acme_identifiers/_index_tbody.html.erb +16 -0
- data/app/views/com/panel/acme_identifiers/_index_thead.html.erb +17 -0
- data/app/views/com/panel/acme_identifiers/_show_table.html.erb +24 -0
- data/app/views/com/panel/acme_identifiers/index.html.erb +3 -0
- data/app/views/com/panel/acme_orders/_breadcrumb.html.erb +6 -0
- data/app/views/com/panel/acme_orders/_filter_form.html.erb +9 -0
- data/app/views/com/panel/acme_orders/_form.html.erb +4 -0
- data/app/views/com/panel/acme_orders/_index_tbody.html.erb +11 -0
- data/app/views/com/panel/acme_orders/_index_thead.html.erb +8 -0
- data/app/views/com/panel/acme_orders/_index_tr.html.erb +25 -0
- data/app/views/com/panel/acme_orders/_item_form.html.erb +14 -0
- data/app/views/com/panel/acme_orders/_new_form.html.erb +7 -0
- data/app/views/com/panel/acme_orders/_show_table.html.erb +4 -0
- data/app/views/com/panel/attachments/_breadcrumb.html.erb +10 -0
- data/app/views/com/panel/attachments/_button.html.erb +0 -0
- data/app/views/com/panel/attachments/_filter_form.html.erb +13 -0
- data/app/views/com/panel/attachments/_index_tbody.html.erb +6 -0
- data/app/views/com/panel/attachments/_index_thead.html.erb +7 -0
- data/app/views/com/panel/attachments/_index_tr.html.erb +10 -0
- data/app/views/com/panel/attachments/index.html.erb +5 -0
- data/app/views/com/panel/base/_index_meta_action.html.erb +14 -0
- data/app/views/com/panel/base/_nav.html.erb +3 -0
- data/app/views/com/panel/blob_defaults/_add_form.html.erb +7 -0
- data/app/views/com/panel/blob_defaults/_filter_form.html.erb +10 -0
- data/app/views/com/panel/blob_defaults/_form.html.erb +4 -0
- data/app/views/com/panel/blob_defaults/_index_tbody.html.erb +7 -0
- data/app/views/com/panel/blob_defaults/_index_thead.html.erb +5 -0
- data/app/views/com/panel/blob_defaults/_index_tr.html.erb +13 -0
- data/app/views/com/panel/blob_defaults/add.turbo_stream.erb +1 -0
- data/app/views/com/panel/blobs/_breadcrumb.html.erb +6 -0
- data/app/views/com/panel/blobs/_filter_form.html.erb +13 -0
- data/app/views/com/panel/blobs/_index_tbody.html.erb +22 -0
- data/app/views/com/panel/blobs/_index_thead.html.erb +12 -0
- data/app/views/com/panel/blobs/_index_tr.html.erb +13 -0
- data/app/views/com/panel/blobs/_new_form.html.erb +5 -0
- data/app/views/com/panel/blobs/index.html.erb +5 -0
- data/app/views/com/panel/cache_lists/_index_tbody.html.erb +4 -0
- data/app/views/com/panel/cache_lists/_index_thead.html.erb +5 -0
- data/app/views/com/panel/cache_lists/_show_table.html.erb +8 -0
- data/app/views/com/panel/csps/_button.html.erb +0 -0
- data/app/views/com/panel/csps/_filter_form.html.erb +8 -0
- data/app/views/com/panel/csps/_index_tbody.html.erb +11 -0
- data/app/views/com/panel/csps/_index_thead.html.erb +12 -0
- data/app/views/com/panel/csps/_index_tr.html.erb +13 -0
- data/app/views/com/panel/csps/_show/_breadcrumb.html.erb +6 -0
- data/app/views/com/panel/csps/_show_table.html.erb +48 -0
- data/app/views/com/panel/csps/show.html.erb +7 -0
- data/app/views/com/panel/errs/_button.html.erb +0 -0
- data/app/views/com/panel/errs/_filter_form.html.erb +11 -0
- data/app/views/com/panel/errs/_index_tbody.html.erb +16 -0
- data/app/views/com/panel/errs/_index_thead.html.erb +11 -0
- data/app/views/com/panel/errs/_index_tr.html.erb +13 -0
- data/app/views/com/panel/errs/_show/_breadcrumb.html.erb +6 -0
- data/app/views/com/panel/errs/_show_table.html.erb +44 -0
- data/app/views/com/panel/errs/show.html.erb +7 -0
- data/app/views/com/panel/inbound_emails/_button.html.erb +0 -0
- data/app/views/com/panel/inbound_emails/_filter_form.html.erb +9 -0
- data/app/views/com/panel/inbound_emails/_index_tbody.html.erb +5 -0
- data/app/views/com/panel/inbound_emails/_index_thead.html.erb +6 -0
- data/app/views/com/panel/inbound_emails/_show_table.html.erb +10 -0
- data/app/views/com/panel/inbound_emails/index.html.erb +5 -0
- data/app/views/com/panel/infos/_filter_form.html.erb +9 -0
- data/app/views/com/panel/infos/_index_tbody.html.erb +4 -0
- data/app/views/com/panel/infos/_index_thead.html.erb +5 -0
- data/app/views/com/panel/infos/index.json.jbuilder +1 -0
- data/app/views/com/panel/meta_actions/_breadcrumb.html.erb +6 -0
- data/app/views/com/panel/meta_actions/_form.html.erb +1 -0
- data/app/views/com/panel/meta_actions/_index_tbody.html.erb +4 -0
- data/app/views/com/panel/meta_actions/_index_thead.html.erb +5 -0
- data/app/views/com/panel/meta_actions/_roles.html.erb +9 -0
- data/app/views/com/panel/meta_actions/index.html.erb +3 -0
- data/app/views/com/panel/meta_actions/roles.js.erb +6 -0
- data/app/views/com/panel/meta_actions/update.turbo_stream.erb +1 -0
- data/app/views/com/panel/meta_businesses/_breadcrumb.html.erb +10 -0
- data/app/views/com/panel/meta_businesses/_button.html.erb +3 -0
- data/app/views/com/panel/meta_businesses/_form.html.erb +3 -0
- data/app/views/com/panel/meta_businesses/_index_tbody.html.erb +12 -0
- data/app/views/com/panel/meta_businesses/_index_thead.html.erb +2 -0
- data/app/views/com/panel/meta_businesses/_index_tr.html.erb +16 -0
- data/app/views/com/panel/meta_businesses/_show_table.html.erb +8 -0
- data/app/views/com/panel/meta_businesses/sync.turbo_stream.erb +3 -0
- data/app/views/com/panel/meta_columns/_breadcrumb.html.erb +6 -0
- data/app/views/com/panel/meta_columns/_form.html.erb +6 -0
- data/app/views/com/panel/meta_columns/_index_tbody.html.erb +20 -0
- data/app/views/com/panel/meta_columns/_index_thead.html.erb +12 -0
- data/app/views/com/panel/meta_columns/_index_tr.html.erb +22 -0
- data/app/views/com/panel/meta_columns/_show_table.html.erb +20 -0
- data/app/views/com/panel/meta_columns/sync.turbo_stream.erb +3 -0
- data/app/views/com/panel/meta_columns/test.turbo_stream.erb +3 -0
- data/app/views/com/panel/meta_controllers/_button.html.erb +3 -0
- data/app/views/com/panel/meta_controllers/_filter_form.html.erb +8 -0
- data/app/views/com/panel/meta_controllers/_filter_tablex.html.erb +8 -0
- data/app/views/com/panel/meta_controllers/_form.html.erb +2 -0
- data/app/views/com/panel/meta_controllers/_index_meta_business.html.erb +10 -0
- data/app/views/com/panel/meta_controllers/_index_meta_controller.html.erb +15 -0
- data/app/views/com/panel/meta_controllers/_index_meta_namespace.html.erb +12 -0
- data/app/views/com/panel/meta_controllers/_index_tbody.html.erb +28 -0
- data/app/views/com/panel/meta_controllers/_index_thead.html.erb +2 -0
- data/app/views/com/panel/meta_controllers/index.html.erb +3 -0
- data/app/views/com/panel/meta_controllers/meta_actions.turbo_stream.erb +1 -0
- data/app/views/com/panel/meta_controllers/meta_controllers.turbo_stream.erb +1 -0
- data/app/views/com/panel/meta_controllers/meta_namespaces.turbo_stream.erb +1 -0
- data/app/views/com/panel/meta_controllers/sync.turbo_stream.erb +3 -0
- data/app/views/com/panel/meta_models/_button.html.erb +6 -0
- data/app/views/com/panel/meta_models/_form.html.erb +4 -0
- data/app/views/com/panel/meta_models/_index_tbody.html.erb +3 -0
- data/app/views/com/panel/meta_models/_index_thead.html.erb +4 -0
- data/app/views/com/panel/meta_models/_index_tr.html.erb +19 -0
- data/app/views/com/panel/meta_models/_show_table.html.erb +12 -0
- data/app/views/com/panel/meta_models/sync.turbo_stream.erb +3 -0
- data/app/views/com/panel/meta_namespaces/_breadcrumb.html.erb +10 -0
- data/app/views/com/panel/meta_namespaces/_button.html.erb +3 -0
- data/app/views/com/panel/meta_namespaces/_form.html.erb +5 -0
- data/app/views/com/panel/meta_namespaces/_index_tbody.html.erb +20 -0
- data/app/views/com/panel/meta_namespaces/_index_thead.html.erb +6 -0
- data/app/views/com/panel/meta_namespaces/_show_table.html.erb +20 -0
- data/app/views/com/panel/meta_namespaces/sync.turbo_stream.erb +3 -0
- data/app/views/com/videos/show.html.erb +9 -0
- data/app/{assets/javascripts/controllers/active_storage_ext/videos/show.ready.js → views/com/videos/show.js} +0 -0
- data/app/views/default_form/_date_field.html.erb +1 -0
- data/app/views/default_form/_datetime_field.html.erb +1 -0
- data/app/views/default_form/_number_field.html.erb +1 -0
- data/app/views/default_form/_outer_select.html.erb +14 -0
- data/app/views/default_form/_select_enum.html.erb +1 -0
- data/app/views/default_form/_text_field.html.erb +1 -0
- data/app/views/default_form/_time_field.html.erb +1 -0
- data/app/views/extra_form/_number_field.html.erb +1 -0
- data/app/views/extra_form/_outer_select.html.erb +14 -0
- data/app/views/extra_form/_text_field.html.erb +1 -0
- data/app/views/home/index.html.erb +0 -0
- data/app/views/kaminari/com/_first_page.html.erb +3 -0
- data/app/views/kaminari/{_gap.html.erb → com/_gap.html.erb} +1 -1
- data/app/views/kaminari/com/_last_page.html.erb +3 -0
- data/app/views/kaminari/com/_next_page.html.erb +3 -0
- data/app/views/kaminari/com/_page.html.erb +1 -0
- data/app/views/kaminari/{_paginator.html.erb → com/_paginator.html+phone.erb} +3 -3
- data/app/views/kaminari/com/_paginator.html.erb +17 -0
- data/app/views/kaminari/com/_prev_page.html.erb +3 -0
- data/app/views/layouts/_admin_head.html.erb +22 -0
- data/app/views/layouts/_application_head.html.erb +26 -0
- data/app/views/layouts/_phone_head.html.erb +28 -0
- data/app/views/layouts/admin.html.erb +12 -0
- data/app/views/layouts/application.html+phone.erb +12 -0
- data/app/views/layouts/application.html.erb +11 -0
- data/app/views/layouts/application.json.jbuilder +2 -0
- data/app/views/layouts/board.html+phone.erb +10 -0
- data/app/views/layouts/board.html.erb +12 -0
- data/app/views/layouts/mailer.html.erb +14 -0
- data/app/views/layouts/mailer.text.erb +1 -0
- data/app/views/layouts/my.html+phone.erb +11 -0
- data/app/views/layouts/my.html.erb +13 -0
- data/app/views/layouts/panel.html.erb +12 -0
- data/app/views/my/home/index.html.erb +0 -0
- data/app/views/panel/_breadcrumb.html.erb +0 -0
- data/app/views/panel/_com_nav.html.erb +19 -0
- data/app/views/panel/_nav.html.erb +6 -0
- data/app/views/panel/_nav_without_login.html.erb +3 -0
- data/app/views/panel/destroy.turbo_stream.erb +1 -0
- data/app/views/panel/home/index.html.erb +0 -0
- data/config/default_form.yml +74 -0
- data/config/locales/en.controller.yml +46 -0
- data/config/locales/en.yml +2 -2
- data/config/locales/zh.attributes.yml +9 -0
- data/config/locales/zh.controller.yml +65 -0
- data/config/locales/zh.enum.yml +11 -0
- data/config/locales/zh.helper.yml +10 -0
- data/config/locales/zh.rb +34 -0
- data/config/locales/zh.yml +66 -10
- data/config/routes.rb +140 -8
- data/lib/active_storage/service/disc_service.rb +41 -0
- data/lib/default_form/active_record/extend.rb +38 -0
- data/lib/default_form/builder/default.rb +88 -0
- data/lib/default_form/builder/helper.rb +212 -0
- data/lib/default_form/builder/wrap.rb +58 -0
- data/lib/default_form/config.rb +50 -0
- data/lib/default_form/controller_helper.rb +14 -0
- data/lib/default_form/form_builder.rb +61 -0
- data/lib/default_form/override/action_view/helpers/tags/collection_check_boxes.rb +23 -0
- data/lib/default_form/override/action_view/helpers/tags/collection_radio_buttons.rb +23 -0
- data/lib/default_form/view_helper.rb +39 -0
- data/lib/generators/jbuilder_generator.rb +22 -0
- data/lib/generators/scaffold_generator.rb +27 -0
- data/lib/generators/templates/jbuilder/_show.json.jbuilder.tt +1 -0
- data/lib/generators/templates/jbuilder/index.json.jbuilder.tt +1 -0
- data/lib/generators/templates/jbuilder/partial.json.jbuilder.tt +17 -0
- data/lib/generators/templates/scaffold_erb/_edit_form.html.erb.tt +4 -0
- data/lib/generators/templates/scaffold_erb/_filter_form.html.erb.tt +9 -0
- data/lib/generators/templates/scaffold_erb/_form.html.erb.tt +4 -0
- data/lib/generators/templates/scaffold_erb/_index_tbody.html.erb.tt +3 -0
- data/lib/generators/templates/scaffold_erb/_index_thead.html.erb.tt +4 -0
- data/lib/generators/templates/scaffold_erb/_new_form.html.erb.tt +4 -0
- data/lib/generators/templates/scaffold_erb/_show_table.html.erb.tt +6 -0
- data/lib/generators/templates/scaffold_erb/index.html.erb.tt +5 -0
- data/lib/rails_com/action_controller/errors.rb +9 -2
- data/lib/rails_com/action_controller/extend.rb +20 -0
- data/lib/rails_com/action_controller/include.rb +31 -0
- data/lib/rails_com/action_controller/parameters.rb +3 -0
- data/lib/rails_com/action_controller/public_exceptions.rb +31 -0
- data/lib/rails_com/action_controller/subscriber.rb +32 -0
- data/lib/rails_com/action_controller.rb +9 -3
- data/lib/rails_com/action_mailbox/inbound_email.rb +23 -0
- data/lib/rails_com/action_mailbox/mail_ext.rb +34 -0
- data/lib/rails_com/action_mailbox.rb +4 -0
- data/lib/rails_com/action_text/rich_text.rb +16 -0
- data/lib/rails_com/action_text.rb +3 -0
- data/lib/rails_com/action_view/partial_renderer.rb +22 -0
- data/lib/rails_com/action_view/template_renderer.rb +27 -28
- data/lib/rails_com/action_view/translation_helper.rb +7 -4
- data/lib/rails_com/action_view.rb +5 -2
- data/lib/rails_com/active_storage/activestorage_attached.rb +7 -4
- data/lib/rails_com/active_storage/attached_macros.rb +17 -5
- data/lib/rails_com/active_storage/attachment_prepend.rb +14 -0
- data/lib/rails_com/active_storage/attachment_transfer.rb +12 -5
- data/lib/rails_com/active_storage/video_response.rb +5 -1
- data/lib/rails_com/active_storage.rb +9 -4
- data/lib/rails_com/all.rb +23 -0
- data/lib/rails_com/api.rb +24 -0
- data/lib/rails_com/config.rb +22 -14
- data/lib/rails_com/engine.rb +41 -25
- data/lib/rails_com/utils/hex_helper.rb +12 -0
- data/lib/rails_com/utils/jobber.rb +3 -1
- data/lib/rails_com/utils/num_helper.rb +7 -5
- data/lib/rails_com/utils/qrcode_helper.rb +35 -0
- data/lib/rails_com/utils/setting.rb +5 -5
- data/lib/rails_com/utils/time_helper.rb +2 -0
- data/lib/rails_com/utils/uid_helper.rb +18 -15
- data/lib/rails_com.rb +25 -17
- data/lib/templates/rails/scaffold_controller/api_controller.rb.tt +20 -19
- data/lib/templates/rails/scaffold_controller/controller.rb.tt +1 -52
- data/lib/templates/test_unit/scaffold/functional_test.rb.tt +64 -0
- metadata +511 -120
- data/app/assets/config/rails_com_manifest.js +0 -6
- data/app/assets/images/image-square.png +0 -0
- data/app/assets/images/verification.jpg +0 -0
- data/app/assets/javascripts/rails_com/application.js +0 -29
- data/app/assets/javascripts/rails_com/attachment.js +0 -421
- data/app/assets/javascripts/rails_com/checkbox.js +0 -59
- data/app/assets/javascripts/rails_com/fetch_xhr_script.js +0 -31
- data/app/assets/javascripts/rails_com/footer.js +0 -9
- data/app/assets/javascripts/rails_com/picture.js +0 -18
- data/app/assets/javascripts/rails_com/sidebar.js +0 -40
- data/app/assets/javascripts/rails_com/time_local.js +0 -9
- data/app/assets/stylesheets/controllers/active_storage_ext/videos/show.css +0 -7
- data/app/assets/stylesheets/controllers/active_storage_ext/videos/transfer.css +0 -4
- data/app/assets/stylesheets/rails_com/application.css +0 -3
- data/app/controllers/active_storage_ext/admin/attachments_controller.rb +0 -13
- data/app/controllers/active_storage_ext/admin/base_controller.rb +0 -4
- data/app/controllers/active_storage_ext/admin/blob_defaults_controller.rb +0 -55
- data/app/controllers/active_storage_ext/admin/blobs_controller.rb +0 -48
- data/app/controllers/active_storage_ext/audios_controller.rb +0 -24
- data/app/controllers/active_storage_ext/videos_controller.rb +0 -25
- data/app/controllers/concerns/rails_common_api.rb +0 -60
- data/app/controllers/concerns/rails_common_controller.rb +0 -46
- data/app/controllers/concerns/rails_common_xhr.rb +0 -15
- data/app/helpers/rails_com/assets_helper.rb +0 -109
- data/app/models/active_storage/blob_default.rb +0 -24
- data/app/models/concerns/state_machine.rb +0 -79
- data/app/views/active_storage_ext/admin/attachments/destroy.js.erb +0 -1
- data/app/views/active_storage_ext/admin/blob_defaults/_form.html.erb +0 -8
- data/app/views/active_storage_ext/admin/blob_defaults/_search_form.html.erb +0 -7
- data/app/views/active_storage_ext/admin/blob_defaults/edit.html.erb +0 -9
- data/app/views/active_storage_ext/admin/blob_defaults/index.html.erb +0 -49
- data/app/views/active_storage_ext/admin/blob_defaults/new.html.erb +0 -9
- data/app/views/active_storage_ext/admin/blob_defaults/show.html.erb +0 -10
- data/app/views/active_storage_ext/admin/blobs/_search_form.html.erb +0 -9
- data/app/views/active_storage_ext/admin/blobs/destroy.js.erb +0 -1
- data/app/views/active_storage_ext/admin/blobs/index.html.erb +0 -51
- data/app/views/active_storage_ext/admin/blobs/new.html.erb +0 -13
- data/app/views/active_storage_ext/admin/blobs/show.html.erb +0 -10
- data/app/views/active_storage_ext/attachments/_default_image_item.html.erb +0 -14
- data/app/views/active_storage_ext/attachments/_image_item.html.erb +0 -6
- data/app/views/active_storage_ext/attachments/_list.html.erb +0 -25
- data/app/views/active_storage_ext/attachments/_list_edit.html.erb +0 -27
- data/app/views/active_storage_ext/attachments/_list_field.html.erb +0 -6
- data/app/views/active_storage_ext/attachments/_video_item.html.erb +0 -6
- data/app/views/active_storage_ext/audios/show.html.erb +0 -5
- data/app/views/active_storage_ext/videos/show.html.erb +0 -6
- data/app/views/kaminari/_first_page.html.erb +0 -3
- data/app/views/kaminari/_last_page.html.erb +0 -3
- data/app/views/kaminari/_next_page.html.erb +0 -3
- data/app/views/kaminari/_page.html.erb +0 -1
- data/app/views/kaminari/_prev_page.html.erb +0 -3
- data/app/views/layouts/rails_com/application.html.erb +0 -17
- data/app/views/shared/_alert.html.erb +0 -8
- data/app/views/shared/_locales.html.erb +0 -8
- data/config/locales/zh.datetime.yml +0 -44
- data/db/migrate/20181012025833_rails_com_init.rb +0 -14
- data/lib/active_record/type/i18n.rb +0 -19
- data/lib/generators/doc_model_generator.rb +0 -37
- data/lib/generators/doc_models_generator.rb +0 -11
- data/lib/generators/templates/model.erb +0 -6
- data/lib/mina/git2.rb +0 -59
- data/lib/mina/puma.rb +0 -64
- data/lib/mina/sidekiq.rb +0 -67
- data/lib/mina/whenever.rb +0 -27
- data/lib/rails_com/action_controller/controller_helper.rb +0 -29
- data/lib/rails_com/active_record/model_helper.rb +0 -107
- data/lib/rails_com/active_record/persistence_sneakily.rb +0 -11
- data/lib/rails_com/active_record/translation.rb +0 -66
- data/lib/rails_com/active_record.rb +0 -3
- data/lib/rails_com/active_storage/blob_ext.rb +0 -34
- data/lib/rails_com/core/array.rb +0 -72
- data/lib/rails_com/core/date.rb +0 -25
- data/lib/rails_com/core/hash.rb +0 -38
- data/lib/rails_com/core/nil.rb +0 -7
- data/lib/rails_com/core/numeric.rb +0 -11
- data/lib/rails_com/core/string.rb +0 -15
- data/lib/rails_com/core.rb +0 -7
- data/lib/rails_com/generators/named_base.rb +0 -10
- data/lib/rails_com/generators/scaffold_generator.rb +0 -15
- data/lib/rails_com/meta/controllers.rb +0 -8
- data/lib/rails_com/meta/models.rb +0 -21
- data/lib/rails_com/meta/routes.rb +0 -53
- data/lib/rails_com/sprockets/non_digest_assets.rb +0 -16
- data/lib/rails_com/utils/babel.rb +0 -38
- data/lib/rails_com/version.rb +0 -3
- data/lib/tasks/rails_com_tasks.rake +0 -4
- data/lib/templates/erb/scaffold/_filter.html.erb.tt +0 -10
- data/lib/templates/erb/scaffold/_form.html.erb.tt +0 -12
- data/lib/templates/erb/scaffold/edit.html.erb.tt +0 -9
- data/lib/templates/erb/scaffold/index.html.erb.tt +0 -45
- data/lib/templates/erb/scaffold/new.html.erb.tt +0 -9
- data/lib/templates/erb/scaffold/show.html.erb.tt +0 -16
@@ -1,107 +0,0 @@
|
|
1
|
-
module RailsCom::ModelHelper
|
2
|
-
|
3
|
-
def to_factory_bot
|
4
|
-
require 'rails/generators'
|
5
|
-
require 'generators/factory_bot/model/model_generator'
|
6
|
-
|
7
|
-
args = [
|
8
|
-
self.name.underscore
|
9
|
-
]
|
10
|
-
cols = columns.map { |col| "#{col.name}:#{col.type}" }
|
11
|
-
|
12
|
-
generator = FactoryBot::Generators::ModelGenerator.new(args + cols, destination_root: Rails.root)
|
13
|
-
generator.invoke_all
|
14
|
-
end
|
15
|
-
|
16
|
-
def column_attributes
|
17
|
-
columns.map do |column|
|
18
|
-
{
|
19
|
-
name: column.name.to_sym,
|
20
|
-
name_i18n: human_attribute_name(column.name),
|
21
|
-
type: column.type,
|
22
|
-
sql_type: column.sql_type,
|
23
|
-
null: column.null,
|
24
|
-
default: column.default,
|
25
|
-
default_function: column.default_function,
|
26
|
-
comment: column.comment
|
27
|
-
}
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def print_table(with_column: false)
|
32
|
-
columns.each do |column|
|
33
|
-
info = with_column ? '# t.column' : '# '
|
34
|
-
info << " :#{column.name.to_sym}, :#{column.type}"
|
35
|
-
info << ", precision: #{column.precision}" if column.precision
|
36
|
-
info << ", scale: #{column.scale}" if column.scale
|
37
|
-
info << ", limit: #{column.limit}" if column.limit
|
38
|
-
if column.default && column.type == :string
|
39
|
-
info << ", default: '#{column.default}'"
|
40
|
-
elsif column.default
|
41
|
-
info << ", default: #{column.default}"
|
42
|
-
end
|
43
|
-
info << ", null: false" unless column.null
|
44
|
-
info << ", comment: '#{column.comment} type: #{column.sql_type}'" if column.comment
|
45
|
-
puts info
|
46
|
-
end
|
47
|
-
|
48
|
-
nil
|
49
|
-
end
|
50
|
-
|
51
|
-
def sql_table(except: [], only: [], pure: true)
|
52
|
-
if only.size > 0
|
53
|
-
_columns = columns.select { |column| only.include?(column.name) }
|
54
|
-
else
|
55
|
-
_columns = columns.reject { |column| except.include?(column.name) }
|
56
|
-
end
|
57
|
-
|
58
|
-
if pure
|
59
|
-
sql = ""
|
60
|
-
else
|
61
|
-
sql = "CREATE TABLE `#{self.table_name}` (\n"
|
62
|
-
end
|
63
|
-
|
64
|
-
_columns.each do |column|
|
65
|
-
sql << " `#{column.name}` #{column.sql_type}"
|
66
|
-
sql << " COLLATE #{column.collation}" if column.collation
|
67
|
-
sql << " NOT NULL" unless column.null
|
68
|
-
if column.default
|
69
|
-
sql << " DEFAULT '#{column.default}',\n"
|
70
|
-
elsif column.default.nil? && column.null
|
71
|
-
sql << " DEFAULT NULL,\n"
|
72
|
-
else
|
73
|
-
sql << ",\n"
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
sql << " PRIMARY KEY (`#{self.primary_key}`)"
|
78
|
-
|
79
|
-
_indexes = connection.indexes(self.table_name).reject { |index| (index.columns & _columns.map { |col| col.name }).blank? }
|
80
|
-
if _indexes.present?
|
81
|
-
sql << ",\n"
|
82
|
-
else
|
83
|
-
sql << "\n"
|
84
|
-
end
|
85
|
-
_indexes.each_with_index do |obj, index|
|
86
|
-
sql << " KEY `#{obj.name}` ("
|
87
|
-
sql << obj.columns.map { |col| "`#{col}`" }.join(',')
|
88
|
-
|
89
|
-
if index + 1 == _indexes.size
|
90
|
-
sql << ")\n"
|
91
|
-
else
|
92
|
-
sql << "),\n"
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
if pure
|
97
|
-
sql
|
98
|
-
else
|
99
|
-
sql << ")"
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
end
|
104
|
-
|
105
|
-
ActiveSupport.on_load :active_record do
|
106
|
-
extend RailsCom::ModelHelper
|
107
|
-
end
|
@@ -1,66 +0,0 @@
|
|
1
|
-
module RailsCom::I18n
|
2
|
-
extend ActiveSupport::Concern
|
3
|
-
|
4
|
-
included do
|
5
|
-
before_update :update_i18n_column
|
6
|
-
end
|
7
|
-
|
8
|
-
def update_i18n_column
|
9
|
-
str = []
|
10
|
-
self.changes.slice(*i18n_attributes).each do |key, _|
|
11
|
-
value = self.public_send("#{key}_before_type_cast")
|
12
|
-
str << "#{key} = #{key}::jsonb || '#{value.to_json}'::jsonb"
|
13
|
-
end
|
14
|
-
return if str.blank?
|
15
|
-
s = str.join(', ')
|
16
|
-
self.class.connection.execute "UPDATE #{self.class.table_name} SET #{s} WHERE id = #{self.id}"
|
17
|
-
end
|
18
|
-
|
19
|
-
def attributes_with_values_for_create(attribute_names)
|
20
|
-
r = super
|
21
|
-
r.slice(*i18n_attributes).each do |key, v|
|
22
|
-
r[key] = public_send "#{key}_before_type_cast"
|
23
|
-
end
|
24
|
-
r
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
module RailsCom::Translation
|
30
|
-
|
31
|
-
# name
|
32
|
-
# * store as jsonb in database;
|
33
|
-
# * read with i18n scope
|
34
|
-
def has_translations(*columns)
|
35
|
-
mattr_accessor :i18n_attributes
|
36
|
-
self.i18n_attributes = columns.map(&:to_s)
|
37
|
-
include RailsCom::I18n
|
38
|
-
columns.each do |column|
|
39
|
-
attribute column, :i18n
|
40
|
-
|
41
|
-
class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
|
42
|
-
|
43
|
-
def #{column}=(value)
|
44
|
-
if value.is_a?(String)
|
45
|
-
super(::I18n.locale.to_s => value)
|
46
|
-
else
|
47
|
-
super
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
RUBY_EVAL
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
55
|
-
|
56
|
-
def _update_record(values, constraints)
|
57
|
-
mattr_accessor :i18n_attributes
|
58
|
-
values.except!(*i18n_attributes)
|
59
|
-
super
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
|
-
ActiveSupport.on_load :active_record do
|
65
|
-
extend RailsCom::Translation
|
66
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
module RailsCom::BlobExt
|
2
|
-
|
3
|
-
def self.prepended(klass)
|
4
|
-
klass.class_attribute :private_service
|
5
|
-
end
|
6
|
-
|
7
|
-
def duration
|
8
|
-
r = metadata[:duration] || 0
|
9
|
-
rh = TimeHelper.exact_distance_time(r.to_f)
|
10
|
-
"#{rh[:minute]}:#{rh[:second].to_s.rjust(2, '0')}"
|
11
|
-
end
|
12
|
-
|
13
|
-
def service
|
14
|
-
if private && private_service
|
15
|
-
private_service
|
16
|
-
else
|
17
|
-
super
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def private
|
22
|
-
return @private if defined?(@private)
|
23
|
-
rts = self.attachments.pluck(:record_type, :name).uniq.to_combined_h
|
24
|
-
ps = Rails.cache.fetch('blob_default/private') do
|
25
|
-
ActiveStorage::BlobDefault.where(private: true).pluck(:record_class, :name).to_combined_h
|
26
|
-
end
|
27
|
-
@private = ps.slice(*rts.keys).map { |p, v| (Array(rts[p]) - Array(v)).blank? }.uniq == [true]
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
ActiveSupport.on_load(:active_storage_blob) do
|
33
|
-
prepend RailsCom::BlobExt
|
34
|
-
end
|
data/lib/rails_com/core/array.rb
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
class Array
|
2
|
-
|
3
|
-
# fill an array with the given elements right;
|
4
|
-
# arr = [1, 2, 3]
|
5
|
-
# arr.rjust! 5, nil
|
6
|
-
# # => [1, 2, 3, nil, nil]
|
7
|
-
def rjust!(n, x)
|
8
|
-
return self if n < length
|
9
|
-
insert(0, *Array.new([0, n-length].max, x))
|
10
|
-
end
|
11
|
-
|
12
|
-
##
|
13
|
-
# arr = [1, 2, 3]
|
14
|
-
# arr.ljust! 5, nil
|
15
|
-
# # => [nil, nil, 1, 2, 3]
|
16
|
-
def ljust!(n, x)
|
17
|
-
return self if n < length
|
18
|
-
fill(x, length...n)
|
19
|
-
end
|
20
|
-
|
21
|
-
##
|
22
|
-
# arr = [1, 2, 3]
|
23
|
-
# arr.mjust!(5, nil)
|
24
|
-
# # => [1, 2, nil, nil, 3]
|
25
|
-
def mjust!(n, x)
|
26
|
-
return self if n < length
|
27
|
-
insert (length / 2.0).ceil, *Array.new(n - length, x)
|
28
|
-
end
|
29
|
-
|
30
|
-
##
|
31
|
-
# combine the same key hash like array
|
32
|
-
# raw_data = [
|
33
|
-
# { a: 1 },
|
34
|
-
# { a: 2 },
|
35
|
-
# { b: 2 }
|
36
|
-
# ]
|
37
|
-
# raw_data.to_combined_hash
|
38
|
-
# #=> { a: [1, 2], b: 2 }
|
39
|
-
def to_combined_hash
|
40
|
-
self.reduce({}) do |memo, index|
|
41
|
-
memo.merge(index) { |_, value, default| [value, default] }
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
#
|
46
|
-
# raw_data = [
|
47
|
-
# [:a, 1],
|
48
|
-
# [:a, 2],
|
49
|
-
# [:b, 2]
|
50
|
-
# ]
|
51
|
-
# raw_data.to_combined_h
|
52
|
-
# #=> { a: [1, 2], b: 2 }
|
53
|
-
# todo nested array bug
|
54
|
-
def to_combined_h
|
55
|
-
hash = {}
|
56
|
-
self.each { |x, y| hash[x] = hash[x] ? Array(hash[x]) << y : y }
|
57
|
-
hash
|
58
|
-
end
|
59
|
-
|
60
|
-
# 2D array to csv file
|
61
|
-
# data = [
|
62
|
-
# [1, 2],
|
63
|
-
# [3, 4]
|
64
|
-
# ]
|
65
|
-
# data.to_csv_file
|
66
|
-
def to_csv_file(file = 'export.csv')
|
67
|
-
CSV.open(file, 'w') do |csv|
|
68
|
-
self.each { |ar| csv << ar }
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
data/lib/rails_com/core/date.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
class Date
|
2
|
-
|
3
|
-
# Chinese custom after date
|
4
|
-
# '2018-01-01'.to_date.after(2.month) => '2018-02-31'
|
5
|
-
# '2018-01-31'.to_date.after(1.month) => '2018-03-02'
|
6
|
-
def after(other)
|
7
|
-
if ActiveSupport::Duration === other
|
8
|
-
if other.parts.keys == [:months]
|
9
|
-
date = self + other
|
10
|
-
if date.day == self.day
|
11
|
-
r = date - 1.day
|
12
|
-
else
|
13
|
-
r = date + (self.day - date.day - 1).days
|
14
|
-
end
|
15
|
-
|
16
|
-
r
|
17
|
-
else
|
18
|
-
self + other
|
19
|
-
end
|
20
|
-
else
|
21
|
-
self + other
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
data/lib/rails_com/core/hash.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
class Hash
|
2
|
-
|
3
|
-
def deep_transform_values(&block)
|
4
|
-
_deep_transform_values_in_object(self, &block)
|
5
|
-
end
|
6
|
-
|
7
|
-
def deep_transform_values!(&block)
|
8
|
-
_deep_transform_values_in_object!(self, &block)
|
9
|
-
end
|
10
|
-
|
11
|
-
private
|
12
|
-
def _deep_transform_values_in_object(object, &block)
|
13
|
-
case object
|
14
|
-
when Hash
|
15
|
-
object.each_with_object({}) do |(key, value), result|
|
16
|
-
result[key] = _deep_transform_values_in_object(value, &block)
|
17
|
-
end
|
18
|
-
when Array
|
19
|
-
object.map { |e| _deep_transform_values_in_object(e, &block) }
|
20
|
-
else
|
21
|
-
yield(object)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def _deep_transform_values_in_object!(object, &block)
|
26
|
-
case object
|
27
|
-
when Hash
|
28
|
-
object.each do |key, value|
|
29
|
-
object[key] = _deep_transform_values_in_object!(value, &block)
|
30
|
-
end
|
31
|
-
when Array
|
32
|
-
object.map! { |e| _deep_transform_values_in_object!(e, &block) }
|
33
|
-
else
|
34
|
-
yield(object)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
data/lib/rails_com/core/nil.rb
DELETED
data/lib/rails_com/core.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'rails/generators'
|
2
|
-
require 'rails/generators/erb/scaffold/scaffold_generator'
|
3
|
-
|
4
|
-
class Erb::Generators::ScaffoldGenerator
|
5
|
-
source_root File.expand_path('../../templates/erb/scaffold', __dir__)
|
6
|
-
|
7
|
-
undef available_views
|
8
|
-
private
|
9
|
-
def available_views
|
10
|
-
['index', 'edit', 'show', 'new', '_form', '_filter']
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module RailsCom::Models
|
2
|
-
extend self
|
3
|
-
|
4
|
-
def models
|
5
|
-
models = ActiveRecord::Base.connection.tables.map do |table|
|
6
|
-
begin
|
7
|
-
klass = table.classify.constantize
|
8
|
-
klass.ancestors.include?(ActiveRecord::Base) ? klass : nil
|
9
|
-
rescue
|
10
|
-
nil
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
models.compact
|
15
|
-
end
|
16
|
-
|
17
|
-
def model_names
|
18
|
-
models.map { |klass| klass.to_s }
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
module RailsCom::Routes
|
2
|
-
extend self
|
3
|
-
|
4
|
-
def verbs(controller, action)
|
5
|
-
routes_wrapper.select { |i| i[:controller] == controller.to_s && i[:action] == action.to_s }.map { |i| i[:verb] }.uniq
|
6
|
-
end
|
7
|
-
|
8
|
-
def actions(controller)
|
9
|
-
routes_wrapper.select { |i| i[:controller] == controller.to_s }.map { |i| i[:action] }.uniq
|
10
|
-
end
|
11
|
-
|
12
|
-
def controllers
|
13
|
-
_controllers = routes_wrapper.map { |i| i[:controller] }.compact.uniq
|
14
|
-
_controllers - RailsCom.config.ignore_controllers
|
15
|
-
end
|
16
|
-
|
17
|
-
def modules
|
18
|
-
controllers.map do |i|
|
19
|
-
x = i.split('/')
|
20
|
-
if x.size >= 2
|
21
|
-
x[0..-2].join('/')
|
22
|
-
end
|
23
|
-
end.compact.uniq
|
24
|
-
end
|
25
|
-
|
26
|
-
def routes_wrapper
|
27
|
-
return @routes_wrapper if @routes_wrapper.present?
|
28
|
-
|
29
|
-
@routes_wrapper = []
|
30
|
-
routes.each do |route|
|
31
|
-
@routes_wrapper << detail(route)
|
32
|
-
end
|
33
|
-
|
34
|
-
@routes_wrapper
|
35
|
-
end
|
36
|
-
|
37
|
-
def detail(route)
|
38
|
-
wrap = ActionDispatch::Routing::RouteWrapper.new(route)
|
39
|
-
info = route.defaults
|
40
|
-
|
41
|
-
{
|
42
|
-
verb: route.verb,
|
43
|
-
path: wrap.path,
|
44
|
-
controller: info[:controller],
|
45
|
-
action: info[:action]
|
46
|
-
}
|
47
|
-
end
|
48
|
-
|
49
|
-
def routes
|
50
|
-
@routes ||= Rails.application.routes.routes
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'sprockets/manifest'
|
2
|
-
|
3
|
-
module NonDigestAssets
|
4
|
-
|
5
|
-
def compile(*args)
|
6
|
-
super
|
7
|
-
|
8
|
-
environment.paths.find_all { |i| i.include? 'nondigest_assets' }.each do |src|
|
9
|
-
r_src = src.to_s + '/.'
|
10
|
-
FileUtils.cp_r r_src, self.dir, verbose: true
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
Sprockets::Manifest.send(:prepend, NonDigestAssets)
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'tempfile'
|
2
|
-
|
3
|
-
module Babel
|
4
|
-
extend self
|
5
|
-
|
6
|
-
def script_path
|
7
|
-
@app_path = File.expand_path('.', Dir.pwd)
|
8
|
-
node_modules_bin_path = ENV['WEBPACKER_NODE_MODULES_BIN_PATH'] || `yarn bin`.chomp
|
9
|
-
babel_config = File.join(@app_path, '.babelrc')
|
10
|
-
|
11
|
-
"#{node_modules_bin_path}/babel --config-file #{babel_config}"
|
12
|
-
end
|
13
|
-
|
14
|
-
def context(file)
|
15
|
-
`#{script_path} #{file}`
|
16
|
-
end
|
17
|
-
|
18
|
-
def transform(code, options = {})
|
19
|
-
tmpfile = write_to_tempfile(code)
|
20
|
-
|
21
|
-
begin
|
22
|
-
r = context(tmpfile)
|
23
|
-
ensure
|
24
|
-
File.unlink(tmpfile)
|
25
|
-
end
|
26
|
-
|
27
|
-
r
|
28
|
-
end
|
29
|
-
|
30
|
-
def write_to_tempfile(contents)
|
31
|
-
tmpfile = Tempfile.open(['babel', 'js'])
|
32
|
-
tmpfile.write(contents)
|
33
|
-
r = tmpfile.path
|
34
|
-
tmpfile.close
|
35
|
-
r
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
data/lib/rails_com/version.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
<%%= form_with model: @<%= singular_name %>, local: true do |f| %>
|
2
|
-
<%%= render 'shared/error_messages', target: @<%= singular_name %> %>
|
3
|
-
<% attributes.each do |attribute| -%>
|
4
|
-
<% if attribute.password_digest? -%>
|
5
|
-
<%%= f.password_field :password %>
|
6
|
-
<%%= f.password_field :password_confirmation %>
|
7
|
-
<% else -%>
|
8
|
-
<%%= f.<%= attribute.field_type %> :<%= attribute.column_name %> %>
|
9
|
-
<% end -%>
|
10
|
-
<% end -%>
|
11
|
-
<%%= f.submit %>
|
12
|
-
<%% end %>
|
@@ -1,45 +0,0 @@
|
|
1
|
-
<div class="ui top attached borderless menu">
|
2
|
-
<div class="header item"><%= plural_table_name.titleize %></div>
|
3
|
-
<div class="right menu">
|
4
|
-
<div class="item">
|
5
|
-
<%%= link_to 'New <%= singular_table_name.titleize %>', new_<%= singular_table_name %>_path, class: 'ui teal button' %>
|
6
|
-
</div>
|
7
|
-
</div>
|
8
|
-
</div>
|
9
|
-
|
10
|
-
<%%= render 'filter' %>
|
11
|
-
|
12
|
-
<table class="ui bottom attached table">
|
13
|
-
<thead>
|
14
|
-
<tr>
|
15
|
-
<th><%%= <%= class_name %>.human_attribute_name(:id) %></th>
|
16
|
-
<% attributes.reject(&:password_digest?).each do |attribute| -%>
|
17
|
-
<th><%%= <%= class_name %>.human_attribute_name(:<%= attribute.name %>) %></th>
|
18
|
-
<% end -%>
|
19
|
-
<th>Actions</th>
|
20
|
-
</tr>
|
21
|
-
</thead>
|
22
|
-
<tbody>
|
23
|
-
<%% @<%= plural_name %>.each do |<%= singular_name %>| %>
|
24
|
-
<tr>
|
25
|
-
<td><%%= <%= singular_name %>.id %></td>
|
26
|
-
<% attributes.reject(&:password_digest?).each do |attribute| -%>
|
27
|
-
<td><%%= <%= singular_name %>.<%= attribute.name %> %></td>
|
28
|
-
<% end -%>
|
29
|
-
<td class="ui labels">
|
30
|
-
<%%= link_to <%= singular_table_name %>_path(<%= singular_name %>), data: { tooltip: t('.show') }, class: 'ui blue mini icon button' do %>
|
31
|
-
<i class="location arrow icon"></i>
|
32
|
-
<%% end %>
|
33
|
-
<%%= link_to edit_<%= singular_table_name %>_path(<%= singular_name %>), data: { tooltip: t('.edit') }, class: 'ui pink mini icon button' do %>
|
34
|
-
<i class="pencil alternate icon"></i>
|
35
|
-
<%% end %>
|
36
|
-
<%%= link_to <%= singular_table_name %>_path(<%= singular_name %>), method: :delete, data: { tooltip: t('.destroy'), confirm: 'Are you sure?' }, class: 'ui red mini icon button' do %>
|
37
|
-
<i class="times icon"></i>
|
38
|
-
<%% end %>
|
39
|
-
</td>
|
40
|
-
</tr>
|
41
|
-
<%% end %>
|
42
|
-
</tbody>
|
43
|
-
</table>
|
44
|
-
|
45
|
-
<%%= paginate @<%= plural_name %> %>
|