Sha256: a6b5c61c46266a7047ad81d3d9d33968eb1c085b65495143b5e3fadccff39360

Contents?: true

Size: 1.32 KB

Versions: 14

Compression:

Stored size: 1.32 KB

Contents

class Cms::SectionNodesController < Cms::BaseController
  check_permissions :publish_content, :only => [:move_before, :move_after]
  
  def index
    @toolbar_tab = :sitemap
    @section = Section.root.first
  end
  def move_before
    move(:before)
  end
  def move_after
    move(:after)
  end
  def move_to_beginning
    move_to(:beginning)
  end
  def move_to_end
    move_to(:end)
  end
  def move_to_root
    @section_node = SectionNode.find(params[:id])
    @root = Section.root.find(params[:section_id])
    @section_node.move_to(@root, 0)
    render :json => {:success => true, :message => "'#{@section_node.node.name}' was moved to '#{@root.name}'"}    
  end
  
  private
  def move(to)
    @section_node = SectionNode.find(params[:id])
    @other_node = SectionNode.find(params[:section_node_id])
    @section_node.send("move_#{to}", @other_node)
    render :json => {:success => true, :message => "'#{@section_node.node.name}' was moved #{to} '#{@other_node.node.name}'"}    
  end
  def move_to(place)
    @section_node = SectionNode.find(params[:id])
    @other_node = SectionNode.find(params[:section_node_id])
    @section_node.send("move_to_#{place}", @other_node.node)
    render :json => {:success => true, :message => "'#{@section_node.node.name}' was moved to the #{place} of '#{@other_node.node.name}'"}            
  end
end

Version data entries

14 entries across 14 versions & 7 rubygems

Version Path
SFEley-browsercms-3.0.2 app/controllers/cms/section_nodes_controller.rb
buzzware-browsercms-3.0.2 app/controllers/cms/section_nodes_controller.rb
coredumplings-browsercms-3.0.0 app/controllers/cms/section_nodes_controller.rb
nate-browsercms-3.0.210 app/controllers/cms/section_nodes_controller.rb
nate-browsercms-3.0.211 app/controllers/cms/section_nodes_controller.rb
we5-browsercms-3.0.1.1 app/controllers/cms/section_nodes_controller.rb
webficient-browsercms-3.0.1 app/controllers/cms/section_nodes_controller.rb
webficient-browsercms-3.0.2 app/controllers/cms/section_nodes_controller.rb
webficient-browsercms-3.0.3 app/controllers/cms/section_nodes_controller.rb
webficient-browsercms-3.0.4 app/controllers/cms/section_nodes_controller.rb
we5-browsercms-3.0.2 app/controllers/cms/section_nodes_controller.rb
browsercms-3.0.2 app/controllers/cms/section_nodes_controller.rb
browsercms-3.0.1 app/controllers/cms/section_nodes_controller.rb
browsercms-3.0.0 app/controllers/cms/section_nodes_controller.rb