Sha256: f411a0157e5f4f1d8c6803137a593f421e822648df9f16728a4f7e152c9ff538

Contents?: true

Size: 387 Bytes

Versions: 16

Compression:

Stored size: 387 Bytes

Contents

module Qbrick
  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

16 entries across 16 versions & 1 rubygems

Version Path
qbrick-2.7.1 lib/qbrick/page_tree.rb
qbrick-2.7 lib/qbrick/page_tree.rb
qbrick-2.6.10 lib/qbrick/page_tree.rb
qbrick-2.6.9 lib/qbrick/page_tree.rb
qbrick-2.6.8 lib/qbrick/page_tree.rb
qbrick-2.6.7 lib/qbrick/page_tree.rb
qbrick-2.6.6 lib/qbrick/page_tree.rb
qbrick-2.6.5 lib/qbrick/page_tree.rb
qbrick-2.6.4 lib/qbrick/page_tree.rb
qbrick-2.6.3 lib/qbrick/page_tree.rb
qbrick-2.6.2 lib/qbrick/page_tree.rb
qbrick-2.6.1 lib/qbrick/page_tree.rb
qbrick-2.6.0 lib/qbrick/page_tree.rb
qbrick-2.5.2 lib/qbrick/page_tree.rb
qbrick-2.5.1 lib/qbrick/page_tree.rb
qbrick-2.5.0 lib/qbrick/page_tree.rb