https://github.com/andrewkatz/image_input
A simple image input for Rails and Active Storage
https://github.com/andrewkatz/image_input
Last synced: about 1 month ago
JSON representation
A simple image input for Rails and Active Storage
- Host: GitHub
- URL: https://github.com/andrewkatz/image_input
- Owner: andrewkatz
- License: mit
- Created: 2020-11-01T12:57:10.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-01-28T14:47:03.000Z (over 4 years ago)
- Last Synced: 2025-03-18T04:47:42.505Z (about 2 months ago)
- Language: Ruby
- Size: 546 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
# Image Input
A Rails helper for a simple, clean image input for use with Active Storage.
Example usage:
```ruby
class User < ApplicationRecord
has_one_attached :profile_picture
end
``````erb
<%= 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:
```ruby
gem 'image_input'
``````sh
bundle install
yarn add @mainkatz/image-input
```Register Stimulus controller. By default in Rails, this is in `controllers/index.js`.
```js
import ImageInputController from '@mainkatz/dropzone-input';application.register('image-input', ImageInputController);
```## Development
To develop this locally you can update your Gemfile:
```ruby
gem 'image_input', path: 'PATH_TO_PROJECT'
```In this project run:
```sh
yarn link
```In your app project run:
```sh
yarn link @mainkatz/image-input
```To auto-recompile this project, run:
```sh
yarn run dev
```