rails_com 1.2.5 → 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 +11 -0
- 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 +19 -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 -0
- 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 +41 -0
- data/lib/rails_com/action_view/translation_helper.rb +23 -0
- data/lib/rails_com/action_view.rb +5 -0
- data/lib/rails_com/{rails_ext → active_storage}/activestorage_attached.rb +7 -3
- data/lib/rails_com/active_storage/attached_macros.rb +32 -0
- data/lib/rails_com/active_storage/attachment_prepend.rb +14 -0
- data/lib/rails_com/{rails_ext → active_storage}/attachment_transfer.rb +15 -6
- data/lib/rails_com/{rails_ext → active_storage}/video_response.rb +6 -1
- data/lib/rails_com/active_storage.rb +9 -0
- 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 +42 -21
- 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 +22 -13
- data/lib/rails_com.rb +31 -29
- 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 +558 -108
- 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 -45
- data/app/assets/javascripts/rails_com/attachment.js +0 -416
- data/app/assets/javascripts/rails_com/checkbox.js +0 -59
- data/app/assets/javascripts/rails_com/fetch_xhr_script.js +0 -20
- data/app/assets/javascripts/rails_com/footer.js +0 -3
- data/app/assets/javascripts/rails_com/picture.js +0 -17
- data/app/assets/javascripts/rails_com/sidebar.js +0 -40
- 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 -54
- 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 -50
- data/app/controllers/concerns/rails_common_xhr.rb +0 -15
- data/app/helpers/rails_com/assets_helper.rb +0 -91
- data/app/models/active_storage/blob_default.rb +0 -5
- 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 -7
- 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 -48
- 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 -6
- 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 -25
- data/app/views/active_storage_ext/attachments/_list_form.html.erb +0 -28
- 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 -13
- 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/core_ext/array.rb +0 -72
- data/lib/rails_com/core_ext/date.rb +0 -25
- data/lib/rails_com/core_ext/hash.rb +0 -38
- data/lib/rails_com/core_ext/nil.rb +0 -7
- data/lib/rails_com/core_ext/numeric.rb +0 -11
- data/lib/rails_com/core_ext/string.rb +0 -15
- data/lib/rails_com/helpers/controller_helper.rb +0 -30
- data/lib/rails_com/helpers/model_helper.rb +0 -107
- 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/rails_ext/attached_macros.rb +0 -21
- data/lib/rails_com/rails_ext/errors.rb +0 -4
- data/lib/rails_com/rails_ext/named_base.rb +0 -9
- data/lib/rails_com/rails_ext/persistence_sneakily.rb +0 -11
- data/lib/rails_com/rails_ext/scaffold_generator.rb +0 -15
- data/lib/rails_com/rails_ext/template_renderer.rb +0 -54
- data/lib/rails_com/rails_ext/translation_helper.rb +0 -18
- 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/_form.html.erb.tt +0 -12
- data/lib/templates/erb/scaffold/_search_form.html.erb.tt +0 -7
- data/lib/templates/erb/scaffold/edit.html.erb.tt +0 -9
- data/lib/templates/erb/scaffold/index.html.erb.tt +0 -47
- data/lib/templates/erb/scaffold/new.html.erb.tt +0 -9
- data/lib/templates/erb/scaffold/show.html.erb.tt +0 -16
@@ -1,54 +0,0 @@
|
|
1
|
-
class ActiveStorageExt::Admin::BlobDefaultsController < ActiveStorageExt::Admin::BaseController
|
2
|
-
before_action :set_blob_default, only: [:show, :edit, :update, :destroy]
|
3
|
-
|
4
|
-
def index
|
5
|
-
@blob_defaults = ActiveStorage::BlobDefault.page(params[:page])
|
6
|
-
end
|
7
|
-
|
8
|
-
def new
|
9
|
-
@blob_default = ActiveStorage::BlobDefault.new
|
10
|
-
end
|
11
|
-
|
12
|
-
def create
|
13
|
-
@blob_default = ActiveStorage::BlobDefault.new(blob_default_params)
|
14
|
-
|
15
|
-
if @blob_default.save
|
16
|
-
redirect_to rails_ext_blob_defaults_url, notice: 'Blob default 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 @blob_default.update(blob_default_params)
|
30
|
-
redirect_to rails_ext_blob_defaults_url, notice: 'Blob default was successfully updated.'
|
31
|
-
else
|
32
|
-
render :edit
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def destroy
|
37
|
-
@blob_default.destroy
|
38
|
-
redirect_to rails_ext_blob_defaults_url, notice: 'Blob default was successfully destroyed.'
|
39
|
-
end
|
40
|
-
|
41
|
-
private
|
42
|
-
def set_blob_default
|
43
|
-
@blob_default = ActiveStorage::BlobDefault.find(params[:id])
|
44
|
-
end
|
45
|
-
|
46
|
-
def blob_default_params
|
47
|
-
params.fetch(:blob_default, {}).permit(
|
48
|
-
:record_class,
|
49
|
-
:name,
|
50
|
-
:file
|
51
|
-
)
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
class ActiveStorageExt::Admin::BlobsController < ActiveStorageExt::Admin::BaseController
|
2
|
-
before_action :set_blob, only: [:destroy]
|
3
|
-
|
4
|
-
def index
|
5
|
-
q_params = {}.with_indifferent_access
|
6
|
-
q_params.merge params.fetch(:q, {}).permit(:key, :filename)
|
7
|
-
@blobs = ActiveStorage::Blob.default_where(q_params).order(id: :desc).page(params[:page])
|
8
|
-
end
|
9
|
-
|
10
|
-
def unattached
|
11
|
-
q_params = {}.with_indifferent_access
|
12
|
-
q_params.merge params.fetch(:q, {}).permit(:key, :filename)
|
13
|
-
@blobs = ActiveStorage::Blob.unattached.default_where(q_params).order(id: :desc).page(params[:page])
|
14
|
-
render :index
|
15
|
-
end
|
16
|
-
|
17
|
-
def new
|
18
|
-
@blob = ActiveStorage::Blob.new(filename: '')
|
19
|
-
end
|
20
|
-
|
21
|
-
def create
|
22
|
-
@blob = ActiveStorage::Blob.build_after_upload(io: blob_params[:io].tempfile, filename: blob_params[:io].original_filename)
|
23
|
-
|
24
|
-
if @blob.save
|
25
|
-
redirect_to rails_ext_blobs_url, notice: 'Blob was successfully created.'
|
26
|
-
else
|
27
|
-
render :new
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def destroy
|
32
|
-
@blob.purge
|
33
|
-
redirect_to rails_ext_blobs_url, notice: 'Blob was successfully destroyed.'
|
34
|
-
end
|
35
|
-
|
36
|
-
private
|
37
|
-
def set_blob
|
38
|
-
@blob = ActiveStorage::Blob.find(params[:id])
|
39
|
-
end
|
40
|
-
|
41
|
-
def blob_params
|
42
|
-
params.fetch(:blob, {}).permit(
|
43
|
-
:key,
|
44
|
-
:io
|
45
|
-
)
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
class ActiveStorageExt::AudiosController < RailsCom.config.app_class.constantize
|
2
|
-
before_action :set_video, only: [:show, :transfer]
|
3
|
-
before_action do
|
4
|
-
ActiveStorage::Current.host = request.base_url
|
5
|
-
end
|
6
|
-
|
7
|
-
def show
|
8
|
-
expires_in ActiveStorage::Blob.service.url_expires_in
|
9
|
-
end
|
10
|
-
|
11
|
-
def transfer
|
12
|
-
attached = @attachment.transfer_faststart
|
13
|
-
@video = attached.blob
|
14
|
-
|
15
|
-
flash[:notice] = 'well done!'
|
16
|
-
render 'show'
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
def set_video
|
21
|
-
@audio = ActiveStorage::Blob.find(params[:id])
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
class ActiveStorageExt::VideosController < RailsCom.config.app_class.constantize
|
2
|
-
before_action :set_video, only: [:show, :transfer]
|
3
|
-
before_action do
|
4
|
-
ActiveStorage::Current.host = request.base_url
|
5
|
-
end
|
6
|
-
|
7
|
-
def show
|
8
|
-
expires_in ActiveStorage::Blob.service.url_expires_in
|
9
|
-
end
|
10
|
-
|
11
|
-
def transfer
|
12
|
-
attached = @attachment.transfer_faststart
|
13
|
-
@video = attached.blob
|
14
|
-
|
15
|
-
flash[:notice] = 'well done!'
|
16
|
-
render 'show'
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
def set_video
|
21
|
-
@attachment = ActiveStorage::Attachment.find(params[:id])
|
22
|
-
@video = @attachment.blob
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
module RailsCommonApi
|
2
|
-
extend ActiveSupport::Concern
|
3
|
-
|
4
|
-
included do
|
5
|
-
rescue_from 'StandardError' do |exp|
|
6
|
-
puts nil, exp.full_message(highlight: true, order: :top)
|
7
|
-
render json: { code: 500, error: { class: exp.class.inspect }, message: exp.message }, status: 500
|
8
|
-
end
|
9
|
-
|
10
|
-
rescue_from 'ActiveRecord::RecordNotFound' do |exp|
|
11
|
-
puts nil, exp.full_message(highlight: true, order: :top)
|
12
|
-
render json: { code: 404, error: { class: exp.class.inspect }, message: exp.message }, status: 404
|
13
|
-
end
|
14
|
-
|
15
|
-
rescue_from 'ActionController::ForbiddenError' do |exp|
|
16
|
-
puts nil, exp.full_message(highlight: true, order: :top)
|
17
|
-
render json: { code: 403, error: { class: exp.class.inspect }, message: exp.message }, status: 403
|
18
|
-
end
|
19
|
-
|
20
|
-
rescue_from 'ActionController::UnauthorizedError' do |exp|
|
21
|
-
puts nil, exp.full_message(highlight: true, order: :top)
|
22
|
-
render json: { code: 401, error: { class: exp.class.inspect }, message: exp.message }, status: 401
|
23
|
-
end
|
24
|
-
|
25
|
-
rescue_from 'ActionController::ParameterMissing' do |exp|
|
26
|
-
puts nil, exp.full_message(highlight: true, order: :top)
|
27
|
-
render json: { code: 400, error: { class: exp.class.inspect }, message: exp.message }, status: 400
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def process_errors(model)
|
32
|
-
render json: {
|
33
|
-
code: 406,
|
34
|
-
error: model.errors.as_json(full_messages: true),
|
35
|
-
message: model.errors.full_messages.join("\n")
|
36
|
-
}, status: 200
|
37
|
-
end
|
38
|
-
|
39
|
-
def render *args
|
40
|
-
options = args.extract_options!
|
41
|
-
|
42
|
-
if options[:json]
|
43
|
-
options[:json].merge! code: 200
|
44
|
-
end
|
45
|
-
|
46
|
-
args << options
|
47
|
-
super *args
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
@@ -1,91 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module RailsCom::AssetsHelper
|
3
|
-
|
4
|
-
# Assets path: app/assets/javascripts/controllers
|
5
|
-
# Packs Path: app/javascript/packs/javascripts
|
6
|
-
def js_load(**options)
|
7
|
-
ext = ['.js', '.js.erb'] + Array(options.delete(:ext))
|
8
|
-
suffix = options.delete(:suffix)
|
9
|
-
|
10
|
-
asset_filename = "controllers/#{controller_path}/#{action_name}"
|
11
|
-
if suffix
|
12
|
-
asset_filename += ['.', suffix].join
|
13
|
-
end
|
14
|
-
asset_paths = assets_load_path(asset_filename, relative_path: 'app/assets/javascripts', ext: ext)
|
15
|
-
|
16
|
-
pack_filename ||= "javascripts/#{controller_path}/#{action_name}"
|
17
|
-
if suffix
|
18
|
-
pack_filename += ['-', suffix].join
|
19
|
-
end
|
20
|
-
pack_paths = assets_load_path(pack_filename, relative_path: 'app/javascript/packs', ext: ext)
|
21
|
-
|
22
|
-
r = []
|
23
|
-
if asset_paths.any? { |path| File.exist?(path) }
|
24
|
-
r << javascript_include_tag(asset_filename, options)
|
25
|
-
end
|
26
|
-
|
27
|
-
if pack_paths.any? { |path| File.exist?(path) }
|
28
|
-
r << javascript_pack_tag(pack_filename, options)
|
29
|
-
end
|
30
|
-
|
31
|
-
r.join("\n ").html_safe
|
32
|
-
end
|
33
|
-
|
34
|
-
def js_ready(**options)
|
35
|
-
js_load(suffix: 'ready', **options)
|
36
|
-
end
|
37
|
-
|
38
|
-
# Assets path: app/assets/stylesheets/controllers
|
39
|
-
# Packs Path: app/javascript/packs/stylesheets
|
40
|
-
def css_load(**options)
|
41
|
-
ext = ['.css', '.css.erb'] + Array(options.delete(:ext))
|
42
|
-
|
43
|
-
asset_filename = "controllers/#{controller_path}/#{action_name}"
|
44
|
-
asset_paths = assets_load_path(asset_filename, relative_path: 'app/assets/stylesheets', ext: ext )
|
45
|
-
|
46
|
-
pack_filename = "stylesheets/#{controller_path}/#{action_name}"
|
47
|
-
pack_paths = assets_load_path(pack_filename, relative_path: 'app/javascript/packs', ext: ext)
|
48
|
-
|
49
|
-
r = []
|
50
|
-
if asset_paths.any? { |path| File.exist?(path) }
|
51
|
-
r << stylesheet_link_tag(asset_filename, options)
|
52
|
-
end
|
53
|
-
|
54
|
-
if pack_paths.any? { |path| File.exist?(path) }
|
55
|
-
|
56
|
-
begin
|
57
|
-
rs = stylesheet_pack_tag(pack_filename, options)
|
58
|
-
rescue
|
59
|
-
rs = nil
|
60
|
-
end
|
61
|
-
|
62
|
-
if rs.is_a?(String)
|
63
|
-
r << rs
|
64
|
-
else
|
65
|
-
r << javascript_pack_tag(pack_filename, options)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
r.join("\n ").html_safe
|
70
|
-
end
|
71
|
-
|
72
|
-
private
|
73
|
-
def assets_load_path(filename, relative_path:, ext:)
|
74
|
-
paths = []
|
75
|
-
|
76
|
-
file_path = Pathname.new(relative_path).join filename
|
77
|
-
rails_path = Rails.root.join file_path
|
78
|
-
ext.each do |name|
|
79
|
-
paths << rails_path.to_s + name
|
80
|
-
end
|
81
|
-
if @_rendered_from
|
82
|
-
engine_path = @_rendered_from.join file_path
|
83
|
-
ext.each do |name|
|
84
|
-
paths << engine_path.to_s + name
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
paths
|
89
|
-
end
|
90
|
-
|
91
|
-
end
|
@@ -1,79 +0,0 @@
|
|
1
|
-
module StateMachine
|
2
|
-
|
3
|
-
# to defined next_xxx_states in class
|
4
|
-
|
5
|
-
# obj.next_to state: 'xxx'
|
6
|
-
def next_to(options = {}, &block)
|
7
|
-
options.each do |column, value|
|
8
|
-
if self.class.method_defined? "next_#{column}_states"
|
9
|
-
_next_state = self.send("next_#{column}_states").first
|
10
|
-
else
|
11
|
-
_next_state = next_state(column, &block)
|
12
|
-
end
|
13
|
-
|
14
|
-
if _next_state == value.to_s
|
15
|
-
assign_attributes(column => value)
|
16
|
-
else
|
17
|
-
error_msg = "Next state is wrong, should be #{_next_state}"
|
18
|
-
errors.add column, error_msg
|
19
|
-
raise ActiveRecord::Rollback, error_msg
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def next_to!(options = {}, &block)
|
25
|
-
self.next_to(options, &block)
|
26
|
-
self.save!
|
27
|
-
end
|
28
|
-
|
29
|
-
def trigger_to(options = {}, &block)
|
30
|
-
options.each do |column, value|
|
31
|
-
if self.class.method_defined? "next_#{column}_states"
|
32
|
-
_next_states = self.send "next_#{column}_states"
|
33
|
-
else
|
34
|
-
_next_states = next_states(column, &block)
|
35
|
-
end
|
36
|
-
|
37
|
-
if _next_states.include?(value.to_s)
|
38
|
-
assign_attributes(column => value)
|
39
|
-
else
|
40
|
-
error_msg = "Next state is wrong, should be one of #{_next_states.join(', ')}"
|
41
|
-
errors.add column, error_msg
|
42
|
-
raise ActiveRecord::Rollback, error_msg
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def trigger_to!(options = {}, &block)
|
48
|
-
self.trigger_to(options, &block)
|
49
|
-
self.save!
|
50
|
-
end
|
51
|
-
|
52
|
-
def next_state(state_name, &block)
|
53
|
-
next_states(state_name, &block).first
|
54
|
-
end
|
55
|
-
|
56
|
-
# obj.next_states(:state) do |result|
|
57
|
-
# result.reject
|
58
|
-
# end
|
59
|
-
def next_states(state_name, &block)
|
60
|
-
_states = self.class.send(state_name.to_s.pluralize)
|
61
|
-
_states = _states.keys
|
62
|
-
_state = self.send(state_name)
|
63
|
-
|
64
|
-
if _state.nil?
|
65
|
-
next_index = 0
|
66
|
-
else
|
67
|
-
i = _states.index(_state)
|
68
|
-
next_index = i + 1
|
69
|
-
end
|
70
|
-
result = _states[next_index..(_states.size - 1)]
|
71
|
-
|
72
|
-
if block_given?
|
73
|
-
yield block.call(result)
|
74
|
-
else
|
75
|
-
result
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
$('#attachment_<%= @attachment.id %>').remove();
|
@@ -1,48 +0,0 @@
|
|
1
|
-
<div class="ui top attached borderless menu">
|
2
|
-
<div class="header item">Blob Defaults</div>
|
3
|
-
<div class="right menu">
|
4
|
-
<div class="item">
|
5
|
-
<%= link_to 'New Blob Default', new_rails_ext_blob_default_path, class: 'ui teal button' %>
|
6
|
-
</div>
|
7
|
-
</div>
|
8
|
-
</div>
|
9
|
-
|
10
|
-
<div class="ui attached segment">
|
11
|
-
<%= render 'search_form' %>
|
12
|
-
</div>
|
13
|
-
|
14
|
-
<table class="ui bottom attached table">
|
15
|
-
<thead>
|
16
|
-
<tr>
|
17
|
-
<th><%= ActiveStorage::BlobDefault.human_attribute_name(:id) %></th>
|
18
|
-
<th><%= ActiveStorage::BlobDefault.human_attribute_name(:record_class) %></th>
|
19
|
-
<th><%= ActiveStorage::BlobDefault.human_attribute_name(:name) %></th>
|
20
|
-
<th><%= ActiveStorage::BlobDefault.human_attribute_name(:file) %></th>
|
21
|
-
<th></th>
|
22
|
-
<th>Actions</th>
|
23
|
-
</tr>
|
24
|
-
</thead>
|
25
|
-
<tbody>
|
26
|
-
<% @blob_defaults.each do |blob_default| %>
|
27
|
-
<tr>
|
28
|
-
<td><%= blob_default.id %></td>
|
29
|
-
<td><%= blob_default.record_class %></td>
|
30
|
-
<td><%= blob_default.name %></td>
|
31
|
-
<td><%= blob_default.file_blob.key if blob_default.file_blob %></td>
|
32
|
-
<td>
|
33
|
-
<%= render 'active_storage_ext/attachments/list', target: blob_default.file %>
|
34
|
-
</td>
|
35
|
-
<td class="ui labels">
|
36
|
-
<%= link_to edit_rails_ext_blob_default_path(blob_default), data: { tooltip: t('.edit') }, class: 'ui pink mini icon button' do %>
|
37
|
-
<i class="pencil alternate icon"></i>
|
38
|
-
<% end %>
|
39
|
-
<%= link_to rails_ext_blob_default_path(blob_default), method: :delete, data: { tooltip: t('.destroy'), confirm: 'Are you sure?' }, class: 'ui red mini icon button' do %>
|
40
|
-
<i class="times icon"></i>
|
41
|
-
<% end %>
|
42
|
-
</td>
|
43
|
-
</tr>
|
44
|
-
<% end %>
|
45
|
-
</tbody>
|
46
|
-
</table>
|
47
|
-
|
48
|
-
<%= paginate @blob_defaults %>
|
@@ -1,9 +0,0 @@
|
|
1
|
-
<div class="ui segment breadcrumb">
|
2
|
-
<%= link_to 'Back', rails_ext_blob_defaults_path(blob_id: params[:blob_id]), class: 'section' %>
|
3
|
-
<div class="divider"> / </div>
|
4
|
-
<div class="active section">Add</div>
|
5
|
-
</div>
|
6
|
-
|
7
|
-
<div class="ui segment">
|
8
|
-
<%= render 'form' %>
|
9
|
-
</div>
|
@@ -1,9 +0,0 @@
|
|
1
|
-
<%= search_form_with do |f| %>
|
2
|
-
<div class="fields">
|
3
|
-
<%= f.text_field :key, placeholder: ActiveStorage::Blob.human_attribute_name(:key) %>
|
4
|
-
<%= f.text_field :filename, placeholder: ActiveStorage::Blob.human_attribute_name(:filename) %>
|
5
|
-
<%= f.submit 'Search' %>
|
6
|
-
</div>
|
7
|
-
<% end %>
|
8
|
-
|
9
|
-
|
@@ -1 +0,0 @@
|
|
1
|
-
$('#attachment_<%= @attachment.id %>').remove();
|
@@ -1,51 +0,0 @@
|
|
1
|
-
<div class="ui top attached borderless menu">
|
2
|
-
<%= link_to 'All', rails_ext_blobs_path, class: active_helper(action: 'index') %>
|
3
|
-
<%= link_to 'Unattached', unattached_rails_ext_blobs_path, class: active_helper(action: 'unattached') %>
|
4
|
-
<div class="right menu">
|
5
|
-
<div class="item">
|
6
|
-
<%= link_to 'New ActiveStorage::Blob', new_rails_ext_blob_path, class: 'ui teal button' %>
|
7
|
-
</div>
|
8
|
-
</div>
|
9
|
-
</div>
|
10
|
-
|
11
|
-
<div class="ui attached segment">
|
12
|
-
<%= render 'search_form' %>
|
13
|
-
</div>
|
14
|
-
|
15
|
-
<table class="ui bottom attached table">
|
16
|
-
<thead>
|
17
|
-
<tr>
|
18
|
-
<th><%= ActiveStorage::Blob.human_attribute_name(:id) %></th>
|
19
|
-
<th><%= ActiveStorage::Blob.human_attribute_name(:key) %></th>
|
20
|
-
<th><%= ActiveStorage::Blob.human_attribute_name(:filename) %></th>
|
21
|
-
<th><%= ActiveStorage::Blob.human_attribute_name(:content_type) %></th>
|
22
|
-
<th><%= ActiveStorage::Blob.human_attribute_name(:metadata) %></th>
|
23
|
-
<th><%= ActiveStorage::Blob.human_attribute_name(:size) %></th>
|
24
|
-
<th><%= ActiveStorage::Blob.human_attribute_name(:created_at) %></th>
|
25
|
-
<th>Actions</th>
|
26
|
-
</tr>
|
27
|
-
</thead>
|
28
|
-
<tbody>
|
29
|
-
<% @blobs.each do |blob| %>
|
30
|
-
<tr>
|
31
|
-
<td><%= blob.id %></td>
|
32
|
-
<td><%= blob.key %></td>
|
33
|
-
<td><%= blob.filename %></td>
|
34
|
-
<td><%= blob.content_type %></td>
|
35
|
-
<td><%= simple_format(blob.metadata) %></td>
|
36
|
-
<td><%= number_to_human_size(blob.byte_size) %></td>
|
37
|
-
<td><time><%= blob.created_at.to_s(:rfc822) %></time></td>
|
38
|
-
<td class="ui labels">
|
39
|
-
<%= link_to rails_ext_blob_path(blob), method: :delete, data: { tooltip: t('.destroy'), confirm: 'Are you sure?' }, class: 'ui red mini icon button' do %>
|
40
|
-
<i class="times icon"></i>
|
41
|
-
<% end %>
|
42
|
-
<%= link_to rails_ext_audio_path(blob.id), target: '_blank', method: :delete, data: { tooltip: '默认' }, class: 'ui blue mini icon button' do %>
|
43
|
-
<i class="play icon"></i>
|
44
|
-
<% end %>
|
45
|
-
</td>
|
46
|
-
</tr>
|
47
|
-
<% end %>
|
48
|
-
</tbody>
|
49
|
-
</table>
|
50
|
-
|
51
|
-
<%= paginate @blobs %>
|
@@ -1,13 +0,0 @@
|
|
1
|
-
<div class="ui segment breadcrumb">
|
2
|
-
<%= link_to 'Back', rails_ext_blobs_path, class: 'section' %>
|
3
|
-
<div class="divider"> / </div>
|
4
|
-
<div class="active section">Add</div>
|
5
|
-
</div>
|
6
|
-
|
7
|
-
<div class="ui segment">
|
8
|
-
<%= form_with model: @blob, url: rails_ext_blobs_path, local: true do |f| %>
|
9
|
-
<%= render 'shared/error_messages', target: @blob %>
|
10
|
-
<%= f.file_field :io %>
|
11
|
-
<%= f.submit %>
|
12
|
-
<% end %>
|
13
|
-
</div>
|
@@ -1,6 +0,0 @@
|
|
1
|
-
<div class="ui image">
|
2
|
-
<a href="javascript:void(0);" onclick="this.parentNode.remove()" class="ui grey right corner mini label">
|
3
|
-
<i class="times icon"></i>
|
4
|
-
</a>
|
5
|
-
<%= image_tag 'image-square.png', data: { target: 'picture.src' }, style: 'max-width: 100%' %>
|
6
|
-
</div>
|
@@ -1,6 +0,0 @@
|
|
1
|
-
<div class="ui image">
|
2
|
-
<%= link_to rails_ext_attachment_path(image.id), method: :delete, data: {confirm: 'Are you sure?'}, remote: true, class: 'ui grey right corner mini label' do %>
|
3
|
-
<i class="times icon"></i>
|
4
|
-
<% end %>
|
5
|
-
<%= image_tag image, id: "attachment_#{image.id}", data: { target: 'picture.src' }, style: 'max-width: 100%' %>
|
6
|
-
</div>
|
@@ -1,25 +0,0 @@
|
|
1
|
-
<% if target.is_a?(ActiveStorage::Attached::One) && target.attachment.present? %>
|
2
|
-
<% if target.content_type.to_s.start_with?('image') %>
|
3
|
-
<%= image_tag target, style: 'max-width: 100%', class: 'ui small image' %>
|
4
|
-
<% elsif target.content_type.to_s.start_with?('video') %>
|
5
|
-
<%= link_to target.filename, rails_video_path(video), target: '_blank' %>
|
6
|
-
<% else %>
|
7
|
-
<p id="attachment_<%= target.id %>">
|
8
|
-
<%= link_to target.filename, rails_blob_path(target) %>
|
9
|
-
</p>
|
10
|
-
<% end %>
|
11
|
-
<% elsif target.is_a?(ActiveStorage::Attached::Many) %>
|
12
|
-
<% target.each do |file| %>
|
13
|
-
<% if file.content_type.to_s.start_with?('image') %>
|
14
|
-
<%= image_tag file, style: 'max-width: 100%', class: 'ui small image' %>
|
15
|
-
<% elsif file.content_type.to_s.start_with?('video') %>
|
16
|
-
<p id="attachment_<%= file.id %>">
|
17
|
-
<%= link_to file.filename, rails_video_path(file), target: '_blank' %>
|
18
|
-
</p>
|
19
|
-
<% else %>
|
20
|
-
<p id="attachment_<%= file.id %>">
|
21
|
-
<%= link_to file.filename, rails_blob_path(file) %>
|
22
|
-
</p>
|
23
|
-
<% end %>
|
24
|
-
<% end %>
|
25
|
-
<% end %>
|
@@ -1,25 +0,0 @@
|
|
1
|
-
<% if target.is_a?(ActiveStorage::Attached::One) && target.attached? %>
|
2
|
-
<% if target.content_type.to_s.start_with?('image') %>
|
3
|
-
<%= render partial: 'active_storage/attachments/image_item', locals: { image: target } %>
|
4
|
-
<% elsif target.content_type.to_s.start_with?('video') %>
|
5
|
-
<%= render partial: 'active_storage/attachments/video_item', locals: { video: target } %>
|
6
|
-
<% else %>
|
7
|
-
<p id="attachment_<%= target.id %>">
|
8
|
-
<%= link_to target.filename, rails_blob_path(target) %>
|
9
|
-
<%= link_to 'x', rails_attachment_path(target.id), method: :delete, data: {confirm: 'Are you sure?'}, remote: true %>
|
10
|
-
</p>
|
11
|
-
<% end %>
|
12
|
-
<% elsif target.is_a?(ActiveStorage::Attached::Many) %>
|
13
|
-
<% target.each do |file| %>
|
14
|
-
<% if file.content_type.to_s.start_with?('image') %>
|
15
|
-
<%= render partial: 'active_storage/attachments/image_item', locals: { image: file } %>
|
16
|
-
<% elsif file.content_type.to_s.start_with?('video') %>
|
17
|
-
<%= render partial: 'active_storage/attachments/video_item', locals: { video: file } %>
|
18
|
-
<% else %>
|
19
|
-
<p id="attachment_<%= file.id %>">
|
20
|
-
<%= link_to file.filename, rails_blob_path(file) %>
|
21
|
-
<%= link_to 'x', rails_attachment_path(file.id), method: :delete, data: {confirm: 'Are you sure?'}, remote: true %>
|
22
|
-
</p>
|
23
|
-
<% end %>
|
24
|
-
<% end %>
|
25
|
-
<% end %>
|