Sha256: 1aae0d47e3de0bdd900771fd5c8fcf2db1c3a0a3c6c6b29c0479988bfea1b107

Contents?: true

Size: 926 Bytes

Versions: 4

Compression:

Stored size: 926 Bytes

Contents

class WysihatFilesController < ApplicationController
  def index
    @wysihat_file = WysihatFile.new
    if params[:type] && params[:type] == "file"
      @wysihat_files = WysihatFile.file_content_type_not_like("image").all
    else
      @wysihat_files = WysihatFile.file_content_type_like("image").all
    end
    render :layout => false
  end
  
  def create
    @wysihat_file = WysihatFile.new(params[:wysihat_file])
    
    responds_to_parent do
      render :update do |page|
        if(@wysihat_file.save)
          page.insert_html :bottom, :wysihat_files, :partial => 'wysihat_file', :object => @wysihat_file  
        end
      end      
    end
  end
  
  def destroy
    @wysihat_file = WysihatFile.find(params[:id])
    respond_to do |wants|
      wants.js {
        render :update do |page|
          page.remove "wysihat_file_#{@wysihat_file.id}"
        end
      }
    end
    @wysihat_file.destroy
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bcalloway-wysihat-engine-0.1.11 app/controllers/wysihat_files_controller.rb
bcalloway-wysihat-engine-0.1.10 app/controllers/wysihat_files_controller.rb
bcalloway-wysihat-engine-0.1.9 app/controllers/wysihat_files_controller.rb
bcalloway-wysihat-engine-0.1.8 app/controllers/wysihat_files_controller.rb