Class: Admin::WidgetFaqsController

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

Instance Method Summary collapse

Instance Method Details

#createObject



11
12
13
14
15
16
17
18
19
# File 'app/controllers/admin/widget_faqs_controller.rb', line 11

def create
  if @widget_faq.save
    flash[:notice] = t('destination.create.success').capitalize
    redirect_to([forgeos_cms, :admin, :widgets])
  else
    flash[:error] = @widget_faq.errors.first.inspect
    render :action => 'new'
  end
end

#destroyObject



43
44
45
46
47
48
49
50
51
# File 'app/controllers/admin/widget_faqs_controller.rb', line 43

def destroy
  if @widget_faq.destroy
    flash[:notice] = I18n.t('widget.destroy.success').capitalize
  else
    flash[:error] = @widget_faq.errors if @widget_faq
    flash[:error] = I18n.t('widget.destroy.failed').capitalize
  end
  render :nothing => true
end

#duplicateObject



27
28
29
30
# File 'app/controllers/admin/widget_faqs_controller.rb', line 27

def duplicate
  @widget_faq = @widget_faq.clone
  render :action => 'new'
end

#editObject



24
25
# File 'app/controllers/admin/widget_faqs_controller.rb', line 24

def edit
end

#indexObject



7
8
9
# File 'app/controllers/admin/widget_faqs_controller.rb', line 7

def index
  return redirect_to([forgeos_cms, :admin, :widgets])
end

#newObject



21
22
# File 'app/controllers/admin/widget_faqs_controller.rb', line 21

def new
end

#updateObject



33
34
35
36
37
38
39
40
41
# File 'app/controllers/admin/widget_faqs_controller.rb', line 33

def update
  if @widget_faq.update_attributes(params[:widget_faq])
    flash[:notice] = t('widget_faq.update.success').capitalize
    redirect_to([forgeos_cms, :admin, :widgets])
  else
    flash[:error] = t('widget_faq.update.failed').capitalize
    render :action => 'edit'
  end
end