Skip to content

Fix for Dragonfly >=1 #8

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

Open
wants to merge 3 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
137 changes: 72 additions & 65 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
GIT
remote: git://github.com/gregbell/active_admin.git
revision: f21cff30e7212706a39710e2c70ad0af8087ccea
revision: 65aae6b68e78aad3071b2f85242b19fd3fccf426
branch: master
specs:
activeadmin (1.0.0.pre)
arbre (~> 1.0)
bourbon
coffee-rails
devise (~> 3.2)
formtastic (~> 2.3.0.rc2)
formtastic (~> 2.3.0.rc3)
inherited_resources (~> 1.3)
jquery-rails
jquery-ui-rails
kaminari (~> 0.15)
rails (>= 3.2, < 4.1)
rails (>= 3.2, <= 4.1)
ransack (~> 1.0)
sass-rails

Expand All @@ -22,64 +22,65 @@ PATH
specs:
activeadmin-dragonfly (0.0.2)
activeadmin
dragonfly (= 0.9.15)
dragonfly
rack-cache

GEM
remote: https://rubygems.org/
specs:
actionmailer (4.0.2)
actionpack (= 4.0.2)
actionmailer (4.1.0)
actionpack (= 4.1.0)
actionview (= 4.1.0)
mail (~> 2.5.4)
actionpack (4.0.2)
activesupport (= 4.0.2)
builder (~> 3.1.0)
erubis (~> 2.7.0)
actionpack (4.1.0)
actionview (= 4.1.0)
activesupport (= 4.1.0)
rack (~> 1.5.2)
rack-test (~> 0.6.2)
activemodel (4.0.2)
activesupport (= 4.0.2)
builder (~> 3.1.0)
activerecord (4.0.2)
activemodel (= 4.0.2)
activerecord-deprecated_finders (~> 1.0.2)
activesupport (= 4.0.2)
arel (~> 4.0.0)
activerecord-deprecated_finders (1.0.3)
activesupport (4.0.2)
i18n (~> 0.6, >= 0.6.4)
minitest (~> 4.2)
multi_json (~> 1.3)
actionview (4.1.0)
activesupport (= 4.1.0)
builder (~> 3.1)
erubis (~> 2.7.0)
activemodel (4.1.0)
activesupport (= 4.1.0)
builder (~> 3.1)
activerecord (4.1.0)
activemodel (= 4.1.0)
activesupport (= 4.1.0)
arel (~> 5.0.0)
activesupport (4.1.0)
i18n (~> 0.6, >= 0.6.9)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
tzinfo (~> 1.1)
arbre (1.0.1)
activesupport (>= 3.0.0)
arel (4.0.1)
atomic (1.1.14)
bcrypt-ruby (3.1.2)
bourbon (3.1.8)
sass (>= 3.2.0)
arel (5.0.1.20140414130214)
bcrypt (3.1.7)
bourbon (3.2.0)
sass (~> 3.2)
thor
builder (3.1.4)
builder (3.2.2)
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.6.3)
devise (3.2.2)
bcrypt-ruby (~> 3.0)
coffee-script-source (1.7.0)
devise (3.2.4)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
thread_safe (~> 0.1)
warden (~> 1.2.3)
dragonfly (0.9.15)
dragonfly (1.0.4)
multi_json (~> 1.0)
rack
erubis (2.7.0)
execjs (2.0.2)
formtastic (2.3.0.rc2)
formtastic (2.3.0.rc3)
actionpack (>= 3.0)
has_scope (0.6.0.rc)
actionpack (>= 3.2, < 5)
Expand All @@ -89,71 +90,77 @@ GEM
inherited_resources (1.4.1)
has_scope (~> 0.6.0.rc)
responders (~> 1.0.0.rc)
jquery-rails (3.0.4)
jquery-rails (3.1.0)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
jquery-ui-rails (4.1.1)
railties (>= 3.1.0)
jquery-ui-rails (4.2.1)
railties (>= 3.2.16)
json (1.8.1)
kaminari (0.15.1)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.25.1)
minitest (4.7.5)
multi_json (1.8.4)
minitest (5.3.3)
multi_json (1.9.2)
orm_adapter (0.5.0)
polyamorous (0.6.4)
polyamorous (1.0.0)
activerecord (>= 3.0)
polyglot (0.3.3)
polyglot (0.3.4)
rack (1.5.2)
rack-cache (1.2)
rack (>= 0.4)
rack-test (0.6.2)
rack (>= 1.0)
rails (4.0.2)
actionmailer (= 4.0.2)
actionpack (= 4.0.2)
activerecord (= 4.0.2)
activesupport (= 4.0.2)
rails (4.1.0)
actionmailer (= 4.1.0)
actionpack (= 4.1.0)
actionview (= 4.1.0)
activemodel (= 4.1.0)
activerecord (= 4.1.0)
activesupport (= 4.1.0)
bundler (>= 1.3.0, < 2.0)
railties (= 4.0.2)
sprockets-rails (~> 2.0.0)
railties (4.0.2)
actionpack (= 4.0.2)
activesupport (= 4.0.2)
railties (= 4.1.0)
sprockets-rails (~> 2.0)
railties (4.1.0)
actionpack (= 4.1.0)
activesupport (= 4.1.0)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.1.1)
ransack (1.1.0)
rake (10.3.1)
ransack (1.2.2)
actionpack (>= 3.0)
activerecord (>= 3.0)
polyamorous (~> 0.6.0)
activesupport (>= 3.0)
i18n
polyamorous (~> 1.0.0)
responders (1.0.0)
railties (>= 3.2, < 5)
sass (3.2.13)
sass-rails (4.0.1)
sass (3.2.19)
sass-rails (4.0.3)
railties (>= 4.0.0, < 5.0)
sass (>= 3.1.10)
sprockets-rails (~> 2.0.0)
sprockets (2.10.1)
sass (~> 3.2.0)
sprockets (~> 2.8, <= 2.11.0)
sprockets-rails (~> 2.0)
sprockets (2.11.0)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.0.1)
sprockets-rails (2.1.3)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (~> 2.8)
thor (0.18.1)
thread_safe (0.1.3)
atomic
thor (0.19.1)
thread_safe (0.3.3)
tilt (1.4.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.38)
tzinfo (1.1.0)
thread_safe (~> 0.1)
warden (1.2.3)
rack (>= 1.0)

