Class: Admin::CarouselsController

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

Instance Method Summary collapse

Instance Method Details

#createObject



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

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

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

#destroyObject



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

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

#duplicateObject



17
18
19
20
# File 'app/controllers/admin/carousels_controller.rb', line 17

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

#editObject



15
# File 'app/controllers/admin/carousels_controller.rb', line 15

def edit; end

#indexObject



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

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

#newObject



13
# File 'app/controllers/admin/carousels_controller.rb', line 13

def new; end

#showObject



11
# File 'app/controllers/admin/carousels_controller.rb', line 11

def show; end

#updateObject



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

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

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

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