Sha256: 58fe68f946328135d511bc9f279e0a361d6e7f07f38731f2250882d025dcb116
Contents?: true
Size: 1.25 KB
Versions: 4
Compression:
Stored size: 1.25 KB
Contents
module Coco module App module Layouts class Page < Coco::Component include Concerns::AcceptsOptions component_name :page_layout accepts_option :width, from: [:full, :constrained], default: :constrained renders_one :header renders_many :hidden_sections renders_many :sections, ->(**kwargs, &block) do coco_tag(:section, **kwargs, &block) end renders_one :previous_link, ->(**kwargs) do Coco::PagerLink.new(**kwargs, direction: :previous, class: "page-control-previous") end renders_one :next_link, ->(**kwargs) do Coco::PagerLink.new(**kwargs, direction: :next, class: "page-control-next") end renders_one :poll_controller, ->(interval) do Coco::PollController.new(interval: interval) end before_render do with_poll_controller(@poll) unless poll_controller? || @poll.nil? with_next_link(href: @next_page) if @next_page with_previous_link(href: @previous_page) if @previous_page end def initialize(poll: nil, **kwargs) @poll = poll @previous_page = kwargs[:previous] @next_page = kwargs[:next] end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems