Sha256: 1bdffee5c9c9505ad52b2413965b81065729050b845bb49c1d5fdd4c58dc6646

Contents?: true

Size: 1.44 KB

Versions: 6

Compression:

Stored size: 1.44 KB

Contents

if defined?(ActiveAdmin)
  ActiveAdmin.register Blogelator::Author, as: "Author" do
    permit_params [
      :bio_markdown,
      :cover_photo,
      :location,
      :meta_description,
      :meta_keywords,
      :name,
      :profile_photo,
      :slug,
      :website
    ]

    controller do
      defaults finder: :find_by_slug!
    end

    filter :name
    filter :bio_html
    filter :location
    filter :website

    index do
      selectable_column
      column :id
      column :title do |author|
        link_to author.name, admin_author_path(author)
      end
      column :created_at
      column :updated_at
    end

    form do |f|
      inputs "#{t('activerecord.models.author', count: 1)} Details" do
        input :name, input_html: { class: "title-to-slug-title" }
        input :bio_markdown, as: :codemirror, codemirror: { mode: "gfm" }
        input :profile_photo, as: :file
        input :cover_photo, as: :file
        input :location
        input :website
      end

      inputs "Search Engine Optimization" do
        input :meta_keywords
        input :meta_description
        input :slug, input_html: { class: "title-to-slug-slug" }
      end

      actions
    end

    show do
      attributes_table do
        row :name
        row :location
        row :website
        row :created_at
        row :updated_at
        row :bio do |author|
          raw author.bio_html
        end
      end
      active_admin_comments
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
blogelator-1.0.5 lib/blogelator/admin/author.rb
blogelator-1.0.4 lib/blogelator/admin/author.rb
blogelator-1.0.3 lib/blogelator/admin/author.rb
blogelator-1.0.2 lib/blogelator/admin/author.rb
blogelator-1.0.1 lib/blogelator/admin/author.rb
blogelator-1.0.0 lib/blogelator/admin/author.rb