Sha256: 2dac718e7a13060b79ca0904d4bf74e51cdb4c49a11daca0d73afc85df94d919

Contents?: true

Size: 611 Bytes

Versions: 22

Compression:

Stored size: 611 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

22 entries across 22 versions & 1 rubygems

Version Path
spina-2.12.0 app/components/spina/pages/page_select_component.rb
spina-2.11.0 app/components/spina/pages/page_select_component.rb
spina-2.10.0 app/components/spina/pages/page_select_component.rb
spina-2.9.1 app/components/spina/pages/page_select_component.rb
spina-2.9.0 app/components/spina/pages/page_select_component.rb
spina-2.8.1 app/components/spina/pages/page_select_component.rb
spina-2.8.0 app/components/spina/pages/page_select_component.rb
spina-2.7.0 app/components/spina/pages/page_select_component.rb
spina-2.6.2 app/components/spina/pages/page_select_component.rb
spina-2.6.1 app/components/spina/pages/page_select_component.rb
spina-2.6.0 app/components/spina/pages/page_select_component.rb
spina-2.5.0 app/components/spina/pages/page_select_component.rb
spina-2.4.0 app/components/spina/pages/page_select_component.rb
spina-2.3.5 app/components/spina/pages/page_select_component.rb
spina-2.3.4 app/components/spina/pages/page_select_component.rb
spina-2.3.3 app/components/spina/pages/page_select_component.rb
spina-2.3.2 app/components/spina/pages/page_select_component.rb
spina-2.3.1 app/components/spina/pages/page_select_component.rb
spina-2.3.0 app/components/spina/pages/page_select_component.rb
spina-2.2.0 app/components/spina/pages/page_select_component.rb