Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixfor ruby3 #949

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ group :development, :test do
gem "autoprefixer-rails", "~> 8.1.0"
gem "byebug", "~> 10.0.0", platforms: %i[mri mingw x64_mingw]
gem "capybara", "~> 2.17.0"
gem "image_processing", ">= 1.2"
gem "kaminari", "~> 1.1.1"
gem "puma", "~> 3.12.2"
gem "rubocop", "~> 0.55.0", require: false
Expand Down
9 changes: 8 additions & 1 deletion app/assets/javascripts/comfy/admin/cms/wysiwyg.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,14 @@
imageManagerJson,
fileUpload,
fileManagerJson,
definedLinks
definedLinks,
// allow unsafe tags and the like (prevent redactor stripping divs and other elements)
cleanOnEnter: false,
replaceTags: false,
removeComments: false,
removeNewLines: false,
deniedTags: [],
replaceDivs: false
};
};

Expand Down
10 changes: 9 additions & 1 deletion app/models/comfy/cms/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class Comfy::Cms::File < ActiveRecord::Base
after_save :process_attachment
end

after_save :clear_page_content_cache

# -- Validations -------------------------------------------------------------
validates :label, presence: true
validates :file, presence: true, on: :create
Expand All @@ -41,6 +43,12 @@ class Comfy::Cms::File < ActiveRecord::Base
where("active_storage_blobs.content_type LIKE 'image/%'").references(:blob)
}

private

def clear_page_content_cache
Comfy::Cms::Page.where(id: site.pages.pluck(:id)).update_all(content_cache: nil)
end

protected

def assign_position
Expand All @@ -56,7 +64,7 @@ def assign_label

def process_attachment
return if @file.blank?
attachment.attach(@file)
self.attachment = @file
end

end
2 changes: 1 addition & 1 deletion app/views/comfy/admin/cms/files/_file.html.haml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%li{data: {id: file.id}}
:ruby
file_tag = cms_file_link_tag(file)
thumb_url = url_for(file.attachment.variant(combine_options: Comfy::Cms::File::VARIANT_SIZE[:thumb])) if file.attachment.variable?
thumb_url = url_for(file.attachment.variant(Comfy::Cms::File::VARIANT_SIZE[:thumb])) if file.attachment.variable?
.row
.col-md-5.item
.item-controls.d-none.d-lg-block
Expand Down
4 changes: 2 additions & 2 deletions app/views/comfy/admin/cms/pages/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
= comfy_admin_partial "comfy/admin/cms/partials/page_form_after", form: form

= form.form_actions do
= submit_tag t(".preview"), name: "preview", formtarget: "comfy-cms-preview", id: nil, class: "btn btn-secondary", data: {disable_with: false}
= submit_tag t(@page.new_record?? ".create" : ".update"), class: "btn btn-primary ml-sm-1", data: {disable_with: false}
= submit_tag t(".preview"), name: "preview", formtarget: "comfy-cms-preview", id: nil, class: "btn btn-secondary"
= submit_tag t(@page.new_record?? ".create" : ".update"), class: "btn btn-primary ml-sm-1"
= link_to t(".cancel"), comfy_admin_cms_site_pages_path, class: "btn btn-link"
1 change: 1 addition & 0 deletions comfortable_mexican_sofa.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Gem::Specification.new do |s|
s.add_dependency "active_link_to", ">= 1.0.0"
s.add_dependency "comfy_bootstrap_form", ">= 4.0.0"
s.add_dependency "haml-rails", ">= 1.0.0"
s.add_dependency "image_processing", ">= 1.2"
s.add_dependency "jquery-rails", ">= 4.3.1"
s.add_dependency "kramdown", ">= 1.0.0"
s.add_dependency "mimemagic", ">= 0.3.2"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# This migration comes from active_storage (originally 20190112182829)
class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0]
def up
unless column_exists?(:active_storage_blobs, :service_name)
add_column :active_storage_blobs, :service_name, :string

if configured_service = ActiveStorage::Blob.service.name
ActiveStorage::Blob.unscoped.update_all(service_name: configured_service)
end

change_column :active_storage_blobs, :service_name, :string, null: false
end
end

def down
remove_column :active_storage_blobs, :service_name
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This migration comes from active_storage (originally 20191206030411)
class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0]
def change
create_table :active_storage_variant_records do |t|
t.belongs_to :blob, null: false, index: false
t.string :variation_digest, null: false

t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true
t.foreign_key :active_storage_blobs, column: :blob_id
end
end
end
2 changes: 1 addition & 1 deletion lib/comfortable_mexican_sofa/routing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class ActionDispatch::Routing::Mapper

def comfy_route(identifier, options = {})
send("comfy_route_#{identifier}", options)
send("comfy_route_#{identifier}", **options)
end

end