This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Rails from '@rails/ujs' | |
const DirectUpload = { | |
start () { | |
document.addEventListener('direct-upload:initialize', DirectUpload.initialize) | |
document.addEventListener('direct-upload:start', DirectUpload.begin) | |
document.addEventListener('direct-upload:progress', DirectUpload.progress) | |
document.addEventListener('direct-upload-error', DirectUpload.error) | |
document.addEventListener('direct-upload:end', DirectUpload.end) | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# After active storage urls are changed, use this to recreate all trix attachments | |
def self.refresh_trixes | |
ActionText::RichText.where.not(body: nil).find_each do |trix| | |
Trix::RefreshJob.perform_later(trix) | |
end | |
end | |
# After active storage urls are changed, use this to recreate a specific strix attachments | |
def self.refresh_trix(trix) | |
return unless trix.embeds.size.positive? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
uninstall() { | |
list=`gem list --no-versions` | |
for gem in $list; do | |
gem uninstall $gem -aIx | |
done | |
gem list | |
gem install bundler | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Remove all drafts from your drafts view | |
// Navigate to drafts | |
// F12 to raise dev console | |
// Paste the below | |
(async function(x) { | |
for (const e of [...document.querySelectorAll('[type="trash"]')]) { | |
e.click(); | |
await new Promise(resolve => setTimeout(resolve, 500)) | |
document.querySelector('[data-qa="drafts_page_draft_delete_confirm"]').click(); | |
await new Promise(resolve => setTimeout(resolve, 1500)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { DirectUpload } from '../rails/activestorage' | |
export default class { | |
constructor (input) { | |
this.input = input | |
this.submit = input.form.querySelector('.btn-submit') // The submit button. We show loading progress here | |
this.progress = this.submit.querySelector('.btn-submit-progress') // The progress bar inside the submit | |
this.loader = this.submit.querySelector('.btn-submit-loader') // The loader animation inside the submit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rake" | |
Rake::Task["assets:precompile"].enhance do | |
assembly = Rails.application.assets | |
output_path = assembly.config.output_path | |
assembly.load_path.assets.each do |asset| | |
asset_path = output_path.join(asset.digested_path) | |
compressed_path = output_path.join(asset.digested_path.to_s + ".br") |
OlderNewer