Sha256: bc9602441ed02bc0ef0c34b96568850e2042cf0fa6a13852f6afc956dcd984bf

Contents?: true

Size: 602 Bytes

Versions: 5

Compression:

Stored size: 602 Bytes

Contents

module Spina::Pages
  class PageSelectComponent < Spina::ApplicationComponent
    attr_accessor :name, :pages, :include_blank, :selected, :disabled

    def initialize(name, pages, include_blank: false, selected: nil, disabled: nil)
      @name = name
      @pages = pages
      @include_blank = include_blank
      @selected = selected
      @disabled = disabled
    end

    def options
      Spina::Page.sort_by_ancestry(pages.arrange(order: :position)).map do |page|
        page_menu_title = page.menu_title.indent(page.depth, "–")
        [page_menu_title, page.id]
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spina-2.15.1 app/components/spina/pages/page_select_component.rb
spina-2.15.0 app/components/spina/pages/page_select_component.rb
spina-2.14.0 app/components/spina/pages/page_select_component.rb
spina-2.13.1 app/components/spina/pages/page_select_component.rb
spina-2.13.0 app/components/spina/pages/page_select_component.rb