Class: Admin::Areas::PostsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/admin/areas/posts_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



34
35
36
# File 'app/controllers/admin/areas/posts_controller.rb', line 34

def destroy
  @post.destroy
end

#editObject



6
7
# File 'app/controllers/admin/areas/posts_controller.rb', line 6

def edit
end

#orderObject



16
17
18
19
20
21
22
23
# File 'app/controllers/admin/areas/posts_controller.rb', line 16

def order
  if params[:post].present?
    params[:post].each_with_index do |post, i|
      Post.update_all(['position = %d', i], ['id = %d', post])
    end
  end
  render :nothing => true
end

#showObject



13
14
# File 'app/controllers/admin/areas/posts_controller.rb', line 13

def show
end

#toggle_reviewed_byObject



25
26
27
28
29
30
31
32
# File 'app/controllers/admin/areas/posts_controller.rb', line 25

def toggle_reviewed_by
  if !@post.reviewed_by
    @post.update_attribute(:reviewed_by, current_user.full_name)
  else
    @post.update_attribute(:reviewed_by, nil)
  end
  render :layout => false
end

#updateObject



9
10
11
# File 'app/controllers/admin/areas/posts_controller.rb', line 9

def update
  @post.update_attributes(params[:post])
end