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,13 +1,16 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'httpx'
|
2
4
|
module ActiveStorage
|
3
5
|
class Attached
|
4
6
|
|
5
7
|
def url_sync(url)
|
6
8
|
filename = File.basename URI(url).path
|
7
|
-
|
9
|
+
|
8
10
|
Tempfile.open do |file|
|
9
11
|
file.binmode
|
10
|
-
|
12
|
+
|
13
|
+
HTTPX.get(url).body.each do |fragment|
|
11
14
|
file.write fragment
|
12
15
|
end
|
13
16
|
|
@@ -20,7 +23,7 @@ module ActiveStorage
|
|
20
23
|
class One
|
21
24
|
|
22
25
|
def variant(transformations)
|
23
|
-
if attachment
|
26
|
+
if attachment&.variable?
|
24
27
|
attachment.variant(transformations)
|
25
28
|
else
|
26
29
|
self
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RailsCom::AttachedOne
|
2
4
|
|
3
5
|
def attachment
|
@@ -7,14 +9,24 @@ module RailsCom::AttachedOne
|
|
7
9
|
return @attachment
|
8
10
|
end
|
9
11
|
|
10
|
-
id =
|
11
|
-
|
12
|
+
id = Com::BlobDefault.defaults["#{record.class.name}_#{name}"]
|
13
|
+
if id
|
14
|
+
begin
|
15
|
+
@attachment = ActiveStorage::Attachment.new(record: record, name: name, blob: ActiveStorage::Blob.find(id))
|
16
|
+
rescue ActiveRecord::RecordNotFound => e
|
17
|
+
Rails.cache.delete('blob_default/default')
|
18
|
+
retry
|
19
|
+
end
|
20
|
+
end
|
12
21
|
end
|
13
22
|
|
14
|
-
def
|
15
|
-
|
23
|
+
def copy(from, from_name)
|
24
|
+
from_attachment = from.send "#{from_name}_attachment"
|
25
|
+
record.send "create_#{name}_attachment", blob_id: from_attachment.blob_id
|
16
26
|
end
|
17
27
|
|
18
28
|
end
|
19
29
|
|
20
|
-
|
30
|
+
ActiveSupport.on_load(:active_storage_record) do
|
31
|
+
ActiveStorage::Attached::One.prepend RailsCom::AttachedOne
|
32
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module RailsCom::AttachmentPrepend
|
2
|
+
|
3
|
+
def identify_blob
|
4
|
+
if record.respond_to? "sync_#{name}"
|
5
|
+
record.send "sync_#{name}"
|
6
|
+
end
|
7
|
+
blob.identify_later
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
ActiveSupport.on_load(:active_storage_attachment) do
|
13
|
+
prepend RailsCom::AttachmentPrepend
|
14
|
+
end
|
@@ -1,10 +1,15 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module RailsCom::AttachmentTransfer
|
3
|
-
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
scope :garbled, -> { left_joins(:blob).where(ActiveStorage::Blob.table_name => { id: nil }) }
|
8
|
+
end
|
4
9
|
|
5
10
|
def copy
|
6
11
|
raise 'Only Support mirror service' unless service.is_a?(ActiveStorage::Service::MirrorService)
|
7
|
-
|
12
|
+
blob.open do |io|
|
8
13
|
checksum = blob.send(:compute_checksum_in_chunks, io)
|
9
14
|
service.mirrors.map do |service|
|
10
15
|
service.upload key, io.tap(&:rewind), checksum: checksum
|
@@ -15,7 +20,7 @@ module RailsCom::AttachmentTransfer
|
|
15
20
|
def transfer_faststart
|
16
21
|
attach = self.record.send(self.name)
|
17
22
|
r = nil
|
18
|
-
|
23
|
+
blob.open do |input|
|
19
24
|
Tempfile.open([ 'ActiveStorage', self.filename.extension_with_delimiter ], Dir.tmpdir) do |file|
|
20
25
|
file.binmode
|
21
26
|
argv = [ffmpeg_path, '-i', input.path, '-codec', 'copy', '-movflags', 'faststart', '-f', 'mp4', '-y', file.path]
|
@@ -41,4 +46,6 @@ module RailsCom::AttachmentTransfer
|
|
41
46
|
|
42
47
|
end
|
43
48
|
|
44
|
-
|
49
|
+
ActiveSupport.on_load(:active_storage_attachment) do
|
50
|
+
include RailsCom::AttachmentTransfer
|
51
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RailsCom::VideoResponse
|
2
4
|
extend ActiveSupport::Concern
|
3
5
|
|
@@ -26,4 +28,6 @@ module RailsCom::VideoResponse
|
|
26
28
|
|
27
29
|
end
|
28
30
|
|
29
|
-
|
31
|
+
ActiveSupport.on_load :action_controller do
|
32
|
+
ActiveStorage::DiskController.include RailsCom::VideoResponse
|
33
|
+
end
|
@@ -1,4 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails_com/active_storage/activestorage_attached'
|
4
|
+
require 'rails_com/active_storage/attached_macros'
|
5
|
+
require 'rails_com/active_storage/attachment_transfer'
|
6
|
+
require 'rails_com/active_storage/attachment_prepend'
|
7
|
+
require 'rails_com/active_storage/video_response'
|
8
|
+
|
9
|
+
ActiveStorage.mattr_accessor :service_urls_expire_in, default: 5.minutes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# rubocop:disable Style/RedundantBegin
|
4
|
+
|
5
|
+
require 'rails'
|
6
|
+
|
7
|
+
[
|
8
|
+
'active_record/railtie',
|
9
|
+
'active_storage/engine',
|
10
|
+
'action_controller/railtie',
|
11
|
+
'action_view/railtie',
|
12
|
+
'action_mailer/railtie',
|
13
|
+
'active_job/railtie',
|
14
|
+
'action_cable/engine',
|
15
|
+
'action_mailbox/engine',
|
16
|
+
'action_text/engine',
|
17
|
+
'rails/test_unit/railtie'
|
18
|
+
].each do |railtie|
|
19
|
+
begin
|
20
|
+
require railtie
|
21
|
+
rescue LoadError
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# rubocop:disable Style/RedundantBegin
|
4
|
+
|
5
|
+
require 'rails'
|
6
|
+
|
7
|
+
[
|
8
|
+
'active_model/railtie',
|
9
|
+
'active_record/railtie',
|
10
|
+
'active_storage/engine',
|
11
|
+
'action_controller/railtie',
|
12
|
+
'action_view/railtie',
|
13
|
+
'action_mailer/railtie',
|
14
|
+
'active_job/railtie',
|
15
|
+
'action_cable/engine',
|
16
|
+
'action_mailbox/engine',
|
17
|
+
'action_text/engine',
|
18
|
+
'rails/test_unit/railtie'
|
19
|
+
].each do |railtie|
|
20
|
+
begin
|
21
|
+
require railtie
|
22
|
+
rescue LoadError
|
23
|
+
end
|
24
|
+
end
|
data/lib/rails_com/config.rb
CHANGED
@@ -1,14 +1,22 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/configurable'
|
4
|
+
|
5
|
+
module RailsCom #:nodoc:
|
6
|
+
include ActiveSupport::Configurable
|
7
|
+
|
8
|
+
configure do |config|
|
9
|
+
config.ignore_exception = [
|
10
|
+
'ActionController::UnknownFormat',
|
11
|
+
'ActiveRecord::RecordNotFound'
|
12
|
+
]
|
13
|
+
config.disable_debug = true
|
14
|
+
config.notify_bot = 'WorkWechatBot'
|
15
|
+
config.notify_key = ''
|
16
|
+
config.not_found_logger = ActiveSupport::Logger.new('log/not_found.log')
|
17
|
+
config.github_hmac_key = 'must_change_this'
|
18
|
+
config.default_error_message = '服务端发生错误'
|
19
|
+
config.acme_url = 'https://acme-v02.api.letsencrypt.org/directory' # 用于 SSL 证书自动签发服务
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
data/lib/rails_com/engine.rb
CHANGED
@@ -1,32 +1,48 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
g.javasricpts false
|
6
|
-
g.javascript_engine false
|
7
|
-
g.helper false
|
8
|
-
g.jbuilder false
|
9
|
-
g.templates.unshift File.expand_path('lib/templates', root)
|
10
|
-
end
|
3
|
+
module RailsCom
|
4
|
+
class Engine < ::Rails::Engine #:nodoc:
|
11
5
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
6
|
+
config.generators do |g|
|
7
|
+
g.stylesheets false
|
8
|
+
g.helper false
|
9
|
+
g.resource_route false
|
10
|
+
g.jbuilder false
|
11
|
+
g.templates.unshift File.expand_path('lib/templates', root)
|
12
|
+
end
|
18
13
|
|
19
|
-
|
20
|
-
|
21
|
-
|
14
|
+
initializer 'rails_com.add_generator_templates'do |app|
|
15
|
+
app.config.paths['lib/templates'].unshift File.expand_path('lib/templates', root)
|
16
|
+
# todo check if really works
|
17
|
+
app.config.generators do |g|
|
18
|
+
g.stylesheets false
|
19
|
+
g.helper false
|
20
|
+
g.resource_route false
|
21
|
+
g.jbuilder true
|
22
|
+
end
|
23
|
+
end
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
config.action_view.field_error_proc = ->(html_tag, instance){ html_tag }
|
26
|
+
|
27
|
+
initializer 'rails_com.default_initializer' do |app|
|
28
|
+
app.config.content_security_policy_nonce_generator = -> request {
|
29
|
+
request.headers['X-Csp-Nonce'] || SecureRandom.base64(16)
|
30
|
+
}
|
31
|
+
app.config.action_dispatch.rescue_responses.merge!({
|
32
|
+
'ActionController::ForbiddenError' => :forbidden,
|
33
|
+
'ActionController::UnauthorizedError' => :unauthorized
|
34
|
+
})
|
35
|
+
Mime::Type.register 'image/webp', :webp
|
36
|
+
#ActiveStorage::Attached::One.prepend RailsCom::AttachedOne
|
29
37
|
end
|
30
|
-
end
|
31
38
|
|
39
|
+
config.to_prepare do
|
40
|
+
overrides = RailsCom::Engine.root.join('app/overrides')
|
41
|
+
Rails.autoloaders.main.ignore(overrides)
|
42
|
+
Dir.glob("#{overrides}/**/*_override.rb").each do |override|
|
43
|
+
load override
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
32
48
|
end
|
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module NumHelper
|
2
|
-
NUM = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖']
|
3
|
-
DEL = ['', '拾', '佰', '仟']
|
4
|
-
SUB_DEL = ['分', '角']
|
5
|
-
UNIT = ['元', '万', '亿', '兆', '京']
|
6
|
-
DELIMITER_REGEX = /(\d)(?=(\d\d\d\d)+(?!\d))
|
4
|
+
NUM = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'].freeze
|
5
|
+
DEL = ['', '拾', '佰', '仟'].freeze
|
6
|
+
SUB_DEL = ['分', '角'].freeze
|
7
|
+
UNIT = ['元', '万', '亿', '兆', '京'].freeze
|
8
|
+
DELIMITER_REGEX = /(\d)(?=(\d\d\d\d)+(?!\d))/.freeze
|
7
9
|
extend self
|
8
10
|
|
9
11
|
def to_rmb(num)
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module QrcodeHelper
|
4
|
+
extend self
|
5
|
+
OPTIONS = {
|
6
|
+
resize_gte_to: false,
|
7
|
+
resize_exactly_to: false,
|
8
|
+
fill: 'white',
|
9
|
+
color: 'black',
|
10
|
+
size: 300,
|
11
|
+
border_modules: 1, # 二维码图片padding
|
12
|
+
module_px_size: 6,
|
13
|
+
file: nil
|
14
|
+
}
|
15
|
+
|
16
|
+
def code_file(url, **options)
|
17
|
+
png = code_png url, **options
|
18
|
+
tmp = Tempfile.new
|
19
|
+
tmp.binmode
|
20
|
+
tmp.write png.to_s
|
21
|
+
tmp.rewind
|
22
|
+
tmp
|
23
|
+
end
|
24
|
+
|
25
|
+
def data_url(url, **options)
|
26
|
+
png = code_png url, **options
|
27
|
+
png.to_data_url
|
28
|
+
end
|
29
|
+
|
30
|
+
def code_png(url, **options)
|
31
|
+
qrcode = RQRCode::QRCode.new(url)
|
32
|
+
qrcode.as_png **OPTIONS.merge(options)
|
33
|
+
end
|
34
|
+
|
35
|
+
end if defined? RQRCode
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class Setting < OpenStruct
|
1
|
+
class RailsCom::Setting < OpenStruct
|
2
2
|
|
3
3
|
def initialize(hash = {})
|
4
4
|
@table = {}
|
@@ -13,7 +13,7 @@ class Setting < OpenStruct
|
|
13
13
|
@table[k.to_sym] = v
|
14
14
|
end
|
15
15
|
@hash_table[k.to_sym] = v
|
16
|
-
new_ostruct_member(k)
|
16
|
+
new_ostruct_member!(k)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -23,12 +23,12 @@ class Setting < OpenStruct
|
|
23
23
|
|
24
24
|
end
|
25
25
|
|
26
|
-
class Settings < Array
|
26
|
+
class RailsCom::Settings < Array
|
27
27
|
|
28
28
|
def initialize(data = [])
|
29
29
|
data.map do |h|
|
30
|
-
self << Setting.new(h)
|
30
|
+
self << RailsCom::Setting.new(h)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
end
|
34
|
+
end
|
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module UidHelper
|
2
4
|
extend self
|
3
5
|
|
4
|
-
def uuid(int, prefix
|
6
|
+
def uuid(int, prefix: '', suffix: '', separator: '')
|
5
7
|
str = int.to_s(36)
|
6
8
|
str = str + suffix
|
7
|
-
str = str.upcase.scan(/.{1,4}/).join(
|
9
|
+
str = str.upcase.scan(/.{1,4}/).join(separator)
|
8
10
|
|
9
11
|
if prefix.present?
|
10
12
|
str = prefix + '-' + str
|
@@ -13,21 +15,26 @@ module UidHelper
|
|
13
15
|
str
|
14
16
|
end
|
15
17
|
|
16
|
-
def nsec_uuid(prefix = '', suffix
|
17
|
-
time = Time.
|
18
|
+
def nsec_uuid(prefix = '', suffix: rand_string, separator: '-')
|
19
|
+
time = Time.current
|
18
20
|
str = time.to_i.to_s + time.nsec.to_s
|
19
|
-
uuid str.to_i, prefix, suffix
|
21
|
+
uuid str.to_i, prefix: prefix, suffix: suffix, separator: separator
|
20
22
|
end
|
21
23
|
|
22
|
-
def usec_uuid(prefix = '', suffix
|
23
|
-
time = Time.
|
24
|
+
def usec_uuid(prefix = '', suffix: rand_string(2), separator: '-')
|
25
|
+
time = Time.current
|
24
26
|
str = time.to_i.to_s + time.usec.to_s
|
25
|
-
uuid str.to_i, prefix, suffix
|
27
|
+
uuid str.to_i, prefix: prefix, suffix: suffix, separator: separator
|
28
|
+
end
|
29
|
+
|
30
|
+
def sec_uuid(prefix = '', suffix: rand_string(2), separator: '-')
|
31
|
+
time = Time.current
|
32
|
+
uuid time.to_i, prefix: prefix, suffix: suffix, separator: separator
|
26
33
|
end
|
27
34
|
|
28
|
-
def
|
29
|
-
|
30
|
-
|
35
|
+
def rand_string(len = 4)
|
36
|
+
list = (0..9).to_a + ('A'..'Z').to_a
|
37
|
+
len.times.map { list.sample }.join
|
31
38
|
end
|
32
39
|
|
33
40
|
def decode_uuid(uuid, prefix: true)
|
@@ -50,8 +57,4 @@ module UidHelper
|
|
50
57
|
end
|
51
58
|
end
|
52
59
|
|
53
|
-
def rand_string(len = 4)
|
54
|
-
len.times.map { ((0..9).to_a + ('A'..'Z').to_a).sample }.join
|
55
|
-
end
|
56
|
-
|
57
60
|
end
|
data/lib/rails_com.rb
CHANGED
@@ -1,33 +1,41 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
3
|
require 'rails_com/config'
|
4
|
+
require 'rails_com/engine'
|
4
5
|
|
5
|
-
require 'rails_com/core'
|
6
6
|
require 'rails_com/action_controller'
|
7
7
|
require 'rails_com/action_view'
|
8
|
-
require 'rails_com/
|
9
|
-
|
10
|
-
require 'rails_com/active_storage
|
11
|
-
|
12
|
-
# Meta for Rails
|
13
|
-
require 'rails_com/meta/routes'
|
14
|
-
require 'rails_com/meta/models'
|
15
|
-
require 'rails_com/meta/controllers'
|
8
|
+
require 'rails_com/action_text'
|
9
|
+
require 'rails_com/action_mailbox'
|
10
|
+
require 'rails_com/active_storage'
|
16
11
|
|
17
12
|
# Rails extension
|
18
|
-
require '
|
19
|
-
require '
|
13
|
+
require 'generators/scaffold_generator'
|
14
|
+
require 'generators/jbuilder_generator' if defined?(Jbuilder)
|
20
15
|
|
21
|
-
#
|
22
|
-
require '
|
16
|
+
# default_form, 需要位于 rails_com 的加载之后
|
17
|
+
require 'default_form/config'
|
18
|
+
require 'default_form/active_record/extend'
|
19
|
+
require 'default_form/override/action_view/helpers/tags/collection_check_boxes'
|
20
|
+
require 'default_form/override/action_view/helpers/tags/collection_radio_buttons'
|
21
|
+
require 'default_form/controller_helper'
|
22
|
+
require 'default_form/view_helper'
|
23
23
|
|
24
24
|
# Utils
|
25
25
|
require 'rails_com/utils/time_helper'
|
26
26
|
require 'rails_com/utils/num_helper'
|
27
|
+
require 'rails_com/utils/qrcode_helper'
|
27
28
|
require 'rails_com/utils/uid_helper'
|
29
|
+
require 'rails_com/utils/hex_helper'
|
28
30
|
require 'rails_com/utils/jobber'
|
29
|
-
|
31
|
+
|
32
|
+
# active storage
|
33
|
+
require 'active_storage/service/disc_service'
|
30
34
|
|
31
35
|
# outside
|
36
|
+
require 'jbuilder'
|
32
37
|
require 'default_where'
|
33
|
-
require '
|
38
|
+
require 'rails_extend'
|
39
|
+
require 'kaminari'
|
40
|
+
require 'acts_as_list'
|
41
|
+
require 'turbo-rails'
|
@@ -1,48 +1,49 @@
|
|
1
|
+
<% module_namespacing do -%>
|
1
2
|
class <%= controller_class_name %>Controller < ApplicationController
|
2
|
-
before_action :set_<%=
|
3
|
+
before_action :set_<%= singular_name %>, only: [:show, :update, :destroy]
|
3
4
|
|
4
5
|
def index
|
5
|
-
@<%=
|
6
|
-
|
7
|
-
render json: <%= "@#{plural_table_name}" %>
|
6
|
+
@<%= plural_name %> = <%= class_name %>.page(params[:page])
|
8
7
|
end
|
9
8
|
|
10
9
|
def show
|
11
|
-
render json: <%= "@#{singular_table_name}" %>
|
12
10
|
end
|
13
11
|
|
14
12
|
def create
|
15
|
-
@<%=
|
13
|
+
@<%= singular_name %> = <%= orm_class.build(class_name, "#{singular_name}_params") %>
|
16
14
|
|
17
|
-
if @<%= orm_instance.save %>
|
18
|
-
render
|
15
|
+
if @<%= orm_instance(singular_name).save %>
|
16
|
+
render :create, status: :created
|
19
17
|
else
|
20
|
-
render
|
18
|
+
render :new, locals: { model: @<%= singular_name %> }, status: :unprocessable_entity
|
21
19
|
end
|
22
20
|
end
|
23
21
|
|
24
22
|
def update
|
25
|
-
|
26
|
-
|
23
|
+
@<%= singular_name %>.assign_attributes(<%= singular_name %>_params)
|
24
|
+
|
25
|
+
if @<%= orm_instance(singular_name).save %>
|
26
|
+
render :update, status: :ok
|
27
27
|
else
|
28
|
-
render
|
28
|
+
render :edit, locals: { model: @<%= singular_name %> }, status: :unprocessable_entity
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
def destroy
|
33
|
-
@<%= orm_instance.destroy %>
|
33
|
+
@<%= orm_instance(singular_name).destroy %>
|
34
34
|
end
|
35
35
|
|
36
36
|
private
|
37
|
-
def set_<%=
|
38
|
-
@<%=
|
37
|
+
def set_<%= singular_name %>
|
38
|
+
@<%= singular_name %> = <%= orm_class.find(class_name, "params[:id]") %>
|
39
39
|
end
|
40
40
|
|
41
|
-
def <%= "#{
|
41
|
+
def <%= "#{singular_name}_params" %>
|
42
42
|
<%- if attributes_names.empty? -%>
|
43
|
-
params.fetch(
|
43
|
+
params.fetch(<%= ":#{singular_name}" %>, {})
|
44
44
|
<%- else -%>
|
45
|
-
params.require(
|
45
|
+
params.require(<%= ":#{singular_name}" %>).permit(<%= permitted_params %>)
|
46
46
|
<%- end -%>
|
47
47
|
end
|
48
|
-
end
|
48
|
+
end
|
49
|
+
<% end -%>
|
@@ -1,54 +1,3 @@
|
|
1
1
|
class <%= controller_class_name %>Controller < <%= controller_class_path.map(&:camelize).join('::') %>::BaseController
|
2
|
-
before_action :set_<%= singular_name %>, only: [:show, :edit, :update, :destroy]
|
3
2
|
|
4
|
-
|
5
|
-
@<%= plural_name %> = <%= class_name %>.page(params[:page])
|
6
|
-
end
|
7
|
-
|
8
|
-
def new
|
9
|
-
@<%= singular_name %> = <%= orm_class.build(class_name) %>
|
10
|
-
end
|
11
|
-
|
12
|
-
def create
|
13
|
-
@<%= singular_name %> = <%= orm_class.build(class_name, "#{singular_name}_params") %>
|
14
|
-
|
15
|
-
if @<%= orm_instance(singular_name).save %>
|
16
|
-
redirect_to <%= index_helper %>_url, notice: <%= "'#{human_name} was successfully created.'" %>
|
17
|
-
else
|
18
|
-
render :new
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def show
|
23
|
-
end
|
24
|
-
|
25
|
-
def edit
|
26
|
-
end
|
27
|
-
|
28
|
-
def update
|
29
|
-
if @<%= orm_instance(singular_name).update("#{singular_name}_params") %>
|
30
|
-
redirect_to <%= index_helper %>_url, notice: <%= "'#{human_name} was successfully updated.'" %>
|
31
|
-
else
|
32
|
-
render :edit
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def destroy
|
37
|
-
@<%= orm_instance(singular_name).destroy %>
|
38
|
-
redirect_to <%= index_helper %>_url, notice: <%= "'#{human_name} was successfully destroyed.'" %>
|
39
|
-
end
|
40
|
-
|
41
|
-
private
|
42
|
-
def set_<%= singular_name %>
|
43
|
-
@<%= singular_name %> = <%= orm_class.find(class_name, "params[:id]") %>
|
44
|
-
end
|
45
|
-
|
46
|
-
def <%= "#{singular_name}_params" %>
|
47
|
-
params.fetch(:<%= singular_name %>, {}).permit(
|
48
|
-
<% attributes_names.map do |name| -%>
|
49
|
-
<%= ":#{name}," %>
|
50
|
-
<% end -%>
|
51
|
-
)
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
3
|
+
end
|