Sha256: f6a4cb165c4c8e05c86a34e1657d0da93b102fb51d0f374139d12c00566d1fcb

Contents?: true

Size: 635 Bytes

Versions: 24

Compression:

Stored size: 635 Bytes

Contents

# frozen_string_literal: true

module PagesCore
  module Admin
    module PageJsonHelper
      def page_json(page)
        { id: page.id, param: page.to_param,
          name: page.name,
          parent_page_id: page.parent_page_id,
          locale: page.locale, status: page.status,
          news_page: page.news_page,
          published_at: page.published_at,
          pinned: page.pinned?, starts_at: page.starts_at,
          permissions: page_permissions(page) }
      end

      def page_permissions(page)
        [(:edit if policy(page).edit?),
         (:create if policy(page).edit?)].compact
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
pages_core-3.14.0 app/helpers/pages_core/admin/page_json_helper.rb
pages_core-3.13.0 app/helpers/pages_core/admin/page_json_helper.rb
pages_core-3.12.7 app/helpers/pages_core/admin/page_json_helper.rb
pages_core-3.12.6 app/helpers/pages_core/admin/page_json_helper.rb
pages_core-3.12.5 app/helpers/pages_core/admin/page_json_helper.rb
pages_core-3.12.4 app/helpers/pages_core/admin/page_json_helper.rb
pages_core-3.12.3 app/helpers/pages_core/admin/page_json_helper.rb
pages_core-3.12.2 app/helpers/pages_core/admin/page_json_helper.rb
pages_core-3.12.1 app/helpers/pages_core/admin/page_json_helper.rb
pages_core-3.12.0 app/helpers/pages_core/admin/page_json_helper.rb
pages_core-3.11.3 app/helpers/pages_core/admin/page_json_helper.rb
pages_core-3.11.2 app/helpers/pages_core/admin/page_json_helper.rb
pages_core-3.11.1 app/helpers/pages_core/admin/page_json_helper.rb
pages_core-3.11.0 app/helpers/pages_core/admin/page_json_helper.rb
pages_core-3.10.2 app/helpers/pages_core/admin/page_json_helper.rb
pages_core-3.10.1 app/helpers/pages_core/admin/page_json_helper.rb
pages_core-3.9.2 app/helpers/pages_core/admin/page_json_helper.rb
pages_core-3.9.1 app/helpers/pages_core/admin/page_json_helper.rb
pages_core-3.9.0 app/helpers/pages_core/admin/page_json_helper.rb
pages_core-3.8.3 app/helpers/pages_core/admin/page_json_helper.rb