Class: WysihatFilesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/wysihat_files_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/wysihat_files_controller.rb', line 12

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

#destroyObject



24
25
26
27
28
29
30
31
32
33
34
# File 'app/controllers/wysihat_files_controller.rb', line 24

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

#indexObject



2
3
4
5
6
7
8
9
10
# File 'app/controllers/wysihat_files_controller.rb', line 2

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