Class: Boxroom::FoldersController

Inherits:
ApplicationController show all
Includes:
BaseController
Defined in:
app/controllers/boxroom/folders_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

Note: @target_folder is set in require_existing_target_folder



28
29
30
31
32
33
34
35
36
# File 'app/controllers/boxroom/folders_controller.rb', line 28

def create
  @folder = @target_folder.children.build(permitted_params.folder)

  if @folder.save
    redirect_to @target_folder
  else
    render :action => 'new'
  end
end

#destroyObject

Note: @folder is set in require_existing_folder



52
53
54
55
56
# File 'app/controllers/boxroom/folders_controller.rb', line 52

def destroy
  target_folder = @folder.parent
  @folder.destroy
  redirect_to target_folder
end

#editObject

Note: @folder is set in require_existing_folder



39
40
# File 'app/controllers/boxroom/folders_controller.rb', line 39

def edit
end

#indexObject



14
15
16
# File 'app/controllers/boxroom/folders_controller.rb', line 14

def index
  redirect_to Folder.root
end

#newObject

Note: @target_folder is set in require_existing_target_folder



23
24
25
# File 'app/controllers/boxroom/folders_controller.rb', line 23

def new
  @folder = @target_folder.children.build
end

#showObject

Note: @folder is set in require_existing_folder



19
20
# File 'app/controllers/boxroom/folders_controller.rb', line 19

def show
end

#updateObject

Note: @folder is set in require_existing_folder



43
44
45
46
47
48
49
# File 'app/controllers/boxroom/folders_controller.rb', line 43

def update
  if @folder.update_attributes(permitted_params.folder)
    redirect_to edit_folder_url(@folder), :notice => t(:your_changes_were_saved)
  else
    render :action => 'edit'
  end
end