- 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.
There is a plugin on Strapi Marketplace that do this response transforming stuffs in a more configurable way. Checkout this if you are interested.
<%= form_with(model: team) do |form| %> | |
<div> | |
<%= form.label :name %> | |
<%= form.text_field :name, class: "input" %> | |
</div> | |
<div> | |
<%= f.select :user_id, {}, {placeholder: "Select user"}, {class: "w-full", data: { controller: "select", select_url_value: users_path }} %> | |
</div> |
This script can be used to generate a set of CSS variables from a Tailwind shades object.
Let's say you have the following JavaScript object. You might have generated such an object on a site such as Tailwind Shades.
{
For apps built before the image_processing
gem became the default, the migration will involve two steps:
Before changing from ImageMagick to Vips, it's better to first test the new syntax and ensure everything is still working.
variant(format: :jpg, strip: true, quality: 80)
tailwind_transformer.rb -> app/models/tailwind_transformer.rb | |
tailwind.rb -> config/initializers/tailwind.rb | |
tailwind.config.js.erb -> config/tailwind.config.js.erb | |
package.json -> ./package.json |
import {Modal} from "tailwindcss-stimulus-components" | |
export default class extends Modal { | |
connect(){ | |
this.element[this.identifier] = this | |
this.toggleClass = 'hidden' | |
} | |
} |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Document</title> | |
<link rel="stylesheet" href="./build.css" /> | |
<script src="https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine.min.js" defer></script> | |
</head> | |
<body class="p-12 m-12"> |
<% if flash.any? %> | |
<div class="fixed inset-0 flex items-end justify-center px-4 py-6 pointer-events-none sm:p-6 sm:items-start sm:justify-end z-50" data-flash-notifications='true'> | |
<% flash.each do |msg_type, msg| %> | |
<div x-data="{flashVisible: false, flashType: '<%= msg_type %>'}" x-show='flashVisible' x-init="() => {flashVisible=true; setTimeout(() => {flashVisible=false}, 5000)}" class="max-w-sm w-full bg-white shadow-lg rounded-lg pointer-events-auto" | |
x-transition:enter="transition ease-out duration-300" | |
x-transition:enter-start="translate-y-2 opacity-0 sm:translate-y-0 sm:translate-x-2" | |
x-transition:enter-end="translate-y-0 opacity-100 sm:translate-x-0" | |
x-transition:leave="transition ease-out duration-100" |