x_11_file_import_via_plugin #65
11 changed files with 94 additions and 11 deletions
|
@ -49,9 +49,10 @@ RUN export DATABASE_URL=mysql2://localhost/temp?encoding=utf8 && \
|
||||||
rm -Rf /var/lib/apt/lists/* /var/cache/apt/*
|
rm -Rf /var/lib/apt/lists/* /var/cache/apt/*
|
||||||
|
|
||||||
# Make relevant dirs and files writable for app user
|
# Make relevant dirs and files writable for app user
|
||||||
RUN mkdir -p tmp && \
|
RUN mkdir -p tmp storage && \
|
||||||
chown nobody config/app_config.yml && \
|
chown nobody config/app_config.yml && \
|
||||||
chown nobody tmp
|
chown nobody tmp && \
|
||||||
|
chown nobody storage
|
||||||
|
|
||||||
# Run app as unprivileged user
|
# Run app as unprivileged user
|
||||||
USER nobody
|
USER nobody
|
||||||
|
|
6
Gemfile
6
Gemfile
|
@ -49,6 +49,8 @@ gem 'whenever', require: false # For defining cronjobs, see config/schedule.rb
|
||||||
gem 'exception_notification'
|
gem 'exception_notification'
|
||||||
gem 'gaffe'
|
gem 'gaffe'
|
||||||
gem 'hashie', '~> 3.4.6', require: false # https://github.com/westfieldlabs/apivore/issues/114
|
gem 'hashie', '~> 3.4.6', require: false # https://github.com/westfieldlabs/apivore/issues/114
|
||||||
|
gem "image_processing", "~> 1.12"
|
||||||
|
gem "importmap-rails", "~> 1.1"
|
||||||
gem 'midi-smtp-server'
|
gem 'midi-smtp-server'
|
||||||
gem 'mime-types'
|
gem 'mime-types'
|
||||||
gem 'recurring_select', git: 'https://github.com/gregschmit/recurring_select'
|
gem 'recurring_select', git: 'https://github.com/gregschmit/recurring_select'
|
||||||
|
@ -58,6 +60,7 @@ gem 'rswag-api'
|
||||||
gem 'rswag-ui'
|
gem 'rswag-ui'
|
||||||
gem 'ruby-filemagic'
|
gem 'ruby-filemagic'
|
||||||
gem 'spreadsheet'
|
gem 'spreadsheet'
|
||||||
|
gem "terser", "~> 1.1"
|
||||||
|
|
||||||
# we use the git version of acts_as_versioned, and need to include it in this Gemfile
|
# we use the git version of acts_as_versioned, and need to include it in this Gemfile
|
||||||
gem 'acts_as_versioned', git: 'https://github.com/technoweenie/acts_as_versioned.git'
|
gem 'acts_as_versioned', git: 'https://github.com/technoweenie/acts_as_versioned.git'
|
||||||
|
@ -122,6 +125,3 @@ group :test do
|
||||||
# api
|
# api
|
||||||
gem 'rswag-specs'
|
gem 'rswag-specs'
|
||||||
end
|
end
|
||||||
|
|
||||||
gem "importmap-rails", "~> 1.1"
|
|
||||||
gem "terser", "~> 1.1"
|
|
||||||
|
|
13
Gemfile.lock
13
Gemfile.lock
|
@ -254,6 +254,9 @@ GEM
|
||||||
i18n-spec (0.6.0)
|
i18n-spec (0.6.0)
|
||||||
iso
|
iso
|
||||||
ice_cube (0.16.4)
|
ice_cube (0.16.4)
|
||||||
|
image_processing (1.12.2)
|
||||||
|
mini_magick (>= 4.9.5, < 5)
|
||||||
|
ruby-vips (>= 2.0.17, < 3)
|
||||||
importmap-rails (1.1.5)
|
importmap-rails (1.1.5)
|
||||||
actionpack (>= 6.0.0)
|
actionpack (>= 6.0.0)
|
||||||
railties (>= 6.0.0)
|
railties (>= 6.0.0)
|
||||||
|
@ -320,8 +323,8 @@ GEM
|
||||||
mime-types (3.4.1)
|
mime-types (3.4.1)
|
||||||
mime-types-data (~> 3.2015)
|
mime-types-data (~> 3.2015)
|
||||||
mime-types-data (3.2022.0105)
|
mime-types-data (3.2022.0105)
|
||||||
|
mini_magick (4.12.0)
|
||||||
mini_mime (1.1.2)
|
mini_mime (1.1.2)
|
||||||
mini_portile2 (2.8.2)
|
|
||||||
minitest (5.18.0)
|
minitest (5.18.0)
|
||||||
mono_logger (1.1.1)
|
mono_logger (1.1.1)
|
||||||
msgpack (1.6.0)
|
msgpack (1.6.0)
|
||||||
|
@ -339,9 +342,6 @@ GEM
|
||||||
net-smtp (0.3.3)
|
net-smtp (0.3.3)
|
||||||
net-protocol
|
net-protocol
|
||||||
nio4r (2.5.8)
|
nio4r (2.5.8)
|
||||||
nokogiri (1.15.2)
|
|
||||||
mini_portile2 (~> 2.8.2)
|
|
||||||
racc (~> 1.4)
|
|
||||||
nokogiri (1.15.2-x86_64-linux)
|
nokogiri (1.15.2-x86_64-linux)
|
||||||
racc (~> 1.4)
|
racc (~> 1.4)
|
||||||
parallel (1.23.0)
|
parallel (1.23.0)
|
||||||
|
@ -499,6 +499,8 @@ GEM
|
||||||
ruby-prof (1.4.5)
|
ruby-prof (1.4.5)
|
||||||
ruby-progressbar (1.13.0)
|
ruby-progressbar (1.13.0)
|
||||||
ruby-units (3.0.0)
|
ruby-units (3.0.0)
|
||||||
|
ruby-vips (2.1.4)
|
||||||
|
ffi (~> 1.12)
|
||||||
ruby2_keywords (0.0.5)
|
ruby2_keywords (0.0.5)
|
||||||
rubyzip (2.3.2)
|
rubyzip (2.3.2)
|
||||||
sass-rails (6.0.0)
|
sass-rails (6.0.0)
|
||||||
|
@ -635,6 +637,7 @@ DEPENDENCIES
|
||||||
i18n-js (~> 3.0.0.rc8)
|
i18n-js (~> 3.0.0.rc8)
|
||||||
i18n-spec
|
i18n-spec
|
||||||
ice_cube
|
ice_cube
|
||||||
|
image_processing (~> 1.12)
|
||||||
importmap-rails (~> 1.1)
|
importmap-rails (~> 1.1)
|
||||||
inherited_resources
|
inherited_resources
|
||||||
jquery-rails
|
jquery-rails
|
||||||
|
@ -692,4 +695,4 @@ DEPENDENCIES
|
||||||
whenever
|
whenever
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.4.13
|
2.4.5
|
||||||
|
|
31
app/assets/stylesheets/actiontext.css
Normal file
31
app/assets/stylesheets/actiontext.css
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* Provides a drop-in pointer for the default Trix stylesheet that will format the toolbar and
|
||||||
|
* the trix-editor content (whether displayed or under editing). Feel free to incorporate this
|
||||||
|
* inclusion directly in any other asset bundle and remove this file.
|
||||||
|
*
|
||||||
|
*= require trix
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We need to override trix.css’s image gallery styles to accommodate the
|
||||||
|
* <action-text-attachment> element we wrap around attachments. Otherwise,
|
||||||
|
* images in galleries will be squished by the max-width: 33%; rule.
|
||||||
|
*/
|
||||||
|
.trix-content .attachment-gallery > action-text-attachment,
|
||||||
|
.trix-content .attachment-gallery > .attachment {
|
||||||
|
flex: 1 0 33%;
|
||||||
|
padding: 0 0.5em;
|
||||||
|
max-width: 33%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.trix-content .attachment-gallery.attachment-gallery--2 > action-text-attachment,
|
||||||
|
.trix-content .attachment-gallery.attachment-gallery--2 > .attachment, .trix-content .attachment-gallery.attachment-gallery--4 > action-text-attachment,
|
||||||
|
.trix-content .attachment-gallery.attachment-gallery--4 > .attachment {
|
||||||
|
flex-basis: 50%;
|
||||||
|
max-width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.trix-content action-text-attachment .attachment {
|
||||||
|
padding: 0 !important;
|
||||||
|
max-width: 100% !important;
|
||||||
|
}
|
|
@ -7,4 +7,5 @@
|
||||||
*= require list.unlist
|
*= require list.unlist
|
||||||
*= require list.missing
|
*= require list.missing
|
||||||
*= require recurring_select
|
*= require recurring_select
|
||||||
|
*= require actiontext
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
|
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
|
||||||
|
import "trix"
|
||||||
|
import "@rails/actiontext"
|
||||||
|
import "./trix-editor-overrides"
|
||||||
|
|
3
app/views/layouts/action_text/contents/_content.html.erb
Normal file
3
app/views/layouts/action_text/contents/_content.html.erb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<div class="trix-content">
|
||||||
|
<%= yield -%>
|
||||||
|
</div>
|
|
@ -68,6 +68,8 @@ module Foodsoft
|
||||||
config.active_record.yaml_column_permitted_classes = [Symbol, BigDecimal]
|
config.active_record.yaml_column_permitted_classes = [Symbol, BigDecimal]
|
||||||
|
|
||||||
config.autoloader = :zeitwerk
|
config.autoloader = :zeitwerk
|
||||||
|
|
||||||
|
config.active_storage.variant_processor = :mini_magick
|
||||||
end
|
end
|
||||||
|
|
||||||
# Foodsoft version
|
# Foodsoft version
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
# Pin npm packages by running ./bin/importmap
|
# Pin npm packages by running ./bin/importmap
|
||||||
pin "application", preload: true
|
pin "application", preload: true
|
||||||
|
pin "trix"
|
||||||
|
pin "@rails/actiontext", to: "actiontext.js"
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
# This migration comes from action_text (originally 20180528164100)
|
||||||
|
class CreateActionTextTables < ActiveRecord::Migration[6.0]
|
||||||
|
def change
|
||||||
|
# Use Active Record's configured type for primary and foreign keys
|
||||||
|
primary_key_type, foreign_key_type = primary_and_foreign_key_types
|
||||||
|
|
||||||
|
create_table :action_text_rich_texts, id: primary_key_type do |t|
|
||||||
|
t.string :name, null: false
|
||||||
|
t.text :body, size: :long
|
||||||
|
t.references :record, null: false, polymorphic: true, index: false, type: foreign_key_type
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
|
||||||
|
t.index [:record_type, :record_id, :name], name: "index_action_text_rich_texts_uniqueness", unique: true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def primary_and_foreign_key_types
|
||||||
|
config = Rails.configuration.generators
|
||||||
|
setting = config.options[config.orm][:primary_key_type]
|
||||||
|
primary_key_type = setting || :primary_key
|
||||||
|
foreign_key_type = setting || :bigint
|
||||||
|
[primary_key_type, foreign_key_type]
|
||||||
|
end
|
||||||
|
end
|
12
db/schema.rb
12
db/schema.rb
|
@ -10,7 +10,17 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.0].define(version: 2023_01_06_144440) do
|
ActiveRecord::Schema[7.0].define(version: 2023_02_15_085312) do
|
||||||
|
create_table "action_text_rich_texts", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
|
||||||
|
t.string "name", null: false
|
||||||
|
t.text "body", size: :long
|
||||||
|
t.string "record_type", null: false
|
||||||
|
t.bigint "record_id", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["record_type", "record_id", "name"], name: "index_action_text_rich_texts_uniqueness", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
create_table "active_storage_attachments", id: :integer, charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
|
create_table "active_storage_attachments", id: :integer, charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t|
|
||||||
t.string "name", null: false
|
t.string "name", null: false
|
||||||
t.string "record_type", null: false
|
t.string "record_type", null: false
|
||||||
|
|
Loading…
Reference in a new issue