Sha256: d251fa703b456ee95d61b6cb8cc19a8aefc0abbdc12bfbe08e32090d5e280784
Contents?: true
Size: 1.66 KB
Versions: 2
Compression:
Stored size: 1.66 KB
Contents
class Admin::Page::LinksController < Admin::BaseController default_param :link, :author_id, :only => [:create, :update], &lambda { |*| current_user.id } before_filter :set_section before_filter :set_links, :only => [:index] before_filter :set_link, :only => [:show, :edit, :update, :destroy] def new @link = @section.links.build params[:link] || {} end def edit end def create @link = @section.links.build params[:link] if @link.save trigger_events(@link) flash[:notice] = t(:'adva.links.flash.create.success') redirect_to [:edit, :admin, @site, @section, @link] else flash.now[:error] = t(:'adva.links.flash.create.failure') render :action => 'new' end end def update @link.attributes = params[:link] if @link.save trigger_events(@link) flash[:notice] = t(:'adva.links.flash.update.success') redirect_to [:edit, :admin, @site, @section, @link] else flash.now[:error] = t(:'adva.links.flash.update.failure') render :action => 'edit', :cl => content_locale end end def destroy if @link.destroy trigger_events(@link) flash[:notice] = t(:'adva.links.flash.destroy.success') redirect_to [:admin, @site, @section, :contents] else flash.now[:error] = t(:'adva.links.flash.destroy.failure') render :action => 'edit' end end protected def current_resource @link || @section end def set_menu @menu = Menus::Admin::Links.new end def set_links @links = @section.links.filtered params[:filters] end def set_link @link = @section.links.find_by_permalink! params[:id] end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
adva_cms-0.0.1 | app/controllers/admin/page/links_controller.rb |
adva-0.0.1 | adva_cms/app/controllers/admin/page/links_controller.rb |