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
Binary file
|
Binary file
|
@@ -1,29 +0,0 @@
|
|
1
|
-
//= require rails-ujs
|
2
|
-
//= require turbolinks
|
3
|
-
//= require ./time_local
|
4
|
-
//= require_self
|
5
|
-
|
6
|
-
document.addEventListener('DOMContentLoaded', function() {
|
7
|
-
timeForLocalized()
|
8
|
-
});
|
9
|
-
document.addEventListener('ajax:beforeSend', function(event) {
|
10
|
-
var detail = event.detail;
|
11
|
-
var xhr = detail[0];
|
12
|
-
var offset = (new Date).getTimezoneOffset();
|
13
|
-
xhr.setRequestHeader('Utc-Offset', offset);
|
14
|
-
xhr.setRequestHeader('X-Csp-Nonce', Rails.cspNonce())
|
15
|
-
});
|
16
|
-
|
17
|
-
document.addEventListener('turbolinks:load', function() {
|
18
|
-
timeForLocalized()
|
19
|
-
});
|
20
|
-
document.addEventListener('turbolinks:visit', function() {
|
21
|
-
timeForLocalized()
|
22
|
-
});
|
23
|
-
document.addEventListener('turbolinks:request-start', function(event) {
|
24
|
-
var xhr = event.data.xhr;
|
25
|
-
var offset = (new Date).getTimezoneOffset();
|
26
|
-
xhr.setRequestHeader('Utc-Offset', offset);
|
27
|
-
xhr.setRequestHeader('X-Csp-Nonce', Rails.cspNonce())
|
28
|
-
});
|
29
|
-
|
@@ -1,421 +0,0 @@
|
|
1
|
-
/* jslint newcap: true */
|
2
|
-
/* global XMLHttpRequest: false, FormData: false */
|
3
|
-
|
4
|
-
/*
|
5
|
-
* Input Field with Attachment
|
6
|
-
* based on https://github.com/Rovak/inlineAttachment/blob/master/LICENSE
|
7
|
-
*/
|
8
|
-
|
9
|
-
(function(document, window) {
|
10
|
-
'use strict';
|
11
|
-
|
12
|
-
var InputAttachment = function(options) {
|
13
|
-
this.settings = Object.assign(InputAttachment.defaults, options);
|
14
|
-
this.editor = this.settings['editor'];
|
15
|
-
this.filenameTag = '{filename}';
|
16
|
-
this.lastValue = null;
|
17
|
-
};
|
18
|
-
|
19
|
-
/**
|
20
|
-
* Default configuration options
|
21
|
-
*
|
22
|
-
* @type {Object}
|
23
|
-
*/
|
24
|
-
InputAttachment.defaults = {
|
25
|
-
/**
|
26
|
-
* URL where the file will be send
|
27
|
-
*/
|
28
|
-
uploadUrl: 'upload_attachment.php',
|
29
|
-
|
30
|
-
/**
|
31
|
-
* Which method will be used to send the file to the upload URL
|
32
|
-
*/
|
33
|
-
uploadMethod: 'POST',
|
34
|
-
|
35
|
-
/**
|
36
|
-
* Name in which the file will be placed
|
37
|
-
*/
|
38
|
-
uploadFieldName: 'file',
|
39
|
-
|
40
|
-
uploadFileInput: '',
|
41
|
-
|
42
|
-
templateDiv: 'file_template',
|
43
|
-
|
44
|
-
/**
|
45
|
-
* Extension which will be used when a file extension could not
|
46
|
-
* be detected
|
47
|
-
*/
|
48
|
-
defaultExtension: 'png',
|
49
|
-
|
50
|
-
/**
|
51
|
-
* JSON field which refers to the uploaded file URL
|
52
|
-
*/
|
53
|
-
jsonFieldName: 'filename',
|
54
|
-
|
55
|
-
/**
|
56
|
-
* Allowed MIME types
|
57
|
-
*/
|
58
|
-
allowedTypes: [
|
59
|
-
'image/jpeg',
|
60
|
-
'image/png',
|
61
|
-
'image/jpg',
|
62
|
-
'image/gif'
|
63
|
-
],
|
64
|
-
|
65
|
-
/**
|
66
|
-
* Text which will be inserted when dropping or pasting a file.
|
67
|
-
* Acts as a placeholder which will be replaced when the file is done with uploading
|
68
|
-
*/
|
69
|
-
progressText: '![Uploading file...]()',
|
70
|
-
|
71
|
-
/**
|
72
|
-
* When a file has successfully been uploaded the progressText
|
73
|
-
* will be replaced by the urlText, the {filename} tag will be replaced
|
74
|
-
* by the filename that has been returned by the server
|
75
|
-
*/
|
76
|
-
urlText: "![file]({filename})",
|
77
|
-
|
78
|
-
/**
|
79
|
-
* Text which will be used when uploading has failed
|
80
|
-
*/
|
81
|
-
errorText: 'Error uploading file',
|
82
|
-
|
83
|
-
/**
|
84
|
-
* Extra parameters which will be send when uploading a file
|
85
|
-
*/
|
86
|
-
extraParams: {},
|
87
|
-
|
88
|
-
/**
|
89
|
-
* Extra headers which will be send when uploading a file
|
90
|
-
*/
|
91
|
-
extraHeaders: {},
|
92
|
-
|
93
|
-
/**
|
94
|
-
* Before the file is send
|
95
|
-
*/
|
96
|
-
beforeFileUpload: function() {
|
97
|
-
return true;
|
98
|
-
},
|
99
|
-
|
100
|
-
/**
|
101
|
-
* Triggers when a file is dropped or pasted
|
102
|
-
*/
|
103
|
-
onFileReceived: function() {
|
104
|
-
|
105
|
-
},
|
106
|
-
|
107
|
-
/**
|
108
|
-
* Custom upload handler
|
109
|
-
*
|
110
|
-
* @return {Boolean} when false is returned it will prevent default upload behavior
|
111
|
-
*/
|
112
|
-
onFileUploadResponse: function() {
|
113
|
-
return true;
|
114
|
-
},
|
115
|
-
|
116
|
-
/**
|
117
|
-
* Custom error handler. Runs after removing the placeholder text and before the alert().
|
118
|
-
* Return false from this function to prevent the alert dialog.
|
119
|
-
*
|
120
|
-
* @return {Boolean} when false is returned it will prevent default error behavior
|
121
|
-
*/
|
122
|
-
onFileUploadError: function() {
|
123
|
-
return true;
|
124
|
-
},
|
125
|
-
|
126
|
-
/**
|
127
|
-
* When a file has successfully been uploaded
|
128
|
-
*/
|
129
|
-
onFileUploaded: function() {}
|
130
|
-
};
|
131
|
-
|
132
|
-
/**
|
133
|
-
* Uploads the blob
|
134
|
-
*
|
135
|
-
* @param {Blob} file blob data received from event.dataTransfer object
|
136
|
-
* @return {XMLHttpRequest} request object which sends the file
|
137
|
-
*/
|
138
|
-
InputAttachment.prototype.uploadFile = function(file) {
|
139
|
-
var me = this,
|
140
|
-
formData = new FormData(),
|
141
|
-
xhr = new XMLHttpRequest(),
|
142
|
-
settings = this.settings,
|
143
|
-
extension = settings.defaultExtension || settings.defualtExtension;
|
144
|
-
|
145
|
-
if (typeof settings.setupFormData === 'function') {
|
146
|
-
settings.setupFormData(formData, file);
|
147
|
-
}
|
148
|
-
|
149
|
-
// Attach the file. If coming from clipboard, add a default filename (only works in Chrome for now)
|
150
|
-
// http://stackoverflow.com/questions/6664967/how-to-give-a-blob-uploaded-as-formdata-a-file-name
|
151
|
-
if (file.name) {
|
152
|
-
var fileNameMatches = file.name.match(/\.(.+)$/);
|
153
|
-
if (fileNameMatches) {
|
154
|
-
extension = fileNameMatches[1];
|
155
|
-
}
|
156
|
-
}
|
157
|
-
|
158
|
-
var remoteFilename = 'image-' + Date.now() + '.' + extension;
|
159
|
-
if (typeof settings.remoteFilename === 'function') {
|
160
|
-
remoteFilename = settings.remoteFilename(file);
|
161
|
-
}
|
162
|
-
|
163
|
-
formData.append(settings.uploadFieldName, file, remoteFilename);
|
164
|
-
|
165
|
-
// Append the extra parameters to the form data
|
166
|
-
if (typeof settings.extraParams === 'object') {
|
167
|
-
for (var key in settings.extraParams) {
|
168
|
-
if (settings.extraParams.hasOwnProperty(key)) {
|
169
|
-
formData.append(key, settings.extraParams[key]);
|
170
|
-
}
|
171
|
-
}
|
172
|
-
}
|
173
|
-
|
174
|
-
xhr.open('POST', settings.uploadUrl);
|
175
|
-
|
176
|
-
// Add any available extra headers
|
177
|
-
if (typeof settings.extraHeaders === 'object') {
|
178
|
-
for (var header in settings.extraHeaders) {
|
179
|
-
if (settings.extraHeaders.hasOwnProperty(header)) {
|
180
|
-
xhr.setRequestHeader(header, settings.extraHeaders[header]);
|
181
|
-
}
|
182
|
-
}
|
183
|
-
}
|
184
|
-
|
185
|
-
xhr.onload = function() {
|
186
|
-
// If HTTP status is OK or Created
|
187
|
-
if (xhr.status === 200 || xhr.status === 201) {
|
188
|
-
me.onFileUploadResponse(xhr);
|
189
|
-
} else {
|
190
|
-
me.onFileUploadError(xhr);
|
191
|
-
}
|
192
|
-
};
|
193
|
-
if (settings.beforeFileUpload(xhr) !== false) {
|
194
|
-
xhr.send(formData);
|
195
|
-
}
|
196
|
-
return xhr;
|
197
|
-
};
|
198
|
-
|
199
|
-
InputAttachment.prototype.previewFile = function(file, previewDiv) {
|
200
|
-
var fileList = document.getElementById(previewDiv);
|
201
|
-
var templateDiv = document.getElementById(this.settings.templateDiv);
|
202
|
-
var template = document.createElement('template');
|
203
|
-
fileList.querySelectorAll('[data-preview=true]').forEach(e => e.parentNode.removeChild(e));
|
204
|
-
template.innerHTML = templateDiv.outerHTML.trim();
|
205
|
-
var img_div = template.content.firstChild;
|
206
|
-
img_div.style.display = 'inline-block';
|
207
|
-
img_div.dataset['preview'] = true;
|
208
|
-
img_div.id = null;
|
209
|
-
var img = img_div.lastElementChild;
|
210
|
-
|
211
|
-
img.src = window.URL.createObjectURL(file); //创建一个object URL,并不是你的本地路径
|
212
|
-
img.onload = function(e) {
|
213
|
-
window.URL.revokeObjectURL(this.src); //图片加载后,释放object URL
|
214
|
-
};
|
215
|
-
|
216
|
-
fileList.appendChild(img_div);
|
217
|
-
};
|
218
|
-
|
219
|
-
/**
|
220
|
-
* Returns if the given file is allowed to handle
|
221
|
-
*
|
222
|
-
* @param {File} file clipboard data file
|
223
|
-
*/
|
224
|
-
InputAttachment.prototype.isFileAllowed = function(file) {
|
225
|
-
if (file.kind === 'string') { return false; }
|
226
|
-
if (this.settings.allowedTypes.indexOf('*') === 0){
|
227
|
-
return true;
|
228
|
-
} else {
|
229
|
-
return this.settings.allowedTypes.indexOf(file.type) >= 0;
|
230
|
-
}
|
231
|
-
};
|
232
|
-
|
233
|
-
/**
|
234
|
-
* Handles upload response
|
235
|
-
*
|
236
|
-
* @param {XMLHttpRequest} xhr
|
237
|
-
* @return {void}
|
238
|
-
*/
|
239
|
-
InputAttachment.prototype.onFileUploadResponse = function(xhr) {
|
240
|
-
if (this.settings.onFileUploadResponse.call(this, xhr) !== false) {
|
241
|
-
var result = JSON.parse(xhr.responseText),
|
242
|
-
filename = result[this.settings.jsonFieldName];
|
243
|
-
|
244
|
-
if (result && filename) {
|
245
|
-
var newValue;
|
246
|
-
if (typeof this.settings.urlText === 'function') {
|
247
|
-
newValue = this.settings.urlText.call(this, filename, result);
|
248
|
-
} else {
|
249
|
-
newValue = this.settings.urlText.replace(this.filenameTag, filename);
|
250
|
-
}
|
251
|
-
this.editor.value.replace(this.lastValue, newValue);
|
252
|
-
this.settings.onFileUploaded.call(this, filename, result);
|
253
|
-
}
|
254
|
-
}
|
255
|
-
};
|
256
|
-
|
257
|
-
|
258
|
-
/**
|
259
|
-
* Called when a file has failed to upload
|
260
|
-
*
|
261
|
-
* @param {XMLHttpRequest} xhr
|
262
|
-
* @return {void}
|
263
|
-
*/
|
264
|
-
InputAttachment.prototype.onFileUploadError = function(xhr) {
|
265
|
-
if (this.settings.onFileUploadError.call(this, xhr) !== false) {
|
266
|
-
this.editor.value.replace(this.lastValue, '');
|
267
|
-
}
|
268
|
-
};
|
269
|
-
|
270
|
-
/**
|
271
|
-
* Called when a file has been inserted, either by drop or paste
|
272
|
-
*
|
273
|
-
* @param {File} file
|
274
|
-
* @return {void}
|
275
|
-
*/
|
276
|
-
InputAttachment.prototype.onFileInserted = function(file) {
|
277
|
-
if (this.settings.onFileReceived.call(this, file) !== false) {
|
278
|
-
this.lastValue = this.settings.progressText;
|
279
|
-
|
280
|
-
var scrollPos = el.scrollTop;
|
281
|
-
el.value = this.lastValue;
|
282
|
-
el.scrollTop = scrollPos;
|
283
|
-
}
|
284
|
-
};
|
285
|
-
|
286
|
-
/**
|
287
|
-
* Called when a paste event occurred
|
288
|
-
* @param {Event} e
|
289
|
-
* @return {Boolean} if the event was handled
|
290
|
-
*/
|
291
|
-
InputAttachment.prototype.onPaste = function(e) {
|
292
|
-
var result = false,
|
293
|
-
clipboardData = e.clipboardData,
|
294
|
-
items;
|
295
|
-
|
296
|
-
if (typeof clipboardData === 'object') {
|
297
|
-
items = clipboardData.items || clipboardData.files || [];
|
298
|
-
|
299
|
-
for (var i = 0; i < items.length; i++) {
|
300
|
-
var item = items[i];
|
301
|
-
if (this.isFileAllowed(item)) {
|
302
|
-
result = true;
|
303
|
-
this.onFileInserted(item.getAsFile());
|
304
|
-
this.uploadFile(item.getAsFile());
|
305
|
-
}
|
306
|
-
}
|
307
|
-
}
|
308
|
-
|
309
|
-
if (result) { e.preventDefault(); }
|
310
|
-
|
311
|
-
return result;
|
312
|
-
};
|
313
|
-
|
314
|
-
/**
|
315
|
-
* Called when a drop event occurs
|
316
|
-
* @param {Event} e
|
317
|
-
* @return {Boolean} if the event was handled
|
318
|
-
*/
|
319
|
-
InputAttachment.prototype.onDrop = function(e) {
|
320
|
-
var result = false;
|
321
|
-
for (var i = 0; i < e.dataTransfer.files.length; i++) {
|
322
|
-
var file = e.dataTransfer.files[i];
|
323
|
-
if (this.isFileAllowed(file)) {
|
324
|
-
result = true;
|
325
|
-
this.onFileInserted(file);
|
326
|
-
this.uploadFile(file);
|
327
|
-
}
|
328
|
-
}
|
329
|
-
|
330
|
-
return result;
|
331
|
-
};
|
332
|
-
|
333
|
-
InputAttachment.prototype.onFileInputChange = function(e) {
|
334
|
-
var result = false;
|
335
|
-
for (var i = 0; i < e.target.files.length; i++) {
|
336
|
-
var file = e.target.files[i];
|
337
|
-
if (this.isFileAllowed(file)) {
|
338
|
-
result = true;
|
339
|
-
this.uploadFile(file);
|
340
|
-
}
|
341
|
-
}
|
342
|
-
|
343
|
-
return result;
|
344
|
-
};
|
345
|
-
|
346
|
-
InputAttachment.prototype.imagePreview = function(e, previewDiv){
|
347
|
-
var result = false;
|
348
|
-
|
349
|
-
for (var i = 0; i < e.target.files.length; i++) {
|
350
|
-
var file = e.target.files[i];
|
351
|
-
if (this.isFileAllowed(file)) {
|
352
|
-
result = true;
|
353
|
-
this.previewFile(file, previewDiv);
|
354
|
-
}
|
355
|
-
}
|
356
|
-
|
357
|
-
return result;
|
358
|
-
};
|
359
|
-
|
360
|
-
InputAttachment.prototype.onFileInputClick = function(e) {
|
361
|
-
console.log('fileInputClick', e)
|
362
|
-
};
|
363
|
-
|
364
|
-
window.InputAttachment = InputAttachment;
|
365
|
-
|
366
|
-
function attachToInput(options) {
|
367
|
-
options = options || {};
|
368
|
-
var input = document.getElementById(options['input']);
|
369
|
-
var fileInput = document.getElementById(options['fileInput']);
|
370
|
-
options['editor'] = input;
|
371
|
-
options['fileInput'] = fileInput;
|
372
|
-
var inlineAttach = new InputAttachment(options);
|
373
|
-
|
374
|
-
if (input) {
|
375
|
-
input.addEventListener('paste', function(e) {
|
376
|
-
inlineAttach.onPaste(e);
|
377
|
-
}, false);
|
378
|
-
|
379
|
-
input.addEventListener('drop', function(e) {
|
380
|
-
e.stopPropagation();
|
381
|
-
e.preventDefault();
|
382
|
-
inlineAttach.onDrop(e);
|
383
|
-
}, false);
|
384
|
-
|
385
|
-
input.addEventListener('dragenter', function(e) {
|
386
|
-
e.stopPropagation();
|
387
|
-
e.preventDefault();
|
388
|
-
}, false);
|
389
|
-
|
390
|
-
input.addEventListener('dragover', function(e) {
|
391
|
-
e.stopPropagation();
|
392
|
-
e.preventDefault();
|
393
|
-
}, false);
|
394
|
-
}
|
395
|
-
if (fileInput) {
|
396
|
-
fileInput.addEventListener('click', function(e) {
|
397
|
-
inlineAttach.onFileInputClick(e)
|
398
|
-
}, false);
|
399
|
-
|
400
|
-
fileInput.addEventListener('change', function(e) {
|
401
|
-
inlineAttach.onFileInputChange(e)
|
402
|
-
}, false);
|
403
|
-
}
|
404
|
-
}
|
405
|
-
|
406
|
-
function attachToPreview(options) {
|
407
|
-
options = options || {};
|
408
|
-
var fileInput = document.getElementById(options['fileInput']);
|
409
|
-
options['fileInput'] = fileInput;
|
410
|
-
var inlineAttach = new InputAttachment(options);
|
411
|
-
|
412
|
-
if (fileInput) {
|
413
|
-
fileInput.addEventListener('change', function(e) {
|
414
|
-
inlineAttach.imagePreview(e, options['previewDiv'])
|
415
|
-
}, false);
|
416
|
-
}
|
417
|
-
}
|
418
|
-
|
419
|
-
window.attachToInput = attachToInput;
|
420
|
-
window.attachToPreview = attachToPreview;
|
421
|
-
})(document, window);
|
@@ -1,59 +0,0 @@
|
|
1
|
-
function listenCheckedIds(name) {
|
2
|
-
var checked = 'input[name=' + name + ']';
|
3
|
-
var add_ids = [];
|
4
|
-
var remove_ids = [];
|
5
|
-
var index;
|
6
|
-
window.sessionStorage.setItem(name + '_add_ids', []);
|
7
|
-
window.sessionStorage.setItem(name + '_remove_ids', []);
|
8
|
-
|
9
|
-
$(checked).change(function(){
|
10
|
-
if (this.checked && this.checked !== this.defaultChecked) {
|
11
|
-
add_ids.push(this.value)
|
12
|
-
} else if (this.checked && this.checked === this.defaultChecked) {
|
13
|
-
index = remove_ids.indexOf(this.value);
|
14
|
-
remove_ids.splice(index, 1);
|
15
|
-
} else if (!this.checked && this.checked !== this.defaultChecked) {
|
16
|
-
remove_ids.push(this.value)
|
17
|
-
} else if (!this.checked && this.checked === this.defaultChecked) {
|
18
|
-
index = add_ids.indexOf(this.value);
|
19
|
-
add_ids.splice(index, 1);
|
20
|
-
}
|
21
|
-
window.sessionStorage.setItem(name + '_remove_ids', remove_ids);
|
22
|
-
window.sessionStorage.setItem(name + '_add_ids', add_ids);
|
23
|
-
})
|
24
|
-
}
|
25
|
-
|
26
|
-
function getAddIds(name){
|
27
|
-
add_str = window.sessionStorage.getItem(name + '_add_ids');
|
28
|
-
return add_str;
|
29
|
-
}
|
30
|
-
|
31
|
-
function getRemoveIds(name){
|
32
|
-
remove_str = window.sessionStorage.getItem(name + '_remove_ids');
|
33
|
-
return remove_str
|
34
|
-
}
|
35
|
-
|
36
|
-
function toggleAll(source, name) {
|
37
|
-
var checkboxes = document.getElementsByName(name);
|
38
|
-
var add_ids = [];
|
39
|
-
var remove_ids = [];
|
40
|
-
var index;
|
41
|
-
|
42
|
-
for(checkbox of checkboxes) {
|
43
|
-
checkbox.checked = source.checked;
|
44
|
-
if (checkbox.checked && checkbox.checked !== checkbox.defaultChecked) {
|
45
|
-
add_ids.push(checkbox.value)
|
46
|
-
} else if (checkbox.checked && checkbox.checked === checkbox.defaultChecked) {
|
47
|
-
index = remove_ids.indexOf(checkbox.value);
|
48
|
-
remove_ids.splice(index, 1);
|
49
|
-
} else if (!checkbox.checked && checkbox.checked !== checkbox.defaultChecked) {
|
50
|
-
remove_ids.push(checkbox.value)
|
51
|
-
} else if (!checkbox.checked && checkbox.checked === checkbox.defaultChecked) {
|
52
|
-
index = add_ids.indexOf(checkbox.value);
|
53
|
-
add_ids.splice(index, 1);
|
54
|
-
}
|
55
|
-
}
|
56
|
-
|
57
|
-
window.sessionStorage.setItem(name + '_remove_ids', remove_ids);
|
58
|
-
window.sessionStorage.setItem(name + '_add_ids', add_ids);
|
59
|
-
}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
function fetch_xhr_script(url, params){
|
2
|
-
var default_params = {
|
3
|
-
credentials: 'include',
|
4
|
-
headers: {
|
5
|
-
Accept: 'application/javascript',
|
6
|
-
'X-CSRF-Token': document.head.querySelector("[name=csrf-token]").content
|
7
|
-
}
|
8
|
-
};
|
9
|
-
var _params = Object.assign(default_params, params);
|
10
|
-
|
11
|
-
fetch(url, _params).then(function(response) {
|
12
|
-
return response.text();
|
13
|
-
}).then(function(text) {
|
14
|
-
var script = document.createElement('script');
|
15
|
-
script.setAttribute('nonce', Rails.cspNonce());
|
16
|
-
script.text = text;
|
17
|
-
document.head.appendChild(script).parentNode.removeChild(script);
|
18
|
-
}).catch(function(ex) {
|
19
|
-
console.log('parsing failed', ex);
|
20
|
-
})
|
21
|
-
}
|
22
|
-
|
23
|
-
function remote_js_load(paths) {
|
24
|
-
for (i = 0; i < paths.length; i++) {
|
25
|
-
Rails.ajax({
|
26
|
-
url: paths[i],
|
27
|
-
type: 'GET',
|
28
|
-
dataType: 'script'
|
29
|
-
})
|
30
|
-
}
|
31
|
-
}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
$('.message .close').on('click', function() {
|
2
|
-
$(this).closest('.message').fadeOut();
|
3
|
-
});
|
4
|
-
$('.ui.toggle.checkbox').checkbox();
|
5
|
-
document.querySelectorAll('input[data-submit="true"]').forEach(function (el) {
|
6
|
-
el.addEventListener('change', function () {
|
7
|
-
this.dataset['params'] = this.name + '=' + this.checked;
|
8
|
-
});
|
9
|
-
});
|
@@ -1,18 +0,0 @@
|
|
1
|
-
//= require ./attachment
|
2
|
-
//= require stimulus
|
3
|
-
|
4
|
-
class PictureController extends Stimulus.Controller {
|
5
|
-
greet() {
|
6
|
-
console.log('Hellos, Stimulus!', this.element)
|
7
|
-
}
|
8
|
-
|
9
|
-
connect() {
|
10
|
-
console.log('Connects, Stimulus!', this.element)
|
11
|
-
attachToPreview({
|
12
|
-
fileInput: 'picture_file'
|
13
|
-
});
|
14
|
-
}
|
15
|
-
}
|
16
|
-
PictureController.targets = ['src']
|
17
|
-
const application = Stimulus.Application.start()
|
18
|
-
application.register('picture', PictureController)
|
@@ -1,40 +0,0 @@
|
|
1
|
-
function sidebarSide1() {
|
2
|
-
$('.ui.side').addClass('invisible');
|
3
|
-
$('.ui.side .ui.menu').removeClass('accordion');
|
4
|
-
$('.ui.side .ui.menu').addClass('icon');
|
5
|
-
$('.ui.side .ui.menu .dropdown.icon').remove();
|
6
|
-
$('.ui.side .ui.menu .item:not(.header)').addClass('ui dropdown');
|
7
|
-
$('.ui.dropdown.item').dropdown({on: 'hover'});
|
8
|
-
$('.ui.side .ui.menu .item:not(.header)').removeClass('hidden');
|
9
|
-
}
|
10
|
-
|
11
|
-
function sidebarSide2() {
|
12
|
-
$('.ui.side').removeClass('invisible');
|
13
|
-
$('.ui.side .ui.menu').addClass('accordion');
|
14
|
-
$('.ui.side .ui.menu').removeClass('icon');
|
15
|
-
$('.ui.side .ui.menu .item:not(.header)').removeClass('ui dropdown');
|
16
|
-
$('.ui.side .ui.menu .dropdown.icon').remove();
|
17
|
-
$('.ui.side .ui.menu .title').append('<i class="dropdown icon"></i>');
|
18
|
-
$('.ui.accordion').accordion({selector: {trigger: '.title'}});
|
19
|
-
$('.ui.side .ui.menu .item:not(.header)').dropdown('destroy');
|
20
|
-
}
|
21
|
-
|
22
|
-
document.addEventListener('turbolinks:load', function(){
|
23
|
-
|
24
|
-
$('#close_side').click(function() {
|
25
|
-
if ($('.ui.side').hasClass('invisible')) {
|
26
|
-
window.localStorage.setItem('invisible', 'false');
|
27
|
-
sidebarSide2();
|
28
|
-
} else {
|
29
|
-
window.localStorage.setItem('invisible', 'true');
|
30
|
-
sidebarSide1();
|
31
|
-
}
|
32
|
-
});
|
33
|
-
|
34
|
-
if (localStorage.getItem('invisible') === 'true') {
|
35
|
-
sidebarSide1();
|
36
|
-
} else {
|
37
|
-
sidebarSide2();
|
38
|
-
}
|
39
|
-
|
40
|
-
});
|
@@ -1,9 +0,0 @@
|
|
1
|
-
function timeForLocalized(){
|
2
|
-
$('time[data-localized!="true"]').each(function(){
|
3
|
-
if (this.textContent.length > 0) {
|
4
|
-
var format = this.dataset['format'] || 'YYYY-MM-DD HH:mm:ss';
|
5
|
-
this.textContent = moment.utc(this.textContent).local().format(format);
|
6
|
-
this.dataset['localized'] = 'true'
|
7
|
-
}
|
8
|
-
})
|
9
|
-
}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class ActiveStorageExt::Admin::AttachmentsController < ActiveStorageExt::Admin::BaseController
|
2
|
-
before_action :set_attachment, only: [:destroy]
|
3
|
-
|
4
|
-
def destroy
|
5
|
-
@attachment.purge
|
6
|
-
end
|
7
|
-
|
8
|
-
private
|
9
|
-
def set_attachment
|
10
|
-
@attachment = ActiveStorage::Attachment.find(params[:id])
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|