Switch branches/tags
Find file
Fetching contributors…
Cannot retrieve contributors at this time
63 lines (47 sloc) 4.17 KB
# encoding: utf-8
require 'radiant-clipped-extension'
require 'acts_as_list'
require 'uuidtools'
require 'cloud'
class ClippedExtension < Radiant::Extension
version RadiantClippedExtension::VERSION
description RadiantClippedExtension::DESCRIPTION
url RadiantClippedExtension::URL
migrate_from 'Paperclipped', 20100327111216
def activate
require 'paperclip/geometry_transformation'
if Asset.table_exists?
Page.send :include, PageAssetAssociations # defines page-asset associations. likely to be generalised soon.
Radiant::AdminUI.send :include, ClippedAdminUI unless defined? admin.asset # defines shards for extension of the asset-admin interface
Radiant::AdminUI.send :include, ClippedFoldersAdminUI unless defined? admin.folder
Admin::PagesController.send :helper, Admin::AssetsHelper # currently only provides a description of asset sizes
Page.send :include, AssetTags # radius tags for selecting sets of assets and presenting each one
UserActionObserver.instance.send :add_observer!, Asset # the usual creator- and updater-stamping :image, :icon => 'image', :default_radius_tag => 'image', :processors => [:thumbnail], :styles => :standard, :extensions => %w[jpg jpeg png gif], :mime_types => %w[image/png image/x-png image/jpeg image/pjpeg image/jpg image/gif] :video, :icon => 'video', :processors => [:frame_grab], :styles => :standard, :mime_types => %w[application/x-mp4 video/mpeg video/quicktime video/x-la-asf video/x-ms-asf video/x-msvideo video/x-sgi-movie video/x-flv flv-application/octet-stream video/3gpp video/3gpp2 video/3gpp-tt video/BMPEG video/BT656 video/CelB video/DV video/H261 video/H263 video/H263-1998 video/H263-2000 video/H264 video/JPEG video/MJ2 video/MP1S video/MP2P video/MP2T video/mp4 video/MP4V-ES video/MPV video/mpeg4 video/mpeg4-generic video/nv video/parityfec video/pointer video/raw video/rtx video/ogg video/webm] :audio, :icon => 'audio', :mime_types => %w[audio/mpeg audio/mpg audio/ogg application/ogg audio/x-ms-wma audio/vnd.rn-realaudio audio/x-wav] :font, :icon => 'font', :extensions => %w[ttf otf eot woff] :flash, :icon => 'flash', :default_radius_tag => 'flash', :extensions => %w{swf}, :mime_types => %w[application/x-shockwave-flash] :pdf, :icon => 'pdf', :processors => [:thumbnail], :extensions => %w{pdf}, :mime_types => %w[application/pdf application/x-pdf], :styles => :standard :document, :icon => 'document', :mime_types => %w[application/msword application/rtf application/ application/ application/ application/ text/plain text/html] :other, :icon => 'unknown'
admin.folder ||= Radiant::AdminUI.load_default_folder_regions
admin.asset ||= Radiant::AdminUI.load_default_asset_regions # loads the shards defined in AssetsAdminUI :form, 'assets', :after => :edit_page_parts # adds the asset-attachment picker to the page edit view :main, 'asset_popups', :after => :edit_popups # adds the asset-attachment picker to the page edit view %w{upload_asset attach_asset} :config, 'admin/configuration/show', :after => 'defaults'
admin.configuration.edit.add :form, 'admin/configuration/edit', :after => 'edit_defaults'
Admin::PagesController.send :helper, Admin::FoldersHelper
Admin::AssetsController.send :helper, Admin::FoldersHelper
if Radiant::Config.table_exists? && Radiant::config["paperclip.command_path"] # This is needed for testing if you are using mod_rails
Paperclip.options[:command_path] = Radiant::config["paperclip.command_path"]
tab "Assets", :after => "Content" do
add_item "All", "/admin/assets/"
def deactivate