Remove unused react component helper method (#38207)
This commit is contained in:
@@ -2,33 +2,16 @@
|
|||||||
|
|
||||||
module ReactComponentHelper
|
module ReactComponentHelper
|
||||||
def react_component(name, props = {}, &block)
|
def react_component(name, props = {}, &block)
|
||||||
data = { component: name.to_s.camelcase, props: Oj.dump(props) }
|
data = { component: name.to_s.camelcase, props: }
|
||||||
if block.nil?
|
if block_given?
|
||||||
div_tag_with_data(data)
|
tag.div data:, &block
|
||||||
else
|
else
|
||||||
content_tag(:div, data: data, &block)
|
tag.div nil, data:
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def react_admin_component(name, props = {})
|
def react_admin_component(name, props = {})
|
||||||
data = { 'admin-component': name.to_s.camelcase, props: Oj.dump(props) }
|
data = { 'admin-component': name.to_s.camelcase, props: }
|
||||||
div_tag_with_data(data)
|
tag.div nil, data:
|
||||||
end
|
|
||||||
|
|
||||||
def serialized_media_attachments(media_attachments)
|
|
||||||
media_attachments.map { |attachment| serialized_attachment(attachment) }
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def div_tag_with_data(data)
|
|
||||||
content_tag(:div, nil, data: data)
|
|
||||||
end
|
|
||||||
|
|
||||||
def serialized_attachment(attachment)
|
|
||||||
ActiveModelSerializers::SerializableResource.new(
|
|
||||||
attachment,
|
|
||||||
serializer: REST::MediaAttachmentSerializer
|
|
||||||
).as_json
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user