- Rails 7.0.2
- stimulus js
- importmaps
- dropzone.js
- direct upload ActiveStorage
This is simple implementation of technologies in hobby project of mine built in Rails7 where I need direct upload to S3.
This is simple implementation of technologies in hobby project of mine built in Rails7 where I need direct upload to S3.
module WebpackerHelper | |
def page_pack_tags | |
join_paths(application_pack_tags, | |
controller_pack_tags) | |
end | |
def application_pack_tags | |
join_paths(attempt_to_find(:stylesheet, 'application'), | |
attempt_to_find(:javascript, 'application')) | |
end |
class RouteRecognizer | |
attr_reader :paths | |
# To use this inside your app, call: | |
# `RouteRecognizer.new.initial_path_segments` | |
# This returns an array, e.g.: ['assets','blog','team','faq','users'] | |
INITIAL_SEGMENT_REGEX = %r{^\/([^\/\(:]+)} | |
def initialize |
class EventedClass | |
bind: (event, callback) -> | |
@eventHandlers ||= {} | |
@eventHandlers[event] = [] unless @eventHandlers[event]? | |
@eventHandlers[event].push(callback) | |
return true | |
unbind: (event, callback) -> | |
@eventHandlers ||= {} |