0.0
No commit activity in last 3 years
No release in over 3 years
A simple image input for Rails and Active Storage.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 6, < 7
 Project 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