Sha256: 3f116015961cf08ac85b7776807ad0b40f9d23bcee39a870f646c495f9db2004

Contents?: true

Size: 1.39 KB

Versions: 14

Compression:

Stored size: 1.39 KB

Contents

# This is basically for the CkEditor Pictures functionality

module Effective
  class AssetsController < ApplicationController
    layout false

    # iframe
    def index  # This is the IFRAME modal dialog that is read by CKEDITOR
      EffectiveAssets.authorized?(self, :index, Effective::Asset.new(:user_id => current_user.try(:id)))

      effective_iframe_uploads = Effective::Attachment.where(box: EffectiveAssets::IFRAME_UPLOADS).pluck(:asset_id)
      @assets = Effective::Asset.where(id: effective_iframe_uploads)

      if params[:only] == 'images'
        @assets = @assets.images
        @file_types = [:jpg, :gif, :png, :bmp, :ico]
        @aws_acl = EffectiveAssets::AWS_PUBLIC
      elsif params[:only] == 'nonimages'
        @assets = @assets.nonimages
        @file_types = [:pdf, :zip, :doc, :docx, :xls, :xlsx, :txt, :csv, :avi, :m4v, :m2v, :mov, :mp3, :mp4, :eml]
        @aws_acl = EffectiveAssets.aws_acl
      end

      @user_uploads = IframeUploads.new(@assets)

      render :file => 'effective/assets/iframe'
    end

    def destroy
      @asset = Effective::Asset.find(params[:id])
      EffectiveAssets.authorized?(self, :destroy, @asset)

      if @asset.destroy
        flash[:success] = 'Successfully deleted asset'
      else
        flash[:danger] = 'Unable to delete asset'
      end

      redirect_to(:back) rescue redirect_to(effective_assets.effective_assets_path)
    end

  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
effective_assets-1.10.1 app/controllers/effective/assets_controller.rb
effective_assets-1.10.0 app/controllers/effective/assets_controller.rb
effective_assets-1.9.14 app/controllers/effective/assets_controller.rb
effective_assets-1.9.13 app/controllers/effective/assets_controller.rb
effective_assets-1.9.12 app/controllers/effective/assets_controller.rb
effective_assets-1.9.11 app/controllers/effective/assets_controller.rb
effective_assets-1.9.10 app/controllers/effective/assets_controller.rb
effective_assets-1.9.9 app/controllers/effective/assets_controller.rb
effective_assets-1.9.8 app/controllers/effective/assets_controller.rb
effective_assets-1.9.7 app/controllers/effective/assets_controller.rb
effective_assets-1.9.6 app/controllers/effective/assets_controller.rb
effective_assets-1.9.5 app/controllers/effective/assets_controller.rb
effective_assets-1.9.4 app/controllers/effective/assets_controller.rb
effective_assets-1.9.3 app/controllers/effective/assets_controller.rb