Sha256: 570c4133e478129b44d88a7506f318257cb4e14d84b89275741f6d3d61a6039f
Contents?: true
Size: 918 Bytes
Versions: 21
Compression:
Stored size: 918 Bytes
Contents
module Spina module Pages class PageComponent < ApplicationComponent attr_reader :sortable def initialize(page:, sortable: true) @page = page @sortable = sortable end def label labels = [] labels << t("spina.pages.concept") if @page.draft? labels << t("spina.pages.show_in_menu") unless @page.show_in_menu? labels << t("spina.pages.skip_to_first_child") if @page.skip_to_first_child? return nil if labels.size.zero? "(#{labels.join(", ")})" end def sortable? sortable end def depth @page.depth end def css_class case depth when 1 "pl-5 bg-gray-100" when 2 "pl-10 bg-gray-200" end end def children @children ||= @page.children.active.sorted end end end end
Version data entries
21 entries across 21 versions & 1 rubygems