diff --git a/app/assets/javascripts/activeadmin-wysihtml5/base.js.coffee b/app/assets/javascripts/activeadmin-wysihtml5/base.js.coffee index d94c729..4ea2743 100644 --- a/app/assets/javascripts/activeadmin-wysihtml5/base.js.coffee +++ b/app/assets/javascripts/activeadmin-wysihtml5/base.js.coffee @@ -103,7 +103,7 @@ refreshAssets = -> $gallery.empty() - $.getJSON '/admin/assets.json', (data) -> + $.getJSON '/admin/wysi_html_five_assets.json', (data) -> $.each data, (i, asset) -> $img = $("") $img.attr @@ -120,7 +120,7 @@ initUploader = -> uploader = new qq.FileUploader element: $uploader.get(0) - action: '/admin/assets.json' + action: '/admin/wysi_html_five_assets.json' onComplete: -> refreshAssets() $tab_handles.eq(1).click() @@ -205,4 +205,3 @@ ) )(jQuery) - diff --git a/app/models/asset.rb b/app/models/wysi_html_five_asset.rb similarity index 93% rename from app/models/asset.rb rename to app/models/wysi_html_five_asset.rb index 5b19bbe..3b240e0 100644 --- a/app/models/asset.rb +++ b/app/models/wysi_html_five_asset.rb @@ -1,4 +1,4 @@ -class Asset < ActiveRecord::Base +class WysiHtmlFiveAsset < ActiveRecord::Base image_accessor :storage def percentage_thumb_url(size) @@ -27,4 +27,3 @@ def as_json(options = {}) } end end - diff --git a/db/migrate/20120816182611_create_active_admin_wysihtml5_assets.rb b/db/migrate/20120816182611_create_active_admin_wysihtml5_assets.rb index 8370fd9..510dd1b 100644 --- a/db/migrate/20120816182611_create_active_admin_wysihtml5_assets.rb +++ b/db/migrate/20120816182611_create_active_admin_wysihtml5_assets.rb @@ -1,7 +1,7 @@ class CreateActiveAdminWysihtml5Assets < ActiveRecord::Migration def change - create_table :assets do |t| + create_table :wysi_html_five_assets do |t| t.string :storage_uid t.string :storage_name t.timestamps diff --git a/db/migrate/20130124143200_add_magic_attributes_to_assets.rb b/db/migrate/20130124143200_add_magic_attributes_to_assets.rb index e48a01a..5fd5325 100644 --- a/db/migrate/20130124143200_add_magic_attributes_to_assets.rb +++ b/db/migrate/20130124143200_add_magic_attributes_to_assets.rb @@ -1,11 +1,11 @@ class AddMagicAttributesToAssets < ActiveRecord::Migration def change - add_column :assets, :storage_width, :integer - add_column :assets, :storage_height, :integer - add_column :assets, :storage_aspect_ratio, :float - add_column :assets, :storage_depth, :integer - add_column :assets, :storage_format, :string - add_column :assets, :storage_mime_type, :string - add_column :assets, :storage_size, :string + add_column :wysi_html_five_assets, :storage_width, :integer + add_column :wysi_html_five_assets, :storage_height, :integer + add_column :wysi_html_five_assets, :storage_aspect_ratio, :float + add_column :wysi_html_five_assets, :storage_depth, :integer + add_column :wysi_html_five_assets, :storage_format, :string + add_column :wysi_html_five_assets, :storage_mime_type, :string + add_column :wysi_html_five_assets, :storage_size, :string end end diff --git a/lib/active_admin/wysihtml5/admin/assets.rb b/lib/active_admin/wysihtml5/admin/wysi_html_five_asset.rb similarity index 94% rename from lib/active_admin/wysihtml5/admin/assets.rb rename to lib/active_admin/wysihtml5/admin/wysi_html_five_asset.rb index 8d6ea08..74bd05c 100644 --- a/lib/active_admin/wysihtml5/admin/assets.rb +++ b/lib/active_admin/wysihtml5/admin/wysi_html_five_asset.rb @@ -1,4 +1,4 @@ -ActiveAdmin.register Asset do +ActiveAdmin.register WysiHtmlFiveAsset do index as: :grid do |asset| link_to(image_tag(asset.storage.thumb("100x100#").url), admin_asset_path(asset)) @@ -42,7 +42,7 @@ def create # If an app is using Rack::RawUpload, it can just use # params['file'] and not worry with original_filename parsing. if params['file'] - @asset = Asset.new + @asset = WysiHtmlFiveAsset.new @asset.storage = params['file'] if @asset.save! @@ -51,7 +51,7 @@ def create render nothing: true, status: 500 and return end elsif params['qqfile'] - @asset = Asset.new + @asset = WysiHtmlFiveAsset.new io = request.env['rack.input'] # throw io @@ -73,4 +73,3 @@ def create end end -