Class: Cms::SectionsController
- Inherits:
-
BaseController
- Object
- BaseController
- Cms::SectionsController
- Defined in:
- app/controllers/cms/sections_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #file_browser ⇒ Object
- #index ⇒ Object
- #move ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/cms/sections_controller.rb', line 23 def create @section = Section.new(params[:section]) @section.parent = @parent @section.groups = @section.parent.groups unless current_user.able_to?(:administrate) if @section.save flash[:notice] = "Section '#{@section.name}' was created" redirect_to [:cms, @section] else render :action => 'new' end end |
#destroy ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/controllers/cms/sections_controller.rb', line 49 def destroy respond_to do |format| if @section.deletable? && @section.destroy = "Section '#{@section.name}' was deleted." format.html { flash[:notice] = ; redirect_to(cms_sitemap_url) } format.json { render :json => {:success => true, :message => } } else = "Section '#{@section.name}' could not be deleted" format.html { flash[:error] = ; redirect_to(cms_sitemap_url) } format.json { render :json => {:success => false, :message => } } end end end |
#edit ⇒ Object
35 36 |
# File 'app/controllers/cms/sections_controller.rb', line 35 def edit end |
#file_browser ⇒ Object
71 72 73 74 75 76 77 78 |
# File 'app/controllers/cms/sections_controller.rb', line 71 def file_browser @section = Section.find_by_name_path(params[:CurrentFolder]) if request.post? && params[:NewFile] handle_file_browser_upload else render_file_browser end end |
#index ⇒ Object
10 11 12 |
# File 'app/controllers/cms/sections_controller.rb', line 10 def index redirect_to cms_sitemap_path end |
#move ⇒ Object
63 64 65 66 67 68 69 |
# File 'app/controllers/cms/sections_controller.rb', line 63 def move if params[:section_id] @move_to = Section.find(params[:section_id]) else @move_to = Section.root.first end end |
#new ⇒ Object
18 19 20 21 |
# File 'app/controllers/cms/sections_controller.rb', line 18 def new @section = Section.new(:parent=>@parent) @section.groups = @parent.groups end |
#show ⇒ Object
14 15 16 |
# File 'app/controllers/cms/sections_controller.rb', line 14 def show redirect_to cms_sitemap_path end |
#update ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'app/controllers/cms/sections_controller.rb', line 38 def update params[:section].delete('group_ids') if params[:section] && !current_user.able_to?(:administrate) @section.attributes = params[:section] if @section.save flash[:notice] = "Section '#{@section.name}' was updated" redirect_to [:cms, @section] else render :action => 'edit' end end |