Sha256: 18d3a9fe4ee92143e144c8aa5faf108e364a63c92a49fd017c4fd9767be4e884

Contents?: true

Size: 1.29 KB

Versions: 8

Compression:

Stored size: 1.29 KB

Contents

module Pageflow
  module Admin
    class EntryTemplatesTab < ViewComponent
      def build(theming)
        account = theming.account
        table_subjects = account.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, account)
            else
              new_link(entry_template, account)
            end
          end
        end
      end

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

      def edit_link(entry_template, account)
        link_to(
          I18n.t('active_admin.edit'),
          edit_admin_account_entry_template_path(
            account,
            entry_template
          )
        )
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pageflow-15.8.0 app/views/components/pageflow/admin/entry_templates_tab.rb
pageflow-15.7.1 app/views/components/pageflow/admin/entry_templates_tab.rb
pageflow-15.7.0 app/views/components/pageflow/admin/entry_templates_tab.rb
pageflow-15.6.1 app/views/components/pageflow/admin/entry_templates_tab.rb
pageflow-15.6.0 app/views/components/pageflow/admin/entry_templates_tab.rb
pageflow-15.5.0 app/views/components/pageflow/admin/entry_templates_tab.rb
pageflow-15.4.0 app/views/components/pageflow/admin/entry_templates_tab.rb
pageflow-15.3.0 app/views/components/pageflow/admin/entry_templates_tab.rb