lib/active_admin/awesome_nested_set/helper.rb
def sortable_tree_member_actions
        member_action :move_up do
          unless resource.left_sibling
            redirect_to :back, :notice => I18n.t('awesome_nested_set.illegal_move_up', :resource => resource_class.to_s.camelize.constantize.model_name.human )
            return
          end

          resource.move_left
          redirect_to :back, :notice => I18n.t('awesome_nested_set.moved_up', :resource => resource_class.to_s.camelize.constantize.model_name.human )
        end

        member_action :move_down do
          unless resource.right_sibling
            redirect_to :back, :notice => I18n.t('awesome_nested_set.illegal_move_down', :resource => resource_class.to_s.camelize.constantize.model_name.human )
            return
          end

          resource.move_right
          redirect_to :back, :notice => I18n.t('awesome_nested_set.moved_down', :resource => resource_class.to_s.camelize.constantize.model_name.human )
        end
      end
# Call this inside your resource definition to add the needed member actions
# for your sortable resource.
#
# Example:
#
# #app/admin/players.rb
#
#  ActiveAdmin.register Player do
#    # Sort players by position
#    config.sort_order = 'lft_asc'
#
#    # Add member actions for positioning.
#    sortable_tree_member_actions
#  end
Call this inside your resource definition to add the needed member actions
for your sortable resource.





ActiveAdmin.register Player do
Sort players by position
config.sort_order = 'lft_asc'

Add member actions for positioning.
Call this inside your resource definition to add the needed member actions for your sortable resource . ActiveAdmin . register Player do Sort players by position config . sort_order = ' lft_asc ' Add member actions for positioning .
def sortable_tree_member_actions
        member_action :move_up do
          unless resource.left_sibling
            redirect_to :back, :notice => I18n.t('awesome_nested_set.illegal_move_up', :resource => resource_class.to_s.camelize.constantize.model_name.human )
            return
          end
          resource.move_left
          redirect_to :back, :notice => I18n.t('awesome_nested_set.moved_up', :resource => resource_class.to_s.camelize.constantize.model_name.human )
        end
        member_action :move_down do
          unless resource.right_sibling
            redirect_to :back, :notice => I18n.t('awesome_nested_set.illegal_move_down', :resource => resource_class.to_s.camelize.constantize.model_name.human )
            return
          end
          resource.move_right
          redirect_to :back, :notice => I18n.t('awesome_nested_set.moved_down', :resource => resource_class.to_s.camelize.constantize.model_name.human )
        end
      end
def sortable_tree_member_actions member_action :move_up do unless resource . left_sibling redirect_to :back , :notice => I18n . t ( 'awesome_nested_set.illegal_move_up' , :resource => resource_class . to_s . camelize . constantize . model_name . human ) return end resource . move_left redirect_to :back , :notice => I18n . t ( 'awesome_nested_set.moved_up' , :resource => resource_class . to_s . camelize . constantize . model_name . human ) end member_action :move_down do unless resource . right_sibling redirect_to :back , :notice => I18n . t ( 'awesome_nested_set.illegal_move_down' , :resource => resource_class . to_s . camelize . constantize . model_name . human ) return end resource . move_right redirect_to :back , :notice => I18n . t ( 'awesome_nested_set.moved_down' , :resource => resource_class . to_s . camelize . constantize . model_name . human ) end end
Call this inside your resource definition to add the needed member actions
for your sortable resource.
Call this inside your resource definition to add the needed member actions for your sortable resource .