Skip to content

Commit

Permalink
Merge pull request #1 from jenfi-eng/master
Browse files Browse the repository at this point in the history
Removed all combine_options: Rails 6.1 and use double splat for Ruby 3
  • Loading branch information
rdsun0301 authored Jul 17, 2023
2 parents 8f7e425 + 64b7a0e commit 62ef7e0
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/controllers/comfy/admin/cms/files_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def index
case params[:type]
when "image"
file_scope.with_images.collect do |file|
{ thumb: url_for(file.attachment.variant(combine_options: Comfy::Cms::File::VARIANT_SIZE[:redactor])),
{ thumb: url_for(file.attachment.variant(Comfy::Cms::File::VARIANT_SIZE[:redactor])),
image: url_for(file.attachment),
title: file.label }
end
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- attachments.each do |attachment|
:ruby
thumb_url = if attachment.variable?
url_for(attachment.variant(combine_options: Comfy::Cms::File::VARIANT_SIZE[:thumb]))
url_for(attachment.variant(Comfy::Cms::File::VARIANT_SIZE[:thumb]))
end
filename = attachment.filename.to_s
truncated_filename = truncate(filename, length: 40, omission: "...#{filename.last(10)}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def content(file: self.file, as: self.as, variant_attrs: self.variant_attrs, lab

attachment_url =
if variant_attrs.present? && file.image?
variant = file.variant(combine_options: variant_attrs)
variant = file.variant(variant_attrs)
url_helpers.rails_representation_path(variant, only_path: true)
else
url_helpers.rails_blob_path(file, only_path: true)
Expand Down
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
2 changes: 1 addition & 1 deletion test/controllers/comfy/admin/cms/files_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_get_index_with_redactor_images
assert_response :success

assert_equal [{
"thumb" => url_for(@file.attachment.variant(combine_options: Comfy::Cms::File::VARIANT_SIZE[:redactor])),
"thumb" => url_for(@file.attachment.variant(Comfy::Cms::File::VARIANT_SIZE[:redactor])),
"image" => url_for(@file.attachment),
"title" => @file.label
}], JSON.parse(response.body)
Expand Down
2 changes: 1 addition & 1 deletion test/lib/content/tags/file_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def test_content_as_image_with_variant
context: @page,
params: [frag.identifier, { "as" => "image", "resize" => "50x50" }]
)
variant = frag.attachments.first.variant(combine_options: { "resize" => "50x50" })
variant = frag.attachments.first.variant({ "resize" => "50x50" })
path = rails_representation_path(variant, only_path: true)
out = "<img src='#{path}' alt='fragment.jpg'/>"
assert_equal out, tag.content
Expand Down
4 changes: 2 additions & 2 deletions test/lib/form_builder_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def test_fragment_field_for_file_with_content

attachment = active_storage_attachments(:file)
attachment_url = view.url_for(attachment)
thumb_url = view.url_for(attachment.variant(combine_options: Comfy::Cms::File::VARIANT_SIZE[:thumb]))
thumb_url = view.url_for(attachment.variant(Comfy::Cms::File::VARIANT_SIZE[:thumb]))

expected = <<~HTML
<div class="form-group row">
Expand Down Expand Up @@ -197,7 +197,7 @@ def test_fragment_field_for_files_with_content

attachment = active_storage_attachments(:file)
attachment_url = view.url_for(attachment)
thumb_url = view.url_for(attachment.variant(combine_options: Comfy::Cms::File::VARIANT_SIZE[:thumb]))
thumb_url = view.url_for(attachment.variant(Comfy::Cms::File::VARIANT_SIZE[:thumb]))

expected = <<~HTML
<div class="form-group row">
Expand Down

0 comments on commit 62ef7e0

Please sign in to comment.