Class: Admin::WidgetActualitiesController

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

Instance Method Summary collapse

Instance Method Details

#createObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/controllers/admin/widget_actualities_controller.rb', line 23

def create
  # check that the linked page exists if page_id is specified
=begin
  if params[:page_id] && !get_page
    flash[:error] = I18n.t('widget.link.create.failed').capitalize
    return
  end
=end

  if @widget_actuality.save
    flash[:notice] = I18n.t('widget_actuality.create.success').capitalize
    redirect_to([forgeos_cms, :edit, :admin, @widget_actuality])
  else
    flash[:error] = I18n.t('widget_actuality.create.failed').capitalize
    render :action => 'new'
  end
end

#destroyObject



57
58
59
60
61
62
63
64
# File 'app/controllers/admin/widget_actualities_controller.rb', line 57

def destroy
  if @widget_actuality.destroy
    flash[:notice] = I18n.t('widget_actuality.destroy.success').capitalize
  else
    flash[:error] = I18n.t('widget_actuality.destroy.failed').capitalize
  end
  redirect_to([forgeos_cms, :admin, :widgets])
end

#duplicateObject



18
19
20
21
# File 'app/controllers/admin/widget_actualities_controller.rb', line 18

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

#editObject



16
# File 'app/controllers/admin/widget_actualities_controller.rb', line 16

def edit; end

#indexObject



8
9
10
# File 'app/controllers/admin/widget_actualities_controller.rb', line 8

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

#newObject



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

def new;  end

#showObject



12
# File 'app/controllers/admin/widget_actualities_controller.rb', line 12

def show; end

#updateObject



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'app/controllers/admin/widget_actualities_controller.rb', line 41

def update
  if updated = @widget_actuality.update_attributes(params[:widget_actuality])
    flash[:notice] = I18n.t('widget_actuality.update.success').capitalize
  else
    flash[:error] = I18n.t('widget_actuality.update.failed').capitalize
  end

  respond_to do |format|
    format.html {
      return render :action => "edit"
    }

    format.js { return render :nothing => true }
  end
end