Sha256: bd7512c0339213f39ef206e69c46e3b78ef6af4b8003346dfcd07c651651a64c
Contents?: true
Size: 616 Bytes
Versions: 5
Compression:
Stored size: 616 Bytes
Contents
# frozen_string_literal: true module Admin class PageTreeResource include Alba::Resource attributes :id, :parent_page_id, :status, :news_page, :pinned, :published_at attribute :blocks do { name: localized_attribute(object, :name) } end attribute :permissions do [(:edit if Policy.for(params[:user], object).edit?), (:create if Policy.for(params[:user], object).edit?)].compact end private def localized_attribute(record, attr) record.locales.index_with do |locale| record.localize(locale).send(attr) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems