@mainkatz/image-input
v0.0.7
Published
Javascript counterpart for image_input gem.
Downloads
2
Readme
Image Input
A Rails helper for a simple, clean image input for use with Active Storage.
Example usage:
class User < ApplicationRecord
has_one_attached :profile_picture
end
<%= form_with(model: User.new) do |form| %>
<%= image_input form, :profile_picture %>
<% end %>
NOTE: The styles of this project are constructed using Tailwind CSS.
Installation
Add to your Gemfile:
gem 'image_input'
bundle install
yarn add @mainkatz/image-input
Register Stimulus controller. By default in Rails, this is in controllers/index.js
.
import ImageInputController from '@mainkatz/dropzone-input';
application.register('image-input', ImageInputController);
Development
To develop this locally you can update your Gemfile:
gem 'image_input', path: 'PATH_TO_PROJECT'
In this project run:
yarn link
In your app project run:
yarn link @mainkatz/image-input
To auto-recompile this project, run:
yarn run dev