Sha256: bf875d93a9b312d5af6e9c4a6cd27d1213cfd80a83c5c22192ac2b30fd82d40f

Contents?: true

Size: 1.61 KB

Versions: 8

Compression:

Stored size: 1.61 KB

Contents

module Pageflow
  module Dom
    module Admin
      # Base class for attribute table dominos.
      #
      # @since 12.2
      class AttributesTable < Domino
        # Visit the admin page of the given resource and find the
        # attributes table.
        def self.for(resource)
          visit(url(resource))
          find!
        end

        # Find the Capybara node of the contents cell for the given
        # attribute.
        def contents_of_row(name)
          node.find(".row-#{name} td")
        end

        def self.url_helpers
          Rails.application.routes.url_helpers
        end
        private_class_method :url_helpers
      end

      # The attributes table on the account page.
      #
      # @since 12.2
      class AccountAttributesTable < AttributesTable
        selector '.attributes_table.pageflow_account'

        def self.url(account)
          url_helpers.admin_account_path(account)
        end
        private_class_method :url
      end

      # The attributes table on the entry page
      #
      # @since 12.2
      class EntryAttributesTable < AttributesTable
        selector '.attributes_table.pageflow_entry'

        def self.url(entry)
          url_helpers.admin_entry_path(entry)
        end
        private_class_method :url
      end

      # The site attributes table on the account page
      #
      # @since 12.2
      class SiteAttributesTable < AttributesTable
        selector '.attributes_table.pageflow_site'

        def self.url(site)
          url_helpers.admin_account_site_path(site.account, site)
        end
        private_class_method :url
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pageflow-support-17.0.4 pageflow/dom/admin/attributes_tables.rb
pageflow-support-17.0.3 pageflow/dom/admin/attributes_tables.rb
pageflow-support-17.0.2 pageflow/dom/admin/attributes_tables.rb
pageflow-support-17.0.1 pageflow/dom/admin/attributes_tables.rb
pageflow-support-17.0.0 pageflow/dom/admin/attributes_tables.rb
pageflow-support-16.2.0 pageflow/dom/admin/attributes_tables.rb
pageflow-support-16.1.0 pageflow/dom/admin/attributes_tables.rb
pageflow-support-16.0.0 pageflow/dom/admin/attributes_tables.rb