Expand Down
2 changes: 1 addition & 1 deletion activeadmin-dragonfly.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Gem::Specification.new do |s|
s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.md"]

s.add_dependency "activeadmin"
s.add_dependency "dragonfly", "0.9.15"
s.add_dependency "dragonfly", "~>1.0"
s.add_dependency "rack-cache"
end

5 changes: 0 additions & 5 deletions lib/active_admin/dragonfly/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ module Dragonfly

class Engine < ::Rails::Engine
initializer "Railsyard precompile hook", group: :all do |app|
# check if someone already initialized Dragonfly for Rails
unless ActiveRecord::Base.methods.include? :image_accessor
require 'dragonfly/rails/images'
end

app.config.assets.precompile += [
"active_admin/active_admin_dragonfly.js",
"active_admin/active_admin_dragonfly.css"
Expand Down
16 changes: 11 additions & 5 deletions lib/formtastic/inputs/dragonfly_input.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def fragment_label(fragment)
if labels_from_options.key?(fragment)
labels_from_options[fragment]
else
::I18n.t(fragment.to_s, :default => fragment.to_s.humanize, :scope => [:dragonfly])
t(fragment.to_s, :default => fragment.to_s.humanize)
end
end

Expand All @@ -68,7 +68,7 @@ def fragment_upload_html

def is_image?(file)
file.mime_type =~ /png|bmp|gif|tif|jpe?g/
rescue Dragonfly::DataStorage::DataNotFound
rescue Dragonfly::Job::Fetch::NotFound
false
end

Expand All @@ -84,7 +84,7 @@ def fragment_preview_html
fragment_download_html
end
else
fragment_label_html(:preview) << "<div class='no-image'>#{I18n.t("dragonfly.no_image")}</div>".html_safe
fragment_label_html(:preview) << "<div class='no-image'>#{t(:no_image)}</div>".html_safe
end
end

Expand All @@ -96,7 +96,7 @@ def fragment_download_html
name = name.blank? ? "Download" : name
template.link_to name, original_url
else
"<span class='no-file'>#{I18n.t("dragonfly.no_file")}</span>".html_safe
"<span class='no-file'>#{t(:no_file)}</span>".html_safe
end
fragment_label_html(:download) << download
end
Expand All @@ -111,11 +111,17 @@ def fragment_remove_html
template.content_tag(:label, for: fragment_id(:remove)) do
builder.check_box("remove_#{method}") <<
" ".html_safe <<
I18n.t("dragonfly.remove")
t(:remove)
end
end
end

private

def t(key, options = {})
::I18n.t key, options.reverse_merge(:scope => [:formtastic, :dragonfly])
end

end

end
Expand Down