Sha256: 8e0f750794b55572605b979df20c5496edda81ee22a83941addc7a1487ed572a

Contents?: true

Size: 388 Bytes

Versions: 9

Compression:

Stored size: 388 Bytes

Contents

module Kuhsaft
  module PageTree
    extend self

    def update(params, parent_id = nil)
      params.each do |page_position, page_content|
        page = Page.find(page_content['id'])
        page.update_attributes(parent_id: parent_id, position: page_position)
        next if page_content['children'].nil?
        update(page_content['children'], page.id)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
kuhsaft-2.6.3 lib/kuhsaft/page_tree.rb
kuhsaft-2.6.2 lib/kuhsaft/page_tree.rb
kuhsaft-2.6.1 lib/kuhsaft/page_tree.rb
kuhsaft-2.5.2 lib/kuhsaft/page_tree.rb
kuhsaft-2.6.0 lib/kuhsaft/page_tree.rb
kuhsaft-2.5.1 lib/kuhsaft/page_tree.rb
kuhsaft-2.5.0 lib/kuhsaft/page_tree.rb
qbrick-2.5.0.pre lib/kuhsaft/page_tree.rb
kuhsaft-2.4.3 lib/kuhsaft/page_tree.rb