Class: Admin::ActualitiesController

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

Instance Method Summary collapse

Instance Method Details

#activateObject



46
47
48
# File 'app/controllers/admin/actualities_controller.rb', line 46

def activate
  render :text => @actuality.activate
end

#createObject



36
37
38
39
40
41
42
43
44
# File 'app/controllers/admin/actualities_controller.rb', line 36

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

#destroyObject



50
51
52
53
54
55
56
57
58
# File 'app/controllers/admin/actualities_controller.rb', line 50

def destroy
  if @actuality.destroy
    flash[:notice] = t('actuality.destroy.success').capitalize
    return redirect_to([forgeos_cms, :admin, :actualities]) if !request.xhr?
  else
    flash[:error] = t('actuality.destroy.failed').capitalize
  end
  render :nothing => true
end

#editObject



18
19
# File 'app/controllers/admin/actualities_controller.rb', line 18

def edit
end

#indexObject



8
9
10
11
12
13
14
15
16
# File 'app/controllers/admin/actualities_controller.rb', line 8

def index
  respond_to do |format|
    format.html
    format.json do
      sort
      render :layout => false
    end
  end
end

#newObject



32
33
34
# File 'app/controllers/admin/actualities_controller.rb', line 32

def new

end

#updateObject



21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/admin/actualities_controller.rb', line 21

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

end