Class: Workarea::Admin::ContentBlogsController

Inherits:
Admin::ApplicationController
  • Object
show all
Defined in:
app/controllers/workarea/admin/content_blogs_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



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

def create
  if @blog.save
    flash[:success] = 'Blog has been created'
    redirect_to edit_content_blog_path(@blog)
  else
    render :new
  end
end

#destroyObject



34
35
36
37
38
# File 'app/controllers/workarea/admin/content_blogs_controller.rb', line 34

def destroy
  @blog.destroy
  flash[:success] = 'This blog has been removed'
  redirect_to content_blogs_path
end

#indexObject



7
8
9
10
11
12
# File 'app/controllers/workarea/admin/content_blogs_controller.rb', line 7

def index
  search = Search::AdminBlogs.new(
    params.merge(autocomplete: request.xhr?)
  )
  @search = BlogSearchViewModel.new(search, params)
end

#showObject



14
# File 'app/controllers/workarea/admin/content_blogs_controller.rb', line 14

def show; end

#updateObject



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

def update
  if @blog.update_attributes(blog_params)
    flash[:success] = 'Blog has been updated'
    redirect_to edit_content_blog_path(@blog)
  else
    render :edit
  end
end