Module: Hibiki::Rails::Generators::UploadFieldHelpers

Included in:
UploadFieldGenerator
Defined in:
lib/generators/hibiki/rails/upload_field_helpers.rb

Overview

Naming and preflight for hibiki:rails:upload_field. NamedBase carries the owner; everything attachment-shaped is derived here.

The emitted concern's private helpers are attachment-suffixed (update_pending_cover, not update_pending) on purpose: a second run includes a second concern into the same channel, and unsuffixed helpers would override each other with bodies reading different ivars.

Constant Summary collapse

JS_CONTROLLER =
"app/javascript/controllers/upload_field_controller.js"
JS_TEMPLATE =
"upload_field_controller.js.tt"
JS_MANY_MARKER =

What a v1 (one file per pick) copy of the controller lacks.

"for (const file of"
ACCEPT =

The --accept tokens, css_variant-style: validated against this map, with a raw type/subtype or .ext passing through untouched. Office formats are extension lists because their MIME names are unreadable in a view and browsers honor either form.

{
  image: "image/*", audio: "audio/*", video: "video/*",
  pdf: "application/pdf", csv: "text/csv", text: "text/plain",
  doc: ".doc,.docx", xls: ".xls,.xlsx", ppt: ".ppt,.pptx"
}.freeze