Sha256: 7562cb18b25a273d588ce70fd78017d5efd3b7a2def0e41e47e60e3ad783ee4b

Contents?: true

Size: 510 Bytes

Versions: 5

Compression:

Stored size: 510 Bytes

Contents

class SimpleContentManagement::SimpleMenuItemsController < InheritedResources::Base
	defaults :resource_class => SimpleContentManagement::SimpleMenuItem
	include SimpleAdminPanel::ControllerExtensions
	actions :all, except: :show
	custom_actions resource: [:insert_at]

	def insert_at
		resource.insert_at params[:position].to_i
		render json: resource_class.all.map{ |smi| { id: smi.id, position: smi.position } }.to_json
	end

	protected
	def collection
		@simple_menu_items = resource_class.ordered
	end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
th_simple_content_management-0.1.4 app/controllers/simple_content_management/simple_menu_items_controller.rb
th_simple_content_management-0.1.3 app/controllers/simple_content_management/simple_menu_items_controller.rb
th_simple_content_management-0.1.2 app/controllers/simple_content_management/simple_menu_items_controller.rb
th_simple_content_management-0.1.1 app/controllers/simple_content_management/simple_menu_items_controller.rb
th_simple_content_management-0.1.0 app/controllers/simple_content_management/simple_menu_items_controller.rb