Sha256: 9ccb78513bc2d0dfa77ff47467309aca4933dfe58e6d29a1f9ab0e6d238d3071

Contents?: true

Size: 1.26 KB

Versions: 5

Compression:

Stored size: 1.26 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)))

      @assets = Effective::Asset.where(user_id: current_user.id)

      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 = IframeUpload.new(@assets)

      render '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

5 entries across 5 versions & 1 rubygems

Version Path
effective_assets-1.12.2 app/controllers/effective/assets_controller.rb
effective_assets-1.12.1 app/controllers/effective/assets_controller.rb
effective_assets-1.12.0 app/controllers/effective/assets_controller.rb
effective_assets-1.11.5 app/controllers/effective/assets_controller.rb
effective_assets-1.11.4 app/controllers/effective/assets_controller.rb