Class: Dust::BlocksController
Instance Method Summary
collapse
#not_authenticated, #permission_denied, #try_return_to_previous_page
Instance Method Details
#create ⇒ Object
17
18
19
20
21
22
23
24
25
|
# File 'app/controllers/dust/blocks_controller.rb', line 17
def create
@block = Dust::Block.new(params[:dust_block])
if @block.save
flash[:notice] = "Successfully created block."
try_return_to_previous_page(dust_blocks_url)
else
render :action => 'new'
end
end
|
#destroy ⇒ Object
41
42
43
44
45
46
|
# File 'app/controllers/dust/blocks_controller.rb', line 41
def destroy
@block = Dust::Block.find(params[:id])
@block.destroy
flash[:notice] = "Successfully destroyed block."
try_return_to_previous_page(dust_blocks_url)
end
|
#edit ⇒ Object
27
28
29
|
# File 'app/controllers/dust/blocks_controller.rb', line 27
def edit
@block = Dust::Block.find(params[:id])
end
|
#index ⇒ Object
8
9
10
|
# File 'app/controllers/dust/blocks_controller.rb', line 8
def index
@blocks = Dust::Block.page(params[:search], params[:page])
end
|
#new ⇒ Object
12
13
14
15
|
# File 'app/controllers/dust/blocks_controller.rb', line 12
def new
@block = Dust::Block.new(:show => params[:show]) if params[:show]
@block ||= Dust::Block.new
end
|
#update ⇒ Object
31
32
33
34
35
36
37
38
39
|
# File 'app/controllers/dust/blocks_controller.rb', line 31
def update
@block = Dust::Block.find(params[:id])
if @block.update_attributes(params[:dust_block])
flash[:notice] = "Successfully updated block."
try_return_to_previous_page(dust_blocks_path)
else
render :action => 'edit'
end
end
|