-
-
Save joseh-henrique/38d56cc16d1d223f60631bbf197fcc45 to your computer and use it in GitHub Desktop.
Active Admin Cloudinary
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
# app / assets / javascripts / active_admin.js | |
//= require active_admin/base | |
//= require jquery.ui.widget | |
//= require jquery.iframe-transport | |
//= require jquery.fileupload | |
//= require cloudinary/jquery.cloudinary | |
//= require attachinary | |
//= require attachments |
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
# config / initializers / active_admin_cloudinary.rb | |
# The Active Admin equivalent of putting this in your application layout: | |
# <head> | |
# <%= cloudinary_js_config %> | |
# </head> | |
module ActiveAdmin | |
module Views | |
module Pages | |
class Base < Arbre::HTML::Document | |
alias_method :original_build_head, :build_active_admin_head | |
def build_active_admin_head | |
original_build_head | |
within @head do | |
text_node cloudinary_js_config | |
end | |
end | |
end | |
end | |
end | |
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
# app / assets / javascripts / attachments.js | |
jQuery -> | |
$('.attachinary-input').attachinary() |
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
# app / inputs / formtastic_attachinary_input.rb | |
class FormtasticAttachinaryInput | |
include Formtastic::Inputs::Base | |
attr_reader :attachinary_options | |
def to_html | |
input_wrapping do | |
label_html << | |
template.builder_attachinary_file_field_tag(method, @builder, { html: input_html_options }) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment