Sha256: 58940ca197e362bdff0da5356a07fb15745fe22c29caa2866d1aff5a658c2743

Contents?: true

Size: 715 Bytes

Versions: 12

Compression:

Stored size: 715 Bytes

Contents

module Typus
  module Controller
    module Ancestry

      def index
        items = []

        @resource.roots.each do |item|
          items << item
          if item.has_children?
            item.children.each do |child|
              items << child
              if child.has_children?
                child.children.each do |child|
                  items << child
                end
              end
            end
          end
        end

        @items = Kaminari.paginate_array(items).page(params[:page]).per(1000)

        set_default_action
        add_resource_action("Trash", {:action => "destroy"}, {:confirm => "#{Typus::I18n.t("Trash")}?", :method => 'delete'})
      end

    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
typus-3.1.10 lib/typus/controller/ancestry.rb
typus-3.1.9 lib/typus/controller/ancestry.rb
typus-3.1.8 lib/typus/controller/ancestry.rb
typus-3.1.7 lib/typus/controller/ancestry.rb
typus-3.1.6 lib/typus/controller/ancestry.rb
typus-3.1.5 lib/typus/controller/ancestry.rb
typus-3.1.4 lib/typus/controller/ancestry.rb
typus-3.1.3 lib/typus/controller/ancestry.rb
typus-3.1.2 lib/typus/controller/ancestry.rb
typus-3.1.1 lib/typus/controller/ancestry.rb
typus-3.1.0 lib/typus/controller/ancestry.rb
typus-3.1.0.rc19 lib/typus/controller/ancestry.rb