Class: WysihatFilesController

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

Instance Method Summary collapse

Instance Method Details

#createObject



7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/wysihat_files_controller.rb', line 7

def create
  @wysihat_file = WysihatFile.new(:file => params[:wysihat_file][: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



19
20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/wysihat_files_controller.rb', line 19

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
# File 'app/controllers/wysihat_files_controller.rb', line 2

def index
  @wysihat_file, @wysihat_files = WysihatFile.new, WysihatFile.all
  render :layout => false
end