Sha256: 30f0f746f3fb2b801dce337ca14ed98b80e0eaf303176ae08d5a0f8df1674aa8

Contents?: true

Size: 1.23 KB

Versions: 8

Compression:

Stored size: 1.23 KB

Contents

module Pageflow
  module Admin
    class EntryTemplatesTab < ViewComponent
      def build(site)
        table_subjects = site.existing_and_potential_entry_templates

        table_for(table_subjects, i18n: Pageflow::EntryTemplate) do
          column do |entry_template|
            if entry_template.id
              render 'admin/accounts/entry_template_details', entry_template: entry_template
            else
              h5(entry_template.translated_entry_type_name)
            end
          end
          column do |entry_template|
            if entry_template.id
              edit_link(entry_template, site)
            else
              new_link(entry_template, site)
            end
          end
        end
      end

      def new_link(entry_template, site)
        link_to(
          I18n.t('active_admin.new'),
          new_admin_site_entry_template_path(
            site,
            entry_template,
            entry_type_name: entry_template.entry_type_name
          )
        )
      end

      def edit_link(entry_template, site)
        link_to(
          I18n.t('active_admin.edit'),
          edit_admin_site_entry_template_path(
            site,
            entry_template
          )
        )
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pageflow-17.0.4 app/views/components/pageflow/admin/entry_templates_tab.rb
pageflow-17.0.3 app/views/components/pageflow/admin/entry_templates_tab.rb
pageflow-17.0.2 app/views/components/pageflow/admin/entry_templates_tab.rb
pageflow-17.0.1 app/views/components/pageflow/admin/entry_templates_tab.rb
pageflow-17.0.0 app/views/components/pageflow/admin/entry_templates_tab.rb
pageflow-16.2.0 app/views/components/pageflow/admin/entry_templates_tab.rb
pageflow-16.1.0 app/views/components/pageflow/admin/entry_templates_tab.rb
pageflow-16.0.0 app/views/components/pageflow/admin/entry_templates_tab.rb