Class: Admin::CarouselsController
- Inherits:
-
BaseController
- Object
- BaseController
- Admin::CarouselsController
- Defined in:
- app/controllers/admin/carousels_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #duplicate ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
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 |
#destroy ⇒ Object
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 |
#duplicate ⇒ Object
17 18 19 20 |
# File 'app/controllers/admin/carousels_controller.rb', line 17 def duplicate @carousel = @carousel.clone render :action => 'new' end |
#edit ⇒ Object
15 |
# File 'app/controllers/admin/carousels_controller.rb', line 15 def edit; end |
#index ⇒ Object
7 8 9 |
# File 'app/controllers/admin/carousels_controller.rb', line 7 def index return redirect_to([forgeos_cms, :admin, :widgets]) end |
#new ⇒ Object
13 |
# File 'app/controllers/admin/carousels_controller.rb', line 13 def new; end |
#show ⇒ Object
11 |
# File 'app/controllers/admin/carousels_controller.rb', line 11 def show; end |
#update ⇒ Object
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 